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