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