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 Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.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/StructureDefinition/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 or header 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 interaction, operation, 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         * Multiple matching records were found when the operation required only one match.
234         */
235        MULTIPLEMATCHES, 
236        /**
237         * 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.
238         */
239        NOTFOUND, 
240        /**
241         * The reference pointed to content (usually a resource) that has been deleted.
242         */
243        DELETED, 
244        /**
245         * Provided content is too long (typically, this is a denial of service protection type of error).
246         */
247        TOOLONG, 
248        /**
249         * The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code.
250         */
251        CODEINVALID, 
252        /**
253         * An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized.
254         */
255        EXTENSION, 
256        /**
257         * The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT.
258         */
259        TOOCOSTLY, 
260        /**
261         * The content/operation failed to pass some business rule and so could not proceed.
262         */
263        BUSINESSRULE, 
264        /**
265         * 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 409 error, but this code may be used where the conflict is discovered further into the application architecture.).
266         */
267        CONFLICT, 
268        /**
269         * Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved.
270         */
271        TRANSIENT, 
272        /**
273         * A resource/record locking failure (usually in an underlying database).
274         */
275        LOCKERROR, 
276        /**
277         * The persistent store is unavailable; e.g. the database is down for maintenance or similar action, and the interaction or operation cannot be processed.
278         */
279        NOSTORE, 
280        /**
281         * y.
282         */
283        EXCEPTION, 
284        /**
285         * An internal timeout has occurred.
286         */
287        TIMEOUT, 
288        /**
289         * Not all data sources typically accessed could be reached or responded in time, so the returned information might not be complete (applies to search interactions and some operations).
290         */
291        INCOMPLETE, 
292        /**
293         * The system is not prepared to handle this request due to load management.
294         */
295        THROTTLED, 
296        /**
297         * 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.).
298         */
299        INFORMATIONAL, 
300        /**
301         * added to help the parsers with the generic types
302         */
303        NULL;
304        public static IssueType fromCode(String codeString) throws FHIRException {
305            if (codeString == null || "".equals(codeString))
306                return null;
307        if ("invalid".equals(codeString))
308          return INVALID;
309        if ("structure".equals(codeString))
310          return STRUCTURE;
311        if ("required".equals(codeString))
312          return REQUIRED;
313        if ("value".equals(codeString))
314          return VALUE;
315        if ("invariant".equals(codeString))
316          return INVARIANT;
317        if ("security".equals(codeString))
318          return SECURITY;
319        if ("login".equals(codeString))
320          return LOGIN;
321        if ("unknown".equals(codeString))
322          return UNKNOWN;
323        if ("expired".equals(codeString))
324          return EXPIRED;
325        if ("forbidden".equals(codeString))
326          return FORBIDDEN;
327        if ("suppressed".equals(codeString))
328          return SUPPRESSED;
329        if ("processing".equals(codeString))
330          return PROCESSING;
331        if ("not-supported".equals(codeString))
332          return NOTSUPPORTED;
333        if ("duplicate".equals(codeString))
334          return DUPLICATE;
335        if ("multiple-matches".equals(codeString))
336          return MULTIPLEMATCHES;
337        if ("not-found".equals(codeString))
338          return NOTFOUND;
339        if ("deleted".equals(codeString))
340          return DELETED;
341        if ("too-long".equals(codeString))
342          return TOOLONG;
343        if ("code-invalid".equals(codeString))
344          return CODEINVALID;
345        if ("extension".equals(codeString))
346          return EXTENSION;
347        if ("too-costly".equals(codeString))
348          return TOOCOSTLY;
349        if ("business-rule".equals(codeString))
350          return BUSINESSRULE;
351        if ("conflict".equals(codeString))
352          return CONFLICT;
353        if ("transient".equals(codeString))
354          return TRANSIENT;
355        if ("lock-error".equals(codeString))
356          return LOCKERROR;
357        if ("no-store".equals(codeString))
358          return NOSTORE;
359        if ("exception".equals(codeString))
360          return EXCEPTION;
361        if ("timeout".equals(codeString))
362          return TIMEOUT;
363        if ("incomplete".equals(codeString))
364          return INCOMPLETE;
365        if ("throttled".equals(codeString))
366          return THROTTLED;
367        if ("informational".equals(codeString))
368          return INFORMATIONAL;
369        if (Configuration.isAcceptInvalidEnums())
370          return null;
371        else
372          throw new FHIRException("Unknown IssueType code '"+codeString+"'");
373        }
374        public String toCode() {
375          switch (this) {
376            case INVALID: return "invalid";
377            case STRUCTURE: return "structure";
378            case REQUIRED: return "required";
379            case VALUE: return "value";
380            case INVARIANT: return "invariant";
381            case SECURITY: return "security";
382            case LOGIN: return "login";
383            case UNKNOWN: return "unknown";
384            case EXPIRED: return "expired";
385            case FORBIDDEN: return "forbidden";
386            case SUPPRESSED: return "suppressed";
387            case PROCESSING: return "processing";
388            case NOTSUPPORTED: return "not-supported";
389            case DUPLICATE: return "duplicate";
390            case MULTIPLEMATCHES: return "multiple-matches";
391            case NOTFOUND: return "not-found";
392            case DELETED: return "deleted";
393            case TOOLONG: return "too-long";
394            case CODEINVALID: return "code-invalid";
395            case EXTENSION: return "extension";
396            case TOOCOSTLY: return "too-costly";
397            case BUSINESSRULE: return "business-rule";
398            case CONFLICT: return "conflict";
399            case TRANSIENT: return "transient";
400            case LOCKERROR: return "lock-error";
401            case NOSTORE: return "no-store";
402            case EXCEPTION: return "exception";
403            case TIMEOUT: return "timeout";
404            case INCOMPLETE: return "incomplete";
405            case THROTTLED: return "throttled";
406            case INFORMATIONAL: return "informational";
407            default: return "?";
408          }
409        }
410        public String getSystem() {
411          switch (this) {
412            case INVALID: return "http://hl7.org/fhir/issue-type";
413            case STRUCTURE: return "http://hl7.org/fhir/issue-type";
414            case REQUIRED: return "http://hl7.org/fhir/issue-type";
415            case VALUE: return "http://hl7.org/fhir/issue-type";
416            case INVARIANT: return "http://hl7.org/fhir/issue-type";
417            case SECURITY: return "http://hl7.org/fhir/issue-type";
418            case LOGIN: return "http://hl7.org/fhir/issue-type";
419            case UNKNOWN: return "http://hl7.org/fhir/issue-type";
420            case EXPIRED: return "http://hl7.org/fhir/issue-type";
421            case FORBIDDEN: return "http://hl7.org/fhir/issue-type";
422            case SUPPRESSED: return "http://hl7.org/fhir/issue-type";
423            case PROCESSING: return "http://hl7.org/fhir/issue-type";
424            case NOTSUPPORTED: return "http://hl7.org/fhir/issue-type";
425            case DUPLICATE: return "http://hl7.org/fhir/issue-type";
426            case MULTIPLEMATCHES: return "http://hl7.org/fhir/issue-type";
427            case NOTFOUND: return "http://hl7.org/fhir/issue-type";
428            case DELETED: return "http://hl7.org/fhir/issue-type";
429            case TOOLONG: return "http://hl7.org/fhir/issue-type";
430            case CODEINVALID: return "http://hl7.org/fhir/issue-type";
431            case EXTENSION: return "http://hl7.org/fhir/issue-type";
432            case TOOCOSTLY: return "http://hl7.org/fhir/issue-type";
433            case BUSINESSRULE: return "http://hl7.org/fhir/issue-type";
434            case CONFLICT: return "http://hl7.org/fhir/issue-type";
435            case TRANSIENT: return "http://hl7.org/fhir/issue-type";
436            case LOCKERROR: return "http://hl7.org/fhir/issue-type";
437            case NOSTORE: return "http://hl7.org/fhir/issue-type";
438            case EXCEPTION: return "http://hl7.org/fhir/issue-type";
439            case TIMEOUT: return "http://hl7.org/fhir/issue-type";
440            case INCOMPLETE: return "http://hl7.org/fhir/issue-type";
441            case THROTTLED: return "http://hl7.org/fhir/issue-type";
442            case INFORMATIONAL: return "http://hl7.org/fhir/issue-type";
443            default: return "?";
444          }
445        }
446        public String getDefinition() {
447          switch (this) {
448            case INVALID: return "Content invalid against the specification or a profile.";
449            case STRUCTURE: return "A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax.";
450            case REQUIRED: return "A required element is missing.";
451            case VALUE: return "An element or header value is invalid.";
452            case INVARIANT: return "A content validation rule failed - e.g. a schematron rule.";
453            case SECURITY: return "An authentication/authorization/permissions issue of some kind.";
454            case LOGIN: return "The client needs to initiate an authentication process.";
455            case UNKNOWN: return "The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable).";
456            case EXPIRED: return "User session expired; a login may be required.";
457            case FORBIDDEN: return "The user does not have the rights to perform this action.";
458            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.";
459            case PROCESSING: return "Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged.";
460            case NOTSUPPORTED: return "The interaction, operation, resource or profile is not supported.";
461            case DUPLICATE: return "An attempt was made to create a duplicate record.";
462            case MULTIPLEMATCHES: return "Multiple matching records were found when the operation required only one match.";
463            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.";
464            case DELETED: return "The reference pointed to content (usually a resource) that has been deleted.";
465            case TOOLONG: return "Provided content is too long (typically, this is a denial of service protection type of error).";
466            case CODEINVALID: return "The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code.";
467            case EXTENSION: return "An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized.";
468            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.";
469            case BUSINESSRULE: return "The content/operation failed to pass some business rule and so could not proceed.";
470            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 409 error, but this code may be used where the conflict is discovered further into the application architecture.).";
471            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.";
472            case LOCKERROR: return "A resource/record locking failure (usually in an underlying database).";
473            case NOSTORE: return "The persistent store is unavailable; e.g. the database is down for maintenance or similar action, and the interaction or operation cannot be processed.";
474            case EXCEPTION: return "y.";
475            case TIMEOUT: return "An internal timeout has occurred.";
476            case INCOMPLETE: return "Not all data sources typically accessed could be reached or responded in time, so the returned information might not be complete (applies to search interactions and some operations).";
477            case THROTTLED: return "The system is not prepared to handle this request due to load management.";
478            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.).";
479            default: return "?";
480          }
481        }
482        public String getDisplay() {
483          switch (this) {
484            case INVALID: return "Invalid Content";
485            case STRUCTURE: return "Structural Issue";
486            case REQUIRED: return "Required element missing";
487            case VALUE: return "Element value invalid";
488            case INVARIANT: return "Validation rule failed";
489            case SECURITY: return "Security Problem";
490            case LOGIN: return "Login Required";
491            case UNKNOWN: return "Unknown User";
492            case EXPIRED: return "Session Expired";
493            case FORBIDDEN: return "Forbidden";
494            case SUPPRESSED: return "Information  Suppressed";
495            case PROCESSING: return "Processing Failure";
496            case NOTSUPPORTED: return "Content not supported";
497            case DUPLICATE: return "Duplicate";
498            case MULTIPLEMATCHES: return "Multiple Matches";
499            case NOTFOUND: return "Not Found";
500            case DELETED: return "Deleted";
501            case TOOLONG: return "Content Too Long";
502            case CODEINVALID: return "Invalid Code";
503            case EXTENSION: return "Unacceptable Extension";
504            case TOOCOSTLY: return "Operation Too Costly";
505            case BUSINESSRULE: return "Business Rule Violation";
506            case CONFLICT: return "Edit Version Conflict";
507            case TRANSIENT: return "Transient Issue";
508            case LOCKERROR: return "Lock Error";
509            case NOSTORE: return "No Store Available";
510            case EXCEPTION: return "Exception";
511            case TIMEOUT: return "Timeout";
512            case INCOMPLETE: return "Incomplete Results";
513            case THROTTLED: return "Throttled";
514            case INFORMATIONAL: return "Informational Note";
515            default: return "?";
516          }
517        }
518    }
519
520  public static class IssueTypeEnumFactory implements EnumFactory<IssueType> {
521    public IssueType fromCode(String codeString) throws IllegalArgumentException {
522      if (codeString == null || "".equals(codeString))
523            if (codeString == null || "".equals(codeString))
524                return null;
525        if ("invalid".equals(codeString))
526          return IssueType.INVALID;
527        if ("structure".equals(codeString))
528          return IssueType.STRUCTURE;
529        if ("required".equals(codeString))
530          return IssueType.REQUIRED;
531        if ("value".equals(codeString))
532          return IssueType.VALUE;
533        if ("invariant".equals(codeString))
534          return IssueType.INVARIANT;
535        if ("security".equals(codeString))
536          return IssueType.SECURITY;
537        if ("login".equals(codeString))
538          return IssueType.LOGIN;
539        if ("unknown".equals(codeString))
540          return IssueType.UNKNOWN;
541        if ("expired".equals(codeString))
542          return IssueType.EXPIRED;
543        if ("forbidden".equals(codeString))
544          return IssueType.FORBIDDEN;
545        if ("suppressed".equals(codeString))
546          return IssueType.SUPPRESSED;
547        if ("processing".equals(codeString))
548          return IssueType.PROCESSING;
549        if ("not-supported".equals(codeString))
550          return IssueType.NOTSUPPORTED;
551        if ("duplicate".equals(codeString))
552          return IssueType.DUPLICATE;
553        if ("multiple-matches".equals(codeString))
554          return IssueType.MULTIPLEMATCHES;
555        if ("not-found".equals(codeString))
556          return IssueType.NOTFOUND;
557        if ("deleted".equals(codeString))
558          return IssueType.DELETED;
559        if ("too-long".equals(codeString))
560          return IssueType.TOOLONG;
561        if ("code-invalid".equals(codeString))
562          return IssueType.CODEINVALID;
563        if ("extension".equals(codeString))
564          return IssueType.EXTENSION;
565        if ("too-costly".equals(codeString))
566          return IssueType.TOOCOSTLY;
567        if ("business-rule".equals(codeString))
568          return IssueType.BUSINESSRULE;
569        if ("conflict".equals(codeString))
570          return IssueType.CONFLICT;
571        if ("transient".equals(codeString))
572          return IssueType.TRANSIENT;
573        if ("lock-error".equals(codeString))
574          return IssueType.LOCKERROR;
575        if ("no-store".equals(codeString))
576          return IssueType.NOSTORE;
577        if ("exception".equals(codeString))
578          return IssueType.EXCEPTION;
579        if ("timeout".equals(codeString))
580          return IssueType.TIMEOUT;
581        if ("incomplete".equals(codeString))
582          return IssueType.INCOMPLETE;
583        if ("throttled".equals(codeString))
584          return IssueType.THROTTLED;
585        if ("informational".equals(codeString))
586          return IssueType.INFORMATIONAL;
587        throw new IllegalArgumentException("Unknown IssueType code '"+codeString+"'");
588        }
589        public Enumeration<IssueType> fromType(Base code) throws FHIRException {
590          if (code == null)
591            return null;
592          if (code.isEmpty())
593            return new Enumeration<IssueType>(this);
594          String codeString = ((PrimitiveType) code).asStringValue();
595          if (codeString == null || "".equals(codeString))
596            return null;
597        if ("invalid".equals(codeString))
598          return new Enumeration<IssueType>(this, IssueType.INVALID);
599        if ("structure".equals(codeString))
600          return new Enumeration<IssueType>(this, IssueType.STRUCTURE);
601        if ("required".equals(codeString))
602          return new Enumeration<IssueType>(this, IssueType.REQUIRED);
603        if ("value".equals(codeString))
604          return new Enumeration<IssueType>(this, IssueType.VALUE);
605        if ("invariant".equals(codeString))
606          return new Enumeration<IssueType>(this, IssueType.INVARIANT);
607        if ("security".equals(codeString))
608          return new Enumeration<IssueType>(this, IssueType.SECURITY);
609        if ("login".equals(codeString))
610          return new Enumeration<IssueType>(this, IssueType.LOGIN);
611        if ("unknown".equals(codeString))
612          return new Enumeration<IssueType>(this, IssueType.UNKNOWN);
613        if ("expired".equals(codeString))
614          return new Enumeration<IssueType>(this, IssueType.EXPIRED);
615        if ("forbidden".equals(codeString))
616          return new Enumeration<IssueType>(this, IssueType.FORBIDDEN);
617        if ("suppressed".equals(codeString))
618          return new Enumeration<IssueType>(this, IssueType.SUPPRESSED);
619        if ("processing".equals(codeString))
620          return new Enumeration<IssueType>(this, IssueType.PROCESSING);
621        if ("not-supported".equals(codeString))
622          return new Enumeration<IssueType>(this, IssueType.NOTSUPPORTED);
623        if ("duplicate".equals(codeString))
624          return new Enumeration<IssueType>(this, IssueType.DUPLICATE);
625        if ("multiple-matches".equals(codeString))
626          return new Enumeration<IssueType>(this, IssueType.MULTIPLEMATCHES);
627        if ("not-found".equals(codeString))
628          return new Enumeration<IssueType>(this, IssueType.NOTFOUND);
629        if ("deleted".equals(codeString))
630          return new Enumeration<IssueType>(this, IssueType.DELETED);
631        if ("too-long".equals(codeString))
632          return new Enumeration<IssueType>(this, IssueType.TOOLONG);
633        if ("code-invalid".equals(codeString))
634          return new Enumeration<IssueType>(this, IssueType.CODEINVALID);
635        if ("extension".equals(codeString))
636          return new Enumeration<IssueType>(this, IssueType.EXTENSION);
637        if ("too-costly".equals(codeString))
638          return new Enumeration<IssueType>(this, IssueType.TOOCOSTLY);
639        if ("business-rule".equals(codeString))
640          return new Enumeration<IssueType>(this, IssueType.BUSINESSRULE);
641        if ("conflict".equals(codeString))
642          return new Enumeration<IssueType>(this, IssueType.CONFLICT);
643        if ("transient".equals(codeString))
644          return new Enumeration<IssueType>(this, IssueType.TRANSIENT);
645        if ("lock-error".equals(codeString))
646          return new Enumeration<IssueType>(this, IssueType.LOCKERROR);
647        if ("no-store".equals(codeString))
648          return new Enumeration<IssueType>(this, IssueType.NOSTORE);
649        if ("exception".equals(codeString))
650          return new Enumeration<IssueType>(this, IssueType.EXCEPTION);
651        if ("timeout".equals(codeString))
652          return new Enumeration<IssueType>(this, IssueType.TIMEOUT);
653        if ("incomplete".equals(codeString))
654          return new Enumeration<IssueType>(this, IssueType.INCOMPLETE);
655        if ("throttled".equals(codeString))
656          return new Enumeration<IssueType>(this, IssueType.THROTTLED);
657        if ("informational".equals(codeString))
658          return new Enumeration<IssueType>(this, IssueType.INFORMATIONAL);
659        throw new FHIRException("Unknown IssueType code '"+codeString+"'");
660        }
661    public String toCode(IssueType code) {
662      if (code == IssueType.INVALID)
663        return "invalid";
664      if (code == IssueType.STRUCTURE)
665        return "structure";
666      if (code == IssueType.REQUIRED)
667        return "required";
668      if (code == IssueType.VALUE)
669        return "value";
670      if (code == IssueType.INVARIANT)
671        return "invariant";
672      if (code == IssueType.SECURITY)
673        return "security";
674      if (code == IssueType.LOGIN)
675        return "login";
676      if (code == IssueType.UNKNOWN)
677        return "unknown";
678      if (code == IssueType.EXPIRED)
679        return "expired";
680      if (code == IssueType.FORBIDDEN)
681        return "forbidden";
682      if (code == IssueType.SUPPRESSED)
683        return "suppressed";
684      if (code == IssueType.PROCESSING)
685        return "processing";
686      if (code == IssueType.NOTSUPPORTED)
687        return "not-supported";
688      if (code == IssueType.DUPLICATE)
689        return "duplicate";
690      if (code == IssueType.MULTIPLEMATCHES)
691        return "multiple-matches";
692      if (code == IssueType.NOTFOUND)
693        return "not-found";
694      if (code == IssueType.DELETED)
695        return "deleted";
696      if (code == IssueType.TOOLONG)
697        return "too-long";
698      if (code == IssueType.CODEINVALID)
699        return "code-invalid";
700      if (code == IssueType.EXTENSION)
701        return "extension";
702      if (code == IssueType.TOOCOSTLY)
703        return "too-costly";
704      if (code == IssueType.BUSINESSRULE)
705        return "business-rule";
706      if (code == IssueType.CONFLICT)
707        return "conflict";
708      if (code == IssueType.TRANSIENT)
709        return "transient";
710      if (code == IssueType.LOCKERROR)
711        return "lock-error";
712      if (code == IssueType.NOSTORE)
713        return "no-store";
714      if (code == IssueType.EXCEPTION)
715        return "exception";
716      if (code == IssueType.TIMEOUT)
717        return "timeout";
718      if (code == IssueType.INCOMPLETE)
719        return "incomplete";
720      if (code == IssueType.THROTTLED)
721        return "throttled";
722      if (code == IssueType.INFORMATIONAL)
723        return "informational";
724      return "?";
725      }
726    public String toSystem(IssueType code) {
727      return code.getSystem();
728      }
729    }
730
731    @Block()
732    public static class OperationOutcomeIssueComponent extends BackboneElement implements IBaseBackboneElement {
733        /**
734         * Indicates whether the issue indicates a variation from successful processing.
735         */
736        @Child(name = "severity", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
737        @Description(shortDefinition="fatal | error | warning | information", formalDefinition="Indicates whether the issue indicates a variation from successful processing." )
738        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/issue-severity")
739        protected Enumeration<IssueSeverity> severity;
740
741        /**
742         * 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.
743         */
744        @Child(name = "code", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
745        @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." )
746        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/issue-type")
747        protected Enumeration<IssueType> code;
748
749        /**
750         * Additional details about the error. This may be a text description of the error, or a system code that identifies the error.
751         */
752        @Child(name = "details", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
753        @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." )
754        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/operation-outcome")
755        protected CodeableConcept details;
756
757        /**
758         * 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.
759         */
760        @Child(name = "diagnostics", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
761        @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." )
762        protected StringType diagnostics;
763
764        /**
765         * This element is depracated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse. 
766
767For 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.
768         */
769        @Child(name = "location", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
770        @Description(shortDefinition="Deprecated: Path of element(s) related to issue", formalDefinition="This element is depracated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse. \n\nFor 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." )
771        protected List<StringType> location;
772
773        /**
774         * 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.
775         */
776        @Child(name = "expression", type = {StringType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
777        @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." )
778        protected List<StringType> expression;
779
780        private static final long serialVersionUID = -1681095438L;
781
782    /**
783     * Constructor
784     */
785      public OperationOutcomeIssueComponent() {
786        super();
787      }
788
789    /**
790     * Constructor
791     */
792      public OperationOutcomeIssueComponent(Enumeration<IssueSeverity> severity, Enumeration<IssueType> code) {
793        super();
794        this.severity = severity;
795        this.code = code;
796      }
797
798        /**
799         * @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
800         */
801        public Enumeration<IssueSeverity> getSeverityElement() { 
802          if (this.severity == null)
803            if (Configuration.errorOnAutoCreate())
804              throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.severity");
805            else if (Configuration.doAutoCreate())
806              this.severity = new Enumeration<IssueSeverity>(new IssueSeverityEnumFactory()); // bb
807          return this.severity;
808        }
809
810        public boolean hasSeverityElement() { 
811          return this.severity != null && !this.severity.isEmpty();
812        }
813
814        public boolean hasSeverity() { 
815          return this.severity != null && !this.severity.isEmpty();
816        }
817
818        /**
819         * @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
820         */
821        public OperationOutcomeIssueComponent setSeverityElement(Enumeration<IssueSeverity> value) { 
822          this.severity = value;
823          return this;
824        }
825
826        /**
827         * @return Indicates whether the issue indicates a variation from successful processing.
828         */
829        public IssueSeverity getSeverity() { 
830          return this.severity == null ? null : this.severity.getValue();
831        }
832
833        /**
834         * @param value Indicates whether the issue indicates a variation from successful processing.
835         */
836        public OperationOutcomeIssueComponent setSeverity(IssueSeverity value) { 
837            if (this.severity == null)
838              this.severity = new Enumeration<IssueSeverity>(new IssueSeverityEnumFactory());
839            this.severity.setValue(value);
840          return this;
841        }
842
843        /**
844         * @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
845         */
846        public Enumeration<IssueType> getCodeElement() { 
847          if (this.code == null)
848            if (Configuration.errorOnAutoCreate())
849              throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.code");
850            else if (Configuration.doAutoCreate())
851              this.code = new Enumeration<IssueType>(new IssueTypeEnumFactory()); // bb
852          return this.code;
853        }
854
855        public boolean hasCodeElement() { 
856          return this.code != null && !this.code.isEmpty();
857        }
858
859        public boolean hasCode() { 
860          return this.code != null && !this.code.isEmpty();
861        }
862
863        /**
864         * @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
865         */
866        public OperationOutcomeIssueComponent setCodeElement(Enumeration<IssueType> value) { 
867          this.code = value;
868          return this;
869        }
870
871        /**
872         * @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.
873         */
874        public IssueType getCode() { 
875          return this.code == null ? null : this.code.getValue();
876        }
877
878        /**
879         * @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.
880         */
881        public OperationOutcomeIssueComponent setCode(IssueType value) { 
882            if (this.code == null)
883              this.code = new Enumeration<IssueType>(new IssueTypeEnumFactory());
884            this.code.setValue(value);
885          return this;
886        }
887
888        /**
889         * @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.)
890         */
891        public CodeableConcept getDetails() { 
892          if (this.details == null)
893            if (Configuration.errorOnAutoCreate())
894              throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.details");
895            else if (Configuration.doAutoCreate())
896              this.details = new CodeableConcept(); // cc
897          return this.details;
898        }
899
900        public boolean hasDetails() { 
901          return this.details != null && !this.details.isEmpty();
902        }
903
904        /**
905         * @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.)
906         */
907        public OperationOutcomeIssueComponent setDetails(CodeableConcept value) { 
908          this.details = value;
909          return this;
910        }
911
912        /**
913         * @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
914         */
915        public StringType getDiagnosticsElement() { 
916          if (this.diagnostics == null)
917            if (Configuration.errorOnAutoCreate())
918              throw new Error("Attempt to auto-create OperationOutcomeIssueComponent.diagnostics");
919            else if (Configuration.doAutoCreate())
920              this.diagnostics = new StringType(); // bb
921          return this.diagnostics;
922        }
923
924        public boolean hasDiagnosticsElement() { 
925          return this.diagnostics != null && !this.diagnostics.isEmpty();
926        }
927
928        public boolean hasDiagnostics() { 
929          return this.diagnostics != null && !this.diagnostics.isEmpty();
930        }
931
932        /**
933         * @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
934         */
935        public OperationOutcomeIssueComponent setDiagnosticsElement(StringType value) { 
936          this.diagnostics = value;
937          return this;
938        }
939
940        /**
941         * @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.
942         */
943        public String getDiagnostics() { 
944          return this.diagnostics == null ? null : this.diagnostics.getValue();
945        }
946
947        /**
948         * @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.
949         */
950        public OperationOutcomeIssueComponent setDiagnostics(String value) { 
951          if (Utilities.noString(value))
952            this.diagnostics = null;
953          else {
954            if (this.diagnostics == null)
955              this.diagnostics = new StringType();
956            this.diagnostics.setValue(value);
957          }
958          return this;
959        }
960
961        /**
962         * @return {@link #location} (This element is depracated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse. 
963
964For 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.)
965         */
966        public List<StringType> getLocation() { 
967          if (this.location == null)
968            this.location = new ArrayList<StringType>();
969          return this.location;
970        }
971
972        /**
973         * @return Returns a reference to <code>this</code> for easy method chaining
974         */
975        public OperationOutcomeIssueComponent setLocation(List<StringType> theLocation) { 
976          this.location = theLocation;
977          return this;
978        }
979
980        public boolean hasLocation() { 
981          if (this.location == null)
982            return false;
983          for (StringType item : this.location)
984            if (!item.isEmpty())
985              return true;
986          return false;
987        }
988
989        /**
990         * @return {@link #location} (This element is depracated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse. 
991
992For 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.)
993         */
994        public StringType addLocationElement() {//2 
995          StringType t = new StringType();
996          if (this.location == null)
997            this.location = new ArrayList<StringType>();
998          this.location.add(t);
999          return t;
1000        }
1001
1002        /**
1003         * @param value {@link #location} (This element is depracated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse. 
1004
1005For 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.)
1006         */
1007        public OperationOutcomeIssueComponent addLocation(String value) { //1
1008          StringType t = new StringType();
1009          t.setValue(value);
1010          if (this.location == null)
1011            this.location = new ArrayList<StringType>();
1012          this.location.add(t);
1013          return this;
1014        }
1015
1016        /**
1017         * @param value {@link #location} (This element is depracated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse. 
1018
1019For 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.)
1020         */
1021        public boolean hasLocation(String value) { 
1022          if (this.location == null)
1023            return false;
1024          for (StringType v : this.location)
1025            if (v.getValue().equals(value)) // string
1026              return true;
1027          return false;
1028        }
1029
1030        /**
1031         * @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.)
1032         */
1033        public List<StringType> getExpression() { 
1034          if (this.expression == null)
1035            this.expression = new ArrayList<StringType>();
1036          return this.expression;
1037        }
1038
1039        /**
1040         * @return Returns a reference to <code>this</code> for easy method chaining
1041         */
1042        public OperationOutcomeIssueComponent setExpression(List<StringType> theExpression) { 
1043          this.expression = theExpression;
1044          return this;
1045        }
1046
1047        public boolean hasExpression() { 
1048          if (this.expression == null)
1049            return false;
1050          for (StringType item : this.expression)
1051            if (!item.isEmpty())
1052              return true;
1053          return false;
1054        }
1055
1056        /**
1057         * @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.)
1058         */
1059        public StringType addExpressionElement() {//2 
1060          StringType t = new StringType();
1061          if (this.expression == null)
1062            this.expression = new ArrayList<StringType>();
1063          this.expression.add(t);
1064          return t;
1065        }
1066
1067        /**
1068         * @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.)
1069         */
1070        public OperationOutcomeIssueComponent addExpression(String value) { //1
1071          StringType t = new StringType();
1072          t.setValue(value);
1073          if (this.expression == null)
1074            this.expression = new ArrayList<StringType>();
1075          this.expression.add(t);
1076          return this;
1077        }
1078
1079        /**
1080         * @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.)
1081         */
1082        public boolean hasExpression(String value) { 
1083          if (this.expression == null)
1084            return false;
1085          for (StringType v : this.expression)
1086            if (v.getValue().equals(value)) // string
1087              return true;
1088          return false;
1089        }
1090
1091        protected void listChildren(List<Property> children) {
1092          super.listChildren(children);
1093          children.add(new Property("severity", "code", "Indicates whether the issue indicates a variation from successful processing.", 0, 1, severity));
1094          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));
1095          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));
1096          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));
1097          children.add(new Property("location", "string", "This element is depracated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse. \n\nFor 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));
1098          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));
1099        }
1100
1101        @Override
1102        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1103          switch (_hash) {
1104          case 1478300413: /*severity*/  return new Property("severity", "code", "Indicates whether the issue indicates a variation from successful processing.", 0, 1, severity);
1105          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);
1106          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);
1107          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);
1108          case 1901043637: /*location*/  return new Property("location", "string", "This element is depracated because it is XML specific. It is replaced by issue.expression, which is format independent, and simpler to parse. \n\nFor 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);
1109          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);
1110          default: return super.getNamedProperty(_hash, _name, _checkValid);
1111          }
1112
1113        }
1114
1115      @Override
1116      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1117        switch (hash) {
1118        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<IssueSeverity>
1119        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // Enumeration<IssueType>
1120        case 1557721666: /*details*/ return this.details == null ? new Base[0] : new Base[] {this.details}; // CodeableConcept
1121        case -740386388: /*diagnostics*/ return this.diagnostics == null ? new Base[0] : new Base[] {this.diagnostics}; // StringType
1122        case 1901043637: /*location*/ return this.location == null ? new Base[0] : this.location.toArray(new Base[this.location.size()]); // StringType
1123        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : this.expression.toArray(new Base[this.expression.size()]); // StringType
1124        default: return super.getProperty(hash, name, checkValid);
1125        }
1126
1127      }
1128
1129      @Override
1130      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1131        switch (hash) {
1132        case 1478300413: // severity
1133          value = new IssueSeverityEnumFactory().fromType(castToCode(value));
1134          this.severity = (Enumeration) value; // Enumeration<IssueSeverity>
1135          return value;
1136        case 3059181: // code
1137          value = new IssueTypeEnumFactory().fromType(castToCode(value));
1138          this.code = (Enumeration) value; // Enumeration<IssueType>
1139          return value;
1140        case 1557721666: // details
1141          this.details = castToCodeableConcept(value); // CodeableConcept
1142          return value;
1143        case -740386388: // diagnostics
1144          this.diagnostics = castToString(value); // StringType
1145          return value;
1146        case 1901043637: // location
1147          this.getLocation().add(castToString(value)); // StringType
1148          return value;
1149        case -1795452264: // expression
1150          this.getExpression().add(castToString(value)); // StringType
1151          return value;
1152        default: return super.setProperty(hash, name, value);
1153        }
1154
1155      }
1156
1157      @Override
1158      public Base setProperty(String name, Base value) throws FHIRException {
1159        if (name.equals("severity")) {
1160          value = new IssueSeverityEnumFactory().fromType(castToCode(value));
1161          this.severity = (Enumeration) value; // Enumeration<IssueSeverity>
1162        } else if (name.equals("code")) {
1163          value = new IssueTypeEnumFactory().fromType(castToCode(value));
1164          this.code = (Enumeration) value; // Enumeration<IssueType>
1165        } else if (name.equals("details")) {
1166          this.details = castToCodeableConcept(value); // CodeableConcept
1167        } else if (name.equals("diagnostics")) {
1168          this.diagnostics = castToString(value); // StringType
1169        } else if (name.equals("location")) {
1170          this.getLocation().add(castToString(value));
1171        } else if (name.equals("expression")) {
1172          this.getExpression().add(castToString(value));
1173        } else
1174          return super.setProperty(name, value);
1175        return value;
1176      }
1177
1178      @Override
1179      public Base makeProperty(int hash, String name) throws FHIRException {
1180        switch (hash) {
1181        case 1478300413:  return getSeverityElement();
1182        case 3059181:  return getCodeElement();
1183        case 1557721666:  return getDetails(); 
1184        case -740386388:  return getDiagnosticsElement();
1185        case 1901043637:  return addLocationElement();
1186        case -1795452264:  return addExpressionElement();
1187        default: return super.makeProperty(hash, name);
1188        }
1189
1190      }
1191
1192      @Override
1193      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1194        switch (hash) {
1195        case 1478300413: /*severity*/ return new String[] {"code"};
1196        case 3059181: /*code*/ return new String[] {"code"};
1197        case 1557721666: /*details*/ return new String[] {"CodeableConcept"};
1198        case -740386388: /*diagnostics*/ return new String[] {"string"};
1199        case 1901043637: /*location*/ return new String[] {"string"};
1200        case -1795452264: /*expression*/ return new String[] {"string"};
1201        default: return super.getTypesForProperty(hash, name);
1202        }
1203
1204      }
1205
1206      @Override
1207      public Base addChild(String name) throws FHIRException {
1208        if (name.equals("severity")) {
1209          throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.severity");
1210        }
1211        else if (name.equals("code")) {
1212          throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.code");
1213        }
1214        else if (name.equals("details")) {
1215          this.details = new CodeableConcept();
1216          return this.details;
1217        }
1218        else if (name.equals("diagnostics")) {
1219          throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.diagnostics");
1220        }
1221        else if (name.equals("location")) {
1222          throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.location");
1223        }
1224        else if (name.equals("expression")) {
1225          throw new FHIRException("Cannot call addChild on a primitive type OperationOutcome.expression");
1226        }
1227        else
1228          return super.addChild(name);
1229      }
1230
1231      public OperationOutcomeIssueComponent copy() {
1232        OperationOutcomeIssueComponent dst = new OperationOutcomeIssueComponent();
1233        copyValues(dst);
1234        dst.severity = severity == null ? null : severity.copy();
1235        dst.code = code == null ? null : code.copy();
1236        dst.details = details == null ? null : details.copy();
1237        dst.diagnostics = diagnostics == null ? null : diagnostics.copy();
1238        if (location != null) {
1239          dst.location = new ArrayList<StringType>();
1240          for (StringType i : location)
1241            dst.location.add(i.copy());
1242        };
1243        if (expression != null) {
1244          dst.expression = new ArrayList<StringType>();
1245          for (StringType i : expression)
1246            dst.expression.add(i.copy());
1247        };
1248        return dst;
1249      }
1250
1251      @Override
1252      public boolean equalsDeep(Base other_) {
1253        if (!super.equalsDeep(other_))
1254          return false;
1255        if (!(other_ instanceof OperationOutcomeIssueComponent))
1256          return false;
1257        OperationOutcomeIssueComponent o = (OperationOutcomeIssueComponent) other_;
1258        return compareDeep(severity, o.severity, true) && compareDeep(code, o.code, true) && compareDeep(details, o.details, true)
1259           && compareDeep(diagnostics, o.diagnostics, true) && compareDeep(location, o.location, true) && compareDeep(expression, o.expression, true)
1260          ;
1261      }
1262
1263      @Override
1264      public boolean equalsShallow(Base other_) {
1265        if (!super.equalsShallow(other_))
1266          return false;
1267        if (!(other_ instanceof OperationOutcomeIssueComponent))
1268          return false;
1269        OperationOutcomeIssueComponent o = (OperationOutcomeIssueComponent) other_;
1270        return compareValues(severity, o.severity, true) && compareValues(code, o.code, true) && compareValues(diagnostics, o.diagnostics, true)
1271           && compareValues(location, o.location, true) && compareValues(expression, o.expression, true);
1272      }
1273
1274      public boolean isEmpty() {
1275        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(severity, code, details
1276          , diagnostics, location, expression);
1277      }
1278
1279  public String fhirType() {
1280    return "OperationOutcome.issue";
1281
1282  }
1283
1284  }
1285
1286    /**
1287     * An error, warning or information message that results from a system action.
1288     */
1289    @Child(name = "issue", type = {}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1290    @Description(shortDefinition="A single issue associated with the action", formalDefinition="An error, warning or information message that results from a system action." )
1291    protected List<OperationOutcomeIssueComponent> issue;
1292
1293    private static final long serialVersionUID = -152150052L;
1294
1295  /**
1296   * Constructor
1297   */
1298    public OperationOutcome() {
1299      super();
1300    }
1301
1302    /**
1303     * @return {@link #issue} (An error, warning or information message that results from a system action.)
1304     */
1305    public List<OperationOutcomeIssueComponent> getIssue() { 
1306      if (this.issue == null)
1307        this.issue = new ArrayList<OperationOutcomeIssueComponent>();
1308      return this.issue;
1309    }
1310
1311    /**
1312     * @return Returns a reference to <code>this</code> for easy method chaining
1313     */
1314    public OperationOutcome setIssue(List<OperationOutcomeIssueComponent> theIssue) { 
1315      this.issue = theIssue;
1316      return this;
1317    }
1318
1319    public boolean hasIssue() { 
1320      if (this.issue == null)
1321        return false;
1322      for (OperationOutcomeIssueComponent item : this.issue)
1323        if (!item.isEmpty())
1324          return true;
1325      return false;
1326    }
1327
1328    public OperationOutcomeIssueComponent addIssue() { //3
1329      OperationOutcomeIssueComponent t = new OperationOutcomeIssueComponent();
1330      if (this.issue == null)
1331        this.issue = new ArrayList<OperationOutcomeIssueComponent>();
1332      this.issue.add(t);
1333      return t;
1334    }
1335
1336    public OperationOutcome addIssue(OperationOutcomeIssueComponent t) { //3
1337      if (t == null)
1338        return this;
1339      if (this.issue == null)
1340        this.issue = new ArrayList<OperationOutcomeIssueComponent>();
1341      this.issue.add(t);
1342      return this;
1343    }
1344
1345    /**
1346     * @return The first repetition of repeating field {@link #issue}, creating it if it does not already exist
1347     */
1348    public OperationOutcomeIssueComponent getIssueFirstRep() { 
1349      if (getIssue().isEmpty()) {
1350        addIssue();
1351      }
1352      return getIssue().get(0);
1353    }
1354
1355      protected void listChildren(List<Property> children) {
1356        super.listChildren(children);
1357        children.add(new Property("issue", "", "An error, warning or information message that results from a system action.", 0, java.lang.Integer.MAX_VALUE, issue));
1358      }
1359
1360      @Override
1361      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1362        switch (_hash) {
1363        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);
1364        default: return super.getNamedProperty(_hash, _name, _checkValid);
1365        }
1366
1367      }
1368
1369      @Override
1370      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1371        switch (hash) {
1372        case 100509913: /*issue*/ return this.issue == null ? new Base[0] : this.issue.toArray(new Base[this.issue.size()]); // OperationOutcomeIssueComponent
1373        default: return super.getProperty(hash, name, checkValid);
1374        }
1375
1376      }
1377
1378      @Override
1379      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1380        switch (hash) {
1381        case 100509913: // issue
1382          this.getIssue().add((OperationOutcomeIssueComponent) value); // OperationOutcomeIssueComponent
1383          return value;
1384        default: return super.setProperty(hash, name, value);
1385        }
1386
1387      }
1388
1389      @Override
1390      public Base setProperty(String name, Base value) throws FHIRException {
1391        if (name.equals("issue")) {
1392          this.getIssue().add((OperationOutcomeIssueComponent) value);
1393        } else
1394          return super.setProperty(name, value);
1395        return value;
1396      }
1397
1398      @Override
1399      public Base makeProperty(int hash, String name) throws FHIRException {
1400        switch (hash) {
1401        case 100509913:  return addIssue(); 
1402        default: return super.makeProperty(hash, name);
1403        }
1404
1405      }
1406
1407      @Override
1408      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1409        switch (hash) {
1410        case 100509913: /*issue*/ return new String[] {};
1411        default: return super.getTypesForProperty(hash, name);
1412        }
1413
1414      }
1415
1416      @Override
1417      public Base addChild(String name) throws FHIRException {
1418        if (name.equals("issue")) {
1419          return addIssue();
1420        }
1421        else
1422          return super.addChild(name);
1423      }
1424
1425  public String fhirType() {
1426    return "OperationOutcome";
1427
1428  }
1429
1430      public OperationOutcome copy() {
1431        OperationOutcome dst = new OperationOutcome();
1432        copyValues(dst);
1433        if (issue != null) {
1434          dst.issue = new ArrayList<OperationOutcomeIssueComponent>();
1435          for (OperationOutcomeIssueComponent i : issue)
1436            dst.issue.add(i.copy());
1437        };
1438        return dst;
1439      }
1440
1441      protected OperationOutcome typedCopy() {
1442        return copy();
1443      }
1444
1445      @Override
1446      public boolean equalsDeep(Base other_) {
1447        if (!super.equalsDeep(other_))
1448          return false;
1449        if (!(other_ instanceof OperationOutcome))
1450          return false;
1451        OperationOutcome o = (OperationOutcome) other_;
1452        return compareDeep(issue, o.issue, true);
1453      }
1454
1455      @Override
1456      public boolean equalsShallow(Base other_) {
1457        if (!super.equalsShallow(other_))
1458          return false;
1459        if (!(other_ instanceof OperationOutcome))
1460          return false;
1461        OperationOutcome o = (OperationOutcome) other_;
1462        return true;
1463      }
1464
1465      public boolean isEmpty() {
1466        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(issue);
1467      }
1468
1469  @Override
1470  public ResourceType getResourceType() {
1471    return ResourceType.OperationOutcome;
1472   }
1473
1474
1475}
1476