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