001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * Indicates an actual or potential clinical issue with or between one or more
049 * active or proposed clinical actions for a patient; e.g. Drug-drug
050 * interaction, Ineffective treatment frequency, Procedure-condition conflict,
051 * etc.
052 */
053@ResourceDef(name = "DetectedIssue", profile = "http://hl7.org/fhir/StructureDefinition/DetectedIssue")
054public class DetectedIssue extends DomainResource {
055
056  public enum DetectedIssueStatus {
057    /**
058     * The existence of the observation is registered, but there is no result yet
059     * available.
060     */
061    REGISTERED,
062    /**
063     * This is an initial or interim observation: data may be incomplete or
064     * unverified.
065     */
066    PRELIMINARY,
067    /**
068     * The observation is complete and there are no further actions needed.
069     * Additional information such "released", "signed", etc would be represented
070     * using [Provenance](provenance.html) which provides not only the act but also
071     * the actors and dates and other related data. These act states would be
072     * associated with an observation status of `preliminary` until they are all
073     * completed and then a status of `final` would be applied.
074     */
075    FINAL,
076    /**
077     * Subsequent to being Final, the observation has been modified subsequent. This
078     * includes updates/new information and corrections.
079     */
080    AMENDED,
081    /**
082     * Subsequent to being Final, the observation has been modified to correct an
083     * error in the test result.
084     */
085    CORRECTED,
086    /**
087     * The observation is unavailable because the measurement was not started or not
088     * completed (also sometimes called "aborted").
089     */
090    CANCELLED,
091    /**
092     * The observation has been withdrawn following previous final release. This
093     * electronic record should never have existed, though it is possible that
094     * real-world decisions were based on it. (If real-world activity has occurred,
095     * the status should be "cancelled" rather than "entered-in-error".).
096     */
097    ENTEREDINERROR,
098    /**
099     * The authoring/source system does not know which of the status values
100     * currently applies for this observation. Note: This concept is not to be used
101     * for "other" - one of the listed statuses is presumed to apply, but the
102     * authoring/source system does not know which.
103     */
104    UNKNOWN,
105    /**
106     * added to help the parsers with the generic types
107     */
108    NULL;
109
110    public static DetectedIssueStatus fromCode(String codeString) throws FHIRException {
111      if (codeString == null || "".equals(codeString))
112        return null;
113      if ("registered".equals(codeString))
114        return REGISTERED;
115      if ("preliminary".equals(codeString))
116        return PRELIMINARY;
117      if ("final".equals(codeString))
118        return FINAL;
119      if ("amended".equals(codeString))
120        return AMENDED;
121      if ("corrected".equals(codeString))
122        return CORRECTED;
123      if ("cancelled".equals(codeString))
124        return CANCELLED;
125      if ("entered-in-error".equals(codeString))
126        return ENTEREDINERROR;
127      if ("unknown".equals(codeString))
128        return UNKNOWN;
129      if (Configuration.isAcceptInvalidEnums())
130        return null;
131      else
132        throw new FHIRException("Unknown DetectedIssueStatus code '" + codeString + "'");
133    }
134
135    public String toCode() {
136      switch (this) {
137      case REGISTERED:
138        return "registered";
139      case PRELIMINARY:
140        return "preliminary";
141      case FINAL:
142        return "final";
143      case AMENDED:
144        return "amended";
145      case CORRECTED:
146        return "corrected";
147      case CANCELLED:
148        return "cancelled";
149      case ENTEREDINERROR:
150        return "entered-in-error";
151      case UNKNOWN:
152        return "unknown";
153      case NULL:
154        return null;
155      default:
156        return "?";
157      }
158    }
159
160    public String getSystem() {
161      switch (this) {
162      case REGISTERED:
163        return "http://hl7.org/fhir/observation-status";
164      case PRELIMINARY:
165        return "http://hl7.org/fhir/observation-status";
166      case FINAL:
167        return "http://hl7.org/fhir/observation-status";
168      case AMENDED:
169        return "http://hl7.org/fhir/observation-status";
170      case CORRECTED:
171        return "http://hl7.org/fhir/observation-status";
172      case CANCELLED:
173        return "http://hl7.org/fhir/observation-status";
174      case ENTEREDINERROR:
175        return "http://hl7.org/fhir/observation-status";
176      case UNKNOWN:
177        return "http://hl7.org/fhir/observation-status";
178      case NULL:
179        return null;
180      default:
181        return "?";
182      }
183    }
184
185    public String getDefinition() {
186      switch (this) {
187      case REGISTERED:
188        return "The existence of the observation is registered, but there is no result yet available.";
189      case PRELIMINARY:
190        return "This is an initial or interim observation: data may be incomplete or unverified.";
191      case FINAL:
192        return "The observation is complete and there are no further actions needed. Additional information such \"released\", \"signed\", etc would be represented using [Provenance](provenance.html) which provides not only the act but also the actors and dates and other related data. These act states would be associated with an observation status of `preliminary` until they are all completed and then a status of `final` would be applied.";
193      case AMENDED:
194        return "Subsequent to being Final, the observation has been modified subsequent.  This includes updates/new information and corrections.";
195      case CORRECTED:
196        return "Subsequent to being Final, the observation has been modified to correct an error in the test result.";
197      case CANCELLED:
198        return "The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\").";
199      case ENTEREDINERROR:
200        return "The observation has been withdrawn following previous final release.  This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".).";
201      case UNKNOWN:
202        return "The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, but the authoring/source system does not know which.";
203      case NULL:
204        return null;
205      default:
206        return "?";
207      }
208    }
209
210    public String getDisplay() {
211      switch (this) {
212      case REGISTERED:
213        return "Registered";
214      case PRELIMINARY:
215        return "Preliminary";
216      case FINAL:
217        return "Final";
218      case AMENDED:
219        return "Amended";
220      case CORRECTED:
221        return "Corrected";
222      case CANCELLED:
223        return "Cancelled";
224      case ENTEREDINERROR:
225        return "Entered in Error";
226      case UNKNOWN:
227        return "Unknown";
228      case NULL:
229        return null;
230      default:
231        return "?";
232      }
233    }
234  }
235
236  public static class DetectedIssueStatusEnumFactory implements EnumFactory<DetectedIssueStatus> {
237    public DetectedIssueStatus fromCode(String codeString) throws IllegalArgumentException {
238      if (codeString == null || "".equals(codeString))
239        if (codeString == null || "".equals(codeString))
240          return null;
241      if ("registered".equals(codeString))
242        return DetectedIssueStatus.REGISTERED;
243      if ("preliminary".equals(codeString))
244        return DetectedIssueStatus.PRELIMINARY;
245      if ("final".equals(codeString))
246        return DetectedIssueStatus.FINAL;
247      if ("amended".equals(codeString))
248        return DetectedIssueStatus.AMENDED;
249      if ("corrected".equals(codeString))
250        return DetectedIssueStatus.CORRECTED;
251      if ("cancelled".equals(codeString))
252        return DetectedIssueStatus.CANCELLED;
253      if ("entered-in-error".equals(codeString))
254        return DetectedIssueStatus.ENTEREDINERROR;
255      if ("unknown".equals(codeString))
256        return DetectedIssueStatus.UNKNOWN;
257      throw new IllegalArgumentException("Unknown DetectedIssueStatus code '" + codeString + "'");
258    }
259
260    public Enumeration<DetectedIssueStatus> fromType(PrimitiveType<?> code) throws FHIRException {
261      if (code == null)
262        return null;
263      if (code.isEmpty())
264        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.NULL, code);
265      String codeString = code.asStringValue();
266      if (codeString == null || "".equals(codeString))
267        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.NULL, code);
268      if ("registered".equals(codeString))
269        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.REGISTERED, code);
270      if ("preliminary".equals(codeString))
271        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.PRELIMINARY, code);
272      if ("final".equals(codeString))
273        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.FINAL, code);
274      if ("amended".equals(codeString))
275        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.AMENDED, code);
276      if ("corrected".equals(codeString))
277        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.CORRECTED, code);
278      if ("cancelled".equals(codeString))
279        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.CANCELLED, code);
280      if ("entered-in-error".equals(codeString))
281        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.ENTEREDINERROR, code);
282      if ("unknown".equals(codeString))
283        return new Enumeration<DetectedIssueStatus>(this, DetectedIssueStatus.UNKNOWN, code);
284      throw new FHIRException("Unknown DetectedIssueStatus code '" + codeString + "'");
285    }
286
287    public String toCode(DetectedIssueStatus code) {
288      if (code == DetectedIssueStatus.REGISTERED)
289        return "registered";
290      if (code == DetectedIssueStatus.PRELIMINARY)
291        return "preliminary";
292      if (code == DetectedIssueStatus.FINAL)
293        return "final";
294      if (code == DetectedIssueStatus.AMENDED)
295        return "amended";
296      if (code == DetectedIssueStatus.CORRECTED)
297        return "corrected";
298      if (code == DetectedIssueStatus.CANCELLED)
299        return "cancelled";
300      if (code == DetectedIssueStatus.ENTEREDINERROR)
301        return "entered-in-error";
302      if (code == DetectedIssueStatus.UNKNOWN)
303        return "unknown";
304      return "?";
305    }
306
307    public String toSystem(DetectedIssueStatus code) {
308      return code.getSystem();
309    }
310  }
311
312  public enum DetectedIssueSeverity {
313    /**
314     * Indicates the issue may be life-threatening or has the potential to cause
315     * permanent injury.
316     */
317    HIGH,
318    /**
319     * Indicates the issue may result in noticeable adverse consequences but is
320     * unlikely to be life-threatening or cause permanent injury.
321     */
322    MODERATE,
323    /**
324     * Indicates the issue may result in some adverse consequences but is unlikely
325     * to substantially affect the situation of the subject.
326     */
327    LOW,
328    /**
329     * added to help the parsers with the generic types
330     */
331    NULL;
332
333    public static DetectedIssueSeverity fromCode(String codeString) throws FHIRException {
334      if (codeString == null || "".equals(codeString))
335        return null;
336      if ("high".equals(codeString))
337        return HIGH;
338      if ("moderate".equals(codeString))
339        return MODERATE;
340      if ("low".equals(codeString))
341        return LOW;
342      if (Configuration.isAcceptInvalidEnums())
343        return null;
344      else
345        throw new FHIRException("Unknown DetectedIssueSeverity code '" + codeString + "'");
346    }
347
348    public String toCode() {
349      switch (this) {
350      case HIGH:
351        return "high";
352      case MODERATE:
353        return "moderate";
354      case LOW:
355        return "low";
356      case NULL:
357        return null;
358      default:
359        return "?";
360      }
361    }
362
363    public String getSystem() {
364      switch (this) {
365      case HIGH:
366        return "http://hl7.org/fhir/detectedissue-severity";
367      case MODERATE:
368        return "http://hl7.org/fhir/detectedissue-severity";
369      case LOW:
370        return "http://hl7.org/fhir/detectedissue-severity";
371      case NULL:
372        return null;
373      default:
374        return "?";
375      }
376    }
377
378    public String getDefinition() {
379      switch (this) {
380      case HIGH:
381        return "Indicates the issue may be life-threatening or has the potential to cause permanent injury.";
382      case MODERATE:
383        return "Indicates the issue may result in noticeable adverse consequences but is unlikely to be life-threatening or cause permanent injury.";
384      case LOW:
385        return "Indicates the issue may result in some adverse consequences but is unlikely to substantially affect the situation of the subject.";
386      case NULL:
387        return null;
388      default:
389        return "?";
390      }
391    }
392
393    public String getDisplay() {
394      switch (this) {
395      case HIGH:
396        return "High";
397      case MODERATE:
398        return "Moderate";
399      case LOW:
400        return "Low";
401      case NULL:
402        return null;
403      default:
404        return "?";
405      }
406    }
407  }
408
409  public static class DetectedIssueSeverityEnumFactory implements EnumFactory<DetectedIssueSeverity> {
410    public DetectedIssueSeverity fromCode(String codeString) throws IllegalArgumentException {
411      if (codeString == null || "".equals(codeString))
412        if (codeString == null || "".equals(codeString))
413          return null;
414      if ("high".equals(codeString))
415        return DetectedIssueSeverity.HIGH;
416      if ("moderate".equals(codeString))
417        return DetectedIssueSeverity.MODERATE;
418      if ("low".equals(codeString))
419        return DetectedIssueSeverity.LOW;
420      throw new IllegalArgumentException("Unknown DetectedIssueSeverity code '" + codeString + "'");
421    }
422
423    public Enumeration<DetectedIssueSeverity> fromType(PrimitiveType<?> code) throws FHIRException {
424      if (code == null)
425        return null;
426      if (code.isEmpty())
427        return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.NULL, code);
428      String codeString = code.asStringValue();
429      if (codeString == null || "".equals(codeString))
430        return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.NULL, code);
431      if ("high".equals(codeString))
432        return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.HIGH, code);
433      if ("moderate".equals(codeString))
434        return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.MODERATE, code);
435      if ("low".equals(codeString))
436        return new Enumeration<DetectedIssueSeverity>(this, DetectedIssueSeverity.LOW, code);
437      throw new FHIRException("Unknown DetectedIssueSeverity code '" + codeString + "'");
438    }
439
440    public String toCode(DetectedIssueSeverity code) {
441      if (code == DetectedIssueSeverity.HIGH)
442        return "high";
443      if (code == DetectedIssueSeverity.MODERATE)
444        return "moderate";
445      if (code == DetectedIssueSeverity.LOW)
446        return "low";
447      return "?";
448    }
449
450    public String toSystem(DetectedIssueSeverity code) {
451      return code.getSystem();
452    }
453  }
454
455  @Block()
456  public static class DetectedIssueEvidenceComponent extends BackboneElement implements IBaseBackboneElement {
457    /**
458     * A manifestation that led to the recording of this detected issue.
459     */
460    @Child(name = "code", type = {
461        CodeableConcept.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
462    @Description(shortDefinition = "Manifestation", formalDefinition = "A manifestation that led to the recording of this detected issue.")
463    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/manifestation-or-symptom")
464    protected List<CodeableConcept> code;
465
466    /**
467     * Links to resources that constitute evidence for the detected issue such as a
468     * GuidanceResponse or MeasureReport.
469     */
470    @Child(name = "detail", type = {
471        Reference.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
472    @Description(shortDefinition = "Supporting information", formalDefinition = "Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport.")
473    protected List<Reference> detail;
474    /**
475     * The actual objects that are the target of the reference (Links to resources
476     * that constitute evidence for the detected issue such as a GuidanceResponse or
477     * MeasureReport.)
478     */
479    protected List<Resource> detailTarget;
480
481    private static final long serialVersionUID = 1135831276L;
482
483    /**
484     * Constructor
485     */
486    public DetectedIssueEvidenceComponent() {
487      super();
488    }
489
490    /**
491     * @return {@link #code} (A manifestation that led to the recording of this
492     *         detected issue.)
493     */
494    public List<CodeableConcept> getCode() {
495      if (this.code == null)
496        this.code = new ArrayList<CodeableConcept>();
497      return this.code;
498    }
499
500    /**
501     * @return Returns a reference to <code>this</code> for easy method chaining
502     */
503    public DetectedIssueEvidenceComponent setCode(List<CodeableConcept> theCode) {
504      this.code = theCode;
505      return this;
506    }
507
508    public boolean hasCode() {
509      if (this.code == null)
510        return false;
511      for (CodeableConcept item : this.code)
512        if (!item.isEmpty())
513          return true;
514      return false;
515    }
516
517    public CodeableConcept addCode() { // 3
518      CodeableConcept t = new CodeableConcept();
519      if (this.code == null)
520        this.code = new ArrayList<CodeableConcept>();
521      this.code.add(t);
522      return t;
523    }
524
525    public DetectedIssueEvidenceComponent addCode(CodeableConcept t) { // 3
526      if (t == null)
527        return this;
528      if (this.code == null)
529        this.code = new ArrayList<CodeableConcept>();
530      this.code.add(t);
531      return this;
532    }
533
534    /**
535     * @return The first repetition of repeating field {@link #code}, creating it if
536     *         it does not already exist
537     */
538    public CodeableConcept getCodeFirstRep() {
539      if (getCode().isEmpty()) {
540        addCode();
541      }
542      return getCode().get(0);
543    }
544
545    /**
546     * @return {@link #detail} (Links to resources that constitute evidence for the
547     *         detected issue such as a GuidanceResponse or MeasureReport.)
548     */
549    public List<Reference> getDetail() {
550      if (this.detail == null)
551        this.detail = new ArrayList<Reference>();
552      return this.detail;
553    }
554
555    /**
556     * @return Returns a reference to <code>this</code> for easy method chaining
557     */
558    public DetectedIssueEvidenceComponent setDetail(List<Reference> theDetail) {
559      this.detail = theDetail;
560      return this;
561    }
562
563    public boolean hasDetail() {
564      if (this.detail == null)
565        return false;
566      for (Reference item : this.detail)
567        if (!item.isEmpty())
568          return true;
569      return false;
570    }
571
572    public Reference addDetail() { // 3
573      Reference t = new Reference();
574      if (this.detail == null)
575        this.detail = new ArrayList<Reference>();
576      this.detail.add(t);
577      return t;
578    }
579
580    public DetectedIssueEvidenceComponent addDetail(Reference t) { // 3
581      if (t == null)
582        return this;
583      if (this.detail == null)
584        this.detail = new ArrayList<Reference>();
585      this.detail.add(t);
586      return this;
587    }
588
589    /**
590     * @return The first repetition of repeating field {@link #detail}, creating it
591     *         if it does not already exist
592     */
593    public Reference getDetailFirstRep() {
594      if (getDetail().isEmpty()) {
595        addDetail();
596      }
597      return getDetail().get(0);
598    }
599
600    /**
601     * @deprecated Use Reference#setResource(IBaseResource) instead
602     */
603    @Deprecated
604    public List<Resource> getDetailTarget() {
605      if (this.detailTarget == null)
606        this.detailTarget = new ArrayList<Resource>();
607      return this.detailTarget;
608    }
609
610    protected void listChildren(List<Property> children) {
611      super.listChildren(children);
612      children.add(new Property("code", "CodeableConcept",
613          "A manifestation that led to the recording of this detected issue.", 0, java.lang.Integer.MAX_VALUE, code));
614      children.add(new Property("detail", "Reference(Any)",
615          "Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport.",
616          0, java.lang.Integer.MAX_VALUE, detail));
617    }
618
619    @Override
620    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
621      switch (_hash) {
622      case 3059181:
623        /* code */ return new Property("code", "CodeableConcept",
624            "A manifestation that led to the recording of this detected issue.", 0, java.lang.Integer.MAX_VALUE, code);
625      case -1335224239:
626        /* detail */ return new Property("detail", "Reference(Any)",
627            "Links to resources that constitute evidence for the detected issue such as a GuidanceResponse or MeasureReport.",
628            0, java.lang.Integer.MAX_VALUE, detail);
629      default:
630        return super.getNamedProperty(_hash, _name, _checkValid);
631      }
632
633    }
634
635    @Override
636    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
637      switch (hash) {
638      case 3059181:
639        /* code */ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
640      case -1335224239:
641        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // Reference
642      default:
643        return super.getProperty(hash, name, checkValid);
644      }
645
646    }
647
648    @Override
649    public Base setProperty(int hash, String name, Base value) throws FHIRException {
650      switch (hash) {
651      case 3059181: // code
652        this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
653        return value;
654      case -1335224239: // detail
655        this.getDetail().add(castToReference(value)); // Reference
656        return value;
657      default:
658        return super.setProperty(hash, name, value);
659      }
660
661    }
662
663    @Override
664    public Base setProperty(String name, Base value) throws FHIRException {
665      if (name.equals("code")) {
666        this.getCode().add(castToCodeableConcept(value));
667      } else if (name.equals("detail")) {
668        this.getDetail().add(castToReference(value));
669      } else
670        return super.setProperty(name, value);
671      return value;
672    }
673
674    @Override
675    public Base makeProperty(int hash, String name) throws FHIRException {
676      switch (hash) {
677      case 3059181:
678        return addCode();
679      case -1335224239:
680        return addDetail();
681      default:
682        return super.makeProperty(hash, name);
683      }
684
685    }
686
687    @Override
688    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
689      switch (hash) {
690      case 3059181:
691        /* code */ return new String[] { "CodeableConcept" };
692      case -1335224239:
693        /* detail */ return new String[] { "Reference" };
694      default:
695        return super.getTypesForProperty(hash, name);
696      }
697
698    }
699
700    @Override
701    public Base addChild(String name) throws FHIRException {
702      if (name.equals("code")) {
703        return addCode();
704      } else if (name.equals("detail")) {
705        return addDetail();
706      } else
707        return super.addChild(name);
708    }
709
710    public DetectedIssueEvidenceComponent copy() {
711      DetectedIssueEvidenceComponent dst = new DetectedIssueEvidenceComponent();
712      copyValues(dst);
713      return dst;
714    }
715
716    public void copyValues(DetectedIssueEvidenceComponent dst) {
717      super.copyValues(dst);
718      if (code != null) {
719        dst.code = new ArrayList<CodeableConcept>();
720        for (CodeableConcept i : code)
721          dst.code.add(i.copy());
722      }
723      ;
724      if (detail != null) {
725        dst.detail = new ArrayList<Reference>();
726        for (Reference i : detail)
727          dst.detail.add(i.copy());
728      }
729      ;
730    }
731
732    @Override
733    public boolean equalsDeep(Base other_) {
734      if (!super.equalsDeep(other_))
735        return false;
736      if (!(other_ instanceof DetectedIssueEvidenceComponent))
737        return false;
738      DetectedIssueEvidenceComponent o = (DetectedIssueEvidenceComponent) other_;
739      return compareDeep(code, o.code, true) && compareDeep(detail, o.detail, true);
740    }
741
742    @Override
743    public boolean equalsShallow(Base other_) {
744      if (!super.equalsShallow(other_))
745        return false;
746      if (!(other_ instanceof DetectedIssueEvidenceComponent))
747        return false;
748      DetectedIssueEvidenceComponent o = (DetectedIssueEvidenceComponent) other_;
749      return true;
750    }
751
752    public boolean isEmpty() {
753      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, detail);
754    }
755
756    public String fhirType() {
757      return "DetectedIssue.evidence";
758
759    }
760
761  }
762
763  @Block()
764  public static class DetectedIssueMitigationComponent extends BackboneElement implements IBaseBackboneElement {
765    /**
766     * Describes the action that was taken or the observation that was made that
767     * reduces/eliminates the risk associated with the identified issue.
768     */
769    @Child(name = "action", type = {
770        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
771    @Description(shortDefinition = "What mitigation?", formalDefinition = "Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.")
772    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/detectedissue-mitigation-action")
773    protected CodeableConcept action;
774
775    /**
776     * Indicates when the mitigating action was documented.
777     */
778    @Child(name = "date", type = { DateTimeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
779    @Description(shortDefinition = "Date committed", formalDefinition = "Indicates when the mitigating action was documented.")
780    protected DateTimeType date;
781
782    /**
783     * Identifies the practitioner who determined the mitigation and takes
784     * responsibility for the mitigation step occurring.
785     */
786    @Child(name = "author", type = { Practitioner.class,
787        PractitionerRole.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
788    @Description(shortDefinition = "Who is committing?", formalDefinition = "Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.")
789    protected Reference author;
790
791    /**
792     * The actual object that is the target of the reference (Identifies the
793     * practitioner who determined the mitigation and takes responsibility for the
794     * mitigation step occurring.)
795     */
796    protected Resource authorTarget;
797
798    private static final long serialVersionUID = -1928864832L;
799
800    /**
801     * Constructor
802     */
803    public DetectedIssueMitigationComponent() {
804      super();
805    }
806
807    /**
808     * Constructor
809     */
810    public DetectedIssueMitigationComponent(CodeableConcept action) {
811      super();
812      this.action = action;
813    }
814
815    /**
816     * @return {@link #action} (Describes the action that was taken or the
817     *         observation that was made that reduces/eliminates the risk associated
818     *         with the identified issue.)
819     */
820    public CodeableConcept getAction() {
821      if (this.action == null)
822        if (Configuration.errorOnAutoCreate())
823          throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.action");
824        else if (Configuration.doAutoCreate())
825          this.action = new CodeableConcept(); // cc
826      return this.action;
827    }
828
829    public boolean hasAction() {
830      return this.action != null && !this.action.isEmpty();
831    }
832
833    /**
834     * @param value {@link #action} (Describes the action that was taken or the
835     *              observation that was made that reduces/eliminates the risk
836     *              associated with the identified issue.)
837     */
838    public DetectedIssueMitigationComponent setAction(CodeableConcept value) {
839      this.action = value;
840      return this;
841    }
842
843    /**
844     * @return {@link #date} (Indicates when the mitigating action was documented.).
845     *         This is the underlying object with id, value and extensions. The
846     *         accessor "getDate" gives direct access to the value
847     */
848    public DateTimeType getDateElement() {
849      if (this.date == null)
850        if (Configuration.errorOnAutoCreate())
851          throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.date");
852        else if (Configuration.doAutoCreate())
853          this.date = new DateTimeType(); // bb
854      return this.date;
855    }
856
857    public boolean hasDateElement() {
858      return this.date != null && !this.date.isEmpty();
859    }
860
861    public boolean hasDate() {
862      return this.date != null && !this.date.isEmpty();
863    }
864
865    /**
866     * @param value {@link #date} (Indicates when the mitigating action was
867     *              documented.). This is the underlying object with id, value and
868     *              extensions. The accessor "getDate" gives direct access to the
869     *              value
870     */
871    public DetectedIssueMitigationComponent setDateElement(DateTimeType value) {
872      this.date = value;
873      return this;
874    }
875
876    /**
877     * @return Indicates when the mitigating action was documented.
878     */
879    public Date getDate() {
880      return this.date == null ? null : this.date.getValue();
881    }
882
883    /**
884     * @param value Indicates when the mitigating action was documented.
885     */
886    public DetectedIssueMitigationComponent setDate(Date value) {
887      if (value == null)
888        this.date = null;
889      else {
890        if (this.date == null)
891          this.date = new DateTimeType();
892        this.date.setValue(value);
893      }
894      return this;
895    }
896
897    /**
898     * @return {@link #author} (Identifies the practitioner who determined the
899     *         mitigation and takes responsibility for the mitigation step
900     *         occurring.)
901     */
902    public Reference getAuthor() {
903      if (this.author == null)
904        if (Configuration.errorOnAutoCreate())
905          throw new Error("Attempt to auto-create DetectedIssueMitigationComponent.author");
906        else if (Configuration.doAutoCreate())
907          this.author = new Reference(); // cc
908      return this.author;
909    }
910
911    public boolean hasAuthor() {
912      return this.author != null && !this.author.isEmpty();
913    }
914
915    /**
916     * @param value {@link #author} (Identifies the practitioner who determined the
917     *              mitigation and takes responsibility for the mitigation step
918     *              occurring.)
919     */
920    public DetectedIssueMitigationComponent setAuthor(Reference value) {
921      this.author = value;
922      return this;
923    }
924
925    /**
926     * @return {@link #author} The actual object that is the target of the
927     *         reference. The reference library doesn't populate this, but you can
928     *         use it to hold the resource if you resolve it. (Identifies the
929     *         practitioner who determined the mitigation and takes responsibility
930     *         for the mitigation step occurring.)
931     */
932    public Resource getAuthorTarget() {
933      return this.authorTarget;
934    }
935
936    /**
937     * @param value {@link #author} The actual object that is the target of the
938     *              reference. The reference library doesn't use these, but you can
939     *              use it to hold the resource if you resolve it. (Identifies the
940     *              practitioner who determined the mitigation and takes
941     *              responsibility for the mitigation step occurring.)
942     */
943    public DetectedIssueMitigationComponent setAuthorTarget(Resource value) {
944      this.authorTarget = value;
945      return this;
946    }
947
948    protected void listChildren(List<Property> children) {
949      super.listChildren(children);
950      children.add(new Property("action", "CodeableConcept",
951          "Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.",
952          0, 1, action));
953      children
954          .add(new Property("date", "dateTime", "Indicates when the mitigating action was documented.", 0, 1, date));
955      children.add(new Property("author", "Reference(Practitioner|PractitionerRole)",
956          "Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.",
957          0, 1, author));
958    }
959
960    @Override
961    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
962      switch (_hash) {
963      case -1422950858:
964        /* action */ return new Property("action", "CodeableConcept",
965            "Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.",
966            0, 1, action);
967      case 3076014:
968        /* date */ return new Property("date", "dateTime", "Indicates when the mitigating action was documented.", 0, 1,
969            date);
970      case -1406328437:
971        /* author */ return new Property("author", "Reference(Practitioner|PractitionerRole)",
972            "Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.",
973            0, 1, author);
974      default:
975        return super.getNamedProperty(_hash, _name, _checkValid);
976      }
977
978    }
979
980    @Override
981    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
982      switch (hash) {
983      case -1422950858:
984        /* action */ return this.action == null ? new Base[0] : new Base[] { this.action }; // CodeableConcept
985      case 3076014:
986        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
987      case -1406328437:
988        /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference
989      default:
990        return super.getProperty(hash, name, checkValid);
991      }
992
993    }
994
995    @Override
996    public Base setProperty(int hash, String name, Base value) throws FHIRException {
997      switch (hash) {
998      case -1422950858: // action
999        this.action = castToCodeableConcept(value); // CodeableConcept
1000        return value;
1001      case 3076014: // date
1002        this.date = castToDateTime(value); // DateTimeType
1003        return value;
1004      case -1406328437: // author
1005        this.author = castToReference(value); // Reference
1006        return value;
1007      default:
1008        return super.setProperty(hash, name, value);
1009      }
1010
1011    }
1012
1013    @Override
1014    public Base setProperty(String name, Base value) throws FHIRException {
1015      if (name.equals("action")) {
1016        this.action = castToCodeableConcept(value); // CodeableConcept
1017      } else if (name.equals("date")) {
1018        this.date = castToDateTime(value); // DateTimeType
1019      } else if (name.equals("author")) {
1020        this.author = castToReference(value); // Reference
1021      } else
1022        return super.setProperty(name, value);
1023      return value;
1024    }
1025
1026    @Override
1027    public Base makeProperty(int hash, String name) throws FHIRException {
1028      switch (hash) {
1029      case -1422950858:
1030        return getAction();
1031      case 3076014:
1032        return getDateElement();
1033      case -1406328437:
1034        return getAuthor();
1035      default:
1036        return super.makeProperty(hash, name);
1037      }
1038
1039    }
1040
1041    @Override
1042    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1043      switch (hash) {
1044      case -1422950858:
1045        /* action */ return new String[] { "CodeableConcept" };
1046      case 3076014:
1047        /* date */ return new String[] { "dateTime" };
1048      case -1406328437:
1049        /* author */ return new String[] { "Reference" };
1050      default:
1051        return super.getTypesForProperty(hash, name);
1052      }
1053
1054    }
1055
1056    @Override
1057    public Base addChild(String name) throws FHIRException {
1058      if (name.equals("action")) {
1059        this.action = new CodeableConcept();
1060        return this.action;
1061      } else if (name.equals("date")) {
1062        throw new FHIRException("Cannot call addChild on a singleton property DetectedIssue.date");
1063      } else if (name.equals("author")) {
1064        this.author = new Reference();
1065        return this.author;
1066      } else
1067        return super.addChild(name);
1068    }
1069
1070    public DetectedIssueMitigationComponent copy() {
1071      DetectedIssueMitigationComponent dst = new DetectedIssueMitigationComponent();
1072      copyValues(dst);
1073      return dst;
1074    }
1075
1076    public void copyValues(DetectedIssueMitigationComponent dst) {
1077      super.copyValues(dst);
1078      dst.action = action == null ? null : action.copy();
1079      dst.date = date == null ? null : date.copy();
1080      dst.author = author == null ? null : author.copy();
1081    }
1082
1083    @Override
1084    public boolean equalsDeep(Base other_) {
1085      if (!super.equalsDeep(other_))
1086        return false;
1087      if (!(other_ instanceof DetectedIssueMitigationComponent))
1088        return false;
1089      DetectedIssueMitigationComponent o = (DetectedIssueMitigationComponent) other_;
1090      return compareDeep(action, o.action, true) && compareDeep(date, o.date, true)
1091          && compareDeep(author, o.author, true);
1092    }
1093
1094    @Override
1095    public boolean equalsShallow(Base other_) {
1096      if (!super.equalsShallow(other_))
1097        return false;
1098      if (!(other_ instanceof DetectedIssueMitigationComponent))
1099        return false;
1100      DetectedIssueMitigationComponent o = (DetectedIssueMitigationComponent) other_;
1101      return compareValues(date, o.date, true);
1102    }
1103
1104    public boolean isEmpty() {
1105      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(action, date, author);
1106    }
1107
1108    public String fhirType() {
1109      return "DetectedIssue.mitigation";
1110
1111    }
1112
1113  }
1114
1115  /**
1116   * Business identifier associated with the detected issue record.
1117   */
1118  @Child(name = "identifier", type = {
1119      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1120  @Description(shortDefinition = "Unique id for the detected issue", formalDefinition = "Business identifier associated with the detected issue record.")
1121  protected List<Identifier> identifier;
1122
1123  /**
1124   * Indicates the status of the detected issue.
1125   */
1126  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
1127  @Description(shortDefinition = "registered | preliminary | final | amended +", formalDefinition = "Indicates the status of the detected issue.")
1128  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/observation-status")
1129  protected Enumeration<DetectedIssueStatus> status;
1130
1131  /**
1132   * Identifies the general type of issue identified.
1133   */
1134  @Child(name = "code", type = { CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1135  @Description(shortDefinition = "Issue Category, e.g. drug-drug, duplicate therapy, etc.", formalDefinition = "Identifies the general type of issue identified.")
1136  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/detectedissue-category")
1137  protected CodeableConcept code;
1138
1139  /**
1140   * Indicates the degree of importance associated with the identified issue based
1141   * on the potential impact on the patient.
1142   */
1143  @Child(name = "severity", type = { CodeType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1144  @Description(shortDefinition = "high | moderate | low", formalDefinition = "Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.")
1145  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/detectedissue-severity")
1146  protected Enumeration<DetectedIssueSeverity> severity;
1147
1148  /**
1149   * Indicates the patient whose record the detected issue is associated with.
1150   */
1151  @Child(name = "patient", type = { Patient.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1152  @Description(shortDefinition = "Associated patient", formalDefinition = "Indicates the patient whose record the detected issue is associated with.")
1153  protected Reference patient;
1154
1155  /**
1156   * The actual object that is the target of the reference (Indicates the patient
1157   * whose record the detected issue is associated with.)
1158   */
1159  protected Patient patientTarget;
1160
1161  /**
1162   * The date or period when the detected issue was initially identified.
1163   */
1164  @Child(name = "identified", type = { DateTimeType.class,
1165      Period.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1166  @Description(shortDefinition = "When identified", formalDefinition = "The date or period when the detected issue was initially identified.")
1167  protected Type identified;
1168
1169  /**
1170   * Individual or device responsible for the issue being raised. For example, a
1171   * decision support application or a pharmacist conducting a medication review.
1172   */
1173  @Child(name = "author", type = { Practitioner.class, PractitionerRole.class,
1174      Device.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1175  @Description(shortDefinition = "The provider or device that identified the issue", formalDefinition = "Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.")
1176  protected Reference author;
1177
1178  /**
1179   * The actual object that is the target of the reference (Individual or device
1180   * responsible for the issue being raised. For example, a decision support
1181   * application or a pharmacist conducting a medication review.)
1182   */
1183  protected Resource authorTarget;
1184
1185  /**
1186   * Indicates the resource representing the current activity or proposed activity
1187   * that is potentially problematic.
1188   */
1189  @Child(name = "implicated", type = {
1190      Reference.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1191  @Description(shortDefinition = "Problem resource", formalDefinition = "Indicates the resource representing the current activity or proposed activity that is potentially problematic.")
1192  protected List<Reference> implicated;
1193  /**
1194   * The actual objects that are the target of the reference (Indicates the
1195   * resource representing the current activity or proposed activity that is
1196   * potentially problematic.)
1197   */
1198  protected List<Resource> implicatedTarget;
1199
1200  /**
1201   * Supporting evidence or manifestations that provide the basis for identifying
1202   * the detected issue such as a GuidanceResponse or MeasureReport.
1203   */
1204  @Child(name = "evidence", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1205  @Description(shortDefinition = "Supporting evidence", formalDefinition = "Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport.")
1206  protected List<DetectedIssueEvidenceComponent> evidence;
1207
1208  /**
1209   * A textual explanation of the detected issue.
1210   */
1211  @Child(name = "detail", type = { StringType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
1212  @Description(shortDefinition = "Description and context", formalDefinition = "A textual explanation of the detected issue.")
1213  protected StringType detail;
1214
1215  /**
1216   * The literature, knowledge-base or similar reference that describes the
1217   * propensity for the detected issue identified.
1218   */
1219  @Child(name = "reference", type = { UriType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
1220  @Description(shortDefinition = "Authority for issue", formalDefinition = "The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.")
1221  protected UriType reference;
1222
1223  /**
1224   * Indicates an action that has been taken or is committed to reduce or
1225   * eliminate the likelihood of the risk identified by the detected issue from
1226   * manifesting. Can also reflect an observation of known mitigating factors that
1227   * may reduce/eliminate the need for any action.
1228   */
1229  @Child(name = "mitigation", type = {}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1230  @Description(shortDefinition = "Step taken to address", formalDefinition = "Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.")
1231  protected List<DetectedIssueMitigationComponent> mitigation;
1232
1233  private static final long serialVersionUID = 1404426283L;
1234
1235  /**
1236   * Constructor
1237   */
1238  public DetectedIssue() {
1239    super();
1240  }
1241
1242  /**
1243   * Constructor
1244   */
1245  public DetectedIssue(Enumeration<DetectedIssueStatus> status) {
1246    super();
1247    this.status = status;
1248  }
1249
1250  /**
1251   * @return {@link #identifier} (Business identifier associated with the detected
1252   *         issue record.)
1253   */
1254  public List<Identifier> getIdentifier() {
1255    if (this.identifier == null)
1256      this.identifier = new ArrayList<Identifier>();
1257    return this.identifier;
1258  }
1259
1260  /**
1261   * @return Returns a reference to <code>this</code> for easy method chaining
1262   */
1263  public DetectedIssue setIdentifier(List<Identifier> theIdentifier) {
1264    this.identifier = theIdentifier;
1265    return this;
1266  }
1267
1268  public boolean hasIdentifier() {
1269    if (this.identifier == null)
1270      return false;
1271    for (Identifier item : this.identifier)
1272      if (!item.isEmpty())
1273        return true;
1274    return false;
1275  }
1276
1277  public Identifier addIdentifier() { // 3
1278    Identifier t = new Identifier();
1279    if (this.identifier == null)
1280      this.identifier = new ArrayList<Identifier>();
1281    this.identifier.add(t);
1282    return t;
1283  }
1284
1285  public DetectedIssue addIdentifier(Identifier t) { // 3
1286    if (t == null)
1287      return this;
1288    if (this.identifier == null)
1289      this.identifier = new ArrayList<Identifier>();
1290    this.identifier.add(t);
1291    return this;
1292  }
1293
1294  /**
1295   * @return The first repetition of repeating field {@link #identifier}, creating
1296   *         it if it does not already exist
1297   */
1298  public Identifier getIdentifierFirstRep() {
1299    if (getIdentifier().isEmpty()) {
1300      addIdentifier();
1301    }
1302    return getIdentifier().get(0);
1303  }
1304
1305  /**
1306   * @return {@link #status} (Indicates the status of the detected issue.). This
1307   *         is the underlying object with id, value and extensions. The accessor
1308   *         "getStatus" gives direct access to the value
1309   */
1310  public Enumeration<DetectedIssueStatus> getStatusElement() {
1311    if (this.status == null)
1312      if (Configuration.errorOnAutoCreate())
1313        throw new Error("Attempt to auto-create DetectedIssue.status");
1314      else if (Configuration.doAutoCreate())
1315        this.status = new Enumeration<DetectedIssueStatus>(new DetectedIssueStatusEnumFactory()); // bb
1316    return this.status;
1317  }
1318
1319  public boolean hasStatusElement() {
1320    return this.status != null && !this.status.isEmpty();
1321  }
1322
1323  public boolean hasStatus() {
1324    return this.status != null && !this.status.isEmpty();
1325  }
1326
1327  /**
1328   * @param value {@link #status} (Indicates the status of the detected issue.).
1329   *              This is the underlying object with id, value and extensions. The
1330   *              accessor "getStatus" gives direct access to the value
1331   */
1332  public DetectedIssue setStatusElement(Enumeration<DetectedIssueStatus> value) {
1333    this.status = value;
1334    return this;
1335  }
1336
1337  /**
1338   * @return Indicates the status of the detected issue.
1339   */
1340  public DetectedIssueStatus getStatus() {
1341    return this.status == null ? null : this.status.getValue();
1342  }
1343
1344  /**
1345   * @param value Indicates the status of the detected issue.
1346   */
1347  public DetectedIssue setStatus(DetectedIssueStatus value) {
1348    if (this.status == null)
1349      this.status = new Enumeration<DetectedIssueStatus>(new DetectedIssueStatusEnumFactory());
1350    this.status.setValue(value);
1351    return this;
1352  }
1353
1354  /**
1355   * @return {@link #code} (Identifies the general type of issue identified.)
1356   */
1357  public CodeableConcept getCode() {
1358    if (this.code == null)
1359      if (Configuration.errorOnAutoCreate())
1360        throw new Error("Attempt to auto-create DetectedIssue.code");
1361      else if (Configuration.doAutoCreate())
1362        this.code = new CodeableConcept(); // cc
1363    return this.code;
1364  }
1365
1366  public boolean hasCode() {
1367    return this.code != null && !this.code.isEmpty();
1368  }
1369
1370  /**
1371   * @param value {@link #code} (Identifies the general type of issue identified.)
1372   */
1373  public DetectedIssue setCode(CodeableConcept value) {
1374    this.code = value;
1375    return this;
1376  }
1377
1378  /**
1379   * @return {@link #severity} (Indicates the degree of importance associated with
1380   *         the identified issue based on the potential impact on the patient.).
1381   *         This is the underlying object with id, value and extensions. The
1382   *         accessor "getSeverity" gives direct access to the value
1383   */
1384  public Enumeration<DetectedIssueSeverity> getSeverityElement() {
1385    if (this.severity == null)
1386      if (Configuration.errorOnAutoCreate())
1387        throw new Error("Attempt to auto-create DetectedIssue.severity");
1388      else if (Configuration.doAutoCreate())
1389        this.severity = new Enumeration<DetectedIssueSeverity>(new DetectedIssueSeverityEnumFactory()); // bb
1390    return this.severity;
1391  }
1392
1393  public boolean hasSeverityElement() {
1394    return this.severity != null && !this.severity.isEmpty();
1395  }
1396
1397  public boolean hasSeverity() {
1398    return this.severity != null && !this.severity.isEmpty();
1399  }
1400
1401  /**
1402   * @param value {@link #severity} (Indicates the degree of importance associated
1403   *              with the identified issue based on the potential impact on the
1404   *              patient.). This is the underlying object with id, value and
1405   *              extensions. The accessor "getSeverity" gives direct access to
1406   *              the value
1407   */
1408  public DetectedIssue setSeverityElement(Enumeration<DetectedIssueSeverity> value) {
1409    this.severity = value;
1410    return this;
1411  }
1412
1413  /**
1414   * @return Indicates the degree of importance associated with the identified
1415   *         issue based on the potential impact on the patient.
1416   */
1417  public DetectedIssueSeverity getSeverity() {
1418    return this.severity == null ? null : this.severity.getValue();
1419  }
1420
1421  /**
1422   * @param value Indicates the degree of importance associated with the
1423   *              identified issue based on the potential impact on the patient.
1424   */
1425  public DetectedIssue setSeverity(DetectedIssueSeverity value) {
1426    if (value == null)
1427      this.severity = null;
1428    else {
1429      if (this.severity == null)
1430        this.severity = new Enumeration<DetectedIssueSeverity>(new DetectedIssueSeverityEnumFactory());
1431      this.severity.setValue(value);
1432    }
1433    return this;
1434  }
1435
1436  /**
1437   * @return {@link #patient} (Indicates the patient whose record the detected
1438   *         issue is associated with.)
1439   */
1440  public Reference getPatient() {
1441    if (this.patient == null)
1442      if (Configuration.errorOnAutoCreate())
1443        throw new Error("Attempt to auto-create DetectedIssue.patient");
1444      else if (Configuration.doAutoCreate())
1445        this.patient = new Reference(); // cc
1446    return this.patient;
1447  }
1448
1449  public boolean hasPatient() {
1450    return this.patient != null && !this.patient.isEmpty();
1451  }
1452
1453  /**
1454   * @param value {@link #patient} (Indicates the patient whose record the
1455   *              detected issue is associated with.)
1456   */
1457  public DetectedIssue setPatient(Reference value) {
1458    this.patient = value;
1459    return this;
1460  }
1461
1462  /**
1463   * @return {@link #patient} The actual object that is the target of the
1464   *         reference. The reference library doesn't populate this, but you can
1465   *         use it to hold the resource if you resolve it. (Indicates the patient
1466   *         whose record the detected issue is associated with.)
1467   */
1468  public Patient getPatientTarget() {
1469    if (this.patientTarget == null)
1470      if (Configuration.errorOnAutoCreate())
1471        throw new Error("Attempt to auto-create DetectedIssue.patient");
1472      else if (Configuration.doAutoCreate())
1473        this.patientTarget = new Patient(); // aa
1474    return this.patientTarget;
1475  }
1476
1477  /**
1478   * @param value {@link #patient} The actual object that is the target of the
1479   *              reference. The reference library doesn't use these, but you can
1480   *              use it to hold the resource if you resolve it. (Indicates the
1481   *              patient whose record the detected issue is associated with.)
1482   */
1483  public DetectedIssue setPatientTarget(Patient value) {
1484    this.patientTarget = value;
1485    return this;
1486  }
1487
1488  /**
1489   * @return {@link #identified} (The date or period when the detected issue was
1490   *         initially identified.)
1491   */
1492  public Type getIdentified() {
1493    return this.identified;
1494  }
1495
1496  /**
1497   * @return {@link #identified} (The date or period when the detected issue was
1498   *         initially identified.)
1499   */
1500  public DateTimeType getIdentifiedDateTimeType() throws FHIRException {
1501    if (this.identified == null)
1502      this.identified = new DateTimeType();
1503    if (!(this.identified instanceof DateTimeType))
1504      throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
1505          + this.identified.getClass().getName() + " was encountered");
1506    return (DateTimeType) this.identified;
1507  }
1508
1509  public boolean hasIdentifiedDateTimeType() {
1510    return this != null && this.identified instanceof DateTimeType;
1511  }
1512
1513  /**
1514   * @return {@link #identified} (The date or period when the detected issue was
1515   *         initially identified.)
1516   */
1517  public Period getIdentifiedPeriod() throws FHIRException {
1518    if (this.identified == null)
1519      this.identified = new Period();
1520    if (!(this.identified instanceof Period))
1521      throw new FHIRException("Type mismatch: the type Period was expected, but " + this.identified.getClass().getName()
1522          + " was encountered");
1523    return (Period) this.identified;
1524  }
1525
1526  public boolean hasIdentifiedPeriod() {
1527    return this != null && this.identified instanceof Period;
1528  }
1529
1530  public boolean hasIdentified() {
1531    return this.identified != null && !this.identified.isEmpty();
1532  }
1533
1534  /**
1535   * @param value {@link #identified} (The date or period when the detected issue
1536   *              was initially identified.)
1537   */
1538  public DetectedIssue setIdentified(Type value) {
1539    if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1540      throw new Error("Not the right type for DetectedIssue.identified[x]: " + value.fhirType());
1541    this.identified = value;
1542    return this;
1543  }
1544
1545  /**
1546   * @return {@link #author} (Individual or device responsible for the issue being
1547   *         raised. For example, a decision support application or a pharmacist
1548   *         conducting a medication review.)
1549   */
1550  public Reference getAuthor() {
1551    if (this.author == null)
1552      if (Configuration.errorOnAutoCreate())
1553        throw new Error("Attempt to auto-create DetectedIssue.author");
1554      else if (Configuration.doAutoCreate())
1555        this.author = new Reference(); // cc
1556    return this.author;
1557  }
1558
1559  public boolean hasAuthor() {
1560    return this.author != null && !this.author.isEmpty();
1561  }
1562
1563  /**
1564   * @param value {@link #author} (Individual or device responsible for the issue
1565   *              being raised. For example, a decision support application or a
1566   *              pharmacist conducting a medication review.)
1567   */
1568  public DetectedIssue setAuthor(Reference value) {
1569    this.author = value;
1570    return this;
1571  }
1572
1573  /**
1574   * @return {@link #author} The actual object that is the target of the
1575   *         reference. The reference library doesn't populate this, but you can
1576   *         use it to hold the resource if you resolve it. (Individual or device
1577   *         responsible for the issue being raised. For example, a decision
1578   *         support application or a pharmacist conducting a medication review.)
1579   */
1580  public Resource getAuthorTarget() {
1581    return this.authorTarget;
1582  }
1583
1584  /**
1585   * @param value {@link #author} The actual object that is the target of the
1586   *              reference. The reference library doesn't use these, but you can
1587   *              use it to hold the resource if you resolve it. (Individual or
1588   *              device responsible for the issue being raised. For example, a
1589   *              decision support application or a pharmacist conducting a
1590   *              medication review.)
1591   */
1592  public DetectedIssue setAuthorTarget(Resource value) {
1593    this.authorTarget = value;
1594    return this;
1595  }
1596
1597  /**
1598   * @return {@link #implicated} (Indicates the resource representing the current
1599   *         activity or proposed activity that is potentially problematic.)
1600   */
1601  public List<Reference> getImplicated() {
1602    if (this.implicated == null)
1603      this.implicated = new ArrayList<Reference>();
1604    return this.implicated;
1605  }
1606
1607  /**
1608   * @return Returns a reference to <code>this</code> for easy method chaining
1609   */
1610  public DetectedIssue setImplicated(List<Reference> theImplicated) {
1611    this.implicated = theImplicated;
1612    return this;
1613  }
1614
1615  public boolean hasImplicated() {
1616    if (this.implicated == null)
1617      return false;
1618    for (Reference item : this.implicated)
1619      if (!item.isEmpty())
1620        return true;
1621    return false;
1622  }
1623
1624  public Reference addImplicated() { // 3
1625    Reference t = new Reference();
1626    if (this.implicated == null)
1627      this.implicated = new ArrayList<Reference>();
1628    this.implicated.add(t);
1629    return t;
1630  }
1631
1632  public DetectedIssue addImplicated(Reference t) { // 3
1633    if (t == null)
1634      return this;
1635    if (this.implicated == null)
1636      this.implicated = new ArrayList<Reference>();
1637    this.implicated.add(t);
1638    return this;
1639  }
1640
1641  /**
1642   * @return The first repetition of repeating field {@link #implicated}, creating
1643   *         it if it does not already exist
1644   */
1645  public Reference getImplicatedFirstRep() {
1646    if (getImplicated().isEmpty()) {
1647      addImplicated();
1648    }
1649    return getImplicated().get(0);
1650  }
1651
1652  /**
1653   * @deprecated Use Reference#setResource(IBaseResource) instead
1654   */
1655  @Deprecated
1656  public List<Resource> getImplicatedTarget() {
1657    if (this.implicatedTarget == null)
1658      this.implicatedTarget = new ArrayList<Resource>();
1659    return this.implicatedTarget;
1660  }
1661
1662  /**
1663   * @return {@link #evidence} (Supporting evidence or manifestations that provide
1664   *         the basis for identifying the detected issue such as a
1665   *         GuidanceResponse or MeasureReport.)
1666   */
1667  public List<DetectedIssueEvidenceComponent> getEvidence() {
1668    if (this.evidence == null)
1669      this.evidence = new ArrayList<DetectedIssueEvidenceComponent>();
1670    return this.evidence;
1671  }
1672
1673  /**
1674   * @return Returns a reference to <code>this</code> for easy method chaining
1675   */
1676  public DetectedIssue setEvidence(List<DetectedIssueEvidenceComponent> theEvidence) {
1677    this.evidence = theEvidence;
1678    return this;
1679  }
1680
1681  public boolean hasEvidence() {
1682    if (this.evidence == null)
1683      return false;
1684    for (DetectedIssueEvidenceComponent item : this.evidence)
1685      if (!item.isEmpty())
1686        return true;
1687    return false;
1688  }
1689
1690  public DetectedIssueEvidenceComponent addEvidence() { // 3
1691    DetectedIssueEvidenceComponent t = new DetectedIssueEvidenceComponent();
1692    if (this.evidence == null)
1693      this.evidence = new ArrayList<DetectedIssueEvidenceComponent>();
1694    this.evidence.add(t);
1695    return t;
1696  }
1697
1698  public DetectedIssue addEvidence(DetectedIssueEvidenceComponent t) { // 3
1699    if (t == null)
1700      return this;
1701    if (this.evidence == null)
1702      this.evidence = new ArrayList<DetectedIssueEvidenceComponent>();
1703    this.evidence.add(t);
1704    return this;
1705  }
1706
1707  /**
1708   * @return The first repetition of repeating field {@link #evidence}, creating
1709   *         it if it does not already exist
1710   */
1711  public DetectedIssueEvidenceComponent getEvidenceFirstRep() {
1712    if (getEvidence().isEmpty()) {
1713      addEvidence();
1714    }
1715    return getEvidence().get(0);
1716  }
1717
1718  /**
1719   * @return {@link #detail} (A textual explanation of the detected issue.). This
1720   *         is the underlying object with id, value and extensions. The accessor
1721   *         "getDetail" gives direct access to the value
1722   */
1723  public StringType getDetailElement() {
1724    if (this.detail == null)
1725      if (Configuration.errorOnAutoCreate())
1726        throw new Error("Attempt to auto-create DetectedIssue.detail");
1727      else if (Configuration.doAutoCreate())
1728        this.detail = new StringType(); // bb
1729    return this.detail;
1730  }
1731
1732  public boolean hasDetailElement() {
1733    return this.detail != null && !this.detail.isEmpty();
1734  }
1735
1736  public boolean hasDetail() {
1737    return this.detail != null && !this.detail.isEmpty();
1738  }
1739
1740  /**
1741   * @param value {@link #detail} (A textual explanation of the detected issue.).
1742   *              This is the underlying object with id, value and extensions. The
1743   *              accessor "getDetail" gives direct access to the value
1744   */
1745  public DetectedIssue setDetailElement(StringType value) {
1746    this.detail = value;
1747    return this;
1748  }
1749
1750  /**
1751   * @return A textual explanation of the detected issue.
1752   */
1753  public String getDetail() {
1754    return this.detail == null ? null : this.detail.getValue();
1755  }
1756
1757  /**
1758   * @param value A textual explanation of the detected issue.
1759   */
1760  public DetectedIssue setDetail(String value) {
1761    if (Utilities.noString(value))
1762      this.detail = null;
1763    else {
1764      if (this.detail == null)
1765        this.detail = new StringType();
1766      this.detail.setValue(value);
1767    }
1768    return this;
1769  }
1770
1771  /**
1772   * @return {@link #reference} (The literature, knowledge-base or similar
1773   *         reference that describes the propensity for the detected issue
1774   *         identified.). This is the underlying object with id, value and
1775   *         extensions. The accessor "getReference" gives direct access to the
1776   *         value
1777   */
1778  public UriType getReferenceElement() {
1779    if (this.reference == null)
1780      if (Configuration.errorOnAutoCreate())
1781        throw new Error("Attempt to auto-create DetectedIssue.reference");
1782      else if (Configuration.doAutoCreate())
1783        this.reference = new UriType(); // bb
1784    return this.reference;
1785  }
1786
1787  public boolean hasReferenceElement() {
1788    return this.reference != null && !this.reference.isEmpty();
1789  }
1790
1791  public boolean hasReference() {
1792    return this.reference != null && !this.reference.isEmpty();
1793  }
1794
1795  /**
1796   * @param value {@link #reference} (The literature, knowledge-base or similar
1797   *              reference that describes the propensity for the detected issue
1798   *              identified.). This is the underlying object with id, value and
1799   *              extensions. The accessor "getReference" gives direct access to
1800   *              the value
1801   */
1802  public DetectedIssue setReferenceElement(UriType value) {
1803    this.reference = value;
1804    return this;
1805  }
1806
1807  /**
1808   * @return The literature, knowledge-base or similar reference that describes
1809   *         the propensity for the detected issue identified.
1810   */
1811  public String getReference() {
1812    return this.reference == null ? null : this.reference.getValue();
1813  }
1814
1815  /**
1816   * @param value The literature, knowledge-base or similar reference that
1817   *              describes the propensity for the detected issue identified.
1818   */
1819  public DetectedIssue setReference(String value) {
1820    if (Utilities.noString(value))
1821      this.reference = null;
1822    else {
1823      if (this.reference == null)
1824        this.reference = new UriType();
1825      this.reference.setValue(value);
1826    }
1827    return this;
1828  }
1829
1830  /**
1831   * @return {@link #mitigation} (Indicates an action that has been taken or is
1832   *         committed to reduce or eliminate the likelihood of the risk
1833   *         identified by the detected issue from manifesting. Can also reflect
1834   *         an observation of known mitigating factors that may reduce/eliminate
1835   *         the need for any action.)
1836   */
1837  public List<DetectedIssueMitigationComponent> getMitigation() {
1838    if (this.mitigation == null)
1839      this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1840    return this.mitigation;
1841  }
1842
1843  /**
1844   * @return Returns a reference to <code>this</code> for easy method chaining
1845   */
1846  public DetectedIssue setMitigation(List<DetectedIssueMitigationComponent> theMitigation) {
1847    this.mitigation = theMitigation;
1848    return this;
1849  }
1850
1851  public boolean hasMitigation() {
1852    if (this.mitigation == null)
1853      return false;
1854    for (DetectedIssueMitigationComponent item : this.mitigation)
1855      if (!item.isEmpty())
1856        return true;
1857    return false;
1858  }
1859
1860  public DetectedIssueMitigationComponent addMitigation() { // 3
1861    DetectedIssueMitigationComponent t = new DetectedIssueMitigationComponent();
1862    if (this.mitigation == null)
1863      this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1864    this.mitigation.add(t);
1865    return t;
1866  }
1867
1868  public DetectedIssue addMitigation(DetectedIssueMitigationComponent t) { // 3
1869    if (t == null)
1870      return this;
1871    if (this.mitigation == null)
1872      this.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
1873    this.mitigation.add(t);
1874    return this;
1875  }
1876
1877  /**
1878   * @return The first repetition of repeating field {@link #mitigation}, creating
1879   *         it if it does not already exist
1880   */
1881  public DetectedIssueMitigationComponent getMitigationFirstRep() {
1882    if (getMitigation().isEmpty()) {
1883      addMitigation();
1884    }
1885    return getMitigation().get(0);
1886  }
1887
1888  protected void listChildren(List<Property> children) {
1889    super.listChildren(children);
1890    children.add(new Property("identifier", "Identifier",
1891        "Business identifier associated with the detected issue record.", 0, java.lang.Integer.MAX_VALUE, identifier));
1892    children.add(new Property("status", "code", "Indicates the status of the detected issue.", 0, 1, status));
1893    children
1894        .add(new Property("code", "CodeableConcept", "Identifies the general type of issue identified.", 0, 1, code));
1895    children.add(new Property("severity", "code",
1896        "Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.",
1897        0, 1, severity));
1898    children.add(new Property("patient", "Reference(Patient)",
1899        "Indicates the patient whose record the detected issue is associated with.", 0, 1, patient));
1900    children.add(new Property("identified[x]", "dateTime|Period",
1901        "The date or period when the detected issue was initially identified.", 0, 1, identified));
1902    children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Device)",
1903        "Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.",
1904        0, 1, author));
1905    children.add(new Property("implicated", "Reference(Any)",
1906        "Indicates the resource representing the current activity or proposed activity that is potentially problematic.",
1907        0, java.lang.Integer.MAX_VALUE, implicated));
1908    children.add(new Property("evidence", "",
1909        "Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport.",
1910        0, java.lang.Integer.MAX_VALUE, evidence));
1911    children.add(new Property("detail", "string", "A textual explanation of the detected issue.", 0, 1, detail));
1912    children.add(new Property("reference", "uri",
1913        "The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.",
1914        0, 1, reference));
1915    children.add(new Property("mitigation", "",
1916        "Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.",
1917        0, java.lang.Integer.MAX_VALUE, mitigation));
1918  }
1919
1920  @Override
1921  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1922    switch (_hash) {
1923    case -1618432855:
1924      /* identifier */ return new Property("identifier", "Identifier",
1925          "Business identifier associated with the detected issue record.", 0, java.lang.Integer.MAX_VALUE, identifier);
1926    case -892481550:
1927      /* status */ return new Property("status", "code", "Indicates the status of the detected issue.", 0, 1, status);
1928    case 3059181:
1929      /* code */ return new Property("code", "CodeableConcept", "Identifies the general type of issue identified.", 0,
1930          1, code);
1931    case 1478300413:
1932      /* severity */ return new Property("severity", "code",
1933          "Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.",
1934          0, 1, severity);
1935    case -791418107:
1936      /* patient */ return new Property("patient", "Reference(Patient)",
1937          "Indicates the patient whose record the detected issue is associated with.", 0, 1, patient);
1938    case 569355781:
1939      /* identified[x] */ return new Property("identified[x]", "dateTime|Period",
1940          "The date or period when the detected issue was initially identified.", 0, 1, identified);
1941    case -1618432869:
1942      /* identified */ return new Property("identified[x]", "dateTime|Period",
1943          "The date or period when the detected issue was initially identified.", 0, 1, identified);
1944    case -968788650:
1945      /* identifiedDateTime */ return new Property("identified[x]", "dateTime|Period",
1946          "The date or period when the detected issue was initially identified.", 0, 1, identified);
1947    case 520482364:
1948      /* identifiedPeriod */ return new Property("identified[x]", "dateTime|Period",
1949          "The date or period when the detected issue was initially identified.", 0, 1, identified);
1950    case -1406328437:
1951      /* author */ return new Property("author", "Reference(Practitioner|PractitionerRole|Device)",
1952          "Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.",
1953          0, 1, author);
1954    case -810216884:
1955      /* implicated */ return new Property("implicated", "Reference(Any)",
1956          "Indicates the resource representing the current activity or proposed activity that is potentially problematic.",
1957          0, java.lang.Integer.MAX_VALUE, implicated);
1958    case 382967383:
1959      /* evidence */ return new Property("evidence", "",
1960          "Supporting evidence or manifestations that provide the basis for identifying the detected issue such as a GuidanceResponse or MeasureReport.",
1961          0, java.lang.Integer.MAX_VALUE, evidence);
1962    case -1335224239:
1963      /* detail */ return new Property("detail", "string", "A textual explanation of the detected issue.", 0, 1,
1964          detail);
1965    case -925155509:
1966      /* reference */ return new Property("reference", "uri",
1967          "The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.",
1968          0, 1, reference);
1969    case 1293793087:
1970      /* mitigation */ return new Property("mitigation", "",
1971          "Indicates an action that has been taken or is committed to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.",
1972          0, java.lang.Integer.MAX_VALUE, mitigation);
1973    default:
1974      return super.getNamedProperty(_hash, _name, _checkValid);
1975    }
1976
1977  }
1978
1979  @Override
1980  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1981    switch (hash) {
1982    case -1618432855:
1983      /* identifier */ return this.identifier == null ? new Base[0]
1984          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1985    case -892481550:
1986      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<DetectedIssueStatus>
1987    case 3059181:
1988      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
1989    case 1478300413:
1990      /* severity */ return this.severity == null ? new Base[0] : new Base[] { this.severity }; // Enumeration<DetectedIssueSeverity>
1991    case -791418107:
1992      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
1993    case -1618432869:
1994      /* identified */ return this.identified == null ? new Base[0] : new Base[] { this.identified }; // Type
1995    case -1406328437:
1996      /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference
1997    case -810216884:
1998      /* implicated */ return this.implicated == null ? new Base[0]
1999          : this.implicated.toArray(new Base[this.implicated.size()]); // Reference
2000    case 382967383:
2001      /* evidence */ return this.evidence == null ? new Base[0] : this.evidence.toArray(new Base[this.evidence.size()]); // DetectedIssueEvidenceComponent
2002    case -1335224239:
2003      /* detail */ return this.detail == null ? new Base[0] : new Base[] { this.detail }; // StringType
2004    case -925155509:
2005      /* reference */ return this.reference == null ? new Base[0] : new Base[] { this.reference }; // UriType
2006    case 1293793087:
2007      /* mitigation */ return this.mitigation == null ? new Base[0]
2008          : this.mitigation.toArray(new Base[this.mitigation.size()]); // DetectedIssueMitigationComponent
2009    default:
2010      return super.getProperty(hash, name, checkValid);
2011    }
2012
2013  }
2014
2015  @Override
2016  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2017    switch (hash) {
2018    case -1618432855: // identifier
2019      this.getIdentifier().add(castToIdentifier(value)); // Identifier
2020      return value;
2021    case -892481550: // status
2022      value = new DetectedIssueStatusEnumFactory().fromType(castToCode(value));
2023      this.status = (Enumeration) value; // Enumeration<DetectedIssueStatus>
2024      return value;
2025    case 3059181: // code
2026      this.code = castToCodeableConcept(value); // CodeableConcept
2027      return value;
2028    case 1478300413: // severity
2029      value = new DetectedIssueSeverityEnumFactory().fromType(castToCode(value));
2030      this.severity = (Enumeration) value; // Enumeration<DetectedIssueSeverity>
2031      return value;
2032    case -791418107: // patient
2033      this.patient = castToReference(value); // Reference
2034      return value;
2035    case -1618432869: // identified
2036      this.identified = castToType(value); // Type
2037      return value;
2038    case -1406328437: // author
2039      this.author = castToReference(value); // Reference
2040      return value;
2041    case -810216884: // implicated
2042      this.getImplicated().add(castToReference(value)); // Reference
2043      return value;
2044    case 382967383: // evidence
2045      this.getEvidence().add((DetectedIssueEvidenceComponent) value); // DetectedIssueEvidenceComponent
2046      return value;
2047    case -1335224239: // detail
2048      this.detail = castToString(value); // StringType
2049      return value;
2050    case -925155509: // reference
2051      this.reference = castToUri(value); // UriType
2052      return value;
2053    case 1293793087: // mitigation
2054      this.getMitigation().add((DetectedIssueMitigationComponent) value); // DetectedIssueMitigationComponent
2055      return value;
2056    default:
2057      return super.setProperty(hash, name, value);
2058    }
2059
2060  }
2061
2062  @Override
2063  public Base setProperty(String name, Base value) throws FHIRException {
2064    if (name.equals("identifier")) {
2065      this.getIdentifier().add(castToIdentifier(value));
2066    } else if (name.equals("status")) {
2067      value = new DetectedIssueStatusEnumFactory().fromType(castToCode(value));
2068      this.status = (Enumeration) value; // Enumeration<DetectedIssueStatus>
2069    } else if (name.equals("code")) {
2070      this.code = castToCodeableConcept(value); // CodeableConcept
2071    } else if (name.equals("severity")) {
2072      value = new DetectedIssueSeverityEnumFactory().fromType(castToCode(value));
2073      this.severity = (Enumeration) value; // Enumeration<DetectedIssueSeverity>
2074    } else if (name.equals("patient")) {
2075      this.patient = castToReference(value); // Reference
2076    } else if (name.equals("identified[x]")) {
2077      this.identified = castToType(value); // Type
2078    } else if (name.equals("author")) {
2079      this.author = castToReference(value); // Reference
2080    } else if (name.equals("implicated")) {
2081      this.getImplicated().add(castToReference(value));
2082    } else if (name.equals("evidence")) {
2083      this.getEvidence().add((DetectedIssueEvidenceComponent) value);
2084    } else if (name.equals("detail")) {
2085      this.detail = castToString(value); // StringType
2086    } else if (name.equals("reference")) {
2087      this.reference = castToUri(value); // UriType
2088    } else if (name.equals("mitigation")) {
2089      this.getMitigation().add((DetectedIssueMitigationComponent) value);
2090    } else
2091      return super.setProperty(name, value);
2092    return value;
2093  }
2094
2095  @Override
2096  public Base makeProperty(int hash, String name) throws FHIRException {
2097    switch (hash) {
2098    case -1618432855:
2099      return addIdentifier();
2100    case -892481550:
2101      return getStatusElement();
2102    case 3059181:
2103      return getCode();
2104    case 1478300413:
2105      return getSeverityElement();
2106    case -791418107:
2107      return getPatient();
2108    case 569355781:
2109      return getIdentified();
2110    case -1618432869:
2111      return getIdentified();
2112    case -1406328437:
2113      return getAuthor();
2114    case -810216884:
2115      return addImplicated();
2116    case 382967383:
2117      return addEvidence();
2118    case -1335224239:
2119      return getDetailElement();
2120    case -925155509:
2121      return getReferenceElement();
2122    case 1293793087:
2123      return addMitigation();
2124    default:
2125      return super.makeProperty(hash, name);
2126    }
2127
2128  }
2129
2130  @Override
2131  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2132    switch (hash) {
2133    case -1618432855:
2134      /* identifier */ return new String[] { "Identifier" };
2135    case -892481550:
2136      /* status */ return new String[] { "code" };
2137    case 3059181:
2138      /* code */ return new String[] { "CodeableConcept" };
2139    case 1478300413:
2140      /* severity */ return new String[] { "code" };
2141    case -791418107:
2142      /* patient */ return new String[] { "Reference" };
2143    case -1618432869:
2144      /* identified */ return new String[] { "dateTime", "Period" };
2145    case -1406328437:
2146      /* author */ return new String[] { "Reference" };
2147    case -810216884:
2148      /* implicated */ return new String[] { "Reference" };
2149    case 382967383:
2150      /* evidence */ return new String[] {};
2151    case -1335224239:
2152      /* detail */ return new String[] { "string" };
2153    case -925155509:
2154      /* reference */ return new String[] { "uri" };
2155    case 1293793087:
2156      /* mitigation */ return new String[] {};
2157    default:
2158      return super.getTypesForProperty(hash, name);
2159    }
2160
2161  }
2162
2163  @Override
2164  public Base addChild(String name) throws FHIRException {
2165    if (name.equals("identifier")) {
2166      return addIdentifier();
2167    } else if (name.equals("status")) {
2168      throw new FHIRException("Cannot call addChild on a singleton property DetectedIssue.status");
2169    } else if (name.equals("code")) {
2170      this.code = new CodeableConcept();
2171      return this.code;
2172    } else if (name.equals("severity")) {
2173      throw new FHIRException("Cannot call addChild on a singleton property DetectedIssue.severity");
2174    } else if (name.equals("patient")) {
2175      this.patient = new Reference();
2176      return this.patient;
2177    } else if (name.equals("identifiedDateTime")) {
2178      this.identified = new DateTimeType();
2179      return this.identified;
2180    } else if (name.equals("identifiedPeriod")) {
2181      this.identified = new Period();
2182      return this.identified;
2183    } else if (name.equals("author")) {
2184      this.author = new Reference();
2185      return this.author;
2186    } else if (name.equals("implicated")) {
2187      return addImplicated();
2188    } else if (name.equals("evidence")) {
2189      return addEvidence();
2190    } else if (name.equals("detail")) {
2191      throw new FHIRException("Cannot call addChild on a singleton property DetectedIssue.detail");
2192    } else if (name.equals("reference")) {
2193      throw new FHIRException("Cannot call addChild on a singleton property DetectedIssue.reference");
2194    } else if (name.equals("mitigation")) {
2195      return addMitigation();
2196    } else
2197      return super.addChild(name);
2198  }
2199
2200  public String fhirType() {
2201    return "DetectedIssue";
2202
2203  }
2204
2205  public DetectedIssue copy() {
2206    DetectedIssue dst = new DetectedIssue();
2207    copyValues(dst);
2208    return dst;
2209  }
2210
2211  public void copyValues(DetectedIssue dst) {
2212    super.copyValues(dst);
2213    if (identifier != null) {
2214      dst.identifier = new ArrayList<Identifier>();
2215      for (Identifier i : identifier)
2216        dst.identifier.add(i.copy());
2217    }
2218    ;
2219    dst.status = status == null ? null : status.copy();
2220    dst.code = code == null ? null : code.copy();
2221    dst.severity = severity == null ? null : severity.copy();
2222    dst.patient = patient == null ? null : patient.copy();
2223    dst.identified = identified == null ? null : identified.copy();
2224    dst.author = author == null ? null : author.copy();
2225    if (implicated != null) {
2226      dst.implicated = new ArrayList<Reference>();
2227      for (Reference i : implicated)
2228        dst.implicated.add(i.copy());
2229    }
2230    ;
2231    if (evidence != null) {
2232      dst.evidence = new ArrayList<DetectedIssueEvidenceComponent>();
2233      for (DetectedIssueEvidenceComponent i : evidence)
2234        dst.evidence.add(i.copy());
2235    }
2236    ;
2237    dst.detail = detail == null ? null : detail.copy();
2238    dst.reference = reference == null ? null : reference.copy();
2239    if (mitigation != null) {
2240      dst.mitigation = new ArrayList<DetectedIssueMitigationComponent>();
2241      for (DetectedIssueMitigationComponent i : mitigation)
2242        dst.mitigation.add(i.copy());
2243    }
2244    ;
2245  }
2246
2247  protected DetectedIssue typedCopy() {
2248    return copy();
2249  }
2250
2251  @Override
2252  public boolean equalsDeep(Base other_) {
2253    if (!super.equalsDeep(other_))
2254      return false;
2255    if (!(other_ instanceof DetectedIssue))
2256      return false;
2257    DetectedIssue o = (DetectedIssue) other_;
2258    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
2259        && compareDeep(code, o.code, true) && compareDeep(severity, o.severity, true)
2260        && compareDeep(patient, o.patient, true) && compareDeep(identified, o.identified, true)
2261        && compareDeep(author, o.author, true) && compareDeep(implicated, o.implicated, true)
2262        && compareDeep(evidence, o.evidence, true) && compareDeep(detail, o.detail, true)
2263        && compareDeep(reference, o.reference, true) && compareDeep(mitigation, o.mitigation, true);
2264  }
2265
2266  @Override
2267  public boolean equalsShallow(Base other_) {
2268    if (!super.equalsShallow(other_))
2269      return false;
2270    if (!(other_ instanceof DetectedIssue))
2271      return false;
2272    DetectedIssue o = (DetectedIssue) other_;
2273    return compareValues(status, o.status, true) && compareValues(severity, o.severity, true)
2274        && compareValues(detail, o.detail, true) && compareValues(reference, o.reference, true);
2275  }
2276
2277  public boolean isEmpty() {
2278    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, code, severity, patient,
2279        identified, author, implicated, evidence, detail, reference, mitigation);
2280  }
2281
2282  @Override
2283  public ResourceType getResourceType() {
2284    return ResourceType.DetectedIssue;
2285  }
2286
2287  /**
2288   * Search parameter: <b>identifier</b>
2289   * <p>
2290   * Description: <b>Unique id for the detected issue</b><br>
2291   * Type: <b>token</b><br>
2292   * Path: <b>DetectedIssue.identifier</b><br>
2293   * </p>
2294   */
2295  @SearchParamDefinition(name = "identifier", path = "DetectedIssue.identifier", description = "Unique id for the detected issue", type = "token")
2296  public static final String SP_IDENTIFIER = "identifier";
2297  /**
2298   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2299   * <p>
2300   * Description: <b>Unique id for the detected issue</b><br>
2301   * Type: <b>token</b><br>
2302   * Path: <b>DetectedIssue.identifier</b><br>
2303   * </p>
2304   */
2305  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2306      SP_IDENTIFIER);
2307
2308  /**
2309   * Search parameter: <b>code</b>
2310   * <p>
2311   * Description: <b>Issue Category, e.g. drug-drug, duplicate therapy,
2312   * etc.</b><br>
2313   * Type: <b>token</b><br>
2314   * Path: <b>DetectedIssue.code</b><br>
2315   * </p>
2316   */
2317  @SearchParamDefinition(name = "code", path = "DetectedIssue.code", description = "Issue Category, e.g. drug-drug, duplicate therapy, etc.", type = "token")
2318  public static final String SP_CODE = "code";
2319  /**
2320   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2321   * <p>
2322   * Description: <b>Issue Category, e.g. drug-drug, duplicate therapy,
2323   * etc.</b><br>
2324   * Type: <b>token</b><br>
2325   * Path: <b>DetectedIssue.code</b><br>
2326   * </p>
2327   */
2328  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2329      SP_CODE);
2330
2331  /**
2332   * Search parameter: <b>identified</b>
2333   * <p>
2334   * Description: <b>When identified</b><br>
2335   * Type: <b>date</b><br>
2336   * Path: <b>DetectedIssue.identified[x]</b><br>
2337   * </p>
2338   */
2339  @SearchParamDefinition(name = "identified", path = "DetectedIssue.identified", description = "When identified", type = "date")
2340  public static final String SP_IDENTIFIED = "identified";
2341  /**
2342   * <b>Fluent Client</b> search parameter constant for <b>identified</b>
2343   * <p>
2344   * Description: <b>When identified</b><br>
2345   * Type: <b>date</b><br>
2346   * Path: <b>DetectedIssue.identified[x]</b><br>
2347   * </p>
2348   */
2349  public static final ca.uhn.fhir.rest.gclient.DateClientParam IDENTIFIED = new ca.uhn.fhir.rest.gclient.DateClientParam(
2350      SP_IDENTIFIED);
2351
2352  /**
2353   * Search parameter: <b>patient</b>
2354   * <p>
2355   * Description: <b>Associated patient</b><br>
2356   * Type: <b>reference</b><br>
2357   * Path: <b>DetectedIssue.patient</b><br>
2358   * </p>
2359   */
2360  @SearchParamDefinition(name = "patient", path = "DetectedIssue.patient", description = "Associated patient", type = "reference", providesMembershipIn = {
2361      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
2362  public static final String SP_PATIENT = "patient";
2363  /**
2364   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2365   * <p>
2366   * Description: <b>Associated patient</b><br>
2367   * Type: <b>reference</b><br>
2368   * Path: <b>DetectedIssue.patient</b><br>
2369   * </p>
2370   */
2371  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2372      SP_PATIENT);
2373
2374  /**
2375   * Constant for fluent queries to be used to add include statements. Specifies
2376   * the path value of "<b>DetectedIssue:patient</b>".
2377   */
2378  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
2379      "DetectedIssue:patient").toLocked();
2380
2381  /**
2382   * Search parameter: <b>author</b>
2383   * <p>
2384   * Description: <b>The provider or device that identified the issue</b><br>
2385   * Type: <b>reference</b><br>
2386   * Path: <b>DetectedIssue.author</b><br>
2387   * </p>
2388   */
2389  @SearchParamDefinition(name = "author", path = "DetectedIssue.author", description = "The provider or device that identified the issue", type = "reference", providesMembershipIn = {
2390      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"),
2391      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Device.class,
2392          Practitioner.class, PractitionerRole.class })
2393  public static final String SP_AUTHOR = "author";
2394  /**
2395   * <b>Fluent Client</b> search parameter constant for <b>author</b>
2396   * <p>
2397   * Description: <b>The provider or device that identified the issue</b><br>
2398   * Type: <b>reference</b><br>
2399   * Path: <b>DetectedIssue.author</b><br>
2400   * </p>
2401   */
2402  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2403      SP_AUTHOR);
2404
2405  /**
2406   * Constant for fluent queries to be used to add include statements. Specifies
2407   * the path value of "<b>DetectedIssue:author</b>".
2408   */
2409  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include(
2410      "DetectedIssue:author").toLocked();
2411
2412  /**
2413   * Search parameter: <b>implicated</b>
2414   * <p>
2415   * Description: <b>Problem resource</b><br>
2416   * Type: <b>reference</b><br>
2417   * Path: <b>DetectedIssue.implicated</b><br>
2418   * </p>
2419   */
2420  @SearchParamDefinition(name = "implicated", path = "DetectedIssue.implicated", description = "Problem resource", type = "reference")
2421  public static final String SP_IMPLICATED = "implicated";
2422  /**
2423   * <b>Fluent Client</b> search parameter constant for <b>implicated</b>
2424   * <p>
2425   * Description: <b>Problem resource</b><br>
2426   * Type: <b>reference</b><br>
2427   * Path: <b>DetectedIssue.implicated</b><br>
2428   * </p>
2429   */
2430  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam IMPLICATED = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2431      SP_IMPLICATED);
2432
2433  /**
2434   * Constant for fluent queries to be used to add include statements. Specifies
2435   * the path value of "<b>DetectedIssue:implicated</b>".
2436   */
2437  public static final ca.uhn.fhir.model.api.Include INCLUDE_IMPLICATED = new ca.uhn.fhir.model.api.Include(
2438      "DetectedIssue:implicated").toLocked();
2439
2440}