001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * An event (i.e. any change to current patient status) that may be related to unintended effects on a patient or research subject.  The unintended effects may require additional monitoring, treatment or hospitalization or may result in death.  The AdverseEvent resource also extends to potential or avoided events that could have had such effects.
052 */
053@ResourceDef(name="AdverseEvent", profile="http://hl7.org/fhir/StructureDefinition/AdverseEvent")
054public class AdverseEvent extends DomainResource {
055
056    public enum AdverseEventActuality {
057        /**
058         * The adverse event actually happened regardless of whether anyone was affected or harmed.
059         */
060        ACTUAL, 
061        /**
062         * A potential adverse event.
063         */
064        POTENTIAL, 
065        /**
066         * added to help the parsers with the generic types
067         */
068        NULL;
069        public static AdverseEventActuality fromCode(String codeString) throws FHIRException {
070            if (codeString == null || "".equals(codeString))
071                return null;
072        if ("actual".equals(codeString))
073          return ACTUAL;
074        if ("potential".equals(codeString))
075          return POTENTIAL;
076        if (Configuration.isAcceptInvalidEnums())
077          return null;
078        else
079          throw new FHIRException("Unknown AdverseEventActuality code '"+codeString+"'");
080        }
081        public String toCode() {
082          switch (this) {
083            case ACTUAL: return "actual";
084            case POTENTIAL: return "potential";
085            default: return "?";
086          }
087        }
088        public String getSystem() {
089          switch (this) {
090            case ACTUAL: return "http://hl7.org/fhir/adverse-event-actuality";
091            case POTENTIAL: return "http://hl7.org/fhir/adverse-event-actuality";
092            default: return "?";
093          }
094        }
095        public String getDefinition() {
096          switch (this) {
097            case ACTUAL: return "The adverse event actually happened regardless of whether anyone was affected or harmed.";
098            case POTENTIAL: return "A potential adverse event.";
099            default: return "?";
100          }
101        }
102        public String getDisplay() {
103          switch (this) {
104            case ACTUAL: return "Adverse Event";
105            case POTENTIAL: return "Potential Adverse Event";
106            default: return "?";
107          }
108        }
109    }
110
111  public static class AdverseEventActualityEnumFactory implements EnumFactory<AdverseEventActuality> {
112    public AdverseEventActuality fromCode(String codeString) throws IllegalArgumentException {
113      if (codeString == null || "".equals(codeString))
114            if (codeString == null || "".equals(codeString))
115                return null;
116        if ("actual".equals(codeString))
117          return AdverseEventActuality.ACTUAL;
118        if ("potential".equals(codeString))
119          return AdverseEventActuality.POTENTIAL;
120        throw new IllegalArgumentException("Unknown AdverseEventActuality code '"+codeString+"'");
121        }
122        public Enumeration<AdverseEventActuality> fromType(Base code) throws FHIRException {
123          if (code == null)
124            return null;
125          if (code.isEmpty())
126            return new Enumeration<AdverseEventActuality>(this);
127          String codeString = ((PrimitiveType) code).asStringValue();
128          if (codeString == null || "".equals(codeString))
129            return null;
130        if ("actual".equals(codeString))
131          return new Enumeration<AdverseEventActuality>(this, AdverseEventActuality.ACTUAL);
132        if ("potential".equals(codeString))
133          return new Enumeration<AdverseEventActuality>(this, AdverseEventActuality.POTENTIAL);
134        throw new FHIRException("Unknown AdverseEventActuality code '"+codeString+"'");
135        }
136    public String toCode(AdverseEventActuality code) {
137      if (code == AdverseEventActuality.ACTUAL)
138        return "actual";
139      if (code == AdverseEventActuality.POTENTIAL)
140        return "potential";
141      return "?";
142      }
143    public String toSystem(AdverseEventActuality code) {
144      return code.getSystem();
145      }
146    }
147
148    public enum AdverseEventStatus {
149        /**
150         * The event is currently occurring.
151         */
152        INPROGRESS, 
153        /**
154         * The event has now concluded.
155         */
156        COMPLETED, 
157        /**
158         * 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 \"stopped\" rather than \"entered-in-error\".).
159         */
160        ENTEREDINERROR, 
161        /**
162         * The authoring/source system does not know which of the status values currently applies for this event.  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.
163         */
164        UNKNOWN, 
165        /**
166         * added to help the parsers with the generic types
167         */
168        NULL;
169        public static AdverseEventStatus fromCode(String codeString) throws FHIRException {
170            if (codeString == null || "".equals(codeString))
171                return null;
172        if ("in-progress".equals(codeString))
173          return INPROGRESS;
174        if ("completed".equals(codeString))
175          return COMPLETED;
176        if ("entered-in-error".equals(codeString))
177          return ENTEREDINERROR;
178        if ("unknown".equals(codeString))
179          return UNKNOWN;
180        if (Configuration.isAcceptInvalidEnums())
181          return null;
182        else
183          throw new FHIRException("Unknown AdverseEventStatus code '"+codeString+"'");
184        }
185        public String toCode() {
186          switch (this) {
187            case INPROGRESS: return "in-progress";
188            case COMPLETED: return "completed";
189            case ENTEREDINERROR: return "entered-in-error";
190            case UNKNOWN: return "unknown";
191            default: return "?";
192          }
193        }
194        public String getSystem() {
195          switch (this) {
196            case INPROGRESS: return "http://hl7.org/fhir/event-status";
197            case COMPLETED: return "http://hl7.org/fhir/event-status";
198            case ENTEREDINERROR: return "http://hl7.org/fhir/event-status";
199            case UNKNOWN: return "http://hl7.org/fhir/event-status";
200            default: return "?";
201          }
202        }
203        public String getDefinition() {
204          switch (this) {
205            case INPROGRESS: return "The event is currently occurring.";
206            case COMPLETED: return "The event has now concluded.";
207            case ENTEREDINERROR: return "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 \"stopped\" rather than \"entered-in-error\".).";
208            case UNKNOWN: return "The authoring/source system does not know which of the status values currently applies for this event.  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.";
209            default: return "?";
210          }
211        }
212        public String getDisplay() {
213          switch (this) {
214            case INPROGRESS: return "In Progress";
215            case COMPLETED: return "Completed";
216            case ENTEREDINERROR: return "Entered in Error";
217            case UNKNOWN: return "Unknown";
218            default: return "?";
219          }
220        }
221    }
222
223  public static class AdverseEventStatusEnumFactory implements EnumFactory<AdverseEventStatus> {
224    public AdverseEventStatus fromCode(String codeString) throws IllegalArgumentException {
225      if (codeString == null || "".equals(codeString))
226            if (codeString == null || "".equals(codeString))
227                return null;
228        if ("in-progress".equals(codeString))
229          return AdverseEventStatus.INPROGRESS;
230        if ("completed".equals(codeString))
231          return AdverseEventStatus.COMPLETED;
232        if ("entered-in-error".equals(codeString))
233          return AdverseEventStatus.ENTEREDINERROR;
234        if ("unknown".equals(codeString))
235          return AdverseEventStatus.UNKNOWN;
236        throw new IllegalArgumentException("Unknown AdverseEventStatus code '"+codeString+"'");
237        }
238        public Enumeration<AdverseEventStatus> fromType(Base code) throws FHIRException {
239          if (code == null)
240            return null;
241          if (code.isEmpty())
242            return new Enumeration<AdverseEventStatus>(this);
243          String codeString = ((PrimitiveType) code).asStringValue();
244          if (codeString == null || "".equals(codeString))
245            return null;
246        if ("in-progress".equals(codeString))
247          return new Enumeration<AdverseEventStatus>(this, AdverseEventStatus.INPROGRESS);
248        if ("completed".equals(codeString))
249          return new Enumeration<AdverseEventStatus>(this, AdverseEventStatus.COMPLETED);
250        if ("entered-in-error".equals(codeString))
251          return new Enumeration<AdverseEventStatus>(this, AdverseEventStatus.ENTEREDINERROR);
252        if ("unknown".equals(codeString))
253          return new Enumeration<AdverseEventStatus>(this, AdverseEventStatus.UNKNOWN);
254        throw new FHIRException("Unknown AdverseEventStatus code '"+codeString+"'");
255        }
256    public String toCode(AdverseEventStatus code) {
257      if (code == AdverseEventStatus.INPROGRESS)
258        return "in-progress";
259      if (code == AdverseEventStatus.COMPLETED)
260        return "completed";
261      if (code == AdverseEventStatus.ENTEREDINERROR)
262        return "entered-in-error";
263      if (code == AdverseEventStatus.UNKNOWN)
264        return "unknown";
265      return "?";
266      }
267    public String toSystem(AdverseEventStatus code) {
268      return code.getSystem();
269      }
270    }
271
272    @Block()
273    public static class AdverseEventParticipantComponent extends BackboneElement implements IBaseBackboneElement {
274        /**
275         * Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.
276         */
277        @Child(name = "function", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
278        @Description(shortDefinition="Type of involvement", formalDefinition="Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant." )
279        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-participant-function")
280        protected CodeableConcept function;
281
282        /**
283         * Indicates who or what participated in the event.
284         */
285        @Child(name = "actor", type = {Practitioner.class, PractitionerRole.class, Organization.class, CareTeam.class, Patient.class, Device.class, RelatedPerson.class}, order=2, min=1, max=1, modifier=false, summary=true)
286        @Description(shortDefinition="Who was involved in the adverse event or the potential adverse event", formalDefinition="Indicates who or what participated in the event." )
287        protected Reference actor;
288
289        private static final long serialVersionUID = -576943815L;
290
291    /**
292     * Constructor
293     */
294      public AdverseEventParticipantComponent() {
295        super();
296      }
297
298    /**
299     * Constructor
300     */
301      public AdverseEventParticipantComponent(Reference actor) {
302        super();
303        this.setActor(actor);
304      }
305
306        /**
307         * @return {@link #function} (Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.)
308         */
309        public CodeableConcept getFunction() { 
310          if (this.function == null)
311            if (Configuration.errorOnAutoCreate())
312              throw new Error("Attempt to auto-create AdverseEventParticipantComponent.function");
313            else if (Configuration.doAutoCreate())
314              this.function = new CodeableConcept(); // cc
315          return this.function;
316        }
317
318        public boolean hasFunction() { 
319          return this.function != null && !this.function.isEmpty();
320        }
321
322        /**
323         * @param value {@link #function} (Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.)
324         */
325        public AdverseEventParticipantComponent setFunction(CodeableConcept value) { 
326          this.function = value;
327          return this;
328        }
329
330        /**
331         * @return {@link #actor} (Indicates who or what participated in the event.)
332         */
333        public Reference getActor() { 
334          if (this.actor == null)
335            if (Configuration.errorOnAutoCreate())
336              throw new Error("Attempt to auto-create AdverseEventParticipantComponent.actor");
337            else if (Configuration.doAutoCreate())
338              this.actor = new Reference(); // cc
339          return this.actor;
340        }
341
342        public boolean hasActor() { 
343          return this.actor != null && !this.actor.isEmpty();
344        }
345
346        /**
347         * @param value {@link #actor} (Indicates who or what participated in the event.)
348         */
349        public AdverseEventParticipantComponent setActor(Reference value) { 
350          this.actor = value;
351          return this;
352        }
353
354        protected void listChildren(List<Property> children) {
355          super.listChildren(children);
356          children.add(new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.", 0, 1, function));
357          children.add(new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Indicates who or what participated in the event.", 0, 1, actor));
358        }
359
360        @Override
361        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
362          switch (_hash) {
363          case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "Distinguishes the type of involvement of the actor in the adverse event, such as contributor or informant.", 0, 1, function);
364          case 92645877: /*actor*/  return new Property("actor", "Reference(Practitioner|PractitionerRole|Organization|CareTeam|Patient|Device|RelatedPerson)", "Indicates who or what participated in the event.", 0, 1, actor);
365          default: return super.getNamedProperty(_hash, _name, _checkValid);
366          }
367
368        }
369
370      @Override
371      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
372        switch (hash) {
373        case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept
374        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
375        default: return super.getProperty(hash, name, checkValid);
376        }
377
378      }
379
380      @Override
381      public Base setProperty(int hash, String name, Base value) throws FHIRException {
382        switch (hash) {
383        case 1380938712: // function
384          this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
385          return value;
386        case 92645877: // actor
387          this.actor = TypeConvertor.castToReference(value); // Reference
388          return value;
389        default: return super.setProperty(hash, name, value);
390        }
391
392      }
393
394      @Override
395      public Base setProperty(String name, Base value) throws FHIRException {
396        if (name.equals("function")) {
397          this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
398        } else if (name.equals("actor")) {
399          this.actor = TypeConvertor.castToReference(value); // Reference
400        } else
401          return super.setProperty(name, value);
402        return value;
403      }
404
405      @Override
406      public Base makeProperty(int hash, String name) throws FHIRException {
407        switch (hash) {
408        case 1380938712:  return getFunction();
409        case 92645877:  return getActor();
410        default: return super.makeProperty(hash, name);
411        }
412
413      }
414
415      @Override
416      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
417        switch (hash) {
418        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
419        case 92645877: /*actor*/ return new String[] {"Reference"};
420        default: return super.getTypesForProperty(hash, name);
421        }
422
423      }
424
425      @Override
426      public Base addChild(String name) throws FHIRException {
427        if (name.equals("function")) {
428          this.function = new CodeableConcept();
429          return this.function;
430        }
431        else if (name.equals("actor")) {
432          this.actor = new Reference();
433          return this.actor;
434        }
435        else
436          return super.addChild(name);
437      }
438
439      public AdverseEventParticipantComponent copy() {
440        AdverseEventParticipantComponent dst = new AdverseEventParticipantComponent();
441        copyValues(dst);
442        return dst;
443      }
444
445      public void copyValues(AdverseEventParticipantComponent dst) {
446        super.copyValues(dst);
447        dst.function = function == null ? null : function.copy();
448        dst.actor = actor == null ? null : actor.copy();
449      }
450
451      @Override
452      public boolean equalsDeep(Base other_) {
453        if (!super.equalsDeep(other_))
454          return false;
455        if (!(other_ instanceof AdverseEventParticipantComponent))
456          return false;
457        AdverseEventParticipantComponent o = (AdverseEventParticipantComponent) other_;
458        return compareDeep(function, o.function, true) && compareDeep(actor, o.actor, true);
459      }
460
461      @Override
462      public boolean equalsShallow(Base other_) {
463        if (!super.equalsShallow(other_))
464          return false;
465        if (!(other_ instanceof AdverseEventParticipantComponent))
466          return false;
467        AdverseEventParticipantComponent o = (AdverseEventParticipantComponent) other_;
468        return true;
469      }
470
471      public boolean isEmpty() {
472        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(function, actor);
473      }
474
475  public String fhirType() {
476    return "AdverseEvent.participant";
477
478  }
479
480  }
481
482    @Block()
483    public static class AdverseEventSuspectEntityComponent extends BackboneElement implements IBaseBackboneElement {
484        /**
485         * Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.
486         */
487        @Child(name = "instance", type = {CodeableConcept.class, Immunization.class, Procedure.class, Substance.class, Medication.class, MedicationAdministration.class, MedicationUsage.class, Device.class}, order=1, min=1, max=1, modifier=false, summary=true)
488        @Description(shortDefinition="Refers to the specific entity that caused the adverse event", formalDefinition="Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device." )
489        protected DataType instance;
490
491        /**
492         * Information on the possible cause of the event.
493         */
494        @Child(name = "causality", type = {}, order=2, min=0, max=1, modifier=false, summary=true)
495        @Description(shortDefinition="Information on the possible cause of the event", formalDefinition="Information on the possible cause of the event." )
496        protected AdverseEventSuspectEntityCausalityComponent causality;
497
498        private static final long serialVersionUID = -1455097004L;
499
500    /**
501     * Constructor
502     */
503      public AdverseEventSuspectEntityComponent() {
504        super();
505      }
506
507    /**
508     * Constructor
509     */
510      public AdverseEventSuspectEntityComponent(DataType instance) {
511        super();
512        this.setInstance(instance);
513      }
514
515        /**
516         * @return {@link #instance} (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
517         */
518        public DataType getInstance() { 
519          return this.instance;
520        }
521
522        /**
523         * @return {@link #instance} (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
524         */
525        public CodeableConcept getInstanceCodeableConcept() throws FHIRException { 
526          if (this.instance == null)
527            this.instance = new CodeableConcept();
528          if (!(this.instance instanceof CodeableConcept))
529            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.instance.getClass().getName()+" was encountered");
530          return (CodeableConcept) this.instance;
531        }
532
533        public boolean hasInstanceCodeableConcept() { 
534          return this != null && this.instance instanceof CodeableConcept;
535        }
536
537        /**
538         * @return {@link #instance} (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
539         */
540        public Reference getInstanceReference() throws FHIRException { 
541          if (this.instance == null)
542            this.instance = new Reference();
543          if (!(this.instance instanceof Reference))
544            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.instance.getClass().getName()+" was encountered");
545          return (Reference) this.instance;
546        }
547
548        public boolean hasInstanceReference() { 
549          return this != null && this.instance instanceof Reference;
550        }
551
552        public boolean hasInstance() { 
553          return this.instance != null && !this.instance.isEmpty();
554        }
555
556        /**
557         * @param value {@link #instance} (Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.)
558         */
559        public AdverseEventSuspectEntityComponent setInstance(DataType value) { 
560          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
561            throw new Error("Not the right type for AdverseEvent.suspectEntity.instance[x]: "+value.fhirType());
562          this.instance = value;
563          return this;
564        }
565
566        /**
567         * @return {@link #causality} (Information on the possible cause of the event.)
568         */
569        public AdverseEventSuspectEntityCausalityComponent getCausality() { 
570          if (this.causality == null)
571            if (Configuration.errorOnAutoCreate())
572              throw new Error("Attempt to auto-create AdverseEventSuspectEntityComponent.causality");
573            else if (Configuration.doAutoCreate())
574              this.causality = new AdverseEventSuspectEntityCausalityComponent(); // cc
575          return this.causality;
576        }
577
578        public boolean hasCausality() { 
579          return this.causality != null && !this.causality.isEmpty();
580        }
581
582        /**
583         * @param value {@link #causality} (Information on the possible cause of the event.)
584         */
585        public AdverseEventSuspectEntityComponent setCausality(AdverseEventSuspectEntityCausalityComponent value) { 
586          this.causality = value;
587          return this;
588        }
589
590        protected void listChildren(List<Property> children) {
591          super.listChildren(children);
592          children.add(new Property("instance[x]", "CodeableConcept|Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|Device)", "Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance));
593          children.add(new Property("causality", "", "Information on the possible cause of the event.", 0, 1, causality));
594        }
595
596        @Override
597        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
598          switch (_hash) {
599          case -2101998645: /*instance[x]*/  return new Property("instance[x]", "CodeableConcept|Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|Device)", "Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance);
600          case 555127957: /*instance*/  return new Property("instance[x]", "CodeableConcept|Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|Device)", "Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance);
601          case 697546316: /*instanceCodeableConcept*/  return new Property("instance[x]", "CodeableConcept", "Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance);
602          case -1675877834: /*instanceReference*/  return new Property("instance[x]", "Reference(Immunization|Procedure|Substance|Medication|MedicationAdministration|MedicationUsage|Device)", "Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.", 0, 1, instance);
603          case -1446450521: /*causality*/  return new Property("causality", "", "Information on the possible cause of the event.", 0, 1, causality);
604          default: return super.getNamedProperty(_hash, _name, _checkValid);
605          }
606
607        }
608
609      @Override
610      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
611        switch (hash) {
612        case 555127957: /*instance*/ return this.instance == null ? new Base[0] : new Base[] {this.instance}; // DataType
613        case -1446450521: /*causality*/ return this.causality == null ? new Base[0] : new Base[] {this.causality}; // AdverseEventSuspectEntityCausalityComponent
614        default: return super.getProperty(hash, name, checkValid);
615        }
616
617      }
618
619      @Override
620      public Base setProperty(int hash, String name, Base value) throws FHIRException {
621        switch (hash) {
622        case 555127957: // instance
623          this.instance = TypeConvertor.castToType(value); // DataType
624          return value;
625        case -1446450521: // causality
626          this.causality = (AdverseEventSuspectEntityCausalityComponent) value; // AdverseEventSuspectEntityCausalityComponent
627          return value;
628        default: return super.setProperty(hash, name, value);
629        }
630
631      }
632
633      @Override
634      public Base setProperty(String name, Base value) throws FHIRException {
635        if (name.equals("instance[x]")) {
636          this.instance = TypeConvertor.castToType(value); // DataType
637        } else if (name.equals("causality")) {
638          this.causality = (AdverseEventSuspectEntityCausalityComponent) value; // AdverseEventSuspectEntityCausalityComponent
639        } else
640          return super.setProperty(name, value);
641        return value;
642      }
643
644      @Override
645      public Base makeProperty(int hash, String name) throws FHIRException {
646        switch (hash) {
647        case -2101998645:  return getInstance();
648        case 555127957:  return getInstance();
649        case -1446450521:  return getCausality();
650        default: return super.makeProperty(hash, name);
651        }
652
653      }
654
655      @Override
656      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
657        switch (hash) {
658        case 555127957: /*instance*/ return new String[] {"CodeableConcept", "Reference"};
659        case -1446450521: /*causality*/ return new String[] {};
660        default: return super.getTypesForProperty(hash, name);
661        }
662
663      }
664
665      @Override
666      public Base addChild(String name) throws FHIRException {
667        if (name.equals("instanceCodeableConcept")) {
668          this.instance = new CodeableConcept();
669          return this.instance;
670        }
671        else if (name.equals("instanceReference")) {
672          this.instance = new Reference();
673          return this.instance;
674        }
675        else if (name.equals("causality")) {
676          this.causality = new AdverseEventSuspectEntityCausalityComponent();
677          return this.causality;
678        }
679        else
680          return super.addChild(name);
681      }
682
683      public AdverseEventSuspectEntityComponent copy() {
684        AdverseEventSuspectEntityComponent dst = new AdverseEventSuspectEntityComponent();
685        copyValues(dst);
686        return dst;
687      }
688
689      public void copyValues(AdverseEventSuspectEntityComponent dst) {
690        super.copyValues(dst);
691        dst.instance = instance == null ? null : instance.copy();
692        dst.causality = causality == null ? null : causality.copy();
693      }
694
695      @Override
696      public boolean equalsDeep(Base other_) {
697        if (!super.equalsDeep(other_))
698          return false;
699        if (!(other_ instanceof AdverseEventSuspectEntityComponent))
700          return false;
701        AdverseEventSuspectEntityComponent o = (AdverseEventSuspectEntityComponent) other_;
702        return compareDeep(instance, o.instance, true) && compareDeep(causality, o.causality, true);
703      }
704
705      @Override
706      public boolean equalsShallow(Base other_) {
707        if (!super.equalsShallow(other_))
708          return false;
709        if (!(other_ instanceof AdverseEventSuspectEntityComponent))
710          return false;
711        AdverseEventSuspectEntityComponent o = (AdverseEventSuspectEntityComponent) other_;
712        return true;
713      }
714
715      public boolean isEmpty() {
716        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(instance, causality);
717      }
718
719  public String fhirType() {
720    return "AdverseEvent.suspectEntity";
721
722  }
723
724  }
725
726    @Block()
727    public static class AdverseEventSuspectEntityCausalityComponent extends BackboneElement implements IBaseBackboneElement {
728        /**
729         * The method of evaluating the relatedness of the suspected entity to the event.
730         */
731        @Child(name = "assessmentMethod", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
732        @Description(shortDefinition="Method of evaluating the relatedness of the suspected entity to the event", formalDefinition="The method of evaluating the relatedness of the suspected entity to the event." )
733        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-causality-method")
734        protected CodeableConcept assessmentMethod;
735
736        /**
737         * The result of the assessment regarding the relatedness of the suspected entity to the event.
738         */
739        @Child(name = "entityRelatedness", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
740        @Description(shortDefinition="Result of the assessment regarding the relatedness of the suspected entity to the event", formalDefinition="The result of the assessment regarding the relatedness of the suspected entity to the event." )
741        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-causality-assess")
742        protected CodeableConcept entityRelatedness;
743
744        /**
745         * The author of the information on the possible cause of the event.
746         */
747        @Child(name = "author", type = {Practitioner.class, PractitionerRole.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=true)
748        @Description(shortDefinition="Author of the information on the possible cause of the event", formalDefinition="The author of the information on the possible cause of the event." )
749        protected Reference author;
750
751        private static final long serialVersionUID = 486112728L;
752
753    /**
754     * Constructor
755     */
756      public AdverseEventSuspectEntityCausalityComponent() {
757        super();
758      }
759
760        /**
761         * @return {@link #assessmentMethod} (The method of evaluating the relatedness of the suspected entity to the event.)
762         */
763        public CodeableConcept getAssessmentMethod() { 
764          if (this.assessmentMethod == null)
765            if (Configuration.errorOnAutoCreate())
766              throw new Error("Attempt to auto-create AdverseEventSuspectEntityCausalityComponent.assessmentMethod");
767            else if (Configuration.doAutoCreate())
768              this.assessmentMethod = new CodeableConcept(); // cc
769          return this.assessmentMethod;
770        }
771
772        public boolean hasAssessmentMethod() { 
773          return this.assessmentMethod != null && !this.assessmentMethod.isEmpty();
774        }
775
776        /**
777         * @param value {@link #assessmentMethod} (The method of evaluating the relatedness of the suspected entity to the event.)
778         */
779        public AdverseEventSuspectEntityCausalityComponent setAssessmentMethod(CodeableConcept value) { 
780          this.assessmentMethod = value;
781          return this;
782        }
783
784        /**
785         * @return {@link #entityRelatedness} (The result of the assessment regarding the relatedness of the suspected entity to the event.)
786         */
787        public CodeableConcept getEntityRelatedness() { 
788          if (this.entityRelatedness == null)
789            if (Configuration.errorOnAutoCreate())
790              throw new Error("Attempt to auto-create AdverseEventSuspectEntityCausalityComponent.entityRelatedness");
791            else if (Configuration.doAutoCreate())
792              this.entityRelatedness = new CodeableConcept(); // cc
793          return this.entityRelatedness;
794        }
795
796        public boolean hasEntityRelatedness() { 
797          return this.entityRelatedness != null && !this.entityRelatedness.isEmpty();
798        }
799
800        /**
801         * @param value {@link #entityRelatedness} (The result of the assessment regarding the relatedness of the suspected entity to the event.)
802         */
803        public AdverseEventSuspectEntityCausalityComponent setEntityRelatedness(CodeableConcept value) { 
804          this.entityRelatedness = value;
805          return this;
806        }
807
808        /**
809         * @return {@link #author} (The author of the information on the possible cause of the event.)
810         */
811        public Reference getAuthor() { 
812          if (this.author == null)
813            if (Configuration.errorOnAutoCreate())
814              throw new Error("Attempt to auto-create AdverseEventSuspectEntityCausalityComponent.author");
815            else if (Configuration.doAutoCreate())
816              this.author = new Reference(); // cc
817          return this.author;
818        }
819
820        public boolean hasAuthor() { 
821          return this.author != null && !this.author.isEmpty();
822        }
823
824        /**
825         * @param value {@link #author} (The author of the information on the possible cause of the event.)
826         */
827        public AdverseEventSuspectEntityCausalityComponent setAuthor(Reference value) { 
828          this.author = value;
829          return this;
830        }
831
832        protected void listChildren(List<Property> children) {
833          super.listChildren(children);
834          children.add(new Property("assessmentMethod", "CodeableConcept", "The method of evaluating the relatedness of the suspected entity to the event.", 0, 1, assessmentMethod));
835          children.add(new Property("entityRelatedness", "CodeableConcept", "The result of the assessment regarding the relatedness of the suspected entity to the event.", 0, 1, entityRelatedness));
836          children.add(new Property("author", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "The author of the information on the possible cause of the event.", 0, 1, author));
837        }
838
839        @Override
840        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
841          switch (_hash) {
842          case 1681283651: /*assessmentMethod*/  return new Property("assessmentMethod", "CodeableConcept", "The method of evaluating the relatedness of the suspected entity to the event.", 0, 1, assessmentMethod);
843          case 2000199967: /*entityRelatedness*/  return new Property("entityRelatedness", "CodeableConcept", "The result of the assessment regarding the relatedness of the suspected entity to the event.", 0, 1, entityRelatedness);
844          case -1406328437: /*author*/  return new Property("author", "Reference(Practitioner|PractitionerRole|Patient|RelatedPerson)", "The author of the information on the possible cause of the event.", 0, 1, author);
845          default: return super.getNamedProperty(_hash, _name, _checkValid);
846          }
847
848        }
849
850      @Override
851      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
852        switch (hash) {
853        case 1681283651: /*assessmentMethod*/ return this.assessmentMethod == null ? new Base[0] : new Base[] {this.assessmentMethod}; // CodeableConcept
854        case 2000199967: /*entityRelatedness*/ return this.entityRelatedness == null ? new Base[0] : new Base[] {this.entityRelatedness}; // CodeableConcept
855        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
856        default: return super.getProperty(hash, name, checkValid);
857        }
858
859      }
860
861      @Override
862      public Base setProperty(int hash, String name, Base value) throws FHIRException {
863        switch (hash) {
864        case 1681283651: // assessmentMethod
865          this.assessmentMethod = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
866          return value;
867        case 2000199967: // entityRelatedness
868          this.entityRelatedness = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
869          return value;
870        case -1406328437: // author
871          this.author = TypeConvertor.castToReference(value); // Reference
872          return value;
873        default: return super.setProperty(hash, name, value);
874        }
875
876      }
877
878      @Override
879      public Base setProperty(String name, Base value) throws FHIRException {
880        if (name.equals("assessmentMethod")) {
881          this.assessmentMethod = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
882        } else if (name.equals("entityRelatedness")) {
883          this.entityRelatedness = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
884        } else if (name.equals("author")) {
885          this.author = TypeConvertor.castToReference(value); // Reference
886        } else
887          return super.setProperty(name, value);
888        return value;
889      }
890
891      @Override
892      public Base makeProperty(int hash, String name) throws FHIRException {
893        switch (hash) {
894        case 1681283651:  return getAssessmentMethod();
895        case 2000199967:  return getEntityRelatedness();
896        case -1406328437:  return getAuthor();
897        default: return super.makeProperty(hash, name);
898        }
899
900      }
901
902      @Override
903      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
904        switch (hash) {
905        case 1681283651: /*assessmentMethod*/ return new String[] {"CodeableConcept"};
906        case 2000199967: /*entityRelatedness*/ return new String[] {"CodeableConcept"};
907        case -1406328437: /*author*/ return new String[] {"Reference"};
908        default: return super.getTypesForProperty(hash, name);
909        }
910
911      }
912
913      @Override
914      public Base addChild(String name) throws FHIRException {
915        if (name.equals("assessmentMethod")) {
916          this.assessmentMethod = new CodeableConcept();
917          return this.assessmentMethod;
918        }
919        else if (name.equals("entityRelatedness")) {
920          this.entityRelatedness = new CodeableConcept();
921          return this.entityRelatedness;
922        }
923        else if (name.equals("author")) {
924          this.author = new Reference();
925          return this.author;
926        }
927        else
928          return super.addChild(name);
929      }
930
931      public AdverseEventSuspectEntityCausalityComponent copy() {
932        AdverseEventSuspectEntityCausalityComponent dst = new AdverseEventSuspectEntityCausalityComponent();
933        copyValues(dst);
934        return dst;
935      }
936
937      public void copyValues(AdverseEventSuspectEntityCausalityComponent dst) {
938        super.copyValues(dst);
939        dst.assessmentMethod = assessmentMethod == null ? null : assessmentMethod.copy();
940        dst.entityRelatedness = entityRelatedness == null ? null : entityRelatedness.copy();
941        dst.author = author == null ? null : author.copy();
942      }
943
944      @Override
945      public boolean equalsDeep(Base other_) {
946        if (!super.equalsDeep(other_))
947          return false;
948        if (!(other_ instanceof AdverseEventSuspectEntityCausalityComponent))
949          return false;
950        AdverseEventSuspectEntityCausalityComponent o = (AdverseEventSuspectEntityCausalityComponent) other_;
951        return compareDeep(assessmentMethod, o.assessmentMethod, true) && compareDeep(entityRelatedness, o.entityRelatedness, true)
952           && compareDeep(author, o.author, true);
953      }
954
955      @Override
956      public boolean equalsShallow(Base other_) {
957        if (!super.equalsShallow(other_))
958          return false;
959        if (!(other_ instanceof AdverseEventSuspectEntityCausalityComponent))
960          return false;
961        AdverseEventSuspectEntityCausalityComponent o = (AdverseEventSuspectEntityCausalityComponent) other_;
962        return true;
963      }
964
965      public boolean isEmpty() {
966        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(assessmentMethod, entityRelatedness
967          , author);
968      }
969
970  public String fhirType() {
971    return "AdverseEvent.suspectEntity.causality";
972
973  }
974
975  }
976
977    @Block()
978    public static class AdverseEventContributingFactorComponent extends BackboneElement implements IBaseBackboneElement {
979        /**
980         * The item that is suspected to have increased the probability or severity of the adverse event.
981         */
982        @Child(name = "item", type = {Condition.class, Observation.class, AllergyIntolerance.class, FamilyMemberHistory.class, Immunization.class, Procedure.class, DocumentReference.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
983        @Description(shortDefinition="Item suspected to have increased the probability or severity of the adverse event", formalDefinition="The item that is suspected to have increased the probability or severity of the adverse event." )
984        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-contributing-factor")
985        protected DataType item;
986
987        private static final long serialVersionUID = 1847936859L;
988
989    /**
990     * Constructor
991     */
992      public AdverseEventContributingFactorComponent() {
993        super();
994      }
995
996    /**
997     * Constructor
998     */
999      public AdverseEventContributingFactorComponent(DataType item) {
1000        super();
1001        this.setItem(item);
1002      }
1003
1004        /**
1005         * @return {@link #item} (The item that is suspected to have increased the probability or severity of the adverse event.)
1006         */
1007        public DataType getItem() { 
1008          return this.item;
1009        }
1010
1011        /**
1012         * @return {@link #item} (The item that is suspected to have increased the probability or severity of the adverse event.)
1013         */
1014        public Reference getItemReference() throws FHIRException { 
1015          if (this.item == null)
1016            this.item = new Reference();
1017          if (!(this.item instanceof Reference))
1018            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
1019          return (Reference) this.item;
1020        }
1021
1022        public boolean hasItemReference() { 
1023          return this != null && this.item instanceof Reference;
1024        }
1025
1026        /**
1027         * @return {@link #item} (The item that is suspected to have increased the probability or severity of the adverse event.)
1028         */
1029        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
1030          if (this.item == null)
1031            this.item = new CodeableConcept();
1032          if (!(this.item instanceof CodeableConcept))
1033            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
1034          return (CodeableConcept) this.item;
1035        }
1036
1037        public boolean hasItemCodeableConcept() { 
1038          return this != null && this.item instanceof CodeableConcept;
1039        }
1040
1041        public boolean hasItem() { 
1042          return this.item != null && !this.item.isEmpty();
1043        }
1044
1045        /**
1046         * @param value {@link #item} (The item that is suspected to have increased the probability or severity of the adverse event.)
1047         */
1048        public AdverseEventContributingFactorComponent setItem(DataType value) { 
1049          if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
1050            throw new Error("Not the right type for AdverseEvent.contributingFactor.item[x]: "+value.fhirType());
1051          this.item = value;
1052          return this;
1053        }
1054
1055        protected void listChildren(List<Property> children) {
1056          super.listChildren(children);
1057          children.add(new Property("item[x]", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)|CodeableConcept", "The item that is suspected to have increased the probability or severity of the adverse event.", 0, 1, item));
1058        }
1059
1060        @Override
1061        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1062          switch (_hash) {
1063          case 2116201613: /*item[x]*/  return new Property("item[x]", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)|CodeableConcept", "The item that is suspected to have increased the probability or severity of the adverse event.", 0, 1, item);
1064          case 3242771: /*item*/  return new Property("item[x]", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)|CodeableConcept", "The item that is suspected to have increased the probability or severity of the adverse event.", 0, 1, item);
1065          case 1376364920: /*itemReference*/  return new Property("item[x]", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)", "The item that is suspected to have increased the probability or severity of the adverse event.", 0, 1, item);
1066          case 106644494: /*itemCodeableConcept*/  return new Property("item[x]", "CodeableConcept", "The item that is suspected to have increased the probability or severity of the adverse event.", 0, 1, item);
1067          default: return super.getNamedProperty(_hash, _name, _checkValid);
1068          }
1069
1070        }
1071
1072      @Override
1073      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1074        switch (hash) {
1075        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // DataType
1076        default: return super.getProperty(hash, name, checkValid);
1077        }
1078
1079      }
1080
1081      @Override
1082      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1083        switch (hash) {
1084        case 3242771: // item
1085          this.item = TypeConvertor.castToType(value); // DataType
1086          return value;
1087        default: return super.setProperty(hash, name, value);
1088        }
1089
1090      }
1091
1092      @Override
1093      public Base setProperty(String name, Base value) throws FHIRException {
1094        if (name.equals("item[x]")) {
1095          this.item = TypeConvertor.castToType(value); // DataType
1096        } else
1097          return super.setProperty(name, value);
1098        return value;
1099      }
1100
1101      @Override
1102      public Base makeProperty(int hash, String name) throws FHIRException {
1103        switch (hash) {
1104        case 2116201613:  return getItem();
1105        case 3242771:  return getItem();
1106        default: return super.makeProperty(hash, name);
1107        }
1108
1109      }
1110
1111      @Override
1112      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1113        switch (hash) {
1114        case 3242771: /*item*/ return new String[] {"Reference", "CodeableConcept"};
1115        default: return super.getTypesForProperty(hash, name);
1116        }
1117
1118      }
1119
1120      @Override
1121      public Base addChild(String name) throws FHIRException {
1122        if (name.equals("itemReference")) {
1123          this.item = new Reference();
1124          return this.item;
1125        }
1126        else if (name.equals("itemCodeableConcept")) {
1127          this.item = new CodeableConcept();
1128          return this.item;
1129        }
1130        else
1131          return super.addChild(name);
1132      }
1133
1134      public AdverseEventContributingFactorComponent copy() {
1135        AdverseEventContributingFactorComponent dst = new AdverseEventContributingFactorComponent();
1136        copyValues(dst);
1137        return dst;
1138      }
1139
1140      public void copyValues(AdverseEventContributingFactorComponent dst) {
1141        super.copyValues(dst);
1142        dst.item = item == null ? null : item.copy();
1143      }
1144
1145      @Override
1146      public boolean equalsDeep(Base other_) {
1147        if (!super.equalsDeep(other_))
1148          return false;
1149        if (!(other_ instanceof AdverseEventContributingFactorComponent))
1150          return false;
1151        AdverseEventContributingFactorComponent o = (AdverseEventContributingFactorComponent) other_;
1152        return compareDeep(item, o.item, true);
1153      }
1154
1155      @Override
1156      public boolean equalsShallow(Base other_) {
1157        if (!super.equalsShallow(other_))
1158          return false;
1159        if (!(other_ instanceof AdverseEventContributingFactorComponent))
1160          return false;
1161        AdverseEventContributingFactorComponent o = (AdverseEventContributingFactorComponent) other_;
1162        return true;
1163      }
1164
1165      public boolean isEmpty() {
1166        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item);
1167      }
1168
1169  public String fhirType() {
1170    return "AdverseEvent.contributingFactor";
1171
1172  }
1173
1174  }
1175
1176    @Block()
1177    public static class AdverseEventPreventiveActionComponent extends BackboneElement implements IBaseBackboneElement {
1178        /**
1179         * The action that contributed to avoiding the adverse event.
1180         */
1181        @Child(name = "item", type = {Immunization.class, Procedure.class, DocumentReference.class, MedicationAdministration.class, MedicationRequest.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1182        @Description(shortDefinition="Action that contributed to avoiding the adverse event", formalDefinition="The action that contributed to avoiding the adverse event." )
1183        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-preventive-action")
1184        protected DataType item;
1185
1186        private static final long serialVersionUID = 1847936859L;
1187
1188    /**
1189     * Constructor
1190     */
1191      public AdverseEventPreventiveActionComponent() {
1192        super();
1193      }
1194
1195    /**
1196     * Constructor
1197     */
1198      public AdverseEventPreventiveActionComponent(DataType item) {
1199        super();
1200        this.setItem(item);
1201      }
1202
1203        /**
1204         * @return {@link #item} (The action that contributed to avoiding the adverse event.)
1205         */
1206        public DataType getItem() { 
1207          return this.item;
1208        }
1209
1210        /**
1211         * @return {@link #item} (The action that contributed to avoiding the adverse event.)
1212         */
1213        public Reference getItemReference() throws FHIRException { 
1214          if (this.item == null)
1215            this.item = new Reference();
1216          if (!(this.item instanceof Reference))
1217            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
1218          return (Reference) this.item;
1219        }
1220
1221        public boolean hasItemReference() { 
1222          return this != null && this.item instanceof Reference;
1223        }
1224
1225        /**
1226         * @return {@link #item} (The action that contributed to avoiding the adverse event.)
1227         */
1228        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
1229          if (this.item == null)
1230            this.item = new CodeableConcept();
1231          if (!(this.item instanceof CodeableConcept))
1232            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
1233          return (CodeableConcept) this.item;
1234        }
1235
1236        public boolean hasItemCodeableConcept() { 
1237          return this != null && this.item instanceof CodeableConcept;
1238        }
1239
1240        public boolean hasItem() { 
1241          return this.item != null && !this.item.isEmpty();
1242        }
1243
1244        /**
1245         * @param value {@link #item} (The action that contributed to avoiding the adverse event.)
1246         */
1247        public AdverseEventPreventiveActionComponent setItem(DataType value) { 
1248          if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
1249            throw new Error("Not the right type for AdverseEvent.preventiveAction.item[x]: "+value.fhirType());
1250          this.item = value;
1251          return this;
1252        }
1253
1254        protected void listChildren(List<Property> children) {
1255          super.listChildren(children);
1256          children.add(new Property("item[x]", "Reference(Immunization|Procedure|DocumentReference|MedicationAdministration|MedicationRequest)|CodeableConcept", "The action that contributed to avoiding the adverse event.", 0, 1, item));
1257        }
1258
1259        @Override
1260        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1261          switch (_hash) {
1262          case 2116201613: /*item[x]*/  return new Property("item[x]", "Reference(Immunization|Procedure|DocumentReference|MedicationAdministration|MedicationRequest)|CodeableConcept", "The action that contributed to avoiding the adverse event.", 0, 1, item);
1263          case 3242771: /*item*/  return new Property("item[x]", "Reference(Immunization|Procedure|DocumentReference|MedicationAdministration|MedicationRequest)|CodeableConcept", "The action that contributed to avoiding the adverse event.", 0, 1, item);
1264          case 1376364920: /*itemReference*/  return new Property("item[x]", "Reference(Immunization|Procedure|DocumentReference|MedicationAdministration|MedicationRequest)", "The action that contributed to avoiding the adverse event.", 0, 1, item);
1265          case 106644494: /*itemCodeableConcept*/  return new Property("item[x]", "CodeableConcept", "The action that contributed to avoiding the adverse event.", 0, 1, item);
1266          default: return super.getNamedProperty(_hash, _name, _checkValid);
1267          }
1268
1269        }
1270
1271      @Override
1272      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1273        switch (hash) {
1274        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // DataType
1275        default: return super.getProperty(hash, name, checkValid);
1276        }
1277
1278      }
1279
1280      @Override
1281      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1282        switch (hash) {
1283        case 3242771: // item
1284          this.item = TypeConvertor.castToType(value); // DataType
1285          return value;
1286        default: return super.setProperty(hash, name, value);
1287        }
1288
1289      }
1290
1291      @Override
1292      public Base setProperty(String name, Base value) throws FHIRException {
1293        if (name.equals("item[x]")) {
1294          this.item = TypeConvertor.castToType(value); // DataType
1295        } else
1296          return super.setProperty(name, value);
1297        return value;
1298      }
1299
1300      @Override
1301      public Base makeProperty(int hash, String name) throws FHIRException {
1302        switch (hash) {
1303        case 2116201613:  return getItem();
1304        case 3242771:  return getItem();
1305        default: return super.makeProperty(hash, name);
1306        }
1307
1308      }
1309
1310      @Override
1311      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1312        switch (hash) {
1313        case 3242771: /*item*/ return new String[] {"Reference", "CodeableConcept"};
1314        default: return super.getTypesForProperty(hash, name);
1315        }
1316
1317      }
1318
1319      @Override
1320      public Base addChild(String name) throws FHIRException {
1321        if (name.equals("itemReference")) {
1322          this.item = new Reference();
1323          return this.item;
1324        }
1325        else if (name.equals("itemCodeableConcept")) {
1326          this.item = new CodeableConcept();
1327          return this.item;
1328        }
1329        else
1330          return super.addChild(name);
1331      }
1332
1333      public AdverseEventPreventiveActionComponent copy() {
1334        AdverseEventPreventiveActionComponent dst = new AdverseEventPreventiveActionComponent();
1335        copyValues(dst);
1336        return dst;
1337      }
1338
1339      public void copyValues(AdverseEventPreventiveActionComponent dst) {
1340        super.copyValues(dst);
1341        dst.item = item == null ? null : item.copy();
1342      }
1343
1344      @Override
1345      public boolean equalsDeep(Base other_) {
1346        if (!super.equalsDeep(other_))
1347          return false;
1348        if (!(other_ instanceof AdverseEventPreventiveActionComponent))
1349          return false;
1350        AdverseEventPreventiveActionComponent o = (AdverseEventPreventiveActionComponent) other_;
1351        return compareDeep(item, o.item, true);
1352      }
1353
1354      @Override
1355      public boolean equalsShallow(Base other_) {
1356        if (!super.equalsShallow(other_))
1357          return false;
1358        if (!(other_ instanceof AdverseEventPreventiveActionComponent))
1359          return false;
1360        AdverseEventPreventiveActionComponent o = (AdverseEventPreventiveActionComponent) other_;
1361        return true;
1362      }
1363
1364      public boolean isEmpty() {
1365        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item);
1366      }
1367
1368  public String fhirType() {
1369    return "AdverseEvent.preventiveAction";
1370
1371  }
1372
1373  }
1374
1375    @Block()
1376    public static class AdverseEventMitigatingActionComponent extends BackboneElement implements IBaseBackboneElement {
1377        /**
1378         * The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.
1379         */
1380        @Child(name = "item", type = {Procedure.class, DocumentReference.class, MedicationAdministration.class, MedicationRequest.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1381        @Description(shortDefinition="Ameliorating action taken after the adverse event occured in order to reduce the extent of harm", formalDefinition="The ameliorating action taken after the adverse event occured in order to reduce the extent of harm." )
1382        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-mitigating-action")
1383        protected DataType item;
1384
1385        private static final long serialVersionUID = 1847936859L;
1386
1387    /**
1388     * Constructor
1389     */
1390      public AdverseEventMitigatingActionComponent() {
1391        super();
1392      }
1393
1394    /**
1395     * Constructor
1396     */
1397      public AdverseEventMitigatingActionComponent(DataType item) {
1398        super();
1399        this.setItem(item);
1400      }
1401
1402        /**
1403         * @return {@link #item} (The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.)
1404         */
1405        public DataType getItem() { 
1406          return this.item;
1407        }
1408
1409        /**
1410         * @return {@link #item} (The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.)
1411         */
1412        public Reference getItemReference() throws FHIRException { 
1413          if (this.item == null)
1414            this.item = new Reference();
1415          if (!(this.item instanceof Reference))
1416            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
1417          return (Reference) this.item;
1418        }
1419
1420        public boolean hasItemReference() { 
1421          return this != null && this.item instanceof Reference;
1422        }
1423
1424        /**
1425         * @return {@link #item} (The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.)
1426         */
1427        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
1428          if (this.item == null)
1429            this.item = new CodeableConcept();
1430          if (!(this.item instanceof CodeableConcept))
1431            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
1432          return (CodeableConcept) this.item;
1433        }
1434
1435        public boolean hasItemCodeableConcept() { 
1436          return this != null && this.item instanceof CodeableConcept;
1437        }
1438
1439        public boolean hasItem() { 
1440          return this.item != null && !this.item.isEmpty();
1441        }
1442
1443        /**
1444         * @param value {@link #item} (The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.)
1445         */
1446        public AdverseEventMitigatingActionComponent setItem(DataType value) { 
1447          if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
1448            throw new Error("Not the right type for AdverseEvent.mitigatingAction.item[x]: "+value.fhirType());
1449          this.item = value;
1450          return this;
1451        }
1452
1453        protected void listChildren(List<Property> children) {
1454          super.listChildren(children);
1455          children.add(new Property("item[x]", "Reference(Procedure|DocumentReference|MedicationAdministration|MedicationRequest)|CodeableConcept", "The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.", 0, 1, item));
1456        }
1457
1458        @Override
1459        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1460          switch (_hash) {
1461          case 2116201613: /*item[x]*/  return new Property("item[x]", "Reference(Procedure|DocumentReference|MedicationAdministration|MedicationRequest)|CodeableConcept", "The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.", 0, 1, item);
1462          case 3242771: /*item*/  return new Property("item[x]", "Reference(Procedure|DocumentReference|MedicationAdministration|MedicationRequest)|CodeableConcept", "The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.", 0, 1, item);
1463          case 1376364920: /*itemReference*/  return new Property("item[x]", "Reference(Procedure|DocumentReference|MedicationAdministration|MedicationRequest)", "The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.", 0, 1, item);
1464          case 106644494: /*itemCodeableConcept*/  return new Property("item[x]", "CodeableConcept", "The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.", 0, 1, item);
1465          default: return super.getNamedProperty(_hash, _name, _checkValid);
1466          }
1467
1468        }
1469
1470      @Override
1471      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1472        switch (hash) {
1473        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // DataType
1474        default: return super.getProperty(hash, name, checkValid);
1475        }
1476
1477      }
1478
1479      @Override
1480      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1481        switch (hash) {
1482        case 3242771: // item
1483          this.item = TypeConvertor.castToType(value); // DataType
1484          return value;
1485        default: return super.setProperty(hash, name, value);
1486        }
1487
1488      }
1489
1490      @Override
1491      public Base setProperty(String name, Base value) throws FHIRException {
1492        if (name.equals("item[x]")) {
1493          this.item = TypeConvertor.castToType(value); // DataType
1494        } else
1495          return super.setProperty(name, value);
1496        return value;
1497      }
1498
1499      @Override
1500      public Base makeProperty(int hash, String name) throws FHIRException {
1501        switch (hash) {
1502        case 2116201613:  return getItem();
1503        case 3242771:  return getItem();
1504        default: return super.makeProperty(hash, name);
1505        }
1506
1507      }
1508
1509      @Override
1510      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1511        switch (hash) {
1512        case 3242771: /*item*/ return new String[] {"Reference", "CodeableConcept"};
1513        default: return super.getTypesForProperty(hash, name);
1514        }
1515
1516      }
1517
1518      @Override
1519      public Base addChild(String name) throws FHIRException {
1520        if (name.equals("itemReference")) {
1521          this.item = new Reference();
1522          return this.item;
1523        }
1524        else if (name.equals("itemCodeableConcept")) {
1525          this.item = new CodeableConcept();
1526          return this.item;
1527        }
1528        else
1529          return super.addChild(name);
1530      }
1531
1532      public AdverseEventMitigatingActionComponent copy() {
1533        AdverseEventMitigatingActionComponent dst = new AdverseEventMitigatingActionComponent();
1534        copyValues(dst);
1535        return dst;
1536      }
1537
1538      public void copyValues(AdverseEventMitigatingActionComponent dst) {
1539        super.copyValues(dst);
1540        dst.item = item == null ? null : item.copy();
1541      }
1542
1543      @Override
1544      public boolean equalsDeep(Base other_) {
1545        if (!super.equalsDeep(other_))
1546          return false;
1547        if (!(other_ instanceof AdverseEventMitigatingActionComponent))
1548          return false;
1549        AdverseEventMitigatingActionComponent o = (AdverseEventMitigatingActionComponent) other_;
1550        return compareDeep(item, o.item, true);
1551      }
1552
1553      @Override
1554      public boolean equalsShallow(Base other_) {
1555        if (!super.equalsShallow(other_))
1556          return false;
1557        if (!(other_ instanceof AdverseEventMitigatingActionComponent))
1558          return false;
1559        AdverseEventMitigatingActionComponent o = (AdverseEventMitigatingActionComponent) other_;
1560        return true;
1561      }
1562
1563      public boolean isEmpty() {
1564        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item);
1565      }
1566
1567  public String fhirType() {
1568    return "AdverseEvent.mitigatingAction";
1569
1570  }
1571
1572  }
1573
1574    @Block()
1575    public static class AdverseEventSupportingInfoComponent extends BackboneElement implements IBaseBackboneElement {
1576        /**
1577         * Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.
1578         */
1579        @Child(name = "item", type = {Condition.class, Observation.class, AllergyIntolerance.class, FamilyMemberHistory.class, Immunization.class, Procedure.class, DocumentReference.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1580        @Description(shortDefinition="Subject medical history or document relevant to this adverse event", formalDefinition="Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action." )
1581        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-supporting-info")
1582        protected DataType item;
1583
1584        private static final long serialVersionUID = 1847936859L;
1585
1586    /**
1587     * Constructor
1588     */
1589      public AdverseEventSupportingInfoComponent() {
1590        super();
1591      }
1592
1593    /**
1594     * Constructor
1595     */
1596      public AdverseEventSupportingInfoComponent(DataType item) {
1597        super();
1598        this.setItem(item);
1599      }
1600
1601        /**
1602         * @return {@link #item} (Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.)
1603         */
1604        public DataType getItem() { 
1605          return this.item;
1606        }
1607
1608        /**
1609         * @return {@link #item} (Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.)
1610         */
1611        public Reference getItemReference() throws FHIRException { 
1612          if (this.item == null)
1613            this.item = new Reference();
1614          if (!(this.item instanceof Reference))
1615            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
1616          return (Reference) this.item;
1617        }
1618
1619        public boolean hasItemReference() { 
1620          return this != null && this.item instanceof Reference;
1621        }
1622
1623        /**
1624         * @return {@link #item} (Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.)
1625         */
1626        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
1627          if (this.item == null)
1628            this.item = new CodeableConcept();
1629          if (!(this.item instanceof CodeableConcept))
1630            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
1631          return (CodeableConcept) this.item;
1632        }
1633
1634        public boolean hasItemCodeableConcept() { 
1635          return this != null && this.item instanceof CodeableConcept;
1636        }
1637
1638        public boolean hasItem() { 
1639          return this.item != null && !this.item.isEmpty();
1640        }
1641
1642        /**
1643         * @param value {@link #item} (Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.)
1644         */
1645        public AdverseEventSupportingInfoComponent setItem(DataType value) { 
1646          if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
1647            throw new Error("Not the right type for AdverseEvent.supportingInfo.item[x]: "+value.fhirType());
1648          this.item = value;
1649          return this;
1650        }
1651
1652        protected void listChildren(List<Property> children) {
1653          super.listChildren(children);
1654          children.add(new Property("item[x]", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)|CodeableConcept", "Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.", 0, 1, item));
1655        }
1656
1657        @Override
1658        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1659          switch (_hash) {
1660          case 2116201613: /*item[x]*/  return new Property("item[x]", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)|CodeableConcept", "Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.", 0, 1, item);
1661          case 3242771: /*item*/  return new Property("item[x]", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)|CodeableConcept", "Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.", 0, 1, item);
1662          case 1376364920: /*itemReference*/  return new Property("item[x]", "Reference(Condition|Observation|AllergyIntolerance|FamilyMemberHistory|Immunization|Procedure|DocumentReference)", "Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.", 0, 1, item);
1663          case 106644494: /*itemCodeableConcept*/  return new Property("item[x]", "CodeableConcept", "Relevant past history for the subject. In a clinical care context, an example being a patient had an adverse event following a pencillin administration and the patient had a previously documented penicillin allergy. In a clinical trials context, an example is a bunion or rash that was present prior to the study. Additionally, the supporting item can be a document that is relevant to this instance of the adverse event that is not part of the subject's medical history. For example, a clinical note, staff list, or material safety data sheet (MSDS).  Supporting information is not a contributing factor, preventive action, or mitigating action.", 0, 1, item);
1664          default: return super.getNamedProperty(_hash, _name, _checkValid);
1665          }
1666
1667        }
1668
1669      @Override
1670      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1671        switch (hash) {
1672        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // DataType
1673        default: return super.getProperty(hash, name, checkValid);
1674        }
1675
1676      }
1677
1678      @Override
1679      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1680        switch (hash) {
1681        case 3242771: // item
1682          this.item = TypeConvertor.castToType(value); // DataType
1683          return value;
1684        default: return super.setProperty(hash, name, value);
1685        }
1686
1687      }
1688
1689      @Override
1690      public Base setProperty(String name, Base value) throws FHIRException {
1691        if (name.equals("item[x]")) {
1692          this.item = TypeConvertor.castToType(value); // DataType
1693        } else
1694          return super.setProperty(name, value);
1695        return value;
1696      }
1697
1698      @Override
1699      public Base makeProperty(int hash, String name) throws FHIRException {
1700        switch (hash) {
1701        case 2116201613:  return getItem();
1702        case 3242771:  return getItem();
1703        default: return super.makeProperty(hash, name);
1704        }
1705
1706      }
1707
1708      @Override
1709      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1710        switch (hash) {
1711        case 3242771: /*item*/ return new String[] {"Reference", "CodeableConcept"};
1712        default: return super.getTypesForProperty(hash, name);
1713        }
1714
1715      }
1716
1717      @Override
1718      public Base addChild(String name) throws FHIRException {
1719        if (name.equals("itemReference")) {
1720          this.item = new Reference();
1721          return this.item;
1722        }
1723        else if (name.equals("itemCodeableConcept")) {
1724          this.item = new CodeableConcept();
1725          return this.item;
1726        }
1727        else
1728          return super.addChild(name);
1729      }
1730
1731      public AdverseEventSupportingInfoComponent copy() {
1732        AdverseEventSupportingInfoComponent dst = new AdverseEventSupportingInfoComponent();
1733        copyValues(dst);
1734        return dst;
1735      }
1736
1737      public void copyValues(AdverseEventSupportingInfoComponent dst) {
1738        super.copyValues(dst);
1739        dst.item = item == null ? null : item.copy();
1740      }
1741
1742      @Override
1743      public boolean equalsDeep(Base other_) {
1744        if (!super.equalsDeep(other_))
1745          return false;
1746        if (!(other_ instanceof AdverseEventSupportingInfoComponent))
1747          return false;
1748        AdverseEventSupportingInfoComponent o = (AdverseEventSupportingInfoComponent) other_;
1749        return compareDeep(item, o.item, true);
1750      }
1751
1752      @Override
1753      public boolean equalsShallow(Base other_) {
1754        if (!super.equalsShallow(other_))
1755          return false;
1756        if (!(other_ instanceof AdverseEventSupportingInfoComponent))
1757          return false;
1758        AdverseEventSupportingInfoComponent o = (AdverseEventSupportingInfoComponent) other_;
1759        return true;
1760      }
1761
1762      public boolean isEmpty() {
1763        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item);
1764      }
1765
1766  public String fhirType() {
1767    return "AdverseEvent.supportingInfo";
1768
1769  }
1770
1771  }
1772
1773    /**
1774     * Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.
1775     */
1776    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1777    @Description(shortDefinition="Business identifier for the event", formalDefinition="Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server." )
1778    protected List<Identifier> identifier;
1779
1780    /**
1781     * The current state of the adverse event or potential adverse event.
1782     */
1783    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1784    @Description(shortDefinition="in-progress | completed | entered-in-error | unknown", formalDefinition="The current state of the adverse event or potential adverse event." )
1785    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-status")
1786    protected Enumeration<AdverseEventStatus> status;
1787
1788    /**
1789     * Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.
1790     */
1791    @Child(name = "actuality", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
1792    @Description(shortDefinition="actual | potential", formalDefinition="Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely." )
1793    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-actuality")
1794    protected Enumeration<AdverseEventActuality> actuality;
1795
1796    /**
1797     * The overall type of event, intended for search and filtering purposes.
1798     */
1799    @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1800    @Description(shortDefinition="wrong-patient | procedure-mishap | medication-mishap | device | unsafe-physical-environment | hospital-aquired-infection | wrong-body-site", formalDefinition="The overall type of event, intended for search and filtering purposes." )
1801    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-category")
1802    protected List<CodeableConcept> category;
1803
1804    /**
1805     * Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.
1806     */
1807    @Child(name = "code", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1808    @Description(shortDefinition="Event or incident that occurred or was averted", formalDefinition="Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused." )
1809    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-type")
1810    protected CodeableConcept code;
1811
1812    /**
1813     * This subject or group impacted by the event.
1814     */
1815    @Child(name = "subject", type = {Patient.class, Group.class, Practitioner.class, RelatedPerson.class}, order=5, min=1, max=1, modifier=false, summary=true)
1816    @Description(shortDefinition="Subject impacted by event", formalDefinition="This subject or group impacted by the event." )
1817    protected Reference subject;
1818
1819    /**
1820     * The Encounter associated with the start of the AdverseEvent.
1821     */
1822    @Child(name = "encounter", type = {Encounter.class}, order=6, min=0, max=1, modifier=false, summary=true)
1823    @Description(shortDefinition="The Encounter associated with the start of the AdverseEvent", formalDefinition="The Encounter associated with the start of the AdverseEvent." )
1824    protected Reference encounter;
1825
1826    /**
1827     * The date (and perhaps time) when the adverse event occurred.
1828     */
1829    @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=7, min=0, max=1, modifier=false, summary=true)
1830    @Description(shortDefinition="When the event occurred", formalDefinition="The date (and perhaps time) when the adverse event occurred." )
1831    protected DataType occurrence;
1832
1833    /**
1834     * Estimated or actual date the AdverseEvent began, in the opinion of the reporter.
1835     */
1836    @Child(name = "detected", type = {DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
1837    @Description(shortDefinition="When the event was detected", formalDefinition="Estimated or actual date the AdverseEvent began, in the opinion of the reporter." )
1838    protected DateTimeType detected;
1839
1840    /**
1841     * The date on which the existence of the AdverseEvent was first recorded.
1842     */
1843    @Child(name = "recordedDate", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1844    @Description(shortDefinition="When the event was recorded", formalDefinition="The date on which the existence of the AdverseEvent was first recorded." )
1845    protected DateTimeType recordedDate;
1846
1847    /**
1848     * Information about the condition that occurred as a result of the adverse event, such as hives due to the exposure to a substance (for example, a drug or a chemical) or a broken leg as a result of the fall.
1849     */
1850    @Child(name = "resultingCondition", type = {Condition.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1851    @Description(shortDefinition="Effect on the subject due to this event", formalDefinition="Information about the condition that occurred as a result of the adverse event, such as hives due to the exposure to a substance (for example, a drug or a chemical) or a broken leg as a result of the fall." )
1852    protected List<Reference> resultingCondition;
1853
1854    /**
1855     * The information about where the adverse event occurred.
1856     */
1857    @Child(name = "location", type = {Location.class}, order=11, min=0, max=1, modifier=false, summary=true)
1858    @Description(shortDefinition="Location where adverse event occurred", formalDefinition="The information about where the adverse event occurred." )
1859    protected Reference location;
1860
1861    /**
1862     * Assessment whether this event, or averted event, was of clinical importance.
1863     */
1864    @Child(name = "seriousness", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=true)
1865    @Description(shortDefinition="Seriousness or gravity of the event", formalDefinition="Assessment whether this event, or averted event, was of clinical importance." )
1866    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-seriousness")
1867    protected CodeableConcept seriousness;
1868
1869    /**
1870     * Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.
1871     */
1872    @Child(name = "outcome", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1873    @Description(shortDefinition="Type of outcome from the adverse event", formalDefinition="Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal." )
1874    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adverse-event-outcome")
1875    protected List<CodeableConcept> outcome;
1876
1877    /**
1878     * Information on who recorded the adverse event.  May be the patient or a practitioner.
1879     */
1880    @Child(name = "recorder", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=14, min=0, max=1, modifier=false, summary=true)
1881    @Description(shortDefinition="Who recorded the adverse event", formalDefinition="Information on who recorded the adverse event.  May be the patient or a practitioner." )
1882    protected Reference recorder;
1883
1884    /**
1885     * Indicates who or what participated in the adverse event and how they were involved.
1886     */
1887    @Child(name = "participant", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1888    @Description(shortDefinition="Who was involved in the adverse event or the potential adverse event and what they did", formalDefinition="Indicates who or what participated in the adverse event and how they were involved." )
1889    protected List<AdverseEventParticipantComponent> participant;
1890
1891    /**
1892     * Describes the entity that is suspected to have caused the adverse event.
1893     */
1894    @Child(name = "suspectEntity", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1895    @Description(shortDefinition="The suspected agent causing the adverse event", formalDefinition="Describes the entity that is suspected to have caused the adverse event." )
1896    protected List<AdverseEventSuspectEntityComponent> suspectEntity;
1897
1898    /**
1899     * The contributing factors suspected to have increased the probability or severity of the adverse event.
1900     */
1901    @Child(name = "contributingFactor", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1902    @Description(shortDefinition="Contributing factors suspected to have increased the probability or severity of the adverse event", formalDefinition="The contributing factors suspected to have increased the probability or severity of the adverse event." )
1903    protected List<AdverseEventContributingFactorComponent> contributingFactor;
1904
1905    /**
1906     * Preventive actions that contributed to avoiding the adverse event.
1907     */
1908    @Child(name = "preventiveAction", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1909    @Description(shortDefinition="Preventive actions that contributed to avoiding the adverse event", formalDefinition="Preventive actions that contributed to avoiding the adverse event." )
1910    protected List<AdverseEventPreventiveActionComponent> preventiveAction;
1911
1912    /**
1913     * The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.
1914     */
1915    @Child(name = "mitigatingAction", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1916    @Description(shortDefinition="Ameliorating actions taken after the adverse event occured in order to reduce the extent of harm", formalDefinition="The ameliorating action taken after the adverse event occured in order to reduce the extent of harm." )
1917    protected List<AdverseEventMitigatingActionComponent> mitigatingAction;
1918
1919    /**
1920     * Supporting information relevant to the event.
1921     */
1922    @Child(name = "supportingInfo", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1923    @Description(shortDefinition="Supporting information relevant to the event", formalDefinition="Supporting information relevant to the event." )
1924    protected List<AdverseEventSupportingInfoComponent> supportingInfo;
1925
1926    /**
1927     * The research study that the subject is enrolled in.
1928     */
1929    @Child(name = "study", type = {ResearchStudy.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1930    @Description(shortDefinition="Research study that the subject is enrolled in", formalDefinition="The research study that the subject is enrolled in." )
1931    protected List<Reference> study;
1932
1933    private static final long serialVersionUID = 1528004510L;
1934
1935  /**
1936   * Constructor
1937   */
1938    public AdverseEvent() {
1939      super();
1940    }
1941
1942  /**
1943   * Constructor
1944   */
1945    public AdverseEvent(AdverseEventStatus status, AdverseEventActuality actuality, Reference subject) {
1946      super();
1947      this.setStatus(status);
1948      this.setActuality(actuality);
1949      this.setSubject(subject);
1950    }
1951
1952    /**
1953     * @return {@link #identifier} (Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.)
1954     */
1955    public List<Identifier> getIdentifier() { 
1956      if (this.identifier == null)
1957        this.identifier = new ArrayList<Identifier>();
1958      return this.identifier;
1959    }
1960
1961    /**
1962     * @return Returns a reference to <code>this</code> for easy method chaining
1963     */
1964    public AdverseEvent setIdentifier(List<Identifier> theIdentifier) { 
1965      this.identifier = theIdentifier;
1966      return this;
1967    }
1968
1969    public boolean hasIdentifier() { 
1970      if (this.identifier == null)
1971        return false;
1972      for (Identifier item : this.identifier)
1973        if (!item.isEmpty())
1974          return true;
1975      return false;
1976    }
1977
1978    public Identifier addIdentifier() { //3
1979      Identifier t = new Identifier();
1980      if (this.identifier == null)
1981        this.identifier = new ArrayList<Identifier>();
1982      this.identifier.add(t);
1983      return t;
1984    }
1985
1986    public AdverseEvent addIdentifier(Identifier t) { //3
1987      if (t == null)
1988        return this;
1989      if (this.identifier == null)
1990        this.identifier = new ArrayList<Identifier>();
1991      this.identifier.add(t);
1992      return this;
1993    }
1994
1995    /**
1996     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1997     */
1998    public Identifier getIdentifierFirstRep() { 
1999      if (getIdentifier().isEmpty()) {
2000        addIdentifier();
2001      }
2002      return getIdentifier().get(0);
2003    }
2004
2005    /**
2006     * @return {@link #status} (The current state of the adverse event or potential adverse event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2007     */
2008    public Enumeration<AdverseEventStatus> getStatusElement() { 
2009      if (this.status == null)
2010        if (Configuration.errorOnAutoCreate())
2011          throw new Error("Attempt to auto-create AdverseEvent.status");
2012        else if (Configuration.doAutoCreate())
2013          this.status = new Enumeration<AdverseEventStatus>(new AdverseEventStatusEnumFactory()); // bb
2014      return this.status;
2015    }
2016
2017    public boolean hasStatusElement() { 
2018      return this.status != null && !this.status.isEmpty();
2019    }
2020
2021    public boolean hasStatus() { 
2022      return this.status != null && !this.status.isEmpty();
2023    }
2024
2025    /**
2026     * @param value {@link #status} (The current state of the adverse event or potential adverse event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2027     */
2028    public AdverseEvent setStatusElement(Enumeration<AdverseEventStatus> value) { 
2029      this.status = value;
2030      return this;
2031    }
2032
2033    /**
2034     * @return The current state of the adverse event or potential adverse event.
2035     */
2036    public AdverseEventStatus getStatus() { 
2037      return this.status == null ? null : this.status.getValue();
2038    }
2039
2040    /**
2041     * @param value The current state of the adverse event or potential adverse event.
2042     */
2043    public AdverseEvent setStatus(AdverseEventStatus value) { 
2044        if (this.status == null)
2045          this.status = new Enumeration<AdverseEventStatus>(new AdverseEventStatusEnumFactory());
2046        this.status.setValue(value);
2047      return this;
2048    }
2049
2050    /**
2051     * @return {@link #actuality} (Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.). This is the underlying object with id, value and extensions. The accessor "getActuality" gives direct access to the value
2052     */
2053    public Enumeration<AdverseEventActuality> getActualityElement() { 
2054      if (this.actuality == null)
2055        if (Configuration.errorOnAutoCreate())
2056          throw new Error("Attempt to auto-create AdverseEvent.actuality");
2057        else if (Configuration.doAutoCreate())
2058          this.actuality = new Enumeration<AdverseEventActuality>(new AdverseEventActualityEnumFactory()); // bb
2059      return this.actuality;
2060    }
2061
2062    public boolean hasActualityElement() { 
2063      return this.actuality != null && !this.actuality.isEmpty();
2064    }
2065
2066    public boolean hasActuality() { 
2067      return this.actuality != null && !this.actuality.isEmpty();
2068    }
2069
2070    /**
2071     * @param value {@link #actuality} (Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.). This is the underlying object with id, value and extensions. The accessor "getActuality" gives direct access to the value
2072     */
2073    public AdverseEvent setActualityElement(Enumeration<AdverseEventActuality> value) { 
2074      this.actuality = value;
2075      return this;
2076    }
2077
2078    /**
2079     * @return Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.
2080     */
2081    public AdverseEventActuality getActuality() { 
2082      return this.actuality == null ? null : this.actuality.getValue();
2083    }
2084
2085    /**
2086     * @param value Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.
2087     */
2088    public AdverseEvent setActuality(AdverseEventActuality value) { 
2089        if (this.actuality == null)
2090          this.actuality = new Enumeration<AdverseEventActuality>(new AdverseEventActualityEnumFactory());
2091        this.actuality.setValue(value);
2092      return this;
2093    }
2094
2095    /**
2096     * @return {@link #category} (The overall type of event, intended for search and filtering purposes.)
2097     */
2098    public List<CodeableConcept> getCategory() { 
2099      if (this.category == null)
2100        this.category = new ArrayList<CodeableConcept>();
2101      return this.category;
2102    }
2103
2104    /**
2105     * @return Returns a reference to <code>this</code> for easy method chaining
2106     */
2107    public AdverseEvent setCategory(List<CodeableConcept> theCategory) { 
2108      this.category = theCategory;
2109      return this;
2110    }
2111
2112    public boolean hasCategory() { 
2113      if (this.category == null)
2114        return false;
2115      for (CodeableConcept item : this.category)
2116        if (!item.isEmpty())
2117          return true;
2118      return false;
2119    }
2120
2121    public CodeableConcept addCategory() { //3
2122      CodeableConcept t = new CodeableConcept();
2123      if (this.category == null)
2124        this.category = new ArrayList<CodeableConcept>();
2125      this.category.add(t);
2126      return t;
2127    }
2128
2129    public AdverseEvent addCategory(CodeableConcept t) { //3
2130      if (t == null)
2131        return this;
2132      if (this.category == null)
2133        this.category = new ArrayList<CodeableConcept>();
2134      this.category.add(t);
2135      return this;
2136    }
2137
2138    /**
2139     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
2140     */
2141    public CodeableConcept getCategoryFirstRep() { 
2142      if (getCategory().isEmpty()) {
2143        addCategory();
2144      }
2145      return getCategory().get(0);
2146    }
2147
2148    /**
2149     * @return {@link #code} (Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.)
2150     */
2151    public CodeableConcept getCode() { 
2152      if (this.code == null)
2153        if (Configuration.errorOnAutoCreate())
2154          throw new Error("Attempt to auto-create AdverseEvent.code");
2155        else if (Configuration.doAutoCreate())
2156          this.code = new CodeableConcept(); // cc
2157      return this.code;
2158    }
2159
2160    public boolean hasCode() { 
2161      return this.code != null && !this.code.isEmpty();
2162    }
2163
2164    /**
2165     * @param value {@link #code} (Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.)
2166     */
2167    public AdverseEvent setCode(CodeableConcept value) { 
2168      this.code = value;
2169      return this;
2170    }
2171
2172    /**
2173     * @return {@link #subject} (This subject or group impacted by the event.)
2174     */
2175    public Reference getSubject() { 
2176      if (this.subject == null)
2177        if (Configuration.errorOnAutoCreate())
2178          throw new Error("Attempt to auto-create AdverseEvent.subject");
2179        else if (Configuration.doAutoCreate())
2180          this.subject = new Reference(); // cc
2181      return this.subject;
2182    }
2183
2184    public boolean hasSubject() { 
2185      return this.subject != null && !this.subject.isEmpty();
2186    }
2187
2188    /**
2189     * @param value {@link #subject} (This subject or group impacted by the event.)
2190     */
2191    public AdverseEvent setSubject(Reference value) { 
2192      this.subject = value;
2193      return this;
2194    }
2195
2196    /**
2197     * @return {@link #encounter} (The Encounter associated with the start of the AdverseEvent.)
2198     */
2199    public Reference getEncounter() { 
2200      if (this.encounter == null)
2201        if (Configuration.errorOnAutoCreate())
2202          throw new Error("Attempt to auto-create AdverseEvent.encounter");
2203        else if (Configuration.doAutoCreate())
2204          this.encounter = new Reference(); // cc
2205      return this.encounter;
2206    }
2207
2208    public boolean hasEncounter() { 
2209      return this.encounter != null && !this.encounter.isEmpty();
2210    }
2211
2212    /**
2213     * @param value {@link #encounter} (The Encounter associated with the start of the AdverseEvent.)
2214     */
2215    public AdverseEvent setEncounter(Reference value) { 
2216      this.encounter = value;
2217      return this;
2218    }
2219
2220    /**
2221     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2222     */
2223    public DataType getOccurrence() { 
2224      return this.occurrence;
2225    }
2226
2227    /**
2228     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2229     */
2230    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
2231      if (this.occurrence == null)
2232        this.occurrence = new DateTimeType();
2233      if (!(this.occurrence instanceof DateTimeType))
2234        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
2235      return (DateTimeType) this.occurrence;
2236    }
2237
2238    public boolean hasOccurrenceDateTimeType() { 
2239      return this != null && this.occurrence instanceof DateTimeType;
2240    }
2241
2242    /**
2243     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2244     */
2245    public Period getOccurrencePeriod() throws FHIRException { 
2246      if (this.occurrence == null)
2247        this.occurrence = new Period();
2248      if (!(this.occurrence instanceof Period))
2249        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
2250      return (Period) this.occurrence;
2251    }
2252
2253    public boolean hasOccurrencePeriod() { 
2254      return this != null && this.occurrence instanceof Period;
2255    }
2256
2257    /**
2258     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2259     */
2260    public Timing getOccurrenceTiming() throws FHIRException { 
2261      if (this.occurrence == null)
2262        this.occurrence = new Timing();
2263      if (!(this.occurrence instanceof Timing))
2264        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
2265      return (Timing) this.occurrence;
2266    }
2267
2268    public boolean hasOccurrenceTiming() { 
2269      return this != null && this.occurrence instanceof Timing;
2270    }
2271
2272    public boolean hasOccurrence() { 
2273      return this.occurrence != null && !this.occurrence.isEmpty();
2274    }
2275
2276    /**
2277     * @param value {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2278     */
2279    public AdverseEvent setOccurrence(DataType value) { 
2280      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
2281        throw new Error("Not the right type for AdverseEvent.occurrence[x]: "+value.fhirType());
2282      this.occurrence = value;
2283      return this;
2284    }
2285
2286    /**
2287     * @return {@link #detected} (Estimated or actual date the AdverseEvent began, in the opinion of the reporter.). This is the underlying object with id, value and extensions. The accessor "getDetected" gives direct access to the value
2288     */
2289    public DateTimeType getDetectedElement() { 
2290      if (this.detected == null)
2291        if (Configuration.errorOnAutoCreate())
2292          throw new Error("Attempt to auto-create AdverseEvent.detected");
2293        else if (Configuration.doAutoCreate())
2294          this.detected = new DateTimeType(); // bb
2295      return this.detected;
2296    }
2297
2298    public boolean hasDetectedElement() { 
2299      return this.detected != null && !this.detected.isEmpty();
2300    }
2301
2302    public boolean hasDetected() { 
2303      return this.detected != null && !this.detected.isEmpty();
2304    }
2305
2306    /**
2307     * @param value {@link #detected} (Estimated or actual date the AdverseEvent began, in the opinion of the reporter.). This is the underlying object with id, value and extensions. The accessor "getDetected" gives direct access to the value
2308     */
2309    public AdverseEvent setDetectedElement(DateTimeType value) { 
2310      this.detected = value;
2311      return this;
2312    }
2313
2314    /**
2315     * @return Estimated or actual date the AdverseEvent began, in the opinion of the reporter.
2316     */
2317    public Date getDetected() { 
2318      return this.detected == null ? null : this.detected.getValue();
2319    }
2320
2321    /**
2322     * @param value Estimated or actual date the AdverseEvent began, in the opinion of the reporter.
2323     */
2324    public AdverseEvent setDetected(Date value) { 
2325      if (value == null)
2326        this.detected = null;
2327      else {
2328        if (this.detected == null)
2329          this.detected = new DateTimeType();
2330        this.detected.setValue(value);
2331      }
2332      return this;
2333    }
2334
2335    /**
2336     * @return {@link #recordedDate} (The date on which the existence of the AdverseEvent was first recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedDate" gives direct access to the value
2337     */
2338    public DateTimeType getRecordedDateElement() { 
2339      if (this.recordedDate == null)
2340        if (Configuration.errorOnAutoCreate())
2341          throw new Error("Attempt to auto-create AdverseEvent.recordedDate");
2342        else if (Configuration.doAutoCreate())
2343          this.recordedDate = new DateTimeType(); // bb
2344      return this.recordedDate;
2345    }
2346
2347    public boolean hasRecordedDateElement() { 
2348      return this.recordedDate != null && !this.recordedDate.isEmpty();
2349    }
2350
2351    public boolean hasRecordedDate() { 
2352      return this.recordedDate != null && !this.recordedDate.isEmpty();
2353    }
2354
2355    /**
2356     * @param value {@link #recordedDate} (The date on which the existence of the AdverseEvent was first recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedDate" gives direct access to the value
2357     */
2358    public AdverseEvent setRecordedDateElement(DateTimeType value) { 
2359      this.recordedDate = value;
2360      return this;
2361    }
2362
2363    /**
2364     * @return The date on which the existence of the AdverseEvent was first recorded.
2365     */
2366    public Date getRecordedDate() { 
2367      return this.recordedDate == null ? null : this.recordedDate.getValue();
2368    }
2369
2370    /**
2371     * @param value The date on which the existence of the AdverseEvent was first recorded.
2372     */
2373    public AdverseEvent setRecordedDate(Date value) { 
2374      if (value == null)
2375        this.recordedDate = null;
2376      else {
2377        if (this.recordedDate == null)
2378          this.recordedDate = new DateTimeType();
2379        this.recordedDate.setValue(value);
2380      }
2381      return this;
2382    }
2383
2384    /**
2385     * @return {@link #resultingCondition} (Information about the condition that occurred as a result of the adverse event, such as hives due to the exposure to a substance (for example, a drug or a chemical) or a broken leg as a result of the fall.)
2386     */
2387    public List<Reference> getResultingCondition() { 
2388      if (this.resultingCondition == null)
2389        this.resultingCondition = new ArrayList<Reference>();
2390      return this.resultingCondition;
2391    }
2392
2393    /**
2394     * @return Returns a reference to <code>this</code> for easy method chaining
2395     */
2396    public AdverseEvent setResultingCondition(List<Reference> theResultingCondition) { 
2397      this.resultingCondition = theResultingCondition;
2398      return this;
2399    }
2400
2401    public boolean hasResultingCondition() { 
2402      if (this.resultingCondition == null)
2403        return false;
2404      for (Reference item : this.resultingCondition)
2405        if (!item.isEmpty())
2406          return true;
2407      return false;
2408    }
2409
2410    public Reference addResultingCondition() { //3
2411      Reference t = new Reference();
2412      if (this.resultingCondition == null)
2413        this.resultingCondition = new ArrayList<Reference>();
2414      this.resultingCondition.add(t);
2415      return t;
2416    }
2417
2418    public AdverseEvent addResultingCondition(Reference t) { //3
2419      if (t == null)
2420        return this;
2421      if (this.resultingCondition == null)
2422        this.resultingCondition = new ArrayList<Reference>();
2423      this.resultingCondition.add(t);
2424      return this;
2425    }
2426
2427    /**
2428     * @return The first repetition of repeating field {@link #resultingCondition}, creating it if it does not already exist {3}
2429     */
2430    public Reference getResultingConditionFirstRep() { 
2431      if (getResultingCondition().isEmpty()) {
2432        addResultingCondition();
2433      }
2434      return getResultingCondition().get(0);
2435    }
2436
2437    /**
2438     * @return {@link #location} (The information about where the adverse event occurred.)
2439     */
2440    public Reference getLocation() { 
2441      if (this.location == null)
2442        if (Configuration.errorOnAutoCreate())
2443          throw new Error("Attempt to auto-create AdverseEvent.location");
2444        else if (Configuration.doAutoCreate())
2445          this.location = new Reference(); // cc
2446      return this.location;
2447    }
2448
2449    public boolean hasLocation() { 
2450      return this.location != null && !this.location.isEmpty();
2451    }
2452
2453    /**
2454     * @param value {@link #location} (The information about where the adverse event occurred.)
2455     */
2456    public AdverseEvent setLocation(Reference value) { 
2457      this.location = value;
2458      return this;
2459    }
2460
2461    /**
2462     * @return {@link #seriousness} (Assessment whether this event, or averted event, was of clinical importance.)
2463     */
2464    public CodeableConcept getSeriousness() { 
2465      if (this.seriousness == null)
2466        if (Configuration.errorOnAutoCreate())
2467          throw new Error("Attempt to auto-create AdverseEvent.seriousness");
2468        else if (Configuration.doAutoCreate())
2469          this.seriousness = new CodeableConcept(); // cc
2470      return this.seriousness;
2471    }
2472
2473    public boolean hasSeriousness() { 
2474      return this.seriousness != null && !this.seriousness.isEmpty();
2475    }
2476
2477    /**
2478     * @param value {@link #seriousness} (Assessment whether this event, or averted event, was of clinical importance.)
2479     */
2480    public AdverseEvent setSeriousness(CodeableConcept value) { 
2481      this.seriousness = value;
2482      return this;
2483    }
2484
2485    /**
2486     * @return {@link #outcome} (Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.)
2487     */
2488    public List<CodeableConcept> getOutcome() { 
2489      if (this.outcome == null)
2490        this.outcome = new ArrayList<CodeableConcept>();
2491      return this.outcome;
2492    }
2493
2494    /**
2495     * @return Returns a reference to <code>this</code> for easy method chaining
2496     */
2497    public AdverseEvent setOutcome(List<CodeableConcept> theOutcome) { 
2498      this.outcome = theOutcome;
2499      return this;
2500    }
2501
2502    public boolean hasOutcome() { 
2503      if (this.outcome == null)
2504        return false;
2505      for (CodeableConcept item : this.outcome)
2506        if (!item.isEmpty())
2507          return true;
2508      return false;
2509    }
2510
2511    public CodeableConcept addOutcome() { //3
2512      CodeableConcept t = new CodeableConcept();
2513      if (this.outcome == null)
2514        this.outcome = new ArrayList<CodeableConcept>();
2515      this.outcome.add(t);
2516      return t;
2517    }
2518
2519    public AdverseEvent addOutcome(CodeableConcept t) { //3
2520      if (t == null)
2521        return this;
2522      if (this.outcome == null)
2523        this.outcome = new ArrayList<CodeableConcept>();
2524      this.outcome.add(t);
2525      return this;
2526    }
2527
2528    /**
2529     * @return The first repetition of repeating field {@link #outcome}, creating it if it does not already exist {3}
2530     */
2531    public CodeableConcept getOutcomeFirstRep() { 
2532      if (getOutcome().isEmpty()) {
2533        addOutcome();
2534      }
2535      return getOutcome().get(0);
2536    }
2537
2538    /**
2539     * @return {@link #recorder} (Information on who recorded the adverse event.  May be the patient or a practitioner.)
2540     */
2541    public Reference getRecorder() { 
2542      if (this.recorder == null)
2543        if (Configuration.errorOnAutoCreate())
2544          throw new Error("Attempt to auto-create AdverseEvent.recorder");
2545        else if (Configuration.doAutoCreate())
2546          this.recorder = new Reference(); // cc
2547      return this.recorder;
2548    }
2549
2550    public boolean hasRecorder() { 
2551      return this.recorder != null && !this.recorder.isEmpty();
2552    }
2553
2554    /**
2555     * @param value {@link #recorder} (Information on who recorded the adverse event.  May be the patient or a practitioner.)
2556     */
2557    public AdverseEvent setRecorder(Reference value) { 
2558      this.recorder = value;
2559      return this;
2560    }
2561
2562    /**
2563     * @return {@link #participant} (Indicates who or what participated in the adverse event and how they were involved.)
2564     */
2565    public List<AdverseEventParticipantComponent> getParticipant() { 
2566      if (this.participant == null)
2567        this.participant = new ArrayList<AdverseEventParticipantComponent>();
2568      return this.participant;
2569    }
2570
2571    /**
2572     * @return Returns a reference to <code>this</code> for easy method chaining
2573     */
2574    public AdverseEvent setParticipant(List<AdverseEventParticipantComponent> theParticipant) { 
2575      this.participant = theParticipant;
2576      return this;
2577    }
2578
2579    public boolean hasParticipant() { 
2580      if (this.participant == null)
2581        return false;
2582      for (AdverseEventParticipantComponent item : this.participant)
2583        if (!item.isEmpty())
2584          return true;
2585      return false;
2586    }
2587
2588    public AdverseEventParticipantComponent addParticipant() { //3
2589      AdverseEventParticipantComponent t = new AdverseEventParticipantComponent();
2590      if (this.participant == null)
2591        this.participant = new ArrayList<AdverseEventParticipantComponent>();
2592      this.participant.add(t);
2593      return t;
2594    }
2595
2596    public AdverseEvent addParticipant(AdverseEventParticipantComponent t) { //3
2597      if (t == null)
2598        return this;
2599      if (this.participant == null)
2600        this.participant = new ArrayList<AdverseEventParticipantComponent>();
2601      this.participant.add(t);
2602      return this;
2603    }
2604
2605    /**
2606     * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist {3}
2607     */
2608    public AdverseEventParticipantComponent getParticipantFirstRep() { 
2609      if (getParticipant().isEmpty()) {
2610        addParticipant();
2611      }
2612      return getParticipant().get(0);
2613    }
2614
2615    /**
2616     * @return {@link #suspectEntity} (Describes the entity that is suspected to have caused the adverse event.)
2617     */
2618    public List<AdverseEventSuspectEntityComponent> getSuspectEntity() { 
2619      if (this.suspectEntity == null)
2620        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2621      return this.suspectEntity;
2622    }
2623
2624    /**
2625     * @return Returns a reference to <code>this</code> for easy method chaining
2626     */
2627    public AdverseEvent setSuspectEntity(List<AdverseEventSuspectEntityComponent> theSuspectEntity) { 
2628      this.suspectEntity = theSuspectEntity;
2629      return this;
2630    }
2631
2632    public boolean hasSuspectEntity() { 
2633      if (this.suspectEntity == null)
2634        return false;
2635      for (AdverseEventSuspectEntityComponent item : this.suspectEntity)
2636        if (!item.isEmpty())
2637          return true;
2638      return false;
2639    }
2640
2641    public AdverseEventSuspectEntityComponent addSuspectEntity() { //3
2642      AdverseEventSuspectEntityComponent t = new AdverseEventSuspectEntityComponent();
2643      if (this.suspectEntity == null)
2644        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2645      this.suspectEntity.add(t);
2646      return t;
2647    }
2648
2649    public AdverseEvent addSuspectEntity(AdverseEventSuspectEntityComponent t) { //3
2650      if (t == null)
2651        return this;
2652      if (this.suspectEntity == null)
2653        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2654      this.suspectEntity.add(t);
2655      return this;
2656    }
2657
2658    /**
2659     * @return The first repetition of repeating field {@link #suspectEntity}, creating it if it does not already exist {3}
2660     */
2661    public AdverseEventSuspectEntityComponent getSuspectEntityFirstRep() { 
2662      if (getSuspectEntity().isEmpty()) {
2663        addSuspectEntity();
2664      }
2665      return getSuspectEntity().get(0);
2666    }
2667
2668    /**
2669     * @return {@link #contributingFactor} (The contributing factors suspected to have increased the probability or severity of the adverse event.)
2670     */
2671    public List<AdverseEventContributingFactorComponent> getContributingFactor() { 
2672      if (this.contributingFactor == null)
2673        this.contributingFactor = new ArrayList<AdverseEventContributingFactorComponent>();
2674      return this.contributingFactor;
2675    }
2676
2677    /**
2678     * @return Returns a reference to <code>this</code> for easy method chaining
2679     */
2680    public AdverseEvent setContributingFactor(List<AdverseEventContributingFactorComponent> theContributingFactor) { 
2681      this.contributingFactor = theContributingFactor;
2682      return this;
2683    }
2684
2685    public boolean hasContributingFactor() { 
2686      if (this.contributingFactor == null)
2687        return false;
2688      for (AdverseEventContributingFactorComponent item : this.contributingFactor)
2689        if (!item.isEmpty())
2690          return true;
2691      return false;
2692    }
2693
2694    public AdverseEventContributingFactorComponent addContributingFactor() { //3
2695      AdverseEventContributingFactorComponent t = new AdverseEventContributingFactorComponent();
2696      if (this.contributingFactor == null)
2697        this.contributingFactor = new ArrayList<AdverseEventContributingFactorComponent>();
2698      this.contributingFactor.add(t);
2699      return t;
2700    }
2701
2702    public AdverseEvent addContributingFactor(AdverseEventContributingFactorComponent t) { //3
2703      if (t == null)
2704        return this;
2705      if (this.contributingFactor == null)
2706        this.contributingFactor = new ArrayList<AdverseEventContributingFactorComponent>();
2707      this.contributingFactor.add(t);
2708      return this;
2709    }
2710
2711    /**
2712     * @return The first repetition of repeating field {@link #contributingFactor}, creating it if it does not already exist {3}
2713     */
2714    public AdverseEventContributingFactorComponent getContributingFactorFirstRep() { 
2715      if (getContributingFactor().isEmpty()) {
2716        addContributingFactor();
2717      }
2718      return getContributingFactor().get(0);
2719    }
2720
2721    /**
2722     * @return {@link #preventiveAction} (Preventive actions that contributed to avoiding the adverse event.)
2723     */
2724    public List<AdverseEventPreventiveActionComponent> getPreventiveAction() { 
2725      if (this.preventiveAction == null)
2726        this.preventiveAction = new ArrayList<AdverseEventPreventiveActionComponent>();
2727      return this.preventiveAction;
2728    }
2729
2730    /**
2731     * @return Returns a reference to <code>this</code> for easy method chaining
2732     */
2733    public AdverseEvent setPreventiveAction(List<AdverseEventPreventiveActionComponent> thePreventiveAction) { 
2734      this.preventiveAction = thePreventiveAction;
2735      return this;
2736    }
2737
2738    public boolean hasPreventiveAction() { 
2739      if (this.preventiveAction == null)
2740        return false;
2741      for (AdverseEventPreventiveActionComponent item : this.preventiveAction)
2742        if (!item.isEmpty())
2743          return true;
2744      return false;
2745    }
2746
2747    public AdverseEventPreventiveActionComponent addPreventiveAction() { //3
2748      AdverseEventPreventiveActionComponent t = new AdverseEventPreventiveActionComponent();
2749      if (this.preventiveAction == null)
2750        this.preventiveAction = new ArrayList<AdverseEventPreventiveActionComponent>();
2751      this.preventiveAction.add(t);
2752      return t;
2753    }
2754
2755    public AdverseEvent addPreventiveAction(AdverseEventPreventiveActionComponent t) { //3
2756      if (t == null)
2757        return this;
2758      if (this.preventiveAction == null)
2759        this.preventiveAction = new ArrayList<AdverseEventPreventiveActionComponent>();
2760      this.preventiveAction.add(t);
2761      return this;
2762    }
2763
2764    /**
2765     * @return The first repetition of repeating field {@link #preventiveAction}, creating it if it does not already exist {3}
2766     */
2767    public AdverseEventPreventiveActionComponent getPreventiveActionFirstRep() { 
2768      if (getPreventiveAction().isEmpty()) {
2769        addPreventiveAction();
2770      }
2771      return getPreventiveAction().get(0);
2772    }
2773
2774    /**
2775     * @return {@link #mitigatingAction} (The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.)
2776     */
2777    public List<AdverseEventMitigatingActionComponent> getMitigatingAction() { 
2778      if (this.mitigatingAction == null)
2779        this.mitigatingAction = new ArrayList<AdverseEventMitigatingActionComponent>();
2780      return this.mitigatingAction;
2781    }
2782
2783    /**
2784     * @return Returns a reference to <code>this</code> for easy method chaining
2785     */
2786    public AdverseEvent setMitigatingAction(List<AdverseEventMitigatingActionComponent> theMitigatingAction) { 
2787      this.mitigatingAction = theMitigatingAction;
2788      return this;
2789    }
2790
2791    public boolean hasMitigatingAction() { 
2792      if (this.mitigatingAction == null)
2793        return false;
2794      for (AdverseEventMitigatingActionComponent item : this.mitigatingAction)
2795        if (!item.isEmpty())
2796          return true;
2797      return false;
2798    }
2799
2800    public AdverseEventMitigatingActionComponent addMitigatingAction() { //3
2801      AdverseEventMitigatingActionComponent t = new AdverseEventMitigatingActionComponent();
2802      if (this.mitigatingAction == null)
2803        this.mitigatingAction = new ArrayList<AdverseEventMitigatingActionComponent>();
2804      this.mitigatingAction.add(t);
2805      return t;
2806    }
2807
2808    public AdverseEvent addMitigatingAction(AdverseEventMitigatingActionComponent t) { //3
2809      if (t == null)
2810        return this;
2811      if (this.mitigatingAction == null)
2812        this.mitigatingAction = new ArrayList<AdverseEventMitigatingActionComponent>();
2813      this.mitigatingAction.add(t);
2814      return this;
2815    }
2816
2817    /**
2818     * @return The first repetition of repeating field {@link #mitigatingAction}, creating it if it does not already exist {3}
2819     */
2820    public AdverseEventMitigatingActionComponent getMitigatingActionFirstRep() { 
2821      if (getMitigatingAction().isEmpty()) {
2822        addMitigatingAction();
2823      }
2824      return getMitigatingAction().get(0);
2825    }
2826
2827    /**
2828     * @return {@link #supportingInfo} (Supporting information relevant to the event.)
2829     */
2830    public List<AdverseEventSupportingInfoComponent> getSupportingInfo() { 
2831      if (this.supportingInfo == null)
2832        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2833      return this.supportingInfo;
2834    }
2835
2836    /**
2837     * @return Returns a reference to <code>this</code> for easy method chaining
2838     */
2839    public AdverseEvent setSupportingInfo(List<AdverseEventSupportingInfoComponent> theSupportingInfo) { 
2840      this.supportingInfo = theSupportingInfo;
2841      return this;
2842    }
2843
2844    public boolean hasSupportingInfo() { 
2845      if (this.supportingInfo == null)
2846        return false;
2847      for (AdverseEventSupportingInfoComponent item : this.supportingInfo)
2848        if (!item.isEmpty())
2849          return true;
2850      return false;
2851    }
2852
2853    public AdverseEventSupportingInfoComponent addSupportingInfo() { //3
2854      AdverseEventSupportingInfoComponent t = new AdverseEventSupportingInfoComponent();
2855      if (this.supportingInfo == null)
2856        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2857      this.supportingInfo.add(t);
2858      return t;
2859    }
2860
2861    public AdverseEvent addSupportingInfo(AdverseEventSupportingInfoComponent t) { //3
2862      if (t == null)
2863        return this;
2864      if (this.supportingInfo == null)
2865        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2866      this.supportingInfo.add(t);
2867      return this;
2868    }
2869
2870    /**
2871     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist {3}
2872     */
2873    public AdverseEventSupportingInfoComponent getSupportingInfoFirstRep() { 
2874      if (getSupportingInfo().isEmpty()) {
2875        addSupportingInfo();
2876      }
2877      return getSupportingInfo().get(0);
2878    }
2879
2880    /**
2881     * @return {@link #study} (The research study that the subject is enrolled in.)
2882     */
2883    public List<Reference> getStudy() { 
2884      if (this.study == null)
2885        this.study = new ArrayList<Reference>();
2886      return this.study;
2887    }
2888
2889    /**
2890     * @return Returns a reference to <code>this</code> for easy method chaining
2891     */
2892    public AdverseEvent setStudy(List<Reference> theStudy) { 
2893      this.study = theStudy;
2894      return this;
2895    }
2896
2897    public boolean hasStudy() { 
2898      if (this.study == null)
2899        return false;
2900      for (Reference item : this.study)
2901        if (!item.isEmpty())
2902          return true;
2903      return false;
2904    }
2905
2906    public Reference addStudy() { //3
2907      Reference t = new Reference();
2908      if (this.study == null)
2909        this.study = new ArrayList<Reference>();
2910      this.study.add(t);
2911      return t;
2912    }
2913
2914    public AdverseEvent addStudy(Reference t) { //3
2915      if (t == null)
2916        return this;
2917      if (this.study == null)
2918        this.study = new ArrayList<Reference>();
2919      this.study.add(t);
2920      return this;
2921    }
2922
2923    /**
2924     * @return The first repetition of repeating field {@link #study}, creating it if it does not already exist {3}
2925     */
2926    public Reference getStudyFirstRep() { 
2927      if (getStudy().isEmpty()) {
2928        addStudy();
2929      }
2930      return getStudy().get(0);
2931    }
2932
2933      protected void listChildren(List<Property> children) {
2934        super.listChildren(children);
2935        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier));
2936        children.add(new Property("status", "code", "The current state of the adverse event or potential adverse event.", 0, 1, status));
2937        children.add(new Property("actuality", "code", "Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.", 0, 1, actuality));
2938        children.add(new Property("category", "CodeableConcept", "The overall type of event, intended for search and filtering purposes.", 0, java.lang.Integer.MAX_VALUE, category));
2939        children.add(new Property("code", "CodeableConcept", "Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.", 0, 1, code));
2940        children.add(new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson)", "This subject or group impacted by the event.", 0, 1, subject));
2941        children.add(new Property("encounter", "Reference(Encounter)", "The Encounter associated with the start of the AdverseEvent.", 0, 1, encounter));
2942        children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence));
2943        children.add(new Property("detected", "dateTime", "Estimated or actual date the AdverseEvent began, in the opinion of the reporter.", 0, 1, detected));
2944        children.add(new Property("recordedDate", "dateTime", "The date on which the existence of the AdverseEvent was first recorded.", 0, 1, recordedDate));
2945        children.add(new Property("resultingCondition", "Reference(Condition)", "Information about the condition that occurred as a result of the adverse event, such as hives due to the exposure to a substance (for example, a drug or a chemical) or a broken leg as a result of the fall.", 0, java.lang.Integer.MAX_VALUE, resultingCondition));
2946        children.add(new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location));
2947        children.add(new Property("seriousness", "CodeableConcept", "Assessment whether this event, or averted event, was of clinical importance.", 0, 1, seriousness));
2948        children.add(new Property("outcome", "CodeableConcept", "Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.", 0, java.lang.Integer.MAX_VALUE, outcome));
2949        children.add(new Property("recorder", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "Information on who recorded the adverse event.  May be the patient or a practitioner.", 0, 1, recorder));
2950        children.add(new Property("participant", "", "Indicates who or what participated in the adverse event and how they were involved.", 0, java.lang.Integer.MAX_VALUE, participant));
2951        children.add(new Property("suspectEntity", "", "Describes the entity that is suspected to have caused the adverse event.", 0, java.lang.Integer.MAX_VALUE, suspectEntity));
2952        children.add(new Property("contributingFactor", "", "The contributing factors suspected to have increased the probability or severity of the adverse event.", 0, java.lang.Integer.MAX_VALUE, contributingFactor));
2953        children.add(new Property("preventiveAction", "", "Preventive actions that contributed to avoiding the adverse event.", 0, java.lang.Integer.MAX_VALUE, preventiveAction));
2954        children.add(new Property("mitigatingAction", "", "The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.", 0, java.lang.Integer.MAX_VALUE, mitigatingAction));
2955        children.add(new Property("supportingInfo", "", "Supporting information relevant to the event.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
2956        children.add(new Property("study", "Reference(ResearchStudy)", "The research study that the subject is enrolled in.", 0, java.lang.Integer.MAX_VALUE, study));
2957      }
2958
2959      @Override
2960      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2961        switch (_hash) {
2962        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this adverse event by the performer or other systems which remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier);
2963        case -892481550: /*status*/  return new Property("status", "code", "The current state of the adverse event or potential adverse event.", 0, 1, status);
2964        case 528866400: /*actuality*/  return new Property("actuality", "code", "Whether the event actually happened, or just had the potential to. Note that this is independent of whether anyone was affected or harmed or how severely.", 0, 1, actuality);
2965        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "The overall type of event, intended for search and filtering purposes.", 0, java.lang.Integer.MAX_VALUE, category);
2966        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.", 0, 1, code);
2967        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson)", "This subject or group impacted by the event.", 0, 1, subject);
2968        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The Encounter associated with the start of the AdverseEvent.", 0, 1, encounter);
2969        case -2022646513: /*occurrence[x]*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2970        case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2971        case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2972        case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "Period", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2973        case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
2974        case 1048254082: /*detected*/  return new Property("detected", "dateTime", "Estimated or actual date the AdverseEvent began, in the opinion of the reporter.", 0, 1, detected);
2975        case -1952893826: /*recordedDate*/  return new Property("recordedDate", "dateTime", "The date on which the existence of the AdverseEvent was first recorded.", 0, 1, recordedDate);
2976        case -830261258: /*resultingCondition*/  return new Property("resultingCondition", "Reference(Condition)", "Information about the condition that occurred as a result of the adverse event, such as hives due to the exposure to a substance (for example, a drug or a chemical) or a broken leg as a result of the fall.", 0, java.lang.Integer.MAX_VALUE, resultingCondition);
2977        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location);
2978        case -1551003909: /*seriousness*/  return new Property("seriousness", "CodeableConcept", "Assessment whether this event, or averted event, was of clinical importance.", 0, 1, seriousness);
2979        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.", 0, java.lang.Integer.MAX_VALUE, outcome);
2980        case -799233858: /*recorder*/  return new Property("recorder", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson)", "Information on who recorded the adverse event.  May be the patient or a practitioner.", 0, 1, recorder);
2981        case 767422259: /*participant*/  return new Property("participant", "", "Indicates who or what participated in the adverse event and how they were involved.", 0, java.lang.Integer.MAX_VALUE, participant);
2982        case -1957422662: /*suspectEntity*/  return new Property("suspectEntity", "", "Describes the entity that is suspected to have caused the adverse event.", 0, java.lang.Integer.MAX_VALUE, suspectEntity);
2983        case -219647527: /*contributingFactor*/  return new Property("contributingFactor", "", "The contributing factors suspected to have increased the probability or severity of the adverse event.", 0, java.lang.Integer.MAX_VALUE, contributingFactor);
2984        case 2052341334: /*preventiveAction*/  return new Property("preventiveAction", "", "Preventive actions that contributed to avoiding the adverse event.", 0, java.lang.Integer.MAX_VALUE, preventiveAction);
2985        case 1992862383: /*mitigatingAction*/  return new Property("mitigatingAction", "", "The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.", 0, java.lang.Integer.MAX_VALUE, mitigatingAction);
2986        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "", "Supporting information relevant to the event.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
2987        case 109776329: /*study*/  return new Property("study", "Reference(ResearchStudy)", "The research study that the subject is enrolled in.", 0, java.lang.Integer.MAX_VALUE, study);
2988        default: return super.getNamedProperty(_hash, _name, _checkValid);
2989        }
2990
2991      }
2992
2993      @Override
2994      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2995        switch (hash) {
2996        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2997        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AdverseEventStatus>
2998        case 528866400: /*actuality*/ return this.actuality == null ? new Base[0] : new Base[] {this.actuality}; // Enumeration<AdverseEventActuality>
2999        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
3000        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3001        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3002        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3003        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // DataType
3004        case 1048254082: /*detected*/ return this.detected == null ? new Base[0] : new Base[] {this.detected}; // DateTimeType
3005        case -1952893826: /*recordedDate*/ return this.recordedDate == null ? new Base[0] : new Base[] {this.recordedDate}; // DateTimeType
3006        case -830261258: /*resultingCondition*/ return this.resultingCondition == null ? new Base[0] : this.resultingCondition.toArray(new Base[this.resultingCondition.size()]); // Reference
3007        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
3008        case -1551003909: /*seriousness*/ return this.seriousness == null ? new Base[0] : new Base[] {this.seriousness}; // CodeableConcept
3009        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : this.outcome.toArray(new Base[this.outcome.size()]); // CodeableConcept
3010        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
3011        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // AdverseEventParticipantComponent
3012        case -1957422662: /*suspectEntity*/ return this.suspectEntity == null ? new Base[0] : this.suspectEntity.toArray(new Base[this.suspectEntity.size()]); // AdverseEventSuspectEntityComponent
3013        case -219647527: /*contributingFactor*/ return this.contributingFactor == null ? new Base[0] : this.contributingFactor.toArray(new Base[this.contributingFactor.size()]); // AdverseEventContributingFactorComponent
3014        case 2052341334: /*preventiveAction*/ return this.preventiveAction == null ? new Base[0] : this.preventiveAction.toArray(new Base[this.preventiveAction.size()]); // AdverseEventPreventiveActionComponent
3015        case 1992862383: /*mitigatingAction*/ return this.mitigatingAction == null ? new Base[0] : this.mitigatingAction.toArray(new Base[this.mitigatingAction.size()]); // AdverseEventMitigatingActionComponent
3016        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // AdverseEventSupportingInfoComponent
3017        case 109776329: /*study*/ return this.study == null ? new Base[0] : this.study.toArray(new Base[this.study.size()]); // Reference
3018        default: return super.getProperty(hash, name, checkValid);
3019        }
3020
3021      }
3022
3023      @Override
3024      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3025        switch (hash) {
3026        case -1618432855: // identifier
3027          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
3028          return value;
3029        case -892481550: // status
3030          value = new AdverseEventStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3031          this.status = (Enumeration) value; // Enumeration<AdverseEventStatus>
3032          return value;
3033        case 528866400: // actuality
3034          value = new AdverseEventActualityEnumFactory().fromType(TypeConvertor.castToCode(value));
3035          this.actuality = (Enumeration) value; // Enumeration<AdverseEventActuality>
3036          return value;
3037        case 50511102: // category
3038          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3039          return value;
3040        case 3059181: // code
3041          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3042          return value;
3043        case -1867885268: // subject
3044          this.subject = TypeConvertor.castToReference(value); // Reference
3045          return value;
3046        case 1524132147: // encounter
3047          this.encounter = TypeConvertor.castToReference(value); // Reference
3048          return value;
3049        case 1687874001: // occurrence
3050          this.occurrence = TypeConvertor.castToType(value); // DataType
3051          return value;
3052        case 1048254082: // detected
3053          this.detected = TypeConvertor.castToDateTime(value); // DateTimeType
3054          return value;
3055        case -1952893826: // recordedDate
3056          this.recordedDate = TypeConvertor.castToDateTime(value); // DateTimeType
3057          return value;
3058        case -830261258: // resultingCondition
3059          this.getResultingCondition().add(TypeConvertor.castToReference(value)); // Reference
3060          return value;
3061        case 1901043637: // location
3062          this.location = TypeConvertor.castToReference(value); // Reference
3063          return value;
3064        case -1551003909: // seriousness
3065          this.seriousness = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3066          return value;
3067        case -1106507950: // outcome
3068          this.getOutcome().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3069          return value;
3070        case -799233858: // recorder
3071          this.recorder = TypeConvertor.castToReference(value); // Reference
3072          return value;
3073        case 767422259: // participant
3074          this.getParticipant().add((AdverseEventParticipantComponent) value); // AdverseEventParticipantComponent
3075          return value;
3076        case -1957422662: // suspectEntity
3077          this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value); // AdverseEventSuspectEntityComponent
3078          return value;
3079        case -219647527: // contributingFactor
3080          this.getContributingFactor().add((AdverseEventContributingFactorComponent) value); // AdverseEventContributingFactorComponent
3081          return value;
3082        case 2052341334: // preventiveAction
3083          this.getPreventiveAction().add((AdverseEventPreventiveActionComponent) value); // AdverseEventPreventiveActionComponent
3084          return value;
3085        case 1992862383: // mitigatingAction
3086          this.getMitigatingAction().add((AdverseEventMitigatingActionComponent) value); // AdverseEventMitigatingActionComponent
3087          return value;
3088        case 1922406657: // supportingInfo
3089          this.getSupportingInfo().add((AdverseEventSupportingInfoComponent) value); // AdverseEventSupportingInfoComponent
3090          return value;
3091        case 109776329: // study
3092          this.getStudy().add(TypeConvertor.castToReference(value)); // Reference
3093          return value;
3094        default: return super.setProperty(hash, name, value);
3095        }
3096
3097      }
3098
3099      @Override
3100      public Base setProperty(String name, Base value) throws FHIRException {
3101        if (name.equals("identifier")) {
3102          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
3103        } else if (name.equals("status")) {
3104          value = new AdverseEventStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3105          this.status = (Enumeration) value; // Enumeration<AdverseEventStatus>
3106        } else if (name.equals("actuality")) {
3107          value = new AdverseEventActualityEnumFactory().fromType(TypeConvertor.castToCode(value));
3108          this.actuality = (Enumeration) value; // Enumeration<AdverseEventActuality>
3109        } else if (name.equals("category")) {
3110          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
3111        } else if (name.equals("code")) {
3112          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3113        } else if (name.equals("subject")) {
3114          this.subject = TypeConvertor.castToReference(value); // Reference
3115        } else if (name.equals("encounter")) {
3116          this.encounter = TypeConvertor.castToReference(value); // Reference
3117        } else if (name.equals("occurrence[x]")) {
3118          this.occurrence = TypeConvertor.castToType(value); // DataType
3119        } else if (name.equals("detected")) {
3120          this.detected = TypeConvertor.castToDateTime(value); // DateTimeType
3121        } else if (name.equals("recordedDate")) {
3122          this.recordedDate = TypeConvertor.castToDateTime(value); // DateTimeType
3123        } else if (name.equals("resultingCondition")) {
3124          this.getResultingCondition().add(TypeConvertor.castToReference(value));
3125        } else if (name.equals("location")) {
3126          this.location = TypeConvertor.castToReference(value); // Reference
3127        } else if (name.equals("seriousness")) {
3128          this.seriousness = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3129        } else if (name.equals("outcome")) {
3130          this.getOutcome().add(TypeConvertor.castToCodeableConcept(value));
3131        } else if (name.equals("recorder")) {
3132          this.recorder = TypeConvertor.castToReference(value); // Reference
3133        } else if (name.equals("participant")) {
3134          this.getParticipant().add((AdverseEventParticipantComponent) value);
3135        } else if (name.equals("suspectEntity")) {
3136          this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value);
3137        } else if (name.equals("contributingFactor")) {
3138          this.getContributingFactor().add((AdverseEventContributingFactorComponent) value);
3139        } else if (name.equals("preventiveAction")) {
3140          this.getPreventiveAction().add((AdverseEventPreventiveActionComponent) value);
3141        } else if (name.equals("mitigatingAction")) {
3142          this.getMitigatingAction().add((AdverseEventMitigatingActionComponent) value);
3143        } else if (name.equals("supportingInfo")) {
3144          this.getSupportingInfo().add((AdverseEventSupportingInfoComponent) value);
3145        } else if (name.equals("study")) {
3146          this.getStudy().add(TypeConvertor.castToReference(value));
3147        } else
3148          return super.setProperty(name, value);
3149        return value;
3150      }
3151
3152      @Override
3153      public Base makeProperty(int hash, String name) throws FHIRException {
3154        switch (hash) {
3155        case -1618432855:  return addIdentifier(); 
3156        case -892481550:  return getStatusElement();
3157        case 528866400:  return getActualityElement();
3158        case 50511102:  return addCategory(); 
3159        case 3059181:  return getCode();
3160        case -1867885268:  return getSubject();
3161        case 1524132147:  return getEncounter();
3162        case -2022646513:  return getOccurrence();
3163        case 1687874001:  return getOccurrence();
3164        case 1048254082:  return getDetectedElement();
3165        case -1952893826:  return getRecordedDateElement();
3166        case -830261258:  return addResultingCondition(); 
3167        case 1901043637:  return getLocation();
3168        case -1551003909:  return getSeriousness();
3169        case -1106507950:  return addOutcome(); 
3170        case -799233858:  return getRecorder();
3171        case 767422259:  return addParticipant(); 
3172        case -1957422662:  return addSuspectEntity(); 
3173        case -219647527:  return addContributingFactor(); 
3174        case 2052341334:  return addPreventiveAction(); 
3175        case 1992862383:  return addMitigatingAction(); 
3176        case 1922406657:  return addSupportingInfo(); 
3177        case 109776329:  return addStudy(); 
3178        default: return super.makeProperty(hash, name);
3179        }
3180
3181      }
3182
3183      @Override
3184      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3185        switch (hash) {
3186        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3187        case -892481550: /*status*/ return new String[] {"code"};
3188        case 528866400: /*actuality*/ return new String[] {"code"};
3189        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
3190        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3191        case -1867885268: /*subject*/ return new String[] {"Reference"};
3192        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3193        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
3194        case 1048254082: /*detected*/ return new String[] {"dateTime"};
3195        case -1952893826: /*recordedDate*/ return new String[] {"dateTime"};
3196        case -830261258: /*resultingCondition*/ return new String[] {"Reference"};
3197        case 1901043637: /*location*/ return new String[] {"Reference"};
3198        case -1551003909: /*seriousness*/ return new String[] {"CodeableConcept"};
3199        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
3200        case -799233858: /*recorder*/ return new String[] {"Reference"};
3201        case 767422259: /*participant*/ return new String[] {};
3202        case -1957422662: /*suspectEntity*/ return new String[] {};
3203        case -219647527: /*contributingFactor*/ return new String[] {};
3204        case 2052341334: /*preventiveAction*/ return new String[] {};
3205        case 1992862383: /*mitigatingAction*/ return new String[] {};
3206        case 1922406657: /*supportingInfo*/ return new String[] {};
3207        case 109776329: /*study*/ return new String[] {"Reference"};
3208        default: return super.getTypesForProperty(hash, name);
3209        }
3210
3211      }
3212
3213      @Override
3214      public Base addChild(String name) throws FHIRException {
3215        if (name.equals("identifier")) {
3216          return addIdentifier();
3217        }
3218        else if (name.equals("status")) {
3219          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.status");
3220        }
3221        else if (name.equals("actuality")) {
3222          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.actuality");
3223        }
3224        else if (name.equals("category")) {
3225          return addCategory();
3226        }
3227        else if (name.equals("code")) {
3228          this.code = new CodeableConcept();
3229          return this.code;
3230        }
3231        else if (name.equals("subject")) {
3232          this.subject = new Reference();
3233          return this.subject;
3234        }
3235        else if (name.equals("encounter")) {
3236          this.encounter = new Reference();
3237          return this.encounter;
3238        }
3239        else if (name.equals("occurrenceDateTime")) {
3240          this.occurrence = new DateTimeType();
3241          return this.occurrence;
3242        }
3243        else if (name.equals("occurrencePeriod")) {
3244          this.occurrence = new Period();
3245          return this.occurrence;
3246        }
3247        else if (name.equals("occurrenceTiming")) {
3248          this.occurrence = new Timing();
3249          return this.occurrence;
3250        }
3251        else if (name.equals("detected")) {
3252          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.detected");
3253        }
3254        else if (name.equals("recordedDate")) {
3255          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.recordedDate");
3256        }
3257        else if (name.equals("resultingCondition")) {
3258          return addResultingCondition();
3259        }
3260        else if (name.equals("location")) {
3261          this.location = new Reference();
3262          return this.location;
3263        }
3264        else if (name.equals("seriousness")) {
3265          this.seriousness = new CodeableConcept();
3266          return this.seriousness;
3267        }
3268        else if (name.equals("outcome")) {
3269          return addOutcome();
3270        }
3271        else if (name.equals("recorder")) {
3272          this.recorder = new Reference();
3273          return this.recorder;
3274        }
3275        else if (name.equals("participant")) {
3276          return addParticipant();
3277        }
3278        else if (name.equals("suspectEntity")) {
3279          return addSuspectEntity();
3280        }
3281        else if (name.equals("contributingFactor")) {
3282          return addContributingFactor();
3283        }
3284        else if (name.equals("preventiveAction")) {
3285          return addPreventiveAction();
3286        }
3287        else if (name.equals("mitigatingAction")) {
3288          return addMitigatingAction();
3289        }
3290        else if (name.equals("supportingInfo")) {
3291          return addSupportingInfo();
3292        }
3293        else if (name.equals("study")) {
3294          return addStudy();
3295        }
3296        else
3297          return super.addChild(name);
3298      }
3299
3300  public String fhirType() {
3301    return "AdverseEvent";
3302
3303  }
3304
3305      public AdverseEvent copy() {
3306        AdverseEvent dst = new AdverseEvent();
3307        copyValues(dst);
3308        return dst;
3309      }
3310
3311      public void copyValues(AdverseEvent dst) {
3312        super.copyValues(dst);
3313        if (identifier != null) {
3314          dst.identifier = new ArrayList<Identifier>();
3315          for (Identifier i : identifier)
3316            dst.identifier.add(i.copy());
3317        };
3318        dst.status = status == null ? null : status.copy();
3319        dst.actuality = actuality == null ? null : actuality.copy();
3320        if (category != null) {
3321          dst.category = new ArrayList<CodeableConcept>();
3322          for (CodeableConcept i : category)
3323            dst.category.add(i.copy());
3324        };
3325        dst.code = code == null ? null : code.copy();
3326        dst.subject = subject == null ? null : subject.copy();
3327        dst.encounter = encounter == null ? null : encounter.copy();
3328        dst.occurrence = occurrence == null ? null : occurrence.copy();
3329        dst.detected = detected == null ? null : detected.copy();
3330        dst.recordedDate = recordedDate == null ? null : recordedDate.copy();
3331        if (resultingCondition != null) {
3332          dst.resultingCondition = new ArrayList<Reference>();
3333          for (Reference i : resultingCondition)
3334            dst.resultingCondition.add(i.copy());
3335        };
3336        dst.location = location == null ? null : location.copy();
3337        dst.seriousness = seriousness == null ? null : seriousness.copy();
3338        if (outcome != null) {
3339          dst.outcome = new ArrayList<CodeableConcept>();
3340          for (CodeableConcept i : outcome)
3341            dst.outcome.add(i.copy());
3342        };
3343        dst.recorder = recorder == null ? null : recorder.copy();
3344        if (participant != null) {
3345          dst.participant = new ArrayList<AdverseEventParticipantComponent>();
3346          for (AdverseEventParticipantComponent i : participant)
3347            dst.participant.add(i.copy());
3348        };
3349        if (suspectEntity != null) {
3350          dst.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
3351          for (AdverseEventSuspectEntityComponent i : suspectEntity)
3352            dst.suspectEntity.add(i.copy());
3353        };
3354        if (contributingFactor != null) {
3355          dst.contributingFactor = new ArrayList<AdverseEventContributingFactorComponent>();
3356          for (AdverseEventContributingFactorComponent i : contributingFactor)
3357            dst.contributingFactor.add(i.copy());
3358        };
3359        if (preventiveAction != null) {
3360          dst.preventiveAction = new ArrayList<AdverseEventPreventiveActionComponent>();
3361          for (AdverseEventPreventiveActionComponent i : preventiveAction)
3362            dst.preventiveAction.add(i.copy());
3363        };
3364        if (mitigatingAction != null) {
3365          dst.mitigatingAction = new ArrayList<AdverseEventMitigatingActionComponent>();
3366          for (AdverseEventMitigatingActionComponent i : mitigatingAction)
3367            dst.mitigatingAction.add(i.copy());
3368        };
3369        if (supportingInfo != null) {
3370          dst.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
3371          for (AdverseEventSupportingInfoComponent i : supportingInfo)
3372            dst.supportingInfo.add(i.copy());
3373        };
3374        if (study != null) {
3375          dst.study = new ArrayList<Reference>();
3376          for (Reference i : study)
3377            dst.study.add(i.copy());
3378        };
3379      }
3380
3381      protected AdverseEvent typedCopy() {
3382        return copy();
3383      }
3384
3385      @Override
3386      public boolean equalsDeep(Base other_) {
3387        if (!super.equalsDeep(other_))
3388          return false;
3389        if (!(other_ instanceof AdverseEvent))
3390          return false;
3391        AdverseEvent o = (AdverseEvent) other_;
3392        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(actuality, o.actuality, true)
3393           && compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
3394           && compareDeep(encounter, o.encounter, true) && compareDeep(occurrence, o.occurrence, true) && compareDeep(detected, o.detected, true)
3395           && compareDeep(recordedDate, o.recordedDate, true) && compareDeep(resultingCondition, o.resultingCondition, true)
3396           && compareDeep(location, o.location, true) && compareDeep(seriousness, o.seriousness, true) && compareDeep(outcome, o.outcome, true)
3397           && compareDeep(recorder, o.recorder, true) && compareDeep(participant, o.participant, true) && compareDeep(suspectEntity, o.suspectEntity, true)
3398           && compareDeep(contributingFactor, o.contributingFactor, true) && compareDeep(preventiveAction, o.preventiveAction, true)
3399           && compareDeep(mitigatingAction, o.mitigatingAction, true) && compareDeep(supportingInfo, o.supportingInfo, true)
3400           && compareDeep(study, o.study, true);
3401      }
3402
3403      @Override
3404      public boolean equalsShallow(Base other_) {
3405        if (!super.equalsShallow(other_))
3406          return false;
3407        if (!(other_ instanceof AdverseEvent))
3408          return false;
3409        AdverseEvent o = (AdverseEvent) other_;
3410        return compareValues(status, o.status, true) && compareValues(actuality, o.actuality, true) && compareValues(detected, o.detected, true)
3411           && compareValues(recordedDate, o.recordedDate, true);
3412      }
3413
3414      public boolean isEmpty() {
3415        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, actuality
3416          , category, code, subject, encounter, occurrence, detected, recordedDate, resultingCondition
3417          , location, seriousness, outcome, recorder, participant, suspectEntity, contributingFactor
3418          , preventiveAction, mitigatingAction, supportingInfo, study);
3419      }
3420
3421  @Override
3422  public ResourceType getResourceType() {
3423    return ResourceType.AdverseEvent;
3424   }
3425
3426 /**
3427   * Search parameter: <b>actuality</b>
3428   * <p>
3429   * Description: <b>actual | potential</b><br>
3430   * Type: <b>token</b><br>
3431   * Path: <b>AdverseEvent.actuality</b><br>
3432   * </p>
3433   */
3434  @SearchParamDefinition(name="actuality", path="AdverseEvent.actuality", description="actual | potential", type="token" )
3435  public static final String SP_ACTUALITY = "actuality";
3436 /**
3437   * <b>Fluent Client</b> search parameter constant for <b>actuality</b>
3438   * <p>
3439   * Description: <b>actual | potential</b><br>
3440   * Type: <b>token</b><br>
3441   * Path: <b>AdverseEvent.actuality</b><br>
3442   * </p>
3443   */
3444  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTUALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTUALITY);
3445
3446 /**
3447   * Search parameter: <b>category</b>
3448   * <p>
3449   * Description: <b>wrong-patient | procedure-mishap | medication-mishap | device | unsafe-physical-environment | hospital-aquired-infection | wrong-body-site</b><br>
3450   * Type: <b>token</b><br>
3451   * Path: <b>AdverseEvent.category</b><br>
3452   * </p>
3453   */
3454  @SearchParamDefinition(name="category", path="AdverseEvent.category", description="wrong-patient | procedure-mishap | medication-mishap | device | unsafe-physical-environment | hospital-aquired-infection | wrong-body-site", type="token" )
3455  public static final String SP_CATEGORY = "category";
3456 /**
3457   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3458   * <p>
3459   * Description: <b>wrong-patient | procedure-mishap | medication-mishap | device | unsafe-physical-environment | hospital-aquired-infection | wrong-body-site</b><br>
3460   * Type: <b>token</b><br>
3461   * Path: <b>AdverseEvent.category</b><br>
3462   * </p>
3463   */
3464  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
3465
3466 /**
3467   * Search parameter: <b>code</b>
3468   * <p>
3469   * Description: <b>Event or incident that occurred or was averted</b><br>
3470   * Type: <b>token</b><br>
3471   * Path: <b>AdverseEvent.code</b><br>
3472   * </p>
3473   */
3474  @SearchParamDefinition(name="code", path="AdverseEvent.code", description="Event or incident that occurred or was averted", type="token" )
3475  public static final String SP_CODE = "code";
3476 /**
3477   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3478   * <p>
3479   * Description: <b>Event or incident that occurred or was averted</b><br>
3480   * Type: <b>token</b><br>
3481   * Path: <b>AdverseEvent.code</b><br>
3482   * </p>
3483   */
3484  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3485
3486 /**
3487   * Search parameter: <b>date</b>
3488   * <p>
3489   * Description: <b>When the event occurred</b><br>
3490   * Type: <b>date</b><br>
3491   * Path: <b>AdverseEvent.occurrence</b><br>
3492   * </p>
3493   */
3494  @SearchParamDefinition(name="date", path="AdverseEvent.occurrence", description="When the event occurred", type="date" )
3495  public static final String SP_DATE = "date";
3496 /**
3497   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3498   * <p>
3499   * Description: <b>When the event occurred</b><br>
3500   * Type: <b>date</b><br>
3501   * Path: <b>AdverseEvent.occurrence</b><br>
3502   * </p>
3503   */
3504  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3505
3506 /**
3507   * Search parameter: <b>identifier</b>
3508   * <p>
3509   * Description: <b>Business identifier for the event</b><br>
3510   * Type: <b>token</b><br>
3511   * Path: <b>AdverseEvent.identifier</b><br>
3512   * </p>
3513   */
3514  @SearchParamDefinition(name="identifier", path="AdverseEvent.identifier", description="Business identifier for the event", type="token" )
3515  public static final String SP_IDENTIFIER = "identifier";
3516 /**
3517   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3518   * <p>
3519   * Description: <b>Business identifier for the event</b><br>
3520   * Type: <b>token</b><br>
3521   * Path: <b>AdverseEvent.identifier</b><br>
3522   * </p>
3523   */
3524  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3525
3526 /**
3527   * Search parameter: <b>location</b>
3528   * <p>
3529   * Description: <b>Location where adverse event occurred</b><br>
3530   * Type: <b>reference</b><br>
3531   * Path: <b>AdverseEvent.location</b><br>
3532   * </p>
3533   */
3534  @SearchParamDefinition(name="location", path="AdverseEvent.location", description="Location where adverse event occurred", type="reference", target={Location.class } )
3535  public static final String SP_LOCATION = "location";
3536 /**
3537   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3538   * <p>
3539   * Description: <b>Location where adverse event occurred</b><br>
3540   * Type: <b>reference</b><br>
3541   * Path: <b>AdverseEvent.location</b><br>
3542   * </p>
3543   */
3544  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3545
3546/**
3547   * Constant for fluent queries to be used to add include statements. Specifies
3548   * the path value of "<b>AdverseEvent:location</b>".
3549   */
3550  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("AdverseEvent:location").toLocked();
3551
3552 /**
3553   * Search parameter: <b>patient</b>
3554   * <p>
3555   * Description: <b>Subject impacted by event</b><br>
3556   * Type: <b>reference</b><br>
3557   * Path: <b>AdverseEvent.subject</b><br>
3558   * </p>
3559   */
3560  @SearchParamDefinition(name="patient", path="AdverseEvent.subject", description="Subject impacted by event", type="reference", target={Group.class, Patient.class, Practitioner.class, RelatedPerson.class } )
3561  public static final String SP_PATIENT = "patient";
3562 /**
3563   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3564   * <p>
3565   * Description: <b>Subject impacted by event</b><br>
3566   * Type: <b>reference</b><br>
3567   * Path: <b>AdverseEvent.subject</b><br>
3568   * </p>
3569   */
3570  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3571
3572/**
3573   * Constant for fluent queries to be used to add include statements. Specifies
3574   * the path value of "<b>AdverseEvent:patient</b>".
3575   */
3576  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AdverseEvent:patient").toLocked();
3577
3578 /**
3579   * Search parameter: <b>recorder</b>
3580   * <p>
3581   * Description: <b>Who recorded the adverse event</b><br>
3582   * Type: <b>reference</b><br>
3583   * Path: <b>AdverseEvent.recorder</b><br>
3584   * </p>
3585   */
3586  @SearchParamDefinition(name="recorder", path="AdverseEvent.recorder", description="Who recorded the adverse event", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for RelatedPerson") }, target={Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
3587  public static final String SP_RECORDER = "recorder";
3588 /**
3589   * <b>Fluent Client</b> search parameter constant for <b>recorder</b>
3590   * <p>
3591   * Description: <b>Who recorded the adverse event</b><br>
3592   * Type: <b>reference</b><br>
3593   * Path: <b>AdverseEvent.recorder</b><br>
3594   * </p>
3595   */
3596  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECORDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECORDER);
3597
3598/**
3599   * Constant for fluent queries to be used to add include statements. Specifies
3600   * the path value of "<b>AdverseEvent:recorder</b>".
3601   */
3602  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECORDER = new ca.uhn.fhir.model.api.Include("AdverseEvent:recorder").toLocked();
3603
3604 /**
3605   * Search parameter: <b>resultingcondition</b>
3606   * <p>
3607   * Description: <b>Effect on the subject due to this event</b><br>
3608   * Type: <b>reference</b><br>
3609   * Path: <b>AdverseEvent.resultingCondition</b><br>
3610   * </p>
3611   */
3612  @SearchParamDefinition(name="resultingcondition", path="AdverseEvent.resultingCondition", description="Effect on the subject due to this event", type="reference", target={Condition.class } )
3613  public static final String SP_RESULTINGCONDITION = "resultingcondition";
3614 /**
3615   * <b>Fluent Client</b> search parameter constant for <b>resultingcondition</b>
3616   * <p>
3617   * Description: <b>Effect on the subject due to this event</b><br>
3618   * Type: <b>reference</b><br>
3619   * Path: <b>AdverseEvent.resultingCondition</b><br>
3620   * </p>
3621   */
3622  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESULTINGCONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESULTINGCONDITION);
3623
3624/**
3625   * Constant for fluent queries to be used to add include statements. Specifies
3626   * the path value of "<b>AdverseEvent:resultingcondition</b>".
3627   */
3628  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESULTINGCONDITION = new ca.uhn.fhir.model.api.Include("AdverseEvent:resultingcondition").toLocked();
3629
3630 /**
3631   * Search parameter: <b>seriousness</b>
3632   * <p>
3633   * Description: <b>Seriousness or gravity of the event</b><br>
3634   * Type: <b>token</b><br>
3635   * Path: <b>AdverseEvent.seriousness</b><br>
3636   * </p>
3637   */
3638  @SearchParamDefinition(name="seriousness", path="AdverseEvent.seriousness", description="Seriousness or gravity of the event", type="token" )
3639  public static final String SP_SERIOUSNESS = "seriousness";
3640 /**
3641   * <b>Fluent Client</b> search parameter constant for <b>seriousness</b>
3642   * <p>
3643   * Description: <b>Seriousness or gravity of the event</b><br>
3644   * Type: <b>token</b><br>
3645   * Path: <b>AdverseEvent.seriousness</b><br>
3646   * </p>
3647   */
3648  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERIOUSNESS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERIOUSNESS);
3649
3650 /**
3651   * Search parameter: <b>status</b>
3652   * <p>
3653   * Description: <b>in-progress | completed | entered-in-error | unknown</b><br>
3654   * Type: <b>token</b><br>
3655   * Path: <b>AdverseEvent.status</b><br>
3656   * </p>
3657   */
3658  @SearchParamDefinition(name="status", path="AdverseEvent.status", description="in-progress | completed | entered-in-error | unknown", type="token" )
3659  public static final String SP_STATUS = "status";
3660 /**
3661   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3662   * <p>
3663   * Description: <b>in-progress | completed | entered-in-error | unknown</b><br>
3664   * Type: <b>token</b><br>
3665   * Path: <b>AdverseEvent.status</b><br>
3666   * </p>
3667   */
3668  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3669
3670 /**
3671   * Search parameter: <b>study</b>
3672   * <p>
3673   * Description: <b>Research study that the subject is enrolled in</b><br>
3674   * Type: <b>reference</b><br>
3675   * Path: <b>AdverseEvent.study</b><br>
3676   * </p>
3677   */
3678  @SearchParamDefinition(name="study", path="AdverseEvent.study", description="Research study that the subject is enrolled in", type="reference", target={ResearchStudy.class } )
3679  public static final String SP_STUDY = "study";
3680 /**
3681   * <b>Fluent Client</b> search parameter constant for <b>study</b>
3682   * <p>
3683   * Description: <b>Research study that the subject is enrolled in</b><br>
3684   * Type: <b>reference</b><br>
3685   * Path: <b>AdverseEvent.study</b><br>
3686   * </p>
3687   */
3688  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam STUDY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_STUDY);
3689
3690/**
3691   * Constant for fluent queries to be used to add include statements. Specifies
3692   * the path value of "<b>AdverseEvent:study</b>".
3693   */
3694  public static final ca.uhn.fhir.model.api.Include INCLUDE_STUDY = new ca.uhn.fhir.model.api.Include("AdverseEvent:study").toLocked();
3695
3696 /**
3697   * Search parameter: <b>subject</b>
3698   * <p>
3699   * Description: <b>Subject impacted by event</b><br>
3700   * Type: <b>reference</b><br>
3701   * Path: <b>AdverseEvent.subject</b><br>
3702   * </p>
3703   */
3704  @SearchParamDefinition(name="subject", path="AdverseEvent.subject", description="Subject impacted by event", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Group.class, Patient.class, Practitioner.class, RelatedPerson.class } )
3705  public static final String SP_SUBJECT = "subject";
3706 /**
3707   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3708   * <p>
3709   * Description: <b>Subject impacted by event</b><br>
3710   * Type: <b>reference</b><br>
3711   * Path: <b>AdverseEvent.subject</b><br>
3712   * </p>
3713   */
3714  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3715
3716/**
3717   * Constant for fluent queries to be used to add include statements. Specifies
3718   * the path value of "<b>AdverseEvent:subject</b>".
3719   */
3720  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("AdverseEvent:subject").toLocked();
3721
3722 /**
3723   * Search parameter: <b>substance</b>
3724   * <p>
3725   * Description: <b>Refers to the specific entity that caused the adverse event</b><br>
3726   * Type: <b>reference</b><br>
3727   * Path: <b>(AdverseEvent.suspectEntity.instance as Reference)</b><br>
3728   * </p>
3729   */
3730  @SearchParamDefinition(name="substance", path="(AdverseEvent.suspectEntity.instance as Reference)", description="Refers to the specific entity that caused the adverse event", type="reference", target={Device.class, Immunization.class, Medication.class, MedicationAdministration.class, MedicationUsage.class, Procedure.class, Substance.class } )
3731  public static final String SP_SUBSTANCE = "substance";
3732 /**
3733   * <b>Fluent Client</b> search parameter constant for <b>substance</b>
3734   * <p>
3735   * Description: <b>Refers to the specific entity that caused the adverse event</b><br>
3736   * Type: <b>reference</b><br>
3737   * Path: <b>(AdverseEvent.suspectEntity.instance as Reference)</b><br>
3738   * </p>
3739   */
3740  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSTANCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSTANCE);
3741
3742/**
3743   * Constant for fluent queries to be used to add include statements. Specifies
3744   * the path value of "<b>AdverseEvent:substance</b>".
3745   */
3746  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSTANCE = new ca.uhn.fhir.model.api.Include("AdverseEvent:substance").toLocked();
3747
3748
3749}
3750