View Javadoc
1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  package ca.uhn.fhir.model.dstu.composite;
18  
19  /*
20   * #%L
21   * HAPI FHIR - Core Library
22   * %%
23   * Copyright (C) 2014 University Health Network
24   * %%
25   * Licensed under the Apache License, Version 2.0 (the "License");
26   * you may not use this file except in compliance with the License.
27   * You may obtain a copy of the License at
28   * 
29   *      http://www.apache.org/licenses/LICENSE-2.0
30   * 
31   * Unless required by applicable law or agreed to in writing, software
32   * distributed under the License is distributed on an "AS IS" BASIS,
33   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34   * See the License for the specific language governing permissions and
35   * limitations under the License.
36   * #L%
37   */
38  
39  import java.util.List;
40  
41  import ca.uhn.fhir.model.api.ICompositeDatatype;
42  import ca.uhn.fhir.model.api.IElement;
43  import ca.uhn.fhir.model.api.annotation.Child;
44  import ca.uhn.fhir.model.api.annotation.DatatypeDef;
45  import ca.uhn.fhir.model.api.annotation.Description;
46  import ca.uhn.fhir.model.api.annotation.SimpleSetter;
47  import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
48  import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
49  import ca.uhn.fhir.model.primitive.BoundCodeDt;
50  import ca.uhn.fhir.model.primitive.CodeDt;
51  import ca.uhn.fhir.model.primitive.StringDt;
52  import ca.uhn.fhir.model.primitive.UriDt;
53  
54  /**
55   * HAPI/FHIR <b>IdentifierDt</b> Datatype
56   * (An identifier intended for computation)
57   *
58   * <p>
59   * <b>Definition:</b>
60   * A technical identifier - identifies some entity uniquely and unambiguously
61   * </p> 
62   *
63   * <p>
64   * <b>Requirements:</b>
65   * Need to be able to identify things with confidence and be sure that the identification is not subject to misinterpretation
66   * </p> 
67   */
68  @DatatypeDef(name="IdentifierDt") 
69  public class IdentifierDt
70          extends  BaseIdentifierDt         implements ICompositeDatatype
71  {
72  
73  	/**
74  	 * Constructor
75  	 */
76  	public IdentifierDt() {
77  		// nothing
78  	}
79  
80  	/**
81  	 * Creates a new identifier with the given system and value
82  	 */
83  	@SimpleSetter
84  	public IdentifierDt(@SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theValue") String theValue) {
85  		setSystem(theSystem);
86  		setValue(theValue);
87  	}
88  
89  	/**
90  	 * Creates a new identifier with the given system and value
91  	 */
92  	@SimpleSetter
93  	public IdentifierDt(@SimpleSetter.Parameter(name="theUse") IdentifierUseEnum theUse, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theValue") String theValue, @SimpleSetter.Parameter(name="theLabel") String theLabel) {
94  		setUse(theUse);
95  		setSystem(theSystem);
96  		setValue(theValue);
97  		setLabel(theLabel);
98  	}
99  	
100 	@Override
101 	public String toString() {
102 		return "IdentifierDt[" + getValueAsQueryToken() + "]";
103 	}
104 
105 	@Child(name="use", type=CodeDt.class, order=0, min=0, max=1)	
106 	@Description(
107 		shortDefinition="usual | official | temp | secondary (If known)",
108 		formalDefinition="The purpose of this identifier"
109 	)
110 	private BoundCodeDt<IdentifierUseEnum> myUse;
111 	
112 	@Child(name="label", type=StringDt.class, order=1, min=0, max=1)	
113 	@Description(
114 		shortDefinition="Description of identifier",
115 		formalDefinition="A text string for the identifier that can be displayed to a human so they can recognize the identifier"
116 	)
117 	private StringDt myLabel;
118 	
119 	@Child(name="system", type=UriDt.class, order=2, min=0, max=1)	
120 	@Description(
121 		shortDefinition="The namespace for the identifier",
122 		formalDefinition="Establishes the namespace in which set of possible id values is unique."
123 	)
124 	private UriDt mySystem;
125 	
126 	@Child(name="value", type=StringDt.class, order=3, min=0, max=1)	
127 	@Description(
128 		shortDefinition="The value that is unique",
129 		formalDefinition="The portion of the identifier typically displayed to the user and which is unique within the context of the system."
130 	)
131 	private StringDt myValue;
132 	
133 	@Child(name="period", type=PeriodDt.class, order=4, min=0, max=1)	
134 	@Description(
135 		shortDefinition="Time period when id is/was valid for use",
136 		formalDefinition="Time period during which identifier is/was valid for use"
137 	)
138 	private PeriodDt myPeriod;
139 	
140 	@Child(name="assigner", order=5, min=0, max=1, type={
141 		ca.uhn.fhir.model.dstu.resource.Organization.class	})
142 	@Description(
143 		shortDefinition="Organization that issued id (may be just text)",
144 		formalDefinition="Organization that issued/manages the identifier"
145 	)
146 	private ResourceReferenceDt myAssigner;
147 	
148 
149 	@Override
150 	public boolean isEmpty() {
151 		return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myUse,  myLabel,  mySystem,  myValue,  myPeriod,  myAssigner);
152 	}
153 	
154 	@Override
155 	public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
156 		return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myUse, myLabel, mySystem, myValue, myPeriod, myAssigner);
157 	}
158 
159 	/**
160 	 * Gets the value(s) for <b>use</b> (usual | official | temp | secondary (If known)).
161 	 * creating it if it does
162 	 * not exist. Will not return <code>null</code>.
163 	 *
164      * <p>
165      * <b>Definition:</b>
166      * The purpose of this identifier
167      * </p> 
168 	 */
169 	public BoundCodeDt<IdentifierUseEnum> getUse() {  
170 		if (myUse == null) {
171 			myUse = new BoundCodeDt<IdentifierUseEnum>(IdentifierUseEnum.VALUESET_BINDER);
172 		}
173 		return myUse;
174 	}
175 
176 	/**
177 	 * Sets the value(s) for <b>use</b> (usual | official | temp | secondary (If known))
178 	 *
179      * <p>
180      * <b>Definition:</b>
181      * The purpose of this identifier
182      * </p> 
183 	 */
184 	public IdentifierDt setUse(BoundCodeDt<IdentifierUseEnum> theValue) {
185 		myUse = theValue;
186 		return this;
187 	}
188 
189 	/**
190 	 * Sets the value(s) for <b>use</b> (usual | official | temp | secondary (If known))
191 	 *
192      * <p>
193      * <b>Definition:</b>
194      * The purpose of this identifier
195      * </p> 
196 	 */
197 	public IdentifierDt setUse(IdentifierUseEnum theValue) {
198 		getUse().setValueAsEnum(theValue);
199 		return this;
200 	}
201 
202   
203 	/**
204 	 * Gets the value(s) for <b>label</b> (Description of identifier).
205 	 * creating it if it does
206 	 * not exist. Will not return <code>null</code>.
207 	 *
208      * <p>
209      * <b>Definition:</b>
210      * A text string for the identifier that can be displayed to a human so they can recognize the identifier
211      * </p> 
212 	 */
213 	public StringDt getLabel() {  
214 		if (myLabel == null) {
215 			myLabel = new StringDt();
216 		}
217 		return myLabel;
218 	}
219 
220 	/**
221 	 * Sets the value(s) for <b>label</b> (Description of identifier)
222 	 *
223      * <p>
224      * <b>Definition:</b>
225      * A text string for the identifier that can be displayed to a human so they can recognize the identifier
226      * </p> 
227 	 */
228 	public IdentifierDt setLabel(StringDt theValue) {
229 		myLabel = theValue;
230 		return this;
231 	}
232 
233  	/**
234 	 * Sets the value for <b>label</b> (Description of identifier)
235 	 *
236      * <p>
237      * <b>Definition:</b>
238      * A text string for the identifier that can be displayed to a human so they can recognize the identifier
239      * </p> 
240 	 */
241 	public IdentifierDt setLabel( String theString) {
242 		myLabel = new StringDt(theString); 
243 		return this; 
244 	}
245 
246  
247 	/**
248 	 * Gets the value(s) for <b>system</b> (The namespace for the identifier).
249 	 * creating it if it does
250 	 * not exist. Will not return <code>null</code>.
251 	 *
252      * <p>
253      * <b>Definition:</b>
254      * Establishes the namespace in which set of possible id values is unique.
255      * </p> 
256 	 */
257 	public UriDt getSystem() {  
258 		if (mySystem == null) {
259 			mySystem = new UriDt();
260 		}
261 		return mySystem;
262 	}
263 
264 	/**
265 	 * Sets the value(s) for <b>system</b> (The namespace for the identifier)
266 	 *
267      * <p>
268      * <b>Definition:</b>
269      * Establishes the namespace in which set of possible id values is unique.
270      * </p> 
271 	 */
272 	public IdentifierDt setSystem(UriDt theValue) {
273 		mySystem = theValue;
274 		return this;
275 	}
276 
277  	/**
278 	 * Sets the value for <b>system</b> (The namespace for the identifier)
279 	 *
280      * <p>
281      * <b>Definition:</b>
282      * Establishes the namespace in which set of possible id values is unique.
283      * </p> 
284 	 */
285 	public IdentifierDt setSystem( String theUri) {
286 		mySystem = new UriDt(theUri); 
287 		return this; 
288 	}
289 
290  
291 	/**
292 	 * Gets the value(s) for <b>value</b> (The value that is unique).
293 	 * creating it if it does
294 	 * not exist. Will not return <code>null</code>.
295 	 *
296      * <p>
297      * <b>Definition:</b>
298      * The portion of the identifier typically displayed to the user and which is unique within the context of the system.
299      * </p> 
300 	 */
301 	public StringDt getValue() {  
302 		if (myValue == null) {
303 			myValue = new StringDt();
304 		}
305 		return myValue;
306 	}
307 
308 	/**
309 	 * Sets the value(s) for <b>value</b> (The value that is unique)
310 	 *
311      * <p>
312      * <b>Definition:</b>
313      * The portion of the identifier typically displayed to the user and which is unique within the context of the system.
314      * </p> 
315 	 */
316 	public IdentifierDt setValue(StringDt theValue) {
317 		myValue = theValue;
318 		return this;
319 	}
320 
321  	/**
322 	 * Sets the value for <b>value</b> (The value that is unique)
323 	 *
324      * <p>
325      * <b>Definition:</b>
326      * The portion of the identifier typically displayed to the user and which is unique within the context of the system.
327      * </p> 
328 	 */
329 	public IdentifierDt setValue( String theString) {
330 		myValue = new StringDt(theString); 
331 		return this; 
332 	}
333 
334  
335 	/**
336 	 * Gets the value(s) for <b>period</b> (Time period when id is/was valid for use).
337 	 * creating it if it does
338 	 * not exist. Will not return <code>null</code>.
339 	 *
340      * <p>
341      * <b>Definition:</b>
342      * Time period during which identifier is/was valid for use
343      * </p> 
344 	 */
345 	public PeriodDt getPeriod() {  
346 		if (myPeriod == null) {
347 			myPeriod = new PeriodDt();
348 		}
349 		return myPeriod;
350 	}
351 
352 	/**
353 	 * Sets the value(s) for <b>period</b> (Time period when id is/was valid for use)
354 	 *
355      * <p>
356      * <b>Definition:</b>
357      * Time period during which identifier is/was valid for use
358      * </p> 
359 	 */
360 	public IdentifierDt setPeriod(PeriodDt theValue) {
361 		myPeriod = theValue;
362 		return this;
363 	}
364 
365   
366 	/**
367 	 * Gets the value(s) for <b>assigner</b> (Organization that issued id (may be just text)).
368 	 * creating it if it does
369 	 * not exist. Will not return <code>null</code>.
370 	 *
371      * <p>
372      * <b>Definition:</b>
373      * Organization that issued/manages the identifier
374      * </p> 
375 	 */
376 	public ResourceReferenceDt getAssigner() {  
377 		if (myAssigner == null) {
378 			myAssigner = new ResourceReferenceDt();
379 		}
380 		return myAssigner;
381 	}
382 
383 	/**
384 	 * Sets the value(s) for <b>assigner</b> (Organization that issued id (may be just text))
385 	 *
386      * <p>
387      * <b>Definition:</b>
388      * Organization that issued/manages the identifier
389      * </p> 
390 	 */
391 	public IdentifierDt setAssigner(ResourceReferenceDt theValue) {
392 		myAssigner = theValue;
393 		return this;
394 	}
395 
396   
397 
398 
399 }