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