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