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 org.apache.commons.lang3.builder.ToStringBuilder;
24  import org.apache.commons.lang3.builder.ToStringStyle;
25  
26  import javax.persistence.*;
27  import java.io.Serializable;
28  import java.util.ArrayList;
29  import java.util.List;
30  
31  @Entity
32  @Table(name = "TRM_CONCEPT_MAP", uniqueConstraints = {
33  	@UniqueConstraint(name = "IDX_CONCEPT_MAP_URL", columnNames = {"URL"})
34  })
35  public class TermConceptMap implements Serializable {
36  	@Id()
37  	@SequenceGenerator(name = "SEQ_CONCEPT_MAP_PID", sequenceName = "SEQ_CONCEPT_MAP_PID")
38  	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_CONCEPT_MAP_PID")
39  	@Column(name = "PID")
40  	private Long myId;
41  
42  	@OneToOne()
43  	@JoinColumn(name = "RES_ID", referencedColumnName = "RES_ID", nullable = false, updatable = false, foreignKey = @ForeignKey(name = "FK_TRMCONCEPTMAP_RES"))
44  	private ResourceTable myResource;
45  
46  	@Column(name = "RES_ID", insertable = false, updatable = false)
47  	private Long myResourcePid;
48  
49  	@Column(name = "SOURCE_URL", nullable = true, length = 200)
50  	private String mySource;
51  
52  	@Column(name = "TARGET_URL", nullable = true, length = 200)
53  	private String myTarget;
54  
55  	@Column(name = "URL", length = 200, nullable = false)
56  	private String myUrl;
57  
58  	@OneToMany(mappedBy = "myConceptMap")
59  	private List<TermConceptMapGroup> myConceptMapGroups;
60  
61  	public List<TermConceptMapGroup> getConceptMapGroups() {
62  		if (myConceptMapGroups == null) {
63  			myConceptMapGroups = new ArrayList<>();
64  		}
65  
66  		return myConceptMapGroups;
67  	}
68  
69  	public Long getId() {
70  		return myId;
71  	}
72  
73  	public ResourceTable getResource() {
74  		return myResource;
75  	}
76  
77  	public void setResource(ResourceTable resource) {
78  		myResource = resource;
79  	}
80  
81  	public Long getResourcePid() {
82  		return myResourcePid;
83  	}
84  
85  	public void setResourcePid(Long resourcePid) {
86  		myResourcePid = resourcePid;
87  	}
88  
89  	public String getSource() {
90  		return mySource;
91  	}
92  
93  	public void setSource(String source) {
94  		mySource = source;
95  	}
96  
97  	public String getTarget() {
98  		return myTarget;
99  	}
100 
101 	public void setTarget(String target) {
102 		myTarget = target;
103 	}
104 
105 	public String getUrl() {
106 		return myUrl;
107 	}
108 
109 	public void setUrl(String theUrl) {
110 		myUrl = theUrl;
111 	}
112 
113 	@Override
114 	public String toString() {
115 		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
116 			.append("myId", myId)
117 			.append("myResource", myResource.toString())
118 			.append("myResourcePid", myResourcePid)
119 			.append("mySource", mySource)
120 			.append("myTarget", myTarget)
121 			.append("myUrl", myUrl)
122 			.append("myConceptMapGroups - size", myConceptMapGroups.size())
123 			.toString();
124 	}
125 }