View Javadoc
1   package ca.uhn.fhir.jpa.entity;
2   
3   /*
4    * #%L
5    * HAPI FHIR JPA Server
6    * %%
7    * Copyright (C) 2014 - 2018 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import java.io.Serializable;
24  
25  import javax.persistence.*;
26  
27  @Embeddable
28  @Entity
29  @Table(name = "HFJ_HISTORY_TAG", uniqueConstraints= {
30  		@UniqueConstraint(name="IDX_RESHISTTAG_TAGID", columnNames= {"RES_VER_PID","TAG_ID"})
31  })
32  public class ResourceHistoryTag extends BaseTag implements Serializable {
33  
34  	private static final long serialVersionUID = 1L;
35  	
36  	@SequenceGenerator(name = "SEQ_HISTORYTAG_ID", sequenceName = "SEQ_HISTORYTAG_ID")
37  	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_HISTORYTAG_ID")
38  	@Id
39  	@Column(name = "PID")
40  	private Long myId;
41  	
42  	@ManyToOne()
43  	@JoinColumn(name="RES_VER_PID", referencedColumnName="PID", nullable=false, foreignKey=@ForeignKey(name="FK_HISTORYTAG_HISTORY"))
44  	private ResourceHistoryTable myResourceHistory;
45  
46  	@Column(name = "RES_TYPE", length = ResourceTable.RESTYPE_LEN, nullable=false)
47  	private String myResourceType;
48  
49  	@Column(name="RES_ID", nullable=false)
50  	private Long myResourceId;
51  
52  	public String getResourceType() {
53  		return myResourceType;
54  	}
55  
56  
57  	public void setResourceType(String theResourceType) {
58  		myResourceType = theResourceType;
59  	}
60  
61  
62  	public Long getResourceId() {
63  		return myResourceId;
64  	}
65  
66  
67  	public void setResourceId(Long theResourceId) {
68  		myResourceId = theResourceId;
69  	}
70  
71  
72  	public ResourceHistoryTag() {
73  	}
74  	
75  
76  	public ResourceHistoryTag(ResourceHistoryTable theResourceHistoryTable, TagDefinition theTag) {
77  		setTag(theTag);
78  		setResource(theResourceHistoryTable);
79  		setResourceId(theResourceHistoryTable.getResourceId());
80  		setResourceType(theResourceHistoryTable.getResourceType());
81  	}
82  
83  	public ResourceHistoryTable getResourceHistory() {
84  		return myResourceHistory;
85  	}
86  
87  	public void setResource(ResourceHistoryTable theResourceHistory) {
88  		myResourceHistory = theResourceHistory;
89  	}
90  
91  }