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