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