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