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