001package ca.uhn.fhir.jpa.entity;
002
003/*
004 * #%L
005 * HAPI FHIR JPA Server
006 * %%
007 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import ca.uhn.fhir.jpa.model.entity.ResourceTable;
024
025import javax.persistence.*;
026import java.util.Date;
027
028@Entity
029@Table(name = "HFJ_SUBSCRIPTION_STATS", uniqueConstraints = {
030        @UniqueConstraint(name = "IDX_SUBSC_RESID", columnNames = {"RES_ID"}),
031})
032public class SubscriptionTable {
033
034        @Temporal(TemporalType.TIMESTAMP)
035        @Column(name = "CREATED_TIME", nullable = false, insertable = true, updatable = false)
036        private Date myCreated;
037
038        @Id
039        @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_SUBSCRIPTION_ID")
040        @SequenceGenerator(name = "SEQ_SUBSCRIPTION_ID", sequenceName = "SEQ_SUBSCRIPTION_ID")
041        @Column(name = "PID", insertable = false, updatable = false)
042        private Long myId;
043
044        @Column(name = "RES_ID", insertable = false, updatable = false)
045        private Long myResId;
046
047        @OneToOne()
048        @JoinColumn(name = "RES_ID", insertable = true, updatable = false, referencedColumnName = "RES_ID",
049                foreignKey = @ForeignKey(name = "FK_SUBSC_RESOURCE_ID")
050        )
051        private ResourceTable mySubscriptionResource;
052
053        /**
054         * Constructor
055         */
056        public SubscriptionTable() {
057                super();
058        }
059
060
061        public Date getCreated() {
062                return myCreated;
063        }
064
065        public void setCreated(Date theCreated) {
066                myCreated = theCreated;
067        }
068
069        public Long getId() {
070                return myId;
071        }
072
073        public ResourceTable getSubscriptionResource() {
074                return mySubscriptionResource;
075        }
076
077        public void setSubscriptionResource(ResourceTable theSubscriptionResource) {
078                mySubscriptionResource = theSubscriptionResource;
079        }
080
081}