001package org.hl7.fhir.dstu3.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
036import java.util.ArrayList;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048/**
049 * A collection of error, warning or information messages that result from a system action.
050 */
051@ResourceDef(name="OperationOutcome", profile="http://hl7.org/fhir/Profile/OperationOutcome")
052public class OperationOutcome extends DomainResource implements IBaseOperationOutcome {
053
054    public enum IssueSeverity {
055        /**
056         * The issue caused the action to fail, and no further checking could be performed.
057         */
058        FATAL, 
059        /**
060         * The issue is sufficiently important to cause the action to fail.
061         */
062        ERROR, 
063        /**
064         * The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired.
065         */
066        WARNING, 
067        /**
068         * The issue has no relation to the degree of success of the action.
069         */
070        INFORMATION, 
071        /**
072         * added to help the parsers with the generic types
073         */
074        NULL;
075        public static IssueSeverity fromCode(String codeString) throws FHIRException {
076            if (codeString == null || "".equals(codeString))
077                return null;
078        if ("fatal".equals(codeString))
079          return FATAL;
080        if ("error".equals(codeString))
081          return ERROR;
082        if ("warning".equals(codeString))
083          return WARNING;
084        if ("information".equals(codeString))
085          return INFORMATION;
086        if (Configuration.isAcceptInvalidEnums())
087          return null;
088        else
089          throw new FHIRException("Unknown IssueSeverity code '"+codeString+"'");
090        }
091        public String toCode() {
092          switch (this) {
093            case FATAL: return "fatal";
094            case ERROR: return "error";
095            case WARNING: return "warning";
096            case INFORMATION: return "information";
097            case NULL: return null;
098            default: return "?";
099          }
100        }
101        public String getSystem() {
102          switch (this) {
103            case FATAL: return "http://hl7.org/fhir/issue-severity";
104            case ERROR: return "http://hl7.org/fhir/issue-severity";
105            case WARNING: return "http://hl7.org/fhir/issue-severity";
106            case INFORMATION: return "http://hl7.org/fhir/issue-severity";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111        public String getDefinition() {
112          switch (this) {
113            case FATAL: return "The issue caused the action to fail, and no further checking could be performed.";
114            case ERROR: return "The issue is sufficiently important to cause the action to fail.";
115            case WARNING: return "The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired.";
116            case INFORMATION: return "The issue has no relation to the degree of success of the action.";
117            case NULL: return null;
118            default: return "?";
119          }
120        }
121        public String getDisplay() {
122          switch (this) {
123            case FATAL: return "Fatal";
124            case ERROR: return "Error";
125            case WARNING: return "Warning";
126            case INFORMATION: return "Information";
127            case NULL: return null;
128            default: return "?";
129          }
130        }
131    }
132
133  public static class IssueSeverityEnumFactory implements EnumFactory<IssueSeverity> {
134    public IssueSeverity fromCode(String codeString) throws IllegalArgumentException {
135      if (codeString == null || "".equals(codeString))
136            if (codeString == null || "".equals(codeString))
137                return null;
138        if ("fatal".equals(codeString))
139          return IssueSeverity.FATAL;
140        if ("error".equals(codeString))
141          return IssueSeverity.ERROR;
142        if ("warning".equals(codeString))
143          return IssueSeverity.WARNING;
144        if ("information".equals(codeString))
145          return IssueSeverity.INFORMATION;
146        throw new IllegalArgumentException("Unknown IssueSeverity code '"+codeString+"'");
147        }
148        public Enumeration<IssueSeverity> fromType(PrimitiveType<?> code) throws FHIRException {
149          if (code == null)
150            return null;
151          if (code.isEmpty())
152            return new Enumeration<IssueSeverity>(this);
153          String codeString = code.asStringValue();
154          if (codeString == null || "".equals(codeString))
155            return null;
156        if ("fatal".equals(codeString))
157          return new Enumeration<IssueSeverity>(this, IssueSeverity.FATAL);
158        if ("error".equals(codeString))
159          return new Enumeration<IssueSeverity>(this, IssueSeverity.ERROR);
160        if ("warning".equals(codeString))
161          return new Enumeration<IssueSeverity>(this, IssueSeverity.WARNING);
162        if ("information".equals(codeString))
163          return new Enumeration<IssueSeverity>(this, IssueSeverity.INFORMATION);
164        throw new FHIRException("Unknown IssueSeverity code '"+codeString+"'");
165        }
166    public String toCode(IssueSeverity code) {
167      if (code == IssueSeverity.FATAL)
168        return "fatal";
169      if (code == IssueSeverity.ERROR)
170        return "error";
171      if (code == IssueSeverity.WARNING)
172        return "warning";
173      if (code == IssueSeverity.INFORMATION)
174        return "information";
175      return "?";
176      }
177    public String toSystem(IssueSeverity code) {
178      return code.getSystem();
179      }
180    }
181
182    public enum IssueType {
183        /**
184         * Content invalid against the specification or a profile.
185         */
186        INVALID, 
187        /**
188         * A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax.
189         */
190        STRUCTURE, 
191        /**
192         * A required element is missing.
193         */
194        REQUIRED, 
195        /**
196         * An element value is invalid.
197         */
198        VALUE, 
199        /**
200         * A content validation rule failed - e.g. a schematron rule.
201         */
202        INVARIANT, 
203        /**
204         * An authentication/authorization/permissions issue of some kind.
205         */
206        SECURITY, 
207        /**
208         * The client needs to initiate an authentication process.
209         */
210        LOGIN, 
211        /**
212         * The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable).
213         */
214        UNKNOWN, 
215        /**
216         * User session expired; a login may be required.
217         */
218        EXPIRED, 
219        /**
220         * The user does not have the rights to perform this action.
221         */
222        FORBIDDEN, 
223        /**
224         * Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints.  This information may be accessible through alternate processes.
225         */
226        SUPPRESSED, 
227        /**
228         * Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged.
229         */
230        PROCESSING, 
231        /**
232         * The resource or profile is not supported.
233         */
234        NOTSUPPORTED, 
235        /**
236         * An attempt was made to create a duplicate record.
237         */
238        DUPLICATE, 
239        /**
240         * The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture.
241         */
242        NOTFOUND, 
243        /**
244         * Provided content is too long (typically, this is a denial of service protection type of error).
245         */
246        TOOLONG, 
247        /**
248         * The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code.
249         */
250        CODEINVALID, 
251        /**
252         * An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized.
253         */
254        EXTENSION, 
255        /**
256         * The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT.
257         */
258        TOOCOSTLY, 
259        /**
260         * The content/operation failed to pass some business rule, and so could not proceed.
261         */
262        BUSINESSRULE, 
263        /**
264         * Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.)
265         */
266        CONFLICT, 
267        /**
268         * Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete.
269         */
270        INCOMPLETE, 
271        /**
272         * Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved.
273         */
274        TRANSIENT, 
275        /**
276         * A resource/record locking failure (usually in an underlying database).
277         */
278        LOCKERROR, 
279        /**
280         * The persistent store is unavailable; e.g. the database is down for maintenance or similar action.
281         */
282        NOSTORE, 
283        /**
284         * An unexpected internal error has occurred.
285         */
286        EXCEPTION, 
287        /**
288         * An internal timeout has occurred.
289         */
290        TIMEOUT, 
291        /**
292         * The system is not prepared to handle this request due to load management.
293         */
294        THROTTLED, 
295        /**
296         * A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.).
297         */
298        INFORMATIONAL, 
299        /**
300         * added to help the parsers with the generic types
301         */
302        NULL;
303        public static IssueType fromCode(String codeString) throws FHIRException {
304            if (codeString == null || "".equals(codeString))
305                return null;
306        if ("invalid".equals(codeString))
307          return INVALID;
308        if ("structure".equals(codeString))
309          return STRUCTURE;
310        if ("required".equals(codeString))
311          return REQUIRED;
312        if ("value".equals(codeString))
313          return VALUE;
314        if ("invariant".equals(codeString))
315          return INVARIANT;
316        if ("security".equals(codeString))
317          return SECURITY;
318        if ("login".equals(codeString))
319          return LOGIN;
320        if ("unknown".equals(codeString))
321          return UNKNOWN;
322        if ("expired".equals(codeString))
323          return EXPIRED;
324        if ("forbidden".equals(codeString))
325          return FORBIDDEN;
326        if ("suppressed".equals(codeString))
327          return SUPPRESSED;
328        if ("processing".equals(codeString))
329          return PROCESSING;
330        if ("not-supported".equals(codeString))
331          return NOTSUPPORTED;
332        if ("duplicate".equals(codeString))
333          return DUPLICATE;
334        if ("not-found".equals(codeString))
335          return NOTFOUND;
336        if ("too-long".equals(codeString))
337          return TOOLONG;
338        if ("code-invalid".equals(codeString))
339          return CODEINVALID;
340        if ("extension".equals(codeString))
341          return EXTENSION;
342        if ("too-costly".equals(codeString))
343          return TOOCOSTLY;
344        if ("business-rule".equals(codeString))
345          return BUSINESSRULE;
346        if ("conflict".equals(codeString))
347          return CONFLICT;
348        if ("incomplete".equals(codeString))
349          return INCOMPLETE;
350        if ("transient".equals(codeString))
351          return TRANSIENT;
352        if ("lock-error".equals(codeString))
353          return LOCKERROR;
354        if ("no-store".equals(codeString))
355          return NOSTORE;
356        if ("exception".equals(codeString))
357          return EXCEPTION;
358        if ("timeout".equals(codeString))
359          return TIMEOUT;
360        if ("throttled".equals(codeString))
361          return THROTTLED;
362        if ("informational".equals(codeString))
363          return INFORMATIONAL;
364        if (Configuration.isAcceptInvalidEnums())
365          return null;
366        else
367          throw new FHIRException("Unknown IssueType code '"+codeString+"'");
368        }
369        public String toCode() {
370          switch (this) {
371            case INVALID: return "invalid";
372            case STRUCTURE: return "structure";
373            case REQUIRED: return "required";
374            case VALUE: return "value";
375            case INVARIANT: return "invariant";
376            case SECURITY: return "security";
377            case LOGIN: return "login";
378            case UNKNOWN: return "unknown";
379            case EXPIRED: return "expired";
380            case FORBIDDEN: return "forbidden";
381            case SUPPRESSED: return "suppressed";
382            case PROCESSING: return "processing";
383            case NOTSUPPORTED: return "not-supported";
384            case DUPLICATE: return "duplicate";
385            case NOTFOUND: return "not-found";
386            case TOOLONG: return "too-long";
387            case CODEINVALID: return "code-invalid";
388            case EXTENSION: return "extension";
389            case TOOCOSTLY: return "too-costly";
390            case BUSINESSRULE: return "business-rule";
391            case CONFLICT: return "conflict";
392            case INCOMPLETE: return "incomplete";
393            case TRANSIENT: return "transient";
394            case LOCKERROR: return "lock-error";
395            case NOSTORE: return "no-store";
396            case EXCEPTION: return "exception";
397            case TIMEOUT: return "timeout";
398            case THROTTLED: return "throttled";
399            case INFORMATIONAL: return "informational";
400            case NULL: return null;
401            default: return "?";
402          }
403        }
404        public String getSystem() {
405          switch (this) {
406            case INVALID: return "http://hl7.org/fhir/issue-type";
407            case STRUCTURE: return "http://hl7.org/fhir/issue-type";
408            case REQUIRED: return "http://hl7.org/fhir/issue-type";
409            case VALUE: return "http://hl7.org/fhir/issue-type";
410            case INVARIANT: return "http://hl7.org/fhir/issue-type";
411            case SECURITY: return "http://hl7.org/fhir/issue-type";
412            case LOGIN: return "http://hl7.org/fhir/issue-type";
413            case UNKNOWN: return "http://hl7.org/fhir/issue-type";
414            case EXPIRED: return "http://hl7.org/fhir/issue-type";
415            case FORBIDDEN: return "http://hl7.org/fhir/issue-type";
416            case SUPPRESSED: return "http://hl7.org/fhir/issue-type";
417            case PROCESSING: return "http://hl7.org/fhir/issue-type";
418            case NOTSUPPORTED: return "http://hl7.org/fhir/issue-type";
419            case DUPLICATE: return "http://hl7.org/fhir/issue-type";
420            case NOTFOUND: return "http://hl7.org/fhir/issue-type";
421            case TOOLONG: return "http://hl7.org/fhir/issue-type";
422            case CODEINVALID: return "http://hl7.org/fhir/issue-type";
423            case EXTENSION: return "http://hl7.org/fhir/issue-type";
424            case TOOCOSTLY: return "http://hl7.org/fhir/issue-type";
425            case BUSINESSRULE: return "http://hl7.org/fhir/issue-type";
426            case CONFLICT: return "http://hl7.org/fhir/issue-type";
427            case INCOMPLETE: return "http://hl7.org/fhir/issue-type";
428            case TRANSIENT: return "http://hl7.org/fhir/issue-type";
429            case LOCKERROR: return "http://hl7.org/fhir/issue-type";
430            case NOSTORE: return "http://hl7.org/fhir/issue-type";
431            case EXCEPTION: return "http://hl7.org/fhir/issue-type";
432            case TIMEOUT: return "http://hl7.org/fhir/issue-type";
433            case THROTTLED: return "http://hl7.org/fhir/issue-type";
434            case INFORMATIONAL: return "http://hl7.org/fhir/issue-type";
435            case NULL: return null;
436            default: return "?";
437          }
438        }
439        public String getDefinition() {
440          switch (this) {
441            case INVALID: return "Content invalid against the specification or a profile.";
442            case STRUCTURE: return "A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax.";
443            case REQUIRED: return "A required element is missing.";
444            case VALUE: return "An element value is invalid.";
445            case INVARIANT: return "A content validation rule failed - e.g. a schematron rule.";
446            case SECURITY: return "An authentication/authorization/permissions issue of some kind.";
447            case LOGIN: return "The client needs to initiate an authentication process.";
448            case UNKNOWN: return "The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable).";
449            case EXPIRED: return "User session expired; a login may be required.";
450            case FORBIDDEN: return "The user does not have the rights to perform this action.";
451            case SUPPRESSED: return "Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints.  This information may be accessible through alternate processes.";
452            case PROCESSING: return "Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged.";
453            case NOTSUPPORTED: return "The resource or profile is not supported.";
454            case DUPLICATE: return "An attempt was made to create a duplicate record.";
455            case NOTFOUND: return "The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture.";
456            case TOOLONG: return "Provided content is too long (typically, this is a denial of service protection type of error).";
457            case CODEINVALID: return "The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code.";
458            case EXTENSION: return "An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized.";
459            case TOOCOSTLY: return "The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT.";
460            case BUSINESSRULE: return "The content/operation failed to pass some business rule, and so could not proceed.";
461            case CONFLICT: return "Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.)";
462            case INCOMPLETE: return "Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete.";
463            case TRANSIENT: return "Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved.";
464            case LOCKERROR: return "A resource/record locking failure (usually in an underlying database).";
465            case NOSTORE: return "The persistent store is unavailable; e.g. the database is down for maintenance or similar action.";
466            case EXCEPTION: return "An unexpected internal error has occurred.";
467            case TIMEOUT: return "An internal timeout has occurred.";
468            case THROTTLED: return "The system is not prepared to handle this request due to load management.";
469            case INFORMATIONAL: return "A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.).";
470            case NULL: return null;
471            default: return "?";
472          }
473        }
474        public String getDisplay() {
475          switch (this) {
476            case INVALID: return "Invalid Content";
477            case STRUCTURE: return "Structural Issue";
478            case REQUIRED: return "Required element missing";
479            case VALUE: return "Element value invalid";
480            case INVARIANT: return "Validation rule failed";
481            case SECURITY: return "Security Problem";
482            case LOGIN: return "Login Required";
483            case UNKNOWN: return "Unknown User";
484            case EXPIRED: return "Session Expired";
485            case FORBIDDEN: return "Forbidden";
486            case SUPPRESSED: return "Information  Suppressed";
487            case PROCESSING: return "Processing Failure";
488            case NOTSUPPORTED: return "Content not supported";
489            case DUPLICATE: return "Duplicate";
490            case NOTFOUND: return "Not Found";
491            case TOOLONG: return "Content Too Long";
492            case CODEINVALID: return "Invalid Code";
493            case EXTENSION: return "Unacceptable Extension";
494            case TOOCOSTLY: return "Operation Too Costly";
495            case BUSINESSRULE: return "Business Rule Violation";
496            case CONFLICT: return "Edit Version Conflict";
497            case INCOMPLETE: return "Incomplete Results";
498            case TRANSIENT: return "Transient Issue";
499            case LOCKERROR: return "Lock Error";
500            case NOSTORE: return "No Store Available";
501            case EXCEPTION: return "Exception";
502            case TIMEOUT: return "Timeout";
503            case THROTTLED: return "Throttled";
504            case INFORMATIONAL: return "Informational Note";
505            case NULL: return null;
506            default: return "?";
507          }
508        }
509    }
510
511  public static class IssueTypeEnumFactory implements EnumFactory<IssueType> {
512    public IssueType fromCode(String codeString) throws IllegalArgumentException {
513      if (codeString == null || "".equals(codeString))
514            if (codeString == null || "".equals(codeString))
515                return null;
516        if ("invalid".equals(codeString))
517          return IssueType.INVALID;
518        if ("structure".equals(codeString))
519          return IssueType.STRUCTURE;
520        if ("required".equals(codeString))
521          return IssueType.REQUIRED;
522        if ("value".equals(codeString))
523          return IssueType.VALUE;
524        if ("invariant".equals(codeString))
525          return IssueType.INVARIANT;
526        if ("security".equals(codeString))
527          return IssueType.SECURITY;
528        if ("login".equals(codeString))
529          return IssueType.LOGIN;
530        if ("unknown".equals(codeString))
531          return IssueType.UNKNOWN;
532        if ("expired".equals(codeString))
533          return IssueType.EXPIRED;
534        if ("forbidden".equals(codeString))
535          return IssueType.FORBIDDEN;
536        if ("suppressed".equals(codeString))
537          return IssueType.SUPPRESSED;
538        if ("processing".equals(codeString))
539          return IssueType.PROCESSING;
540        if ("not-supported".equals(codeString))
541          return IssueType.NOTSUPPORTED;
542        if ("duplicate".equals(codeString))
543          return IssueType.DUPLICATE;
544        if ("not-found".equals(codeString))
545          return IssueType.NOTFOUND;
546        if ("too-long".equals(codeString))
547          return IssueType.TOOLONG;
548        if ("code-invalid".equals(codeString))
549          return IssueType.CODEINVALID;
550        if ("extension".equals(codeString))
551          return IssueType.EXTENSION;
552        if ("too-costly".equals(codeString))
553          return IssueType.TOOCOSTLY;
554        if ("business-rule".equals(codeString))
555          return IssueType.BUSINESSRULE;
556        if ("conflict".equals(codeString))
557          return IssueType.CONFLICT;
558        if ("incomplete".equals(codeString))
559          return IssueType.INCOMPLETE;
560        if ("transient".equals(codeString))
561          return IssueType.TRANSIENT;
562        if ("lock-error".equals(codeString))
563          return IssueType.LOCKERROR;
564        if ("no-store".equals(codeString))
565          return IssueType.NOSTORE;
566        if ("exception".equals(codeString))
567          return IssueType.EXCEPTION;
568        if ("timeout".equals(codeString))
569          return IssueType.TIMEOUT;
570        if ("throttled".equals(codeString))
571          return IssueType.THROTTLED;
572        if ("informational".equals(codeString))
573          return IssueType.INFORMATIONAL;
574        throw new IllegalArgumentException("Unknown IssueType code '"+codeString+"'");
575        }
576        public Enumeration<IssueType> fromType(PrimitiveType<?> code) throws FHIRException {
577          if (code == null)
578            return null;
579          if (code.isEmpty())
580            return new Enumeration<IssueType>(this);
581          String codeString = code.asStringValue();
582          if (codeString == null || "".equals(codeString))
583            return null;
584        if ("invalid".equals(codeString))
585          return new Enumeration<IssueType>(this, IssueType.INVALID);
586        if ("structure".equals(codeString))
587          return new Enumeration<IssueType>(this, IssueType.STRUCTURE);
588        if ("required".equals(codeString))
589          return new Enumeration<IssueType>(this, IssueType.REQUIRED);
590        if ("value".equals(codeString))
591          return new Enumeration<IssueType>(this, IssueType.VALUE);
592        if ("invariant".equals(codeString))
593          return new Enumeration<IssueType>(this, IssueType.INVARIANT);
594        if ("security".equals(codeString))
595          return new Enumeration<IssueType>(this, IssueType.SECURITY);
596        if ("login".equals(codeString))
597          return new Enumeration<IssueType>(this, IssueType.LOGIN);
598        if ("unknown".equals(codeString))
599          return new Enumeration<IssueType>(this, IssueType.UNKNOWN);
600        if ("expired".equals(codeString))
601          return new Enumeration<IssueType>(this, IssueType.EXPIRED);
602        if ("forbidden".equals(codeString))
603          return new Enumeration<IssueType>(this, IssueType.FORBIDDEN);
604        if ("suppressed".equals(codeString))
605          return new Enumeration<IssueType>(this, IssueType.SUPPRESSED);
606        if ("processing".equals(codeString))
607          return new Enumeration<IssueType>(this, IssueType.PROCESSING);
608        if ("not-supported".equals(codeString))
609          return new Enumeration<IssueType>(this, IssueType.NOTSUPPORTED);
610        if ("duplicate".equals(codeString))
611          return new Enumeration<IssueType>(this, IssueType.DUPLICATE);
612        if ("not-found".equals(codeString))
613          return new Enumeration<IssueType>(this, IssueType.NOTFOUND);
614        if ("too-long".equals(codeString))
615          return new Enumeration<IssueType>(this, IssueType.TOOLONG);
616        if ("code-invalid".equals(codeString))
617          return new Enumeration<IssueType>(this, IssueType.CODEINVALID);
618        if ("extension".equals(codeString))
619          return new Enumeration<IssueType>(this, IssueType.EXTENSION);
620        if ("too-costly".equals(codeString))
621          return new Enumeration<IssueType>(this, IssueType.TOOCOSTLY);
622        if ("business-rule".equals(codeString))
623          return new Enumeration<IssueType>(this, IssueType.BUSINESSRULE);
624        if ("conflict".equals(codeString))
625          return new Enumeration<IssueType>(this, IssueType.CONFLICT);
626        if ("incomplete".equals(codeString))
627          return new Enumeration<IssueType>(this, IssueType.INCOMPLETE);
628        if ("transient".equals(codeString))
629          return new Enumeration<IssueType>(this, IssueType.TRANSIENT);
630        if ("lock-error".equals(codeString))
631          return new Enumeration<IssueType>(this, IssueType.LOCKERROR);
632        if ("no-store".equals(codeString))
633          return new Enumeration<IssueType>(this, IssueType.NOSTORE);
634        if ("exception".equals(codeString))
635          return new Enumeration<IssueType>(this, IssueType.EXCEPTION);
636        if ("timeout".equals(codeString))
637          return new Enumeration<IssueType>(this, IssueType.TIMEOUT);
638        if ("throttled".equals(codeString))
639          return new Enumeration<IssueType>(this, IssueType.THROTTLED);
640        if ("informational".equals(codeString))
641          return new Enumeration<IssueType>(this, IssueType.INFORMATIONAL);
642        throw new FHIRException("Unknown IssueType code '"+codeString+"'");
643        }
644    public String toCode(IssueType code) {
645      if (code == IssueType.INVALID)
646        return "invalid";
647      if (code == IssueType.STRUCTURE)
648        return "structure";
649      if (code == IssueType.REQUIRED)
650        return "required";
651      if (code == IssueType.VALUE)
652        return "value";
653      if (code == IssueType.INVARIANT)
654        return "invariant";
655      if (code == IssueType.SECURITY)
656        return "security";
657      if (code == IssueType.LOGIN)
658        return "login";
659      if (code == IssueType.UNKNOWN)
660        return "unknown";
661      if (code == IssueType.EXPIRED)
662        return "expired";
663      if (code == IssueType.FORBIDDEN)
664        return "forbidden";
665      if (code == IssueType.SUPPRESSED)
666        return "suppressed";
667      if (code == IssueType.PROCESSING)
668        return "processing";
669      if (code == IssueType.NOTSUPPORTED)
670        return "not-supported";
671      if (code == IssueType.DUPLICATE)
672        return "duplicate";
673      if (code == IssueType.NOTFOUND)
674        return "not-found";
675      if (code == IssueType.TOOLONG)
676        return "too-long";
677      if (code == IssueType.CODEINVALID)
678        return "code-invalid";
679      if (code == IssueType.EXTENSION)
680        return "extension";
681      if (code == IssueType.TOOCOSTLY)
682        return "too-costly";
683      if (code == IssueType.BUSINESSRULE)
684        return "business-rule";
685      if (code == IssueType.CONFLICT)
686        return "conflict";
687      if (code == IssueType.INCOMPLETE)
688        return "incomplete";
689      if (code == IssueType.TRANSIENT)
690        return "transient";
691      if (code == IssueType.LOCKERROR)
692        return "lock-error";
693      if (code == IssueType.NOSTORE)
694        return "no-store";
695      if (code == IssueType.EXCEPTION)
696        return "exception";
697      if (code == IssueType.TIMEOUT)
698        return "timeout";
699      if (code == IssueType.THROTTLED)
700        return "throttled";
701      if (code == IssueType.INFORMATIONAL)
702        return "informational";
703      return "?";
704      }
705    public String toSystem(IssueType code) {
706      return code.getSystem();
707      }
708    }
709
710    @Block()
711    public static class OperationOutcomeIssueComponent extends BackboneElement implements IBaseBackboneElement {
712        /**
713         * Indicates whether the issue indicates a variation from successful processing.
714         */
715        @Child(name = "severity", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
716        @Description(shortDefinition="fatal | error | warning | information", formalDefinition="Indicates whether the issue indicates a variation from successful processing." )
717        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/issue-severity")
718        protected Enumeration<IssueSeverity> severity;
719
720        /**
721         * Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.
722         */
723        @Child(name = "code", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
724        @Description(shortDefinition="Error or warning code", formalDefinition="Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element." )
725        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/issue-type")
726        protected Enumeration<IssueType> code;
727
728        /**
729         * Additional details about the error. This may be a text description of the error, or a system code that identifies the error.
730         */
731        @Child(name = "details", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
732        @Description(shortDefinition="Additional details about the error", formalDefinition="Additional details about the error. This may be a text description of the error, or a system code that identifies the error." )
733        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/operation-outcome")
734        protected CodeableConcept details;
735
736        /**
737         * Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.
738         */
739        @Child(name = "diagnostics", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
740        @Description(shortDefinition="Additional diagnostic information about the issue", formalDefinition="Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue." )
741        protected StringType diagnostics;
742
743        /**
744         * For resource issues, this will be 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.  For HTTP errors, will be "http." + the parameter name.
745         */
746        @Child(name = "location", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
747        @Description(shortDefinition="Path of element(s) related to issue", formalDefinition="For resource issues, this will be 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.  For HTTP errors, will be \"http.\" + the parameter name." )
748        protected List<StringType> location;
749
750        /**
751         * A simple FHIRPath 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.
752         */
753        @Child(name = "expression", type = {StringType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
754        @Description(shortDefinition="FHIRPath of element(s) related to issue", formalDefinition="A simple FHIRPath 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." )
755        protected List<StringType> expression;
756
757        private static final long serialVersionUID = -1681095438L;
758
759    /**
760     * Constructor
761     */
762      public OperationOutcomeIssueComponent() {
763        super();
764      }
765
766    /**
767     * Constructor
768     */
769      public OperationOutcomeIssueComponent(Enumeration<IssueSeverity> severity, Enumeration<IssueType> code) {
770        super();
771        this.severity = severity;
772        this.code = code;
773      }
774
775        /**
776         * @return {@link #severity} (Indicates whether the issue indicates a variation from successful processing.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
777         */
778        public Enumeration<IssueSeverity> getSeverityElement() { 
779          if (this.severity == null)
780            if (Configuration.errorOnAutoCreate())
781              throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.severity");
782            else if (Configuration.doAutoCreate())
783              this.severity = new Enumeration<IssueSeverity>(new IssueSeverityEnumFactory()); // bb
784          return this.severity;
785        }
786
787        public boolean hasSeverityElement() { 
788          return this.severity != null && !this.severity.isEmpty();
789        }
790
791        public boolean hasSeverity() { 
792          return this.severity != null && !this.severity.isEmpty();
793        }
794
795        /**
796         * @param value {@link #severity} (Indicates whether the issue indicates a variation from successful processing.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
797         */
798        public OperationOutcomeIssueComponent setSeverityElement(Enumeration<IssueSeverity> value) { 
799          this.severity = value;
800          return this;
801        }
802
803        /**
804         * @return Indicates whether the issue indicates a variation from successful processing.
805         */
806        public IssueSeverity getSeverity() { 
807          return this.severity == null ? null : this.severity.getValue();
808        }
809
810        /**
811         * @param value Indicates whether the issue indicates a variation from successful processing.
812         */
813        public OperationOutcomeIssueComponent setSeverity(IssueSeverity value) { 
814            if (this.severity == null)
815              this.severity = new Enumeration<IssueSeverity>(new IssueSeverityEnumFactory());
816            this.severity.setValue(value);
817          return this;
818        }
819
820        /**
821         * @return {@link #code} (Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
822         */
823        public Enumeration<IssueType> getCodeElement() { 
824          if (this.code == null)
825            if (Configuration.errorOnAutoCreate())
826              throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.code");
827            else if (Configuration.doAutoCreate())
828              this.code = new Enumeration<IssueType>(new IssueTypeEnumFactory()); // bb
829          return this.code;
830        }
831
832        public boolean hasCodeElement() { 
833          return this.code != null && !this.code.isEmpty();
834        }
835
836        public boolean hasCode() { 
837          return this.code != null && !this.code.isEmpty();
838        }
839
840        /**
841         * @param value {@link #code} (Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
842         */
843        public OperationOutcomeIssueComponent setCodeElement(Enumeration<IssueType> value) { 
844          this.code = value;
845          return this;
846        }
847
848        /**
849         * @return Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.
850         */
851        public IssueType getCode() { 
852          return this.code == null ? null : this.code.getValue();
853        }
854
855        /**
856         * @param value Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.
857         */
858        public OperationOutcomeIssueComponent setCode(IssueType value) { 
859            if (this.code == null)
860              this.code = new Enumeration<IssueType>(new IssueTypeEnumFactory());
861            this.code.setValue(value);
862          return this;
863        }
864
865        /**
866         * @return {@link #details} (Additional details about the error. This may be a text description of the error, or a system code that identifies the error.)
867         */
868        public CodeableConcept getDetails() { 
869          if (this.details == null)
870            if (Configuration.errorOnAutoCreate())
871              throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.details");
872            else if (Configuration.doAutoCreate())
873              this.details = new CodeableConcept(); // cc
874          return this.details;
875        }
876
877        public boolean hasDetails() { 
878          return this.details != null && !this.details.isEmpty();
879        }
880
881        /**
882         * @param value {@link #details} (Additional details about the error. This may be a text description of the error, or a system code that identifies the error.)
883         */
884        public OperationOutcomeIssueComponent setDetails(CodeableConcept value)  { 
885          this.details = value;
886          return this;
887        }
888
889        /**
890         * @return {@link #diagnostics} (Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.). This is the underlying object with id, value and extensions. The accessor "getDiagnostics" gives direct access to the value
891         */
892        public StringType getDiagnosticsElement() { 
893          if (this.diagnostics == null)
894            if (Configuration.errorOnAutoCreate())
895              throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.diagnostics");
896            else if (Configuration.doAutoCreate())
897              this.diagnostics = new StringType(); // bb
898          return this.diagnostics;
899        }
900
901        public boolean hasDiagnosticsElement() { 
902          return this.diagnostics != null && !this.diagnostics.isEmpty();
903        }
904
905        public boolean hasDiagnostics() { 
906          return this.diagnostics != null && !this.diagnostics.isEmpty();
907        }
908
909        /**
910         * @param value {@link #diagnostics} (Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.). This is the underlying object with id, value and extensions. The accessor "getDiagnostics" gives direct access to the value
911         */
912        public OperationOutcomeIssueComponent setDiagnosticsElement(StringType value) { 
913          this.diagnostics = value;
914          return this;
915        }
916
917        /**
918         * @return Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.
919         */
920        public String getDiagnostics() { 
921          return this.diagnostics == null ? null : this.diagnostics.getValue();
922        }
923
924        /**
925         * @param value Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.
926         */
927        public OperationOutcomeIssueComponent setDiagnostics(String value) { 
928          if (Utilities.noString(value))
929            this.diagnostics = null;
930          else {
931            if (this.diagnostics == null)
932              this.diagnostics = new StringType();
933            this.diagnostics.setValue(value);
934          }
935          return this;
936        }
937
938        /**
939         * @return {@link #location} (For resource issues, this will be 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.  For HTTP errors, will be "http." + the parameter name.)
940         */
941        public List<StringType> getLocation() { 
942          if (this.location == null)
943            this.location = new ArrayList<StringType>();
944          return this.location;
945        }
946
947        /**
948         * @return Returns a reference to <code>this</code> for easy method chaining
949         */
950        public OperationOutcomeIssueComponent setLocation(List<StringType> theLocation) { 
951          this.location = theLocation;
952          return this;
953        }
954
955        public boolean hasLocation() { 
956          if (this.location == null)
957            return false;
958          for (StringType item : this.location)
959            if (!item.isEmpty())
960              return true;
961          return false;
962        }
963
964        /**
965         * @return {@link #location} (For resource issues, this will be 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.  For HTTP errors, will be "http." + the parameter name.)
966         */
967        public StringType addLocationElement() {//2 
968          StringType t = new StringType();
969          if (this.location == null)
970            this.location = new ArrayList<StringType>();
971          this.location.add(t);
972          return t;
973        }
974
975        /**
976         * @param value {@link #location} (For resource issues, this will be 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.  For HTTP errors, will be "http." + the parameter name.)
977         */
978        public OperationOutcomeIssueComponent addLocation(String value) { //1
979          StringType t = new StringType();
980          t.setValue(value);
981          if (this.location == null)
982            this.location = new ArrayList<StringType>();
983          this.location.add(t);
984          return this;
985        }
986
987        /**
988         * @param value {@link #location} (For resource issues, this will be 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.  For HTTP errors, will be "http." + the parameter name.)
989         */
990        public boolean hasLocation(String value) { 
991          if (this.location == null)
992            return false;
993          for (StringType v : this.location)
994            if (v.getValue().equals(value)) // string
995              return true;
996          return false;
997        }
998
999        /**
1000         * @return {@link #expression} (A simple FHIRPath 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.)
1001         */
1002        public List<StringType> getExpression() { 
1003          if (this.expression == null)
1004            this.expression = new ArrayList<StringType>();
1005          return this.expression;
1006        }
1007
1008        /**
1009         * @return Returns a reference to <code>this</code> for easy method chaining
1010         */
1011        public OperationOutcomeIssueComponent setExpression(List<StringType> theExpression) { 
1012          this.expression = theExpression;
1013          return this;
1014        }
1015
1016        public boolean hasExpression() { 
1017          if (this.expression == null)
1018            return false;
1019          for (StringType item : this.expression)
1020            if (!item.isEmpty())
1021              return true;
1022          return false;
1023        }
1024
1025        /**
1026         * @return {@link #expression} (A simple FHIRPath 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.)
1027         */
1028        public StringType addExpressionElement() {//2 
1029          StringType t = new StringType();
1030          if (this.expression == null)
1031            this.expression = new ArrayList<StringType>();
1032          this.expression.add(t);
1033          return t;
1034        }
1035
1036        /**
1037         * @param value {@link #expression} (A simple FHIRPath 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.)
1038         */
1039        public OperationOutcomeIssueComponent addExpression(String value) { //1
1040          StringType t = new StringType();
1041          t.setValue(value);
1042          if (this.expression == null)
1043            this.expression = new ArrayList<StringType>();
1044          this.expression.add(t);
1045          return this;
1046        }
1047
1048        /**
1049         * @param value {@link #expression} (A simple FHIRPath 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.)
1050         */
1051        public boolean hasExpression(String value) { 
1052          if (this.expression == null)
1053            return false;
1054          for (StringType v : this.expression)
1055            if (v.getValue().equals(value)) // string
1056              return true;
1057          return false;
1058        }
1059
1060        protected void listChildren(List<Property> children) {
1061          super.listChildren(children);
1062          children.add(new Property("severity", "code", "Indicates whether the issue indicates a variation from successful processing.", 0, 1, severity));
1063          children.add(new Property("code", "code", "Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.", 0, 1, code));
1064          children.add(new Property("details", "CodeableConcept", "Additional details about the error. This may be a text description of the error, or a system code that identifies the error.", 0, 1, details));
1065          children.add(new Property("diagnostics", "string", "Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.", 0, 1, diagnostics));
1066          children.add(new Property("location", "string", "For resource issues, this will be 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.  For HTTP errors, will be \"http.\" + the parameter name.", 0, java.lang.Integer.MAX_VALUE, location));
1067          children.add(new Property("expression", "string", "A simple FHIRPath 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.", 0, java.lang.Integer.MAX_VALUE, expression));
1068        }
1069
1070        @Override
1071        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1072          switch (_hash) {
1073          case 1478300413: /*severity*/  return new Property("severity", "code", "Indicates whether the issue indicates a variation from successful processing.", 0, 1, severity);
1074          case 3059181: /*code*/  return new Property("code", "code", "Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.", 0, 1, code);
1075          case 1557721666: /*details*/  return new Property("details", "CodeableConcept", "Additional details about the error. This may be a text description of the error, or a system code that identifies the error.", 0, 1, details);
1076          case -740386388: /*diagnostics*/  return new Property("diagnostics", "string", "Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.", 0, 1, diagnostics);
1077          case 1901043637: /*location*/  return new Property("location", "string", "For resource issues, this will be 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.  For HTTP errors, will be \"http.\" + the parameter name.", 0, java.lang.Integer.MAX_VALUE, location);
1078          case -1795452264: /*expression*/  return new Property("expression", "string", "A simple FHIRPath 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.", 0, java.lang.Integer.MAX_VALUE, expression);
1079          default: return super.getNamedProperty(_hash, _name, _checkValid);
1080          }
1081
1082        }
1083
1084      @Override
1085      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1086        switch (hash) {
1087        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<IssueSeverity>
1088        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<IssueType>
1089        case 1557721666: /*details*/ return this.details == null ? new Base[0] : new Base[] {this.details}; // CodeableConcept
1090        case -740386388: /*diagnostics*/ return this.diagnostics == null ? new Base[0] : new Base[] {this.diagnostics}; // StringType
1091        case 1901043637: /*location*/ return this.location == null ? new Base[0] : this.location.toArray(new Base[this.location.size()]); // StringType
1092        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : this.expression.toArray(new Base[this.expression.size()]); // StringType
1093        default: return super.getProperty(hash, name, checkValid);
1094        }
1095
1096      }
1097
1098      @Override
1099      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1100        switch (hash) {
1101        case 1478300413: // severity
1102          value = new IssueSeverityEnumFactory().fromType(castToCode(value));
1103          this.severity = (Enumeration) value; // Enumeration<IssueSeverity>
1104          return value;
1105        case 3059181: // code
1106          value = new IssueTypeEnumFactory().fromType(castToCode(value));
1107          this.code = (Enumeration) value; // Enumeration<IssueType>
1108          return value;
1109        case 1557721666: // details
1110          this.details = castToCodeableConcept(value); // CodeableConcept
1111          return value;
1112        case -740386388: // diagnostics
1113          this.diagnostics = castToString(value); // StringType
1114          return value;
1115        case 1901043637: // location
1116          this.getLocation().add(castToString(value)); // StringType
1117          return value;
1118        case -1795452264: // expression
1119          this.getExpression().add(castToString(value)); // StringType
1120          return value;
1121        default: return super.setProperty(hash, name, value);
1122        }
1123
1124      }
1125
1126      @Override
1127      public Base setProperty(String name, Base value) throws FHIRException {
1128        if (name.equals("severity")) {
1129          value = new IssueSeverityEnumFactory().fromType(castToCode(value));
1130          this.severity = (Enumeration) value; // Enumeration<IssueSeverity>
1131        } else if (name.equals("code")) {
1132          value = new IssueTypeEnumFactory().fromType(castToCode(value));
1133          this.code = (Enumeration) value; // Enumeration<IssueType>
1134        } else if (name.equals("details")) {
1135          this.details = castToCodeableConcept(value); // CodeableConcept
1136        } else if (name.equals("diagnostics")) {
1137          this.diagnostics = castToString(value); // StringType
1138        } else if (name.equals("location")) {
1139          this.getLocation().add(castToString(value));
1140        } else if (name.equals("expression")) {
1141          this.getExpression().add(castToString(value));
1142        } else
1143          return super.setProperty(name, value);
1144        return value;
1145      }
1146
1147      @Override
1148      public Base makeProperty(int hash, String name) throws FHIRException {
1149        switch (hash) {
1150        case 1478300413:  return getSeverityElement();
1151        case 3059181:  return getCodeElement();
1152        case 1557721666:  return getDetails(); 
1153        case -740386388:  return getDiagnosticsElement();
1154        case 1901043637:  return addLocationElement();
1155        case -1795452264:  return addExpressionElement();
1156        default: return super.makeProperty(hash, name);
1157        }
1158
1159      }
1160
1161      @Override
1162      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1163        switch (hash) {
1164        case 1478300413: /*severity*/ return new String[] {"code"};
1165        case 3059181: /*code*/ return new String[] {"code"};
1166        case 1557721666: /*details*/ return new String[] {"CodeableConcept"};
1167        case -740386388: /*diagnostics*/ return new String[] {"string"};
1168        case 1901043637: /*location*/ return new String[] {"string"};
1169        case -1795452264: /*expression*/ return new String[] {"string"};
1170        default: return super.getTypesForProperty(hash, name);
1171        }
1172
1173      }
1174
1175      @Override
1176      public Base addChild(String name) throws FHIRException {
1177        if (name.equals("severity")) {
1178          throw new FHIRException("Cannot call addChild on a singleton property OperationOutcome.severity");
1179        }
1180        else if (name.equals("code")) {
1181          throw new FHIRException("Cannot call addChild on a singleton property OperationOutcome.code");
1182        }
1183        else if (name.equals("details")) {
1184          this.details = new CodeableConcept();
1185          return this.details;
1186        }
1187        else if (name.equals("diagnostics")) {
1188          throw new FHIRException("Cannot call addChild on a singleton property OperationOutcome.diagnostics");
1189        }
1190        else if (name.equals("location")) {
1191          throw new FHIRException("Cannot call addChild on a singleton property OperationOutcome.location");
1192        }
1193        else if (name.equals("expression")) {
1194          throw new FHIRException("Cannot call addChild on a singleton property OperationOutcome.expression");
1195        }
1196        else
1197          return super.addChild(name);
1198      }
1199
1200      public OperationOutcomeIssueComponent copy() {
1201        OperationOutcomeIssueComponent dst = new OperationOutcomeIssueComponent();
1202        copyValues(dst);
1203        dst.severity = severity == null ? null : severity.copy();
1204        dst.code = code == null ? null : code.copy();
1205        dst.details = details == null ? null : details.copy();
1206        dst.diagnostics = diagnostics == null ? null : diagnostics.copy();
1207        if (location != null) {
1208          dst.location = new ArrayList<StringType>();
1209          for (StringType i : location)
1210            dst.location.add(i.copy());
1211        };
1212        if (expression != null) {
1213          dst.expression = new ArrayList<StringType>();
1214          for (StringType i : expression)
1215            dst.expression.add(i.copy());
1216        };
1217        return dst;
1218      }
1219
1220      @Override
1221      public boolean equalsDeep(Base other_) {
1222        if (!super.equalsDeep(other_))
1223          return false;
1224        if (!(other_ instanceof OperationOutcomeIssueComponent))
1225          return false;
1226        OperationOutcomeIssueComponent o = (OperationOutcomeIssueComponent) other_;
1227        return compareDeep(severity, o.severity, true) && compareDeep(code, o.code, true) && compareDeep(details, o.details, true)
1228           && compareDeep(diagnostics, o.diagnostics, true) && compareDeep(location, o.location, true) && compareDeep(expression, o.expression, true)
1229          ;
1230      }
1231
1232      @Override
1233      public boolean equalsShallow(Base other_) {
1234        if (!super.equalsShallow(other_))
1235          return false;
1236        if (!(other_ instanceof OperationOutcomeIssueComponent))
1237          return false;
1238        OperationOutcomeIssueComponent o = (OperationOutcomeIssueComponent) other_;
1239        return compareValues(severity, o.severity, true) && compareValues(code, o.code, true) && compareValues(diagnostics, o.diagnostics, true)
1240           && compareValues(location, o.location, true) && compareValues(expression, o.expression, true);
1241      }
1242
1243      public boolean isEmpty() {
1244        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(severity, code, details
1245          , diagnostics, location, expression);
1246      }
1247
1248  public String fhirType() {
1249    return "OperationOutcome.issue";
1250
1251  }
1252
1253  }
1254
1255    /**
1256     * An error, warning or information message that results from a system action.
1257     */
1258    @Child(name = "issue", type = {}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1259    @Description(shortDefinition="A single issue associated with the action", formalDefinition="An error, warning or information message that results from a system action." )
1260    protected List<OperationOutcomeIssueComponent> issue;
1261
1262    private static final long serialVersionUID = -152150052L;
1263
1264  /**
1265   * Constructor
1266   */
1267    public OperationOutcome() {
1268      super();
1269    }
1270
1271    /**
1272     * @return {@link #issue} (An error, warning or information message that results from a system action.)
1273     */
1274    public List<OperationOutcomeIssueComponent> getIssue() { 
1275      if (this.issue == null)
1276        this.issue = new ArrayList<OperationOutcomeIssueComponent>();
1277      return this.issue;
1278    }
1279
1280    /**
1281     * @return Returns a reference to <code>this</code> for easy method chaining
1282     */
1283    public OperationOutcome setIssue(List<OperationOutcomeIssueComponent> theIssue) { 
1284      this.issue = theIssue;
1285      return this;
1286    }
1287
1288    public boolean hasIssue() { 
1289      if (this.issue == null)
1290        return false;
1291      for (OperationOutcomeIssueComponent item : this.issue)
1292        if (!item.isEmpty())
1293          return true;
1294      return false;
1295    }
1296
1297    public OperationOutcomeIssueComponent addIssue() { //3
1298      OperationOutcomeIssueComponent t = new OperationOutcomeIssueComponent();
1299      if (this.issue == null)
1300        this.issue = new ArrayList<OperationOutcomeIssueComponent>();
1301      this.issue.add(t);
1302      return t;
1303    }
1304
1305    public OperationOutcome addIssue(OperationOutcomeIssueComponent t) { //3
1306      if (t == null)
1307        return this;
1308      if (this.issue == null)
1309        this.issue = new ArrayList<OperationOutcomeIssueComponent>();
1310      this.issue.add(t);
1311      return this;
1312    }
1313
1314    /**
1315     * @return The first repetition of repeating field {@link #issue}, creating it if it does not already exist
1316     */
1317    public OperationOutcomeIssueComponent getIssueFirstRep() { 
1318      if (getIssue().isEmpty()) {
1319        addIssue();
1320      }
1321      return getIssue().get(0);
1322    }
1323
1324      protected void listChildren(List<Property> children) {
1325        super.listChildren(children);
1326        children.add(new Property("issue", "", "An error, warning or information message that results from a system action.", 0, java.lang.Integer.MAX_VALUE, issue));
1327      }
1328
1329      @Override
1330      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1331        switch (_hash) {
1332        case 100509913: /*issue*/  return new Property("issue", "", "An error, warning or information message that results from a system action.", 0, java.lang.Integer.MAX_VALUE, issue);
1333        default: return super.getNamedProperty(_hash, _name, _checkValid);
1334        }
1335
1336      }
1337
1338      @Override
1339      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1340        switch (hash) {
1341        case 100509913: /*issue*/ return this.issue == null ? new Base[0] : this.issue.toArray(new Base[this.issue.size()]); // OperationOutcomeIssueComponent
1342        default: return super.getProperty(hash, name, checkValid);
1343        }
1344
1345      }
1346
1347      @Override
1348      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1349        switch (hash) {
1350        case 100509913: // issue
1351          this.getIssue().add((OperationOutcomeIssueComponent) value); // OperationOutcomeIssueComponent
1352          return value;
1353        default: return super.setProperty(hash, name, value);
1354        }
1355
1356      }
1357
1358      @Override
1359      public Base setProperty(String name, Base value) throws FHIRException {
1360        if (name.equals("issue")) {
1361          this.getIssue().add((OperationOutcomeIssueComponent) value);
1362        } else
1363          return super.setProperty(name, value);
1364        return value;
1365      }
1366
1367      @Override
1368      public Base makeProperty(int hash, String name) throws FHIRException {
1369        switch (hash) {
1370        case 100509913:  return addIssue(); 
1371        default: return super.makeProperty(hash, name);
1372        }
1373
1374      }
1375
1376      @Override
1377      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1378        switch (hash) {
1379        case 100509913: /*issue*/ return new String[] {};
1380        default: return super.getTypesForProperty(hash, name);
1381        }
1382
1383      }
1384
1385      @Override
1386      public Base addChild(String name) throws FHIRException {
1387        if (name.equals("issue")) {
1388          return addIssue();
1389        }
1390        else
1391          return super.addChild(name);
1392      }
1393
1394  public String fhirType() {
1395    return "OperationOutcome";
1396
1397  }
1398
1399      public OperationOutcome copy() {
1400        OperationOutcome dst = new OperationOutcome();
1401        copyValues(dst);
1402        if (issue != null) {
1403          dst.issue = new ArrayList<OperationOutcomeIssueComponent>();
1404          for (OperationOutcomeIssueComponent i : issue)
1405            dst.issue.add(i.copy());
1406        };
1407        return dst;
1408      }
1409
1410      protected OperationOutcome typedCopy() {
1411        return copy();
1412      }
1413
1414      @Override
1415      public boolean equalsDeep(Base other_) {
1416        if (!super.equalsDeep(other_))
1417          return false;
1418        if (!(other_ instanceof OperationOutcome))
1419          return false;
1420        OperationOutcome o = (OperationOutcome) other_;
1421        return compareDeep(issue, o.issue, true);
1422      }
1423
1424      @Override
1425      public boolean equalsShallow(Base other_) {
1426        if (!super.equalsShallow(other_))
1427          return false;
1428        if (!(other_ instanceof OperationOutcome))
1429          return false;
1430        OperationOutcome o = (OperationOutcome) other_;
1431        return true;
1432      }
1433
1434      public boolean isEmpty() {
1435        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(issue);
1436      }
1437
1438  @Override
1439  public ResourceType getResourceType() {
1440    return ResourceType.OperationOutcome;
1441   }
1442
1443
1444}