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_GROUP")
33  public class TermConceptMapGroup implements Serializable {
34  	@Id()
35  	@SequenceGenerator(name = "SEQ_CONCEPT_MAP_GROUP_PID", sequenceName = "SEQ_CONCEPT_MAP_GROUP_PID")
36  	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_CONCEPT_MAP_GROUP_PID")
37  	@Column(name = "PID")
38  	private Long myId;
39  
40  	@ManyToOne()
41  	@JoinColumn(name = "CONCEPT_MAP_PID", nullable = false, referencedColumnName = "PID", foreignKey=@ForeignKey(name="FK_TCMGROUP_CONCEPTMAP"))
42  	private TermConceptMap myConceptMap;
43  
44  	@Column(name = "SOURCE_URL", nullable = false, length = 200)
45  	private String mySource;
46  
47  	@Column(name = "SOURCE_VERSION", length = 100)
48  	private String mySourceVersion;
49  
50  	@Column(name = "TARGET_URL", nullable = false, length = 200)
51  	private String myTarget;
52  
53  	@Column(name = "TARGET_VERSION", length = 100)
54  	private String myTargetVersion;
55  
56  	@OneToMany(mappedBy = "myConceptMapGroup")
57  	private List<TermConceptMapGroupElement> myConceptMapGroupElements;
58  
59  	private String myConceptMapUrl;
60  	private String mySourceValueSet;
61  	private String myTargetValueSet;
62  
63  	public TermConceptMap getConceptMap() {
64  		return myConceptMap;
65  	}
66  
67  	public void setConceptMap(TermConceptMap theTermConceptMap) {
68  		myConceptMap = theTermConceptMap;
69  	}
70  
71  	public List<TermConceptMapGroupElement> getConceptMapGroupElements() {
72  		if (myConceptMapGroupElements == null) {
73  			myConceptMapGroupElements = new ArrayList<>();
74  		}
75  
76  		return myConceptMapGroupElements;
77  	}
78  
79  	public String getConceptMapUrl() {
80  		if (myConceptMapUrl == null) {
81  			myConceptMapUrl = getConceptMap().getUrl();
82  		}
83  		return myConceptMapUrl;
84  	}
85  
86  	public Long getId() {
87  		return myId;
88  	}
89  
90  	public String getSource() {
91  		return mySource;
92  	}
93  
94  	public void setSource(String theSource) {
95  		this.mySource = theSource;
96  	}
97  
98  	public String getSourceValueSet() {
99  		if (mySourceValueSet == null) {
100 			mySourceValueSet = getConceptMap().getSource();
101 		}
102 		return mySourceValueSet;
103 	}
104 
105 	public String getSourceVersion() {
106 		return mySourceVersion;
107 	}
108 
109 	public void setSourceVersion(String theSourceVersion) {
110 		mySourceVersion = theSourceVersion;
111 	}
112 
113 	public String getTarget() {
114 		return myTarget;
115 	}
116 
117 	public void setTarget(String theTarget) {
118 		this.myTarget = theTarget;
119 	}
120 
121 	public String getTargetValueSet() {
122 		if (myTargetValueSet == null) {
123 			myTargetValueSet = getConceptMap().getTarget();
124 		}
125 		return myTargetValueSet;
126 	}
127 
128 	public String getTargetVersion() {
129 		return myTargetVersion;
130 	}
131 
132 	public void setTargetVersion(String theTargetVersion) {
133 		myTargetVersion = theTargetVersion;
134 	}
135 
136 	@Override
137 	public String toString() {
138 		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
139 			.append("myId", myId)
140 			.append("myConceptMap - id", myConceptMap.getId())
141 			.append("mySource", mySource)
142 			.append("mySourceVersion", mySourceVersion)
143 			.append("myTarget", myTarget)
144 			.append("myTargetVersion", myTargetVersion)
145 			.append("myConceptMapGroupElements - size", myConceptMapGroupElements.size())
146 			.append("myConceptMapUrl", this.getConceptMapUrl())
147 			.append("mySourceValueSet", this.getSourceValueSet())
148 			.append("myTargetValueSet", this.getTargetValueSet())
149 			.toString();
150 	}
151 }