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