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