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.BaseIdentifiableElement;
42  import ca.uhn.fhir.model.api.ICompositeDatatype;
43  import ca.uhn.fhir.model.api.IElement;
44  import ca.uhn.fhir.model.api.annotation.Child;
45  import ca.uhn.fhir.model.api.annotation.DatatypeDef;
46  import ca.uhn.fhir.model.api.annotation.Description;
47  import ca.uhn.fhir.model.api.annotation.SimpleSetter;
48  import ca.uhn.fhir.model.dstu.valueset.ContactSystemEnum;
49  import ca.uhn.fhir.model.dstu.valueset.ContactUseEnum;
50  import ca.uhn.fhir.model.primitive.BoundCodeDt;
51  import ca.uhn.fhir.model.primitive.CodeDt;
52  import ca.uhn.fhir.model.primitive.StringDt;
53  
54  /**
55   * HAPI/FHIR <b>ContactDt</b> Datatype
56   * (Technology mediated contact details (phone, fax, email, etc))
57   *
58   * <p>
59   * <b>Definition:</b>
60   * All kinds of technology mediated contact details for a person or organization, including telephone, email, etc.
61   * </p> 
62   *
63   * <p>
64   * <b>Requirements:</b>
65   * Need to track phone, fax, mobile, sms numbers, email addresses, twitter tags, etc.
66   * </p> 
67   */
68  @DatatypeDef(name="ContactDt") 
69  public class ContactDt
70          extends  BaseIdentifiableElement         implements ICompositeDatatype
71  {
72  
73  	/**
74  	 * Constructor
75  	 */
76  	public ContactDt() {
77  		// nothing
78  	}
79  
80  	/**
81  	 * Constructor
82  	 */
83  	@SimpleSetter
84  	public ContactDt(@SimpleSetter.Parameter(name="theValue") String theValue) {
85  		setValue(theValue);
86  	}
87  	
88  	/**
89  	 * Constructor
90  	 */
91  	@SimpleSetter
92  	public ContactDt(@SimpleSetter.Parameter(name="theContactUse") ContactUseEnum theContactUse, @SimpleSetter.Parameter(name="theValue") String theValue) {
93  		setUse(theContactUse);
94  		setValue(theValue);
95  	}	
96  
97  	@Child(name="system", type=CodeDt.class, order=0, min=0, max=1)	
98  	@Description(
99  		shortDefinition="phone | fax | email | url",
100 		formalDefinition="Telecommunications form for contact - what communications system is required to make use of the contact"
101 	)
102 	private BoundCodeDt<ContactSystemEnum> mySystem;
103 	
104 	@Child(name="value", type=StringDt.class, order=1, min=0, max=1)	
105 	@Description(
106 		shortDefinition="The actual contact details",
107 		formalDefinition="The actual contact details, in a form that is meaningful to the designated communication system (i.e. phone number or email address)."
108 	)
109 	private StringDt myValue;
110 	
111 	@Child(name="use", type=CodeDt.class, order=2, min=0, max=1)	
112 	@Description(
113 		shortDefinition="home | work | temp | old | mobile - purpose of this address",
114 		formalDefinition="Identifies the purpose for the address"
115 	)
116 	private BoundCodeDt<ContactUseEnum> myUse;
117 	
118 	@Child(name="period", type=PeriodDt.class, order=3, min=0, max=1)	
119 	@Description(
120 		shortDefinition="Time period when the contact was/is in use",
121 		formalDefinition="Time period when the contact was/is in use"
122 	)
123 	private PeriodDt myPeriod;
124 	
125 
126 	@Override
127 	public boolean isEmpty() {
128 		return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  mySystem,  myValue,  myUse,  myPeriod);
129 	}
130 	
131 	@Override
132 	public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
133 		return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, mySystem, myValue, myUse, myPeriod);
134 	}
135 
136 	/**
137 	 * Gets the value(s) for <b>system</b> (phone | fax | email | url).
138 	 * creating it if it does
139 	 * not exist. Will not return <code>null</code>.
140 	 *
141      * <p>
142      * <b>Definition:</b>
143      * Telecommunications form for contact - what communications system is required to make use of the contact
144      * </p> 
145 	 */
146 	public BoundCodeDt<ContactSystemEnum> getSystem() {  
147 		if (mySystem == null) {
148 			mySystem = new BoundCodeDt<ContactSystemEnum>(ContactSystemEnum.VALUESET_BINDER);
149 		}
150 		return mySystem;
151 	}
152 
153 	/**
154 	 * Sets the value(s) for <b>system</b> (phone | fax | email | url)
155 	 *
156      * <p>
157      * <b>Definition:</b>
158      * Telecommunications form for contact - what communications system is required to make use of the contact
159      * </p> 
160 	 */
161 	public ContactDt setSystem(BoundCodeDt<ContactSystemEnum> theValue) {
162 		mySystem = theValue;
163 		return this;
164 	}
165 
166 	/**
167 	 * Sets the value(s) for <b>system</b> (phone | fax | email | url)
168 	 *
169      * <p>
170      * <b>Definition:</b>
171      * Telecommunications form for contact - what communications system is required to make use of the contact
172      * </p> 
173 	 */
174 	public ContactDt setSystem(ContactSystemEnum theValue) {
175 		getSystem().setValueAsEnum(theValue);
176 		return this;
177 	}
178 
179   
180 	/**
181 	 * Gets the value(s) for <b>value</b> (The actual contact details).
182 	 * creating it if it does
183 	 * not exist. Will not return <code>null</code>.
184 	 *
185      * <p>
186      * <b>Definition:</b>
187      * The actual contact details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
188      * </p> 
189 	 */
190 	public StringDt getValue() {  
191 		if (myValue == null) {
192 			myValue = new StringDt();
193 		}
194 		return myValue;
195 	}
196 
197 	/**
198 	 * Sets the value(s) for <b>value</b> (The actual contact details)
199 	 *
200      * <p>
201      * <b>Definition:</b>
202      * The actual contact details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
203      * </p> 
204 	 */
205 	public ContactDt setValue(StringDt theValue) {
206 		myValue = theValue;
207 		return this;
208 	}
209 
210  	/**
211 	 * Sets the value for <b>value</b> (The actual contact details)
212 	 *
213      * <p>
214      * <b>Definition:</b>
215      * The actual contact details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
216      * </p> 
217 	 */
218 	public ContactDt setValue( String theString) {
219 		myValue = new StringDt(theString); 
220 		return this; 
221 	}
222 
223  
224 	/**
225 	 * Gets the value(s) for <b>use</b> (home | work | temp | old | mobile - purpose of this address).
226 	 * creating it if it does
227 	 * not exist. Will not return <code>null</code>.
228 	 *
229      * <p>
230      * <b>Definition:</b>
231      * Identifies the purpose for the address
232      * </p> 
233 	 */
234 	public BoundCodeDt<ContactUseEnum> getUse() {  
235 		if (myUse == null) {
236 			myUse = new BoundCodeDt<ContactUseEnum>(ContactUseEnum.VALUESET_BINDER);
237 		}
238 		return myUse;
239 	}
240 
241 	/**
242 	 * Sets the value(s) for <b>use</b> (home | work | temp | old | mobile - purpose of this address)
243 	 *
244      * <p>
245      * <b>Definition:</b>
246      * Identifies the purpose for the address
247      * </p> 
248 	 */
249 	public ContactDt setUse(BoundCodeDt<ContactUseEnum> theValue) {
250 		myUse = theValue;
251 		return this;
252 	}
253 
254 	/**
255 	 * Sets the value(s) for <b>use</b> (home | work | temp | old | mobile - purpose of this address)
256 	 *
257      * <p>
258      * <b>Definition:</b>
259      * Identifies the purpose for the address
260      * </p> 
261 	 */
262 	public ContactDt setUse(ContactUseEnum theValue) {
263 		getUse().setValueAsEnum(theValue);
264 		return this;
265 	}
266 
267   
268 	/**
269 	 * Gets the value(s) for <b>period</b> (Time period when the contact was/is in use).
270 	 * creating it if it does
271 	 * not exist. Will not return <code>null</code>.
272 	 *
273      * <p>
274      * <b>Definition:</b>
275      * Time period when the contact was/is in use
276      * </p> 
277 	 */
278 	public PeriodDt getPeriod() {  
279 		if (myPeriod == null) {
280 			myPeriod = new PeriodDt();
281 		}
282 		return myPeriod;
283 	}
284 
285 	/**
286 	 * Sets the value(s) for <b>period</b> (Time period when the contact was/is in use)
287 	 *
288      * <p>
289      * <b>Definition:</b>
290      * Time period when the contact was/is in use
291      * </p> 
292 	 */
293 	public ContactDt setPeriod(PeriodDt theValue) {
294 		myPeriod = theValue;
295 		return this;
296 	}
297 
298   
299 
300 
301 }