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