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.resource;
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  
40  import java.util.List;
41  
42  import ca.uhn.fhir.model.api.BaseIdentifiableElement;
43  import ca.uhn.fhir.model.api.BaseResource;
44  import ca.uhn.fhir.model.api.IElement;
45  import ca.uhn.fhir.model.api.IResource;
46  import ca.uhn.fhir.model.api.IResourceBlock;
47  import ca.uhn.fhir.model.api.annotation.Block;
48  import ca.uhn.fhir.model.api.annotation.Child;
49  import ca.uhn.fhir.model.api.annotation.Description;
50  import ca.uhn.fhir.model.api.annotation.ResourceDef;
51  import ca.uhn.fhir.model.dstu.composite.CodingDt;
52  import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
53  import ca.uhn.fhir.model.primitive.BoundCodeDt;
54  import ca.uhn.fhir.model.primitive.CodeDt;
55  import ca.uhn.fhir.model.primitive.StringDt;
56  
57  
58  /**
59   * HAPI/FHIR <b>OperationOutcome</b> Resource
60   * (Information about the success/failure of an action)
61   *
62   * <p>
63   * <b>Definition:</b>
64   * A collection of error, warning or information messages that result from a system action
65   * </p> 
66   *
67   * <p>
68   * <b>Requirements:</b>
69   * 
70   * </p> 
71   *
72   * <p>
73   * <b>Profile Definition:</b>
74   * <a href="http://hl7.org/fhir/profiles/OperationOutcome">http://hl7.org/fhir/profiles/OperationOutcome</a> 
75   * </p>
76   *
77   */
78  @ResourceDef(name="OperationOutcome", profile="http://hl7.org/fhir/profiles/OperationOutcome", id="operationoutcome")
79  public class OperationOutcome extends BaseResource implements IResource {
80  
81  
82  	@Child(name="issue", order=0, min=1, max=Child.MAX_UNLIMITED)	
83  	@Description(
84  		shortDefinition="A single issue associated with the action",
85  		formalDefinition="An error, warning or information message that results from a system action"
86  	)
87  	private java.util.List<Issue> myIssue;
88  	
89  
90  	@Override
91  	public boolean isEmpty() {
92  		return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myIssue);
93  	}
94  	
95  	@Override
96  	public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
97  		return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIssue);
98  	}
99  
100 	/**
101 	 * Gets the value(s) for <b>issue</b> (A single issue associated with the action).
102 	 * creating it if it does
103 	 * not exist. Will not return <code>null</code>.
104 	 *
105      * <p>
106      * <b>Definition:</b>
107      * An error, warning or information message that results from a system action
108      * </p> 
109 	 */
110 	public java.util.List<Issue> getIssue() {  
111 		if (myIssue == null) {
112 			myIssue = new java.util.ArrayList<Issue>();
113 		}
114 		return myIssue;
115 	}
116 
117 	/**
118 	 * Sets the value(s) for <b>issue</b> (A single issue associated with the action)
119 	 *
120      * <p>
121      * <b>Definition:</b>
122      * An error, warning or information message that results from a system action
123      * </p> 
124 	 */
125 	public OperationOutcome setIssue(java.util.List<Issue> theValue) {
126 		myIssue = theValue;
127 		return this;
128 	}
129 
130 	/**
131 	 * Adds and returns a new value for <b>issue</b> (A single issue associated with the action)
132 	 *
133      * <p>
134      * <b>Definition:</b>
135      * An error, warning or information message that results from a system action
136      * </p> 
137 	 */
138 	public Issue addIssue() {
139 		Issue newType = new Issue();
140 		getIssue().add(newType);
141 		return newType; 
142 	}
143 
144 	/**
145 	 * Gets the first repetition for <b>issue</b> (A single issue associated with the action),
146 	 * creating it if it does not already exist.
147 	 *
148      * <p>
149      * <b>Definition:</b>
150      * An error, warning or information message that results from a system action
151      * </p> 
152 	 */
153 	public Issue getIssueFirstRep() {
154 		if (getIssue().isEmpty()) {
155 			return addIssue();
156 		}
157 		return getIssue().get(0); 
158 	}
159   
160 	/**
161 	 * Block class for child element: <b>OperationOutcome.issue</b> (A single issue associated with the action)
162 	 *
163      * <p>
164      * <b>Definition:</b>
165      * An error, warning or information message that results from a system action
166      * </p> 
167 	 */
168 	@Block()	
169 	public static class Issue extends BaseIdentifiableElement implements IResourceBlock {
170 	
171 	@Child(name="severity", type=CodeDt.class, order=0, min=1, max=1)	
172 	@Description(
173 		shortDefinition="fatal | error | warning | information",
174 		formalDefinition="Indicates whether the issue indicates a variation from successful processing"
175 	)
176 	private BoundCodeDt<IssueSeverityEnum> mySeverity;
177 	
178 	@Child(name="type", type=CodingDt.class, order=1, min=0, max=1)	
179 	@Description(
180 		shortDefinition="Error or warning code",
181 		formalDefinition="A code indicating the type of error, warning or information message."
182 	)
183 	private CodingDt myType;
184 	
185 	@Child(name="details", type=StringDt.class, order=2, min=0, max=1)	
186 	@Description(
187 		shortDefinition="Additional description of the issue",
188 		formalDefinition="Additional description of the issue"
189 	)
190 	private StringDt myDetails;
191 	
192 	@Child(name="location", type=StringDt.class, order=3, min=0, max=Child.MAX_UNLIMITED)	
193 	@Description(
194 		shortDefinition="XPath of element(s) related to issue",
195 		formalDefinition="A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised."
196 	)
197 	private java.util.List<StringDt> myLocation;
198 	
199 
200 	@Override
201 	public boolean isEmpty() {
202 		return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  mySeverity,  myType,  myDetails,  myLocation);
203 	}
204 	
205 	@Override
206 	public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
207 		return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, mySeverity, myType, myDetails, myLocation);
208 	}
209 
210 	/**
211 	 * Gets the value(s) for <b>severity</b> (fatal | error | warning | information).
212 	 * creating it if it does
213 	 * not exist. Will not return <code>null</code>.
214 	 *
215      * <p>
216      * <b>Definition:</b>
217      * Indicates whether the issue indicates a variation from successful processing
218      * </p> 
219 	 */
220 	public BoundCodeDt<IssueSeverityEnum> getSeverity() {  
221 		if (mySeverity == null) {
222 			mySeverity = new BoundCodeDt<IssueSeverityEnum>(IssueSeverityEnum.VALUESET_BINDER);
223 		}
224 		return mySeverity;
225 	}
226 
227 	/**
228 	 * Sets the value(s) for <b>severity</b> (fatal | error | warning | information)
229 	 *
230      * <p>
231      * <b>Definition:</b>
232      * Indicates whether the issue indicates a variation from successful processing
233      * </p> 
234 	 */
235 	public Issue setSeverity(BoundCodeDt<IssueSeverityEnum> theValue) {
236 		mySeverity = theValue;
237 		return this;
238 	}
239 
240 	/**
241 	 * Sets the value(s) for <b>severity</b> (fatal | error | warning | information)
242 	 *
243      * <p>
244      * <b>Definition:</b>
245      * Indicates whether the issue indicates a variation from successful processing
246      * </p> 
247 	 */
248 	public Issue setSeverity(IssueSeverityEnum theValue) {
249 		getSeverity().setValueAsEnum(theValue);
250 		return this;
251 	}
252 
253   
254 	/**
255 	 * Gets the value(s) for <b>type</b> (Error or warning code).
256 	 * creating it if it does
257 	 * not exist. Will not return <code>null</code>.
258 	 *
259      * <p>
260      * <b>Definition:</b>
261      * A code indicating the type of error, warning or information message.
262      * </p> 
263 	 */
264 	public CodingDt getType() {  
265 		if (myType == null) {
266 			myType = new CodingDt();
267 		}
268 		return myType;
269 	}
270 
271 	/**
272 	 * Sets the value(s) for <b>type</b> (Error or warning code)
273 	 *
274      * <p>
275      * <b>Definition:</b>
276      * A code indicating the type of error, warning or information message.
277      * </p> 
278 	 */
279 	public Issue setType(CodingDt theValue) {
280 		myType = theValue;
281 		return this;
282 	}
283 
284   
285 	/**
286 	 * Gets the value(s) for <b>details</b> (Additional description of the issue).
287 	 * creating it if it does
288 	 * not exist. Will not return <code>null</code>.
289 	 *
290      * <p>
291      * <b>Definition:</b>
292      * Additional description of the issue
293      * </p> 
294 	 */
295 	public StringDt getDetails() {  
296 		if (myDetails == null) {
297 			myDetails = new StringDt();
298 		}
299 		return myDetails;
300 	}
301 
302 	/**
303 	 * Sets the value(s) for <b>details</b> (Additional description of the issue)
304 	 *
305      * <p>
306      * <b>Definition:</b>
307      * Additional description of the issue
308      * </p> 
309 	 */
310 	public Issue setDetails(StringDt theValue) {
311 		myDetails = theValue;
312 		return this;
313 	}
314 
315  	/**
316 	 * Sets the value for <b>details</b> (Additional description of the issue)
317 	 *
318      * <p>
319      * <b>Definition:</b>
320      * Additional description of the issue
321      * </p> 
322 	 */
323 	public Issue setDetails( String theString) {
324 		myDetails = new StringDt(theString); 
325 		return this; 
326 	}
327 
328  
329 	/**
330 	 * Gets the value(s) for <b>location</b> (XPath of element(s) related to issue).
331 	 * creating it if it does
332 	 * not exist. Will not return <code>null</code>.
333 	 *
334      * <p>
335      * <b>Definition:</b>
336      * A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
337      * </p> 
338 	 */
339 	public java.util.List<StringDt> getLocation() {  
340 		if (myLocation == null) {
341 			myLocation = new java.util.ArrayList<StringDt>();
342 		}
343 		return myLocation;
344 	}
345 
346 	/**
347 	 * Sets the value(s) for <b>location</b> (XPath of element(s) related to issue)
348 	 *
349      * <p>
350      * <b>Definition:</b>
351      * A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
352      * </p> 
353 	 */
354 	public Issue setLocation(java.util.List<StringDt> theValue) {
355 		myLocation = theValue;
356 		return this;
357 	}
358 
359 	/**
360 	 * Adds and returns a new value for <b>location</b> (XPath of element(s) related to issue)
361 	 *
362      * <p>
363      * <b>Definition:</b>
364      * A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
365      * </p> 
366 	 */
367 	public StringDt addLocation() {
368 		StringDt newType = new StringDt();
369 		getLocation().add(newType);
370 		return newType; 
371 	}
372 
373 	/**
374 	 * Gets the first repetition for <b>location</b> (XPath of element(s) related to issue),
375 	 * creating it if it does not already exist.
376 	 *
377      * <p>
378      * <b>Definition:</b>
379      * A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
380      * </p> 
381 	 */
382 	public StringDt getLocationFirstRep() {
383 		if (getLocation().isEmpty()) {
384 			return addLocation();
385 		}
386 		return getLocation().get(0); 
387 	}
388  	/**
389 	 * Adds a new value for <b>location</b> (XPath of element(s) related to issue)
390 	 *
391      * <p>
392      * <b>Definition:</b>
393      * A simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.
394      * </p> 
395      *
396      * @return Returns a reference to this object, to allow for simple chaining.
397 	 */
398 	public Issue addLocation( String theString) {
399 		if (myLocation == null) {
400 			myLocation = new java.util.ArrayList<StringDt>();
401 		}
402 		myLocation.add(new StringDt(theString));
403 		return this; 
404 	}
405 
406  
407 
408 	}
409 
410 
411 
412 
413 }