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 Sat, Nov 5, 2022 10:47+1100 for FHIR v5.0.0-ballot
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, hospitalization, or may result in death. The AdverseEvent resource also extends to potential or avoided events that could have had such effects. There are two major domains where the AdverseEvent resource is expected to be used. One is in clinical care reported adverse events and the other is in reporting adverse events in clinical  research trial management. Given the differences between these two arenas, we recommend consulting the domain specific implementation guides when implementing the AdverseEvent Resource. The implementation guides include specific extensions, value sets and constraints.
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, ResearchSubject.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|ResearchSubject)", "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|ResearchSubject)", "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, ResearchSubject.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|ResearchSubject)", "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|ResearchSubject)", "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, Device.class, DocumentReference.class, MedicationAdministration.class, MedicationUsage.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|Device|DocumentReference|MedicationAdministration|MedicationUsage)|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|Device|DocumentReference|MedicationAdministration|MedicationUsage)|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|Device|DocumentReference|MedicationAdministration|MedicationUsage)|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|Device|DocumentReference|MedicationAdministration|MedicationUsage)", "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, MedicationAdministration.class, MedicationUsage.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|MedicationAdministration|MedicationUsage)|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|MedicationAdministration|MedicationUsage)|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|MedicationAdministration|MedicationUsage)|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|MedicationAdministration|MedicationUsage)", "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, ResearchSubject.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, ResearchSubject.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     * The research study that the subject is enrolled in.
1901     */
1902    @Child(name = "study", type = {ResearchStudy.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1903    @Description(shortDefinition="Research study that the subject is enrolled in", formalDefinition="The research study that the subject is enrolled in." )
1904    protected List<Reference> study;
1905
1906    /**
1907     * 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.
1908     */
1909    @Child(name = "expectedInResearchStudy", type = {BooleanType.class}, order=17, min=0, max=1, modifier=false, summary=false)
1910    @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." )
1911    protected BooleanType expectedInResearchStudy;
1912
1913    /**
1914     * Describes the entity that is suspected to have caused the adverse event.
1915     */
1916    @Child(name = "suspectEntity", type = {}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1917    @Description(shortDefinition="The suspected agent causing the adverse event", formalDefinition="Describes the entity that is suspected to have caused the adverse event." )
1918    protected List<AdverseEventSuspectEntityComponent> suspectEntity;
1919
1920    /**
1921     * The contributing factors suspected to have increased the probability or severity of the adverse event.
1922     */
1923    @Child(name = "contributingFactor", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1924    @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." )
1925    protected List<AdverseEventContributingFactorComponent> contributingFactor;
1926
1927    /**
1928     * Preventive actions that contributed to avoiding the adverse event.
1929     */
1930    @Child(name = "preventiveAction", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1931    @Description(shortDefinition="Preventive actions that contributed to avoiding the adverse event", formalDefinition="Preventive actions that contributed to avoiding the adverse event." )
1932    protected List<AdverseEventPreventiveActionComponent> preventiveAction;
1933
1934    /**
1935     * The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.
1936     */
1937    @Child(name = "mitigatingAction", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1938    @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." )
1939    protected List<AdverseEventMitigatingActionComponent> mitigatingAction;
1940
1941    /**
1942     * Supporting information relevant to the event.
1943     */
1944    @Child(name = "supportingInfo", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1945    @Description(shortDefinition="Supporting information relevant to the event", formalDefinition="Supporting information relevant to the event." )
1946    protected List<AdverseEventSupportingInfoComponent> supportingInfo;
1947
1948    /**
1949     * Comments made about the adverse event by the performer, subject or other participants.
1950     */
1951    @Child(name = "note", type = {Annotation.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1952    @Description(shortDefinition="Comment on adverse event", formalDefinition="Comments made about the adverse event by the performer, subject or other participants." )
1953    protected List<Annotation> note;
1954
1955    private static final long serialVersionUID = 973851632L;
1956
1957  /**
1958   * Constructor
1959   */
1960    public AdverseEvent() {
1961      super();
1962    }
1963
1964  /**
1965   * Constructor
1966   */
1967    public AdverseEvent(AdverseEventStatus status, AdverseEventActuality actuality, Reference subject) {
1968      super();
1969      this.setStatus(status);
1970      this.setActuality(actuality);
1971      this.setSubject(subject);
1972    }
1973
1974    /**
1975     * @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.)
1976     */
1977    public List<Identifier> getIdentifier() { 
1978      if (this.identifier == null)
1979        this.identifier = new ArrayList<Identifier>();
1980      return this.identifier;
1981    }
1982
1983    /**
1984     * @return Returns a reference to <code>this</code> for easy method chaining
1985     */
1986    public AdverseEvent setIdentifier(List<Identifier> theIdentifier) { 
1987      this.identifier = theIdentifier;
1988      return this;
1989    }
1990
1991    public boolean hasIdentifier() { 
1992      if (this.identifier == null)
1993        return false;
1994      for (Identifier item : this.identifier)
1995        if (!item.isEmpty())
1996          return true;
1997      return false;
1998    }
1999
2000    public Identifier addIdentifier() { //3
2001      Identifier t = new Identifier();
2002      if (this.identifier == null)
2003        this.identifier = new ArrayList<Identifier>();
2004      this.identifier.add(t);
2005      return t;
2006    }
2007
2008    public AdverseEvent addIdentifier(Identifier t) { //3
2009      if (t == null)
2010        return this;
2011      if (this.identifier == null)
2012        this.identifier = new ArrayList<Identifier>();
2013      this.identifier.add(t);
2014      return this;
2015    }
2016
2017    /**
2018     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
2019     */
2020    public Identifier getIdentifierFirstRep() { 
2021      if (getIdentifier().isEmpty()) {
2022        addIdentifier();
2023      }
2024      return getIdentifier().get(0);
2025    }
2026
2027    /**
2028     * @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
2029     */
2030    public Enumeration<AdverseEventStatus> getStatusElement() { 
2031      if (this.status == null)
2032        if (Configuration.errorOnAutoCreate())
2033          throw new Error("Attempt to auto-create AdverseEvent.status");
2034        else if (Configuration.doAutoCreate())
2035          this.status = new Enumeration<AdverseEventStatus>(new AdverseEventStatusEnumFactory()); // bb
2036      return this.status;
2037    }
2038
2039    public boolean hasStatusElement() { 
2040      return this.status != null && !this.status.isEmpty();
2041    }
2042
2043    public boolean hasStatus() { 
2044      return this.status != null && !this.status.isEmpty();
2045    }
2046
2047    /**
2048     * @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
2049     */
2050    public AdverseEvent setStatusElement(Enumeration<AdverseEventStatus> value) { 
2051      this.status = value;
2052      return this;
2053    }
2054
2055    /**
2056     * @return The current state of the adverse event or potential adverse event.
2057     */
2058    public AdverseEventStatus getStatus() { 
2059      return this.status == null ? null : this.status.getValue();
2060    }
2061
2062    /**
2063     * @param value The current state of the adverse event or potential adverse event.
2064     */
2065    public AdverseEvent setStatus(AdverseEventStatus value) { 
2066        if (this.status == null)
2067          this.status = new Enumeration<AdverseEventStatus>(new AdverseEventStatusEnumFactory());
2068        this.status.setValue(value);
2069      return this;
2070    }
2071
2072    /**
2073     * @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
2074     */
2075    public Enumeration<AdverseEventActuality> getActualityElement() { 
2076      if (this.actuality == null)
2077        if (Configuration.errorOnAutoCreate())
2078          throw new Error("Attempt to auto-create AdverseEvent.actuality");
2079        else if (Configuration.doAutoCreate())
2080          this.actuality = new Enumeration<AdverseEventActuality>(new AdverseEventActualityEnumFactory()); // bb
2081      return this.actuality;
2082    }
2083
2084    public boolean hasActualityElement() { 
2085      return this.actuality != null && !this.actuality.isEmpty();
2086    }
2087
2088    public boolean hasActuality() { 
2089      return this.actuality != null && !this.actuality.isEmpty();
2090    }
2091
2092    /**
2093     * @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
2094     */
2095    public AdverseEvent setActualityElement(Enumeration<AdverseEventActuality> value) { 
2096      this.actuality = value;
2097      return this;
2098    }
2099
2100    /**
2101     * @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.
2102     */
2103    public AdverseEventActuality getActuality() { 
2104      return this.actuality == null ? null : this.actuality.getValue();
2105    }
2106
2107    /**
2108     * @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.
2109     */
2110    public AdverseEvent setActuality(AdverseEventActuality value) { 
2111        if (this.actuality == null)
2112          this.actuality = new Enumeration<AdverseEventActuality>(new AdverseEventActualityEnumFactory());
2113        this.actuality.setValue(value);
2114      return this;
2115    }
2116
2117    /**
2118     * @return {@link #category} (The overall type of event, intended for search and filtering purposes.)
2119     */
2120    public List<CodeableConcept> getCategory() { 
2121      if (this.category == null)
2122        this.category = new ArrayList<CodeableConcept>();
2123      return this.category;
2124    }
2125
2126    /**
2127     * @return Returns a reference to <code>this</code> for easy method chaining
2128     */
2129    public AdverseEvent setCategory(List<CodeableConcept> theCategory) { 
2130      this.category = theCategory;
2131      return this;
2132    }
2133
2134    public boolean hasCategory() { 
2135      if (this.category == null)
2136        return false;
2137      for (CodeableConcept item : this.category)
2138        if (!item.isEmpty())
2139          return true;
2140      return false;
2141    }
2142
2143    public CodeableConcept addCategory() { //3
2144      CodeableConcept t = new CodeableConcept();
2145      if (this.category == null)
2146        this.category = new ArrayList<CodeableConcept>();
2147      this.category.add(t);
2148      return t;
2149    }
2150
2151    public AdverseEvent addCategory(CodeableConcept t) { //3
2152      if (t == null)
2153        return this;
2154      if (this.category == null)
2155        this.category = new ArrayList<CodeableConcept>();
2156      this.category.add(t);
2157      return this;
2158    }
2159
2160    /**
2161     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
2162     */
2163    public CodeableConcept getCategoryFirstRep() { 
2164      if (getCategory().isEmpty()) {
2165        addCategory();
2166      }
2167      return getCategory().get(0);
2168    }
2169
2170    /**
2171     * @return {@link #code} (Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.)
2172     */
2173    public CodeableConcept getCode() { 
2174      if (this.code == null)
2175        if (Configuration.errorOnAutoCreate())
2176          throw new Error("Attempt to auto-create AdverseEvent.code");
2177        else if (Configuration.doAutoCreate())
2178          this.code = new CodeableConcept(); // cc
2179      return this.code;
2180    }
2181
2182    public boolean hasCode() { 
2183      return this.code != null && !this.code.isEmpty();
2184    }
2185
2186    /**
2187     * @param value {@link #code} (Specific event that occurred or that was averted, such as patient fall, wrong organ removed, or wrong blood transfused.)
2188     */
2189    public AdverseEvent setCode(CodeableConcept value) { 
2190      this.code = value;
2191      return this;
2192    }
2193
2194    /**
2195     * @return {@link #subject} (This subject or group impacted by the event.)
2196     */
2197    public Reference getSubject() { 
2198      if (this.subject == null)
2199        if (Configuration.errorOnAutoCreate())
2200          throw new Error("Attempt to auto-create AdverseEvent.subject");
2201        else if (Configuration.doAutoCreate())
2202          this.subject = new Reference(); // cc
2203      return this.subject;
2204    }
2205
2206    public boolean hasSubject() { 
2207      return this.subject != null && !this.subject.isEmpty();
2208    }
2209
2210    /**
2211     * @param value {@link #subject} (This subject or group impacted by the event.)
2212     */
2213    public AdverseEvent setSubject(Reference value) { 
2214      this.subject = value;
2215      return this;
2216    }
2217
2218    /**
2219     * @return {@link #encounter} (The Encounter associated with the start of the AdverseEvent.)
2220     */
2221    public Reference getEncounter() { 
2222      if (this.encounter == null)
2223        if (Configuration.errorOnAutoCreate())
2224          throw new Error("Attempt to auto-create AdverseEvent.encounter");
2225        else if (Configuration.doAutoCreate())
2226          this.encounter = new Reference(); // cc
2227      return this.encounter;
2228    }
2229
2230    public boolean hasEncounter() { 
2231      return this.encounter != null && !this.encounter.isEmpty();
2232    }
2233
2234    /**
2235     * @param value {@link #encounter} (The Encounter associated with the start of the AdverseEvent.)
2236     */
2237    public AdverseEvent setEncounter(Reference value) { 
2238      this.encounter = value;
2239      return this;
2240    }
2241
2242    /**
2243     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2244     */
2245    public DataType getOccurrence() { 
2246      return this.occurrence;
2247    }
2248
2249    /**
2250     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2251     */
2252    public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 
2253      if (this.occurrence == null)
2254        this.occurrence = new DateTimeType();
2255      if (!(this.occurrence instanceof DateTimeType))
2256        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered");
2257      return (DateTimeType) this.occurrence;
2258    }
2259
2260    public boolean hasOccurrenceDateTimeType() { 
2261      return this != null && this.occurrence instanceof DateTimeType;
2262    }
2263
2264    /**
2265     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2266     */
2267    public Period getOccurrencePeriod() throws FHIRException { 
2268      if (this.occurrence == null)
2269        this.occurrence = new Period();
2270      if (!(this.occurrence instanceof Period))
2271        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered");
2272      return (Period) this.occurrence;
2273    }
2274
2275    public boolean hasOccurrencePeriod() { 
2276      return this != null && this.occurrence instanceof Period;
2277    }
2278
2279    /**
2280     * @return {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2281     */
2282    public Timing getOccurrenceTiming() throws FHIRException { 
2283      if (this.occurrence == null)
2284        this.occurrence = new Timing();
2285      if (!(this.occurrence instanceof Timing))
2286        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered");
2287      return (Timing) this.occurrence;
2288    }
2289
2290    public boolean hasOccurrenceTiming() { 
2291      return this != null && this.occurrence instanceof Timing;
2292    }
2293
2294    public boolean hasOccurrence() { 
2295      return this.occurrence != null && !this.occurrence.isEmpty();
2296    }
2297
2298    /**
2299     * @param value {@link #occurrence} (The date (and perhaps time) when the adverse event occurred.)
2300     */
2301    public AdverseEvent setOccurrence(DataType value) { 
2302      if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing))
2303        throw new Error("Not the right type for AdverseEvent.occurrence[x]: "+value.fhirType());
2304      this.occurrence = value;
2305      return this;
2306    }
2307
2308    /**
2309     * @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
2310     */
2311    public DateTimeType getDetectedElement() { 
2312      if (this.detected == null)
2313        if (Configuration.errorOnAutoCreate())
2314          throw new Error("Attempt to auto-create AdverseEvent.detected");
2315        else if (Configuration.doAutoCreate())
2316          this.detected = new DateTimeType(); // bb
2317      return this.detected;
2318    }
2319
2320    public boolean hasDetectedElement() { 
2321      return this.detected != null && !this.detected.isEmpty();
2322    }
2323
2324    public boolean hasDetected() { 
2325      return this.detected != null && !this.detected.isEmpty();
2326    }
2327
2328    /**
2329     * @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
2330     */
2331    public AdverseEvent setDetectedElement(DateTimeType value) { 
2332      this.detected = value;
2333      return this;
2334    }
2335
2336    /**
2337     * @return Estimated or actual date the AdverseEvent began, in the opinion of the reporter.
2338     */
2339    public Date getDetected() { 
2340      return this.detected == null ? null : this.detected.getValue();
2341    }
2342
2343    /**
2344     * @param value Estimated or actual date the AdverseEvent began, in the opinion of the reporter.
2345     */
2346    public AdverseEvent setDetected(Date value) { 
2347      if (value == null)
2348        this.detected = null;
2349      else {
2350        if (this.detected == null)
2351          this.detected = new DateTimeType();
2352        this.detected.setValue(value);
2353      }
2354      return this;
2355    }
2356
2357    /**
2358     * @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
2359     */
2360    public DateTimeType getRecordedDateElement() { 
2361      if (this.recordedDate == null)
2362        if (Configuration.errorOnAutoCreate())
2363          throw new Error("Attempt to auto-create AdverseEvent.recordedDate");
2364        else if (Configuration.doAutoCreate())
2365          this.recordedDate = new DateTimeType(); // bb
2366      return this.recordedDate;
2367    }
2368
2369    public boolean hasRecordedDateElement() { 
2370      return this.recordedDate != null && !this.recordedDate.isEmpty();
2371    }
2372
2373    public boolean hasRecordedDate() { 
2374      return this.recordedDate != null && !this.recordedDate.isEmpty();
2375    }
2376
2377    /**
2378     * @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
2379     */
2380    public AdverseEvent setRecordedDateElement(DateTimeType value) { 
2381      this.recordedDate = value;
2382      return this;
2383    }
2384
2385    /**
2386     * @return The date on which the existence of the AdverseEvent was first recorded.
2387     */
2388    public Date getRecordedDate() { 
2389      return this.recordedDate == null ? null : this.recordedDate.getValue();
2390    }
2391
2392    /**
2393     * @param value The date on which the existence of the AdverseEvent was first recorded.
2394     */
2395    public AdverseEvent setRecordedDate(Date value) { 
2396      if (value == null)
2397        this.recordedDate = null;
2398      else {
2399        if (this.recordedDate == null)
2400          this.recordedDate = new DateTimeType();
2401        this.recordedDate.setValue(value);
2402      }
2403      return this;
2404    }
2405
2406    /**
2407     * @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.)
2408     */
2409    public List<Reference> getResultingCondition() { 
2410      if (this.resultingCondition == null)
2411        this.resultingCondition = new ArrayList<Reference>();
2412      return this.resultingCondition;
2413    }
2414
2415    /**
2416     * @return Returns a reference to <code>this</code> for easy method chaining
2417     */
2418    public AdverseEvent setResultingCondition(List<Reference> theResultingCondition) { 
2419      this.resultingCondition = theResultingCondition;
2420      return this;
2421    }
2422
2423    public boolean hasResultingCondition() { 
2424      if (this.resultingCondition == null)
2425        return false;
2426      for (Reference item : this.resultingCondition)
2427        if (!item.isEmpty())
2428          return true;
2429      return false;
2430    }
2431
2432    public Reference addResultingCondition() { //3
2433      Reference t = new Reference();
2434      if (this.resultingCondition == null)
2435        this.resultingCondition = new ArrayList<Reference>();
2436      this.resultingCondition.add(t);
2437      return t;
2438    }
2439
2440    public AdverseEvent addResultingCondition(Reference t) { //3
2441      if (t == null)
2442        return this;
2443      if (this.resultingCondition == null)
2444        this.resultingCondition = new ArrayList<Reference>();
2445      this.resultingCondition.add(t);
2446      return this;
2447    }
2448
2449    /**
2450     * @return The first repetition of repeating field {@link #resultingCondition}, creating it if it does not already exist {3}
2451     */
2452    public Reference getResultingConditionFirstRep() { 
2453      if (getResultingCondition().isEmpty()) {
2454        addResultingCondition();
2455      }
2456      return getResultingCondition().get(0);
2457    }
2458
2459    /**
2460     * @return {@link #location} (The information about where the adverse event occurred.)
2461     */
2462    public Reference getLocation() { 
2463      if (this.location == null)
2464        if (Configuration.errorOnAutoCreate())
2465          throw new Error("Attempt to auto-create AdverseEvent.location");
2466        else if (Configuration.doAutoCreate())
2467          this.location = new Reference(); // cc
2468      return this.location;
2469    }
2470
2471    public boolean hasLocation() { 
2472      return this.location != null && !this.location.isEmpty();
2473    }
2474
2475    /**
2476     * @param value {@link #location} (The information about where the adverse event occurred.)
2477     */
2478    public AdverseEvent setLocation(Reference value) { 
2479      this.location = value;
2480      return this;
2481    }
2482
2483    /**
2484     * @return {@link #seriousness} (Assessment whether this event, or averted event, was of clinical importance.)
2485     */
2486    public CodeableConcept getSeriousness() { 
2487      if (this.seriousness == null)
2488        if (Configuration.errorOnAutoCreate())
2489          throw new Error("Attempt to auto-create AdverseEvent.seriousness");
2490        else if (Configuration.doAutoCreate())
2491          this.seriousness = new CodeableConcept(); // cc
2492      return this.seriousness;
2493    }
2494
2495    public boolean hasSeriousness() { 
2496      return this.seriousness != null && !this.seriousness.isEmpty();
2497    }
2498
2499    /**
2500     * @param value {@link #seriousness} (Assessment whether this event, or averted event, was of clinical importance.)
2501     */
2502    public AdverseEvent setSeriousness(CodeableConcept value) { 
2503      this.seriousness = value;
2504      return this;
2505    }
2506
2507    /**
2508     * @return {@link #outcome} (Describes the type of outcome from the adverse event, such as resolved, recovering, ongoing, resolved-with-sequelae, or fatal.)
2509     */
2510    public List<CodeableConcept> getOutcome() { 
2511      if (this.outcome == null)
2512        this.outcome = new ArrayList<CodeableConcept>();
2513      return this.outcome;
2514    }
2515
2516    /**
2517     * @return Returns a reference to <code>this</code> for easy method chaining
2518     */
2519    public AdverseEvent setOutcome(List<CodeableConcept> theOutcome) { 
2520      this.outcome = theOutcome;
2521      return this;
2522    }
2523
2524    public boolean hasOutcome() { 
2525      if (this.outcome == null)
2526        return false;
2527      for (CodeableConcept item : this.outcome)
2528        if (!item.isEmpty())
2529          return true;
2530      return false;
2531    }
2532
2533    public CodeableConcept addOutcome() { //3
2534      CodeableConcept t = new CodeableConcept();
2535      if (this.outcome == null)
2536        this.outcome = new ArrayList<CodeableConcept>();
2537      this.outcome.add(t);
2538      return t;
2539    }
2540
2541    public AdverseEvent addOutcome(CodeableConcept t) { //3
2542      if (t == null)
2543        return this;
2544      if (this.outcome == null)
2545        this.outcome = new ArrayList<CodeableConcept>();
2546      this.outcome.add(t);
2547      return this;
2548    }
2549
2550    /**
2551     * @return The first repetition of repeating field {@link #outcome}, creating it if it does not already exist {3}
2552     */
2553    public CodeableConcept getOutcomeFirstRep() { 
2554      if (getOutcome().isEmpty()) {
2555        addOutcome();
2556      }
2557      return getOutcome().get(0);
2558    }
2559
2560    /**
2561     * @return {@link #recorder} (Information on who recorded the adverse event.  May be the patient or a practitioner.)
2562     */
2563    public Reference getRecorder() { 
2564      if (this.recorder == null)
2565        if (Configuration.errorOnAutoCreate())
2566          throw new Error("Attempt to auto-create AdverseEvent.recorder");
2567        else if (Configuration.doAutoCreate())
2568          this.recorder = new Reference(); // cc
2569      return this.recorder;
2570    }
2571
2572    public boolean hasRecorder() { 
2573      return this.recorder != null && !this.recorder.isEmpty();
2574    }
2575
2576    /**
2577     * @param value {@link #recorder} (Information on who recorded the adverse event.  May be the patient or a practitioner.)
2578     */
2579    public AdverseEvent setRecorder(Reference value) { 
2580      this.recorder = value;
2581      return this;
2582    }
2583
2584    /**
2585     * @return {@link #participant} (Indicates who or what participated in the adverse event and how they were involved.)
2586     */
2587    public List<AdverseEventParticipantComponent> getParticipant() { 
2588      if (this.participant == null)
2589        this.participant = new ArrayList<AdverseEventParticipantComponent>();
2590      return this.participant;
2591    }
2592
2593    /**
2594     * @return Returns a reference to <code>this</code> for easy method chaining
2595     */
2596    public AdverseEvent setParticipant(List<AdverseEventParticipantComponent> theParticipant) { 
2597      this.participant = theParticipant;
2598      return this;
2599    }
2600
2601    public boolean hasParticipant() { 
2602      if (this.participant == null)
2603        return false;
2604      for (AdverseEventParticipantComponent item : this.participant)
2605        if (!item.isEmpty())
2606          return true;
2607      return false;
2608    }
2609
2610    public AdverseEventParticipantComponent addParticipant() { //3
2611      AdverseEventParticipantComponent t = new AdverseEventParticipantComponent();
2612      if (this.participant == null)
2613        this.participant = new ArrayList<AdverseEventParticipantComponent>();
2614      this.participant.add(t);
2615      return t;
2616    }
2617
2618    public AdverseEvent addParticipant(AdverseEventParticipantComponent t) { //3
2619      if (t == null)
2620        return this;
2621      if (this.participant == null)
2622        this.participant = new ArrayList<AdverseEventParticipantComponent>();
2623      this.participant.add(t);
2624      return this;
2625    }
2626
2627    /**
2628     * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist {3}
2629     */
2630    public AdverseEventParticipantComponent getParticipantFirstRep() { 
2631      if (getParticipant().isEmpty()) {
2632        addParticipant();
2633      }
2634      return getParticipant().get(0);
2635    }
2636
2637    /**
2638     * @return {@link #study} (The research study that the subject is enrolled in.)
2639     */
2640    public List<Reference> getStudy() { 
2641      if (this.study == null)
2642        this.study = new ArrayList<Reference>();
2643      return this.study;
2644    }
2645
2646    /**
2647     * @return Returns a reference to <code>this</code> for easy method chaining
2648     */
2649    public AdverseEvent setStudy(List<Reference> theStudy) { 
2650      this.study = theStudy;
2651      return this;
2652    }
2653
2654    public boolean hasStudy() { 
2655      if (this.study == null)
2656        return false;
2657      for (Reference item : this.study)
2658        if (!item.isEmpty())
2659          return true;
2660      return false;
2661    }
2662
2663    public Reference addStudy() { //3
2664      Reference t = new Reference();
2665      if (this.study == null)
2666        this.study = new ArrayList<Reference>();
2667      this.study.add(t);
2668      return t;
2669    }
2670
2671    public AdverseEvent addStudy(Reference t) { //3
2672      if (t == null)
2673        return this;
2674      if (this.study == null)
2675        this.study = new ArrayList<Reference>();
2676      this.study.add(t);
2677      return this;
2678    }
2679
2680    /**
2681     * @return The first repetition of repeating field {@link #study}, creating it if it does not already exist {3}
2682     */
2683    public Reference getStudyFirstRep() { 
2684      if (getStudy().isEmpty()) {
2685        addStudy();
2686      }
2687      return getStudy().get(0);
2688    }
2689
2690    /**
2691     * @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
2692     */
2693    public BooleanType getExpectedInResearchStudyElement() { 
2694      if (this.expectedInResearchStudy == null)
2695        if (Configuration.errorOnAutoCreate())
2696          throw new Error("Attempt to auto-create AdverseEvent.expectedInResearchStudy");
2697        else if (Configuration.doAutoCreate())
2698          this.expectedInResearchStudy = new BooleanType(); // bb
2699      return this.expectedInResearchStudy;
2700    }
2701
2702    public boolean hasExpectedInResearchStudyElement() { 
2703      return this.expectedInResearchStudy != null && !this.expectedInResearchStudy.isEmpty();
2704    }
2705
2706    public boolean hasExpectedInResearchStudy() { 
2707      return this.expectedInResearchStudy != null && !this.expectedInResearchStudy.isEmpty();
2708    }
2709
2710    /**
2711     * @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
2712     */
2713    public AdverseEvent setExpectedInResearchStudyElement(BooleanType value) { 
2714      this.expectedInResearchStudy = value;
2715      return this;
2716    }
2717
2718    /**
2719     * @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.
2720     */
2721    public boolean getExpectedInResearchStudy() { 
2722      return this.expectedInResearchStudy == null || this.expectedInResearchStudy.isEmpty() ? false : this.expectedInResearchStudy.getValue();
2723    }
2724
2725    /**
2726     * @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.
2727     */
2728    public AdverseEvent setExpectedInResearchStudy(boolean value) { 
2729        if (this.expectedInResearchStudy == null)
2730          this.expectedInResearchStudy = new BooleanType();
2731        this.expectedInResearchStudy.setValue(value);
2732      return this;
2733    }
2734
2735    /**
2736     * @return {@link #suspectEntity} (Describes the entity that is suspected to have caused the adverse event.)
2737     */
2738    public List<AdverseEventSuspectEntityComponent> getSuspectEntity() { 
2739      if (this.suspectEntity == null)
2740        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2741      return this.suspectEntity;
2742    }
2743
2744    /**
2745     * @return Returns a reference to <code>this</code> for easy method chaining
2746     */
2747    public AdverseEvent setSuspectEntity(List<AdverseEventSuspectEntityComponent> theSuspectEntity) { 
2748      this.suspectEntity = theSuspectEntity;
2749      return this;
2750    }
2751
2752    public boolean hasSuspectEntity() { 
2753      if (this.suspectEntity == null)
2754        return false;
2755      for (AdverseEventSuspectEntityComponent item : this.suspectEntity)
2756        if (!item.isEmpty())
2757          return true;
2758      return false;
2759    }
2760
2761    public AdverseEventSuspectEntityComponent addSuspectEntity() { //3
2762      AdverseEventSuspectEntityComponent t = new AdverseEventSuspectEntityComponent();
2763      if (this.suspectEntity == null)
2764        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2765      this.suspectEntity.add(t);
2766      return t;
2767    }
2768
2769    public AdverseEvent addSuspectEntity(AdverseEventSuspectEntityComponent t) { //3
2770      if (t == null)
2771        return this;
2772      if (this.suspectEntity == null)
2773        this.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
2774      this.suspectEntity.add(t);
2775      return this;
2776    }
2777
2778    /**
2779     * @return The first repetition of repeating field {@link #suspectEntity}, creating it if it does not already exist {3}
2780     */
2781    public AdverseEventSuspectEntityComponent getSuspectEntityFirstRep() { 
2782      if (getSuspectEntity().isEmpty()) {
2783        addSuspectEntity();
2784      }
2785      return getSuspectEntity().get(0);
2786    }
2787
2788    /**
2789     * @return {@link #contributingFactor} (The contributing factors suspected to have increased the probability or severity of the adverse event.)
2790     */
2791    public List<AdverseEventContributingFactorComponent> getContributingFactor() { 
2792      if (this.contributingFactor == null)
2793        this.contributingFactor = new ArrayList<AdverseEventContributingFactorComponent>();
2794      return this.contributingFactor;
2795    }
2796
2797    /**
2798     * @return Returns a reference to <code>this</code> for easy method chaining
2799     */
2800    public AdverseEvent setContributingFactor(List<AdverseEventContributingFactorComponent> theContributingFactor) { 
2801      this.contributingFactor = theContributingFactor;
2802      return this;
2803    }
2804
2805    public boolean hasContributingFactor() { 
2806      if (this.contributingFactor == null)
2807        return false;
2808      for (AdverseEventContributingFactorComponent item : this.contributingFactor)
2809        if (!item.isEmpty())
2810          return true;
2811      return false;
2812    }
2813
2814    public AdverseEventContributingFactorComponent addContributingFactor() { //3
2815      AdverseEventContributingFactorComponent t = new AdverseEventContributingFactorComponent();
2816      if (this.contributingFactor == null)
2817        this.contributingFactor = new ArrayList<AdverseEventContributingFactorComponent>();
2818      this.contributingFactor.add(t);
2819      return t;
2820    }
2821
2822    public AdverseEvent addContributingFactor(AdverseEventContributingFactorComponent t) { //3
2823      if (t == null)
2824        return this;
2825      if (this.contributingFactor == null)
2826        this.contributingFactor = new ArrayList<AdverseEventContributingFactorComponent>();
2827      this.contributingFactor.add(t);
2828      return this;
2829    }
2830
2831    /**
2832     * @return The first repetition of repeating field {@link #contributingFactor}, creating it if it does not already exist {3}
2833     */
2834    public AdverseEventContributingFactorComponent getContributingFactorFirstRep() { 
2835      if (getContributingFactor().isEmpty()) {
2836        addContributingFactor();
2837      }
2838      return getContributingFactor().get(0);
2839    }
2840
2841    /**
2842     * @return {@link #preventiveAction} (Preventive actions that contributed to avoiding the adverse event.)
2843     */
2844    public List<AdverseEventPreventiveActionComponent> getPreventiveAction() { 
2845      if (this.preventiveAction == null)
2846        this.preventiveAction = new ArrayList<AdverseEventPreventiveActionComponent>();
2847      return this.preventiveAction;
2848    }
2849
2850    /**
2851     * @return Returns a reference to <code>this</code> for easy method chaining
2852     */
2853    public AdverseEvent setPreventiveAction(List<AdverseEventPreventiveActionComponent> thePreventiveAction) { 
2854      this.preventiveAction = thePreventiveAction;
2855      return this;
2856    }
2857
2858    public boolean hasPreventiveAction() { 
2859      if (this.preventiveAction == null)
2860        return false;
2861      for (AdverseEventPreventiveActionComponent item : this.preventiveAction)
2862        if (!item.isEmpty())
2863          return true;
2864      return false;
2865    }
2866
2867    public AdverseEventPreventiveActionComponent addPreventiveAction() { //3
2868      AdverseEventPreventiveActionComponent t = new AdverseEventPreventiveActionComponent();
2869      if (this.preventiveAction == null)
2870        this.preventiveAction = new ArrayList<AdverseEventPreventiveActionComponent>();
2871      this.preventiveAction.add(t);
2872      return t;
2873    }
2874
2875    public AdverseEvent addPreventiveAction(AdverseEventPreventiveActionComponent t) { //3
2876      if (t == null)
2877        return this;
2878      if (this.preventiveAction == null)
2879        this.preventiveAction = new ArrayList<AdverseEventPreventiveActionComponent>();
2880      this.preventiveAction.add(t);
2881      return this;
2882    }
2883
2884    /**
2885     * @return The first repetition of repeating field {@link #preventiveAction}, creating it if it does not already exist {3}
2886     */
2887    public AdverseEventPreventiveActionComponent getPreventiveActionFirstRep() { 
2888      if (getPreventiveAction().isEmpty()) {
2889        addPreventiveAction();
2890      }
2891      return getPreventiveAction().get(0);
2892    }
2893
2894    /**
2895     * @return {@link #mitigatingAction} (The ameliorating action taken after the adverse event occured in order to reduce the extent of harm.)
2896     */
2897    public List<AdverseEventMitigatingActionComponent> getMitigatingAction() { 
2898      if (this.mitigatingAction == null)
2899        this.mitigatingAction = new ArrayList<AdverseEventMitigatingActionComponent>();
2900      return this.mitigatingAction;
2901    }
2902
2903    /**
2904     * @return Returns a reference to <code>this</code> for easy method chaining
2905     */
2906    public AdverseEvent setMitigatingAction(List<AdverseEventMitigatingActionComponent> theMitigatingAction) { 
2907      this.mitigatingAction = theMitigatingAction;
2908      return this;
2909    }
2910
2911    public boolean hasMitigatingAction() { 
2912      if (this.mitigatingAction == null)
2913        return false;
2914      for (AdverseEventMitigatingActionComponent item : this.mitigatingAction)
2915        if (!item.isEmpty())
2916          return true;
2917      return false;
2918    }
2919
2920    public AdverseEventMitigatingActionComponent addMitigatingAction() { //3
2921      AdverseEventMitigatingActionComponent t = new AdverseEventMitigatingActionComponent();
2922      if (this.mitigatingAction == null)
2923        this.mitigatingAction = new ArrayList<AdverseEventMitigatingActionComponent>();
2924      this.mitigatingAction.add(t);
2925      return t;
2926    }
2927
2928    public AdverseEvent addMitigatingAction(AdverseEventMitigatingActionComponent t) { //3
2929      if (t == null)
2930        return this;
2931      if (this.mitigatingAction == null)
2932        this.mitigatingAction = new ArrayList<AdverseEventMitigatingActionComponent>();
2933      this.mitigatingAction.add(t);
2934      return this;
2935    }
2936
2937    /**
2938     * @return The first repetition of repeating field {@link #mitigatingAction}, creating it if it does not already exist {3}
2939     */
2940    public AdverseEventMitigatingActionComponent getMitigatingActionFirstRep() { 
2941      if (getMitigatingAction().isEmpty()) {
2942        addMitigatingAction();
2943      }
2944      return getMitigatingAction().get(0);
2945    }
2946
2947    /**
2948     * @return {@link #supportingInfo} (Supporting information relevant to the event.)
2949     */
2950    public List<AdverseEventSupportingInfoComponent> getSupportingInfo() { 
2951      if (this.supportingInfo == null)
2952        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2953      return this.supportingInfo;
2954    }
2955
2956    /**
2957     * @return Returns a reference to <code>this</code> for easy method chaining
2958     */
2959    public AdverseEvent setSupportingInfo(List<AdverseEventSupportingInfoComponent> theSupportingInfo) { 
2960      this.supportingInfo = theSupportingInfo;
2961      return this;
2962    }
2963
2964    public boolean hasSupportingInfo() { 
2965      if (this.supportingInfo == null)
2966        return false;
2967      for (AdverseEventSupportingInfoComponent item : this.supportingInfo)
2968        if (!item.isEmpty())
2969          return true;
2970      return false;
2971    }
2972
2973    public AdverseEventSupportingInfoComponent addSupportingInfo() { //3
2974      AdverseEventSupportingInfoComponent t = new AdverseEventSupportingInfoComponent();
2975      if (this.supportingInfo == null)
2976        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2977      this.supportingInfo.add(t);
2978      return t;
2979    }
2980
2981    public AdverseEvent addSupportingInfo(AdverseEventSupportingInfoComponent t) { //3
2982      if (t == null)
2983        return this;
2984      if (this.supportingInfo == null)
2985        this.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
2986      this.supportingInfo.add(t);
2987      return this;
2988    }
2989
2990    /**
2991     * @return The first repetition of repeating field {@link #supportingInfo}, creating it if it does not already exist {3}
2992     */
2993    public AdverseEventSupportingInfoComponent getSupportingInfoFirstRep() { 
2994      if (getSupportingInfo().isEmpty()) {
2995        addSupportingInfo();
2996      }
2997      return getSupportingInfo().get(0);
2998    }
2999
3000    /**
3001     * @return {@link #note} (Comments made about the adverse event by the performer, subject or other participants.)
3002     */
3003    public List<Annotation> getNote() { 
3004      if (this.note == null)
3005        this.note = new ArrayList<Annotation>();
3006      return this.note;
3007    }
3008
3009    /**
3010     * @return Returns a reference to <code>this</code> for easy method chaining
3011     */
3012    public AdverseEvent setNote(List<Annotation> theNote) { 
3013      this.note = theNote;
3014      return this;
3015    }
3016
3017    public boolean hasNote() { 
3018      if (this.note == null)
3019        return false;
3020      for (Annotation item : this.note)
3021        if (!item.isEmpty())
3022          return true;
3023      return false;
3024    }
3025
3026    public Annotation addNote() { //3
3027      Annotation t = new Annotation();
3028      if (this.note == null)
3029        this.note = new ArrayList<Annotation>();
3030      this.note.add(t);
3031      return t;
3032    }
3033
3034    public AdverseEvent addNote(Annotation t) { //3
3035      if (t == null)
3036        return this;
3037      if (this.note == null)
3038        this.note = new ArrayList<Annotation>();
3039      this.note.add(t);
3040      return this;
3041    }
3042
3043    /**
3044     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
3045     */
3046    public Annotation getNoteFirstRep() { 
3047      if (getNote().isEmpty()) {
3048        addNote();
3049      }
3050      return getNote().get(0);
3051    }
3052
3053      protected void listChildren(List<Property> children) {
3054        super.listChildren(children);
3055        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));
3056        children.add(new Property("status", "code", "The current state of the adverse event or potential adverse event.", 0, 1, status));
3057        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));
3058        children.add(new Property("category", "CodeableConcept", "The overall type of event, intended for search and filtering purposes.", 0, java.lang.Integer.MAX_VALUE, category));
3059        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));
3060        children.add(new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson|ResearchSubject)", "This subject or group impacted by the event.", 0, 1, subject));
3061        children.add(new Property("encounter", "Reference(Encounter)", "The Encounter associated with the start of the AdverseEvent.", 0, 1, encounter));
3062        children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence));
3063        children.add(new Property("detected", "dateTime", "Estimated or actual date the AdverseEvent began, in the opinion of the reporter.", 0, 1, detected));
3064        children.add(new Property("recordedDate", "dateTime", "The date on which the existence of the AdverseEvent was first recorded.", 0, 1, recordedDate));
3065        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));
3066        children.add(new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location));
3067        children.add(new Property("seriousness", "CodeableConcept", "Assessment whether this event, or averted event, was of clinical importance.", 0, 1, seriousness));
3068        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));
3069        children.add(new Property("recorder", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|ResearchSubject)", "Information on who recorded the adverse event.  May be the patient or a practitioner.", 0, 1, recorder));
3070        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));
3071        children.add(new Property("study", "Reference(ResearchStudy)", "The research study that the subject is enrolled in.", 0, java.lang.Integer.MAX_VALUE, study));
3072        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));
3073        children.add(new Property("suspectEntity", "", "Describes the entity that is suspected to have caused the adverse event.", 0, java.lang.Integer.MAX_VALUE, suspectEntity));
3074        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));
3075        children.add(new Property("preventiveAction", "", "Preventive actions that contributed to avoiding the adverse event.", 0, java.lang.Integer.MAX_VALUE, preventiveAction));
3076        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));
3077        children.add(new Property("supportingInfo", "", "Supporting information relevant to the event.", 0, java.lang.Integer.MAX_VALUE, supportingInfo));
3078        children.add(new Property("note", "Annotation", "Comments made about the adverse event by the performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
3079      }
3080
3081      @Override
3082      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3083        switch (_hash) {
3084        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);
3085        case -892481550: /*status*/  return new Property("status", "code", "The current state of the adverse event or potential adverse event.", 0, 1, status);
3086        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);
3087        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);
3088        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);
3089        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group|Practitioner|RelatedPerson|ResearchSubject)", "This subject or group impacted by the event.", 0, 1, subject);
3090        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "The Encounter associated with the start of the AdverseEvent.", 0, 1, encounter);
3091        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);
3092        case 1687874001: /*occurrence*/  return new Property("occurrence[x]", "dateTime|Period|Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
3093        case -298443636: /*occurrenceDateTime*/  return new Property("occurrence[x]", "dateTime", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
3094        case 1397156594: /*occurrencePeriod*/  return new Property("occurrence[x]", "Period", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
3095        case 1515218299: /*occurrenceTiming*/  return new Property("occurrence[x]", "Timing", "The date (and perhaps time) when the adverse event occurred.", 0, 1, occurrence);
3096        case 1048254082: /*detected*/  return new Property("detected", "dateTime", "Estimated or actual date the AdverseEvent began, in the opinion of the reporter.", 0, 1, detected);
3097        case -1952893826: /*recordedDate*/  return new Property("recordedDate", "dateTime", "The date on which the existence of the AdverseEvent was first recorded.", 0, 1, recordedDate);
3098        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);
3099        case 1901043637: /*location*/  return new Property("location", "Reference(Location)", "The information about where the adverse event occurred.", 0, 1, location);
3100        case -1551003909: /*seriousness*/  return new Property("seriousness", "CodeableConcept", "Assessment whether this event, or averted event, was of clinical importance.", 0, 1, seriousness);
3101        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);
3102        case -799233858: /*recorder*/  return new Property("recorder", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|ResearchSubject)", "Information on who recorded the adverse event.  May be the patient or a practitioner.", 0, 1, recorder);
3103        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);
3104        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);
3105        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);
3106        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);
3107        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);
3108        case 2052341334: /*preventiveAction*/  return new Property("preventiveAction", "", "Preventive actions that contributed to avoiding the adverse event.", 0, java.lang.Integer.MAX_VALUE, preventiveAction);
3109        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);
3110        case 1922406657: /*supportingInfo*/  return new Property("supportingInfo", "", "Supporting information relevant to the event.", 0, java.lang.Integer.MAX_VALUE, supportingInfo);
3111        case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the adverse event by the performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
3112        default: return super.getNamedProperty(_hash, _name, _checkValid);
3113        }
3114
3115      }
3116
3117      @Override
3118      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3119        switch (hash) {
3120        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3121        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<AdverseEventStatus>
3122        case 528866400: /*actuality*/ return this.actuality == null ? new Base[0] : new Base[] {this.actuality}; // Enumeration<AdverseEventActuality>
3123        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
3124        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3125        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
3126        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
3127        case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // DataType
3128        case 1048254082: /*detected*/ return this.detected == null ? new Base[0] : new Base[] {this.detected}; // DateTimeType
3129        case -1952893826: /*recordedDate*/ return this.recordedDate == null ? new Base[0] : new Base[] {this.recordedDate}; // DateTimeType
3130        case -830261258: /*resultingCondition*/ return this.resultingCondition == null ? new Base[0] : this.resultingCondition.toArray(new Base[this.resultingCondition.size()]); // Reference
3131        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // Reference
3132        case -1551003909: /*seriousness*/ return this.seriousness == null ? new Base[0] : new Base[] {this.seriousness}; // CodeableConcept
3133        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : this.outcome.toArray(new Base[this.outcome.size()]); // CodeableConcept
3134        case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference
3135        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // AdverseEventParticipantComponent
3136        case 109776329: /*study*/ return this.study == null ? new Base[0] : this.study.toArray(new Base[this.study.size()]); // Reference
3137        case -1071467023: /*expectedInResearchStudy*/ return this.expectedInResearchStudy == null ? new Base[0] : new Base[] {this.expectedInResearchStudy}; // BooleanType
3138        case -1957422662: /*suspectEntity*/ return this.suspectEntity == null ? new Base[0] : this.suspectEntity.toArray(new Base[this.suspectEntity.size()]); // AdverseEventSuspectEntityComponent
3139        case -219647527: /*contributingFactor*/ return this.contributingFactor == null ? new Base[0] : this.contributingFactor.toArray(new Base[this.contributingFactor.size()]); // AdverseEventContributingFactorComponent
3140        case 2052341334: /*preventiveAction*/ return this.preventiveAction == null ? new Base[0] : this.preventiveAction.toArray(new Base[this.preventiveAction.size()]); // AdverseEventPreventiveActionComponent
3141        case 1992862383: /*mitigatingAction*/ return this.mitigatingAction == null ? new Base[0] : this.mitigatingAction.toArray(new Base[this.mitigatingAction.size()]); // AdverseEventMitigatingActionComponent
3142        case 1922406657: /*supportingInfo*/ return this.supportingInfo == null ? new Base[0] : this.supportingInfo.toArray(new Base[this.supportingInfo.size()]); // AdverseEventSupportingInfoComponent
3143        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3144        default: return super.getProperty(hash, name, checkValid);
3145        }
3146
3147      }
3148
3149      @Override
3150      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3151        switch (hash) {
3152        case -1618432855: // identifier
3153          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
3154          return value;
3155        case -892481550: // status
3156          value = new AdverseEventStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3157          this.status = (Enumeration) value; // Enumeration<AdverseEventStatus>
3158          return value;
3159        case 528866400: // actuality
3160          value = new AdverseEventActualityEnumFactory().fromType(TypeConvertor.castToCode(value));
3161          this.actuality = (Enumeration) value; // Enumeration<AdverseEventActuality>
3162          return value;
3163        case 50511102: // category
3164          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3165          return value;
3166        case 3059181: // code
3167          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3168          return value;
3169        case -1867885268: // subject
3170          this.subject = TypeConvertor.castToReference(value); // Reference
3171          return value;
3172        case 1524132147: // encounter
3173          this.encounter = TypeConvertor.castToReference(value); // Reference
3174          return value;
3175        case 1687874001: // occurrence
3176          this.occurrence = TypeConvertor.castToType(value); // DataType
3177          return value;
3178        case 1048254082: // detected
3179          this.detected = TypeConvertor.castToDateTime(value); // DateTimeType
3180          return value;
3181        case -1952893826: // recordedDate
3182          this.recordedDate = TypeConvertor.castToDateTime(value); // DateTimeType
3183          return value;
3184        case -830261258: // resultingCondition
3185          this.getResultingCondition().add(TypeConvertor.castToReference(value)); // Reference
3186          return value;
3187        case 1901043637: // location
3188          this.location = TypeConvertor.castToReference(value); // Reference
3189          return value;
3190        case -1551003909: // seriousness
3191          this.seriousness = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3192          return value;
3193        case -1106507950: // outcome
3194          this.getOutcome().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3195          return value;
3196        case -799233858: // recorder
3197          this.recorder = TypeConvertor.castToReference(value); // Reference
3198          return value;
3199        case 767422259: // participant
3200          this.getParticipant().add((AdverseEventParticipantComponent) value); // AdverseEventParticipantComponent
3201          return value;
3202        case 109776329: // study
3203          this.getStudy().add(TypeConvertor.castToReference(value)); // Reference
3204          return value;
3205        case -1071467023: // expectedInResearchStudy
3206          this.expectedInResearchStudy = TypeConvertor.castToBoolean(value); // BooleanType
3207          return value;
3208        case -1957422662: // suspectEntity
3209          this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value); // AdverseEventSuspectEntityComponent
3210          return value;
3211        case -219647527: // contributingFactor
3212          this.getContributingFactor().add((AdverseEventContributingFactorComponent) value); // AdverseEventContributingFactorComponent
3213          return value;
3214        case 2052341334: // preventiveAction
3215          this.getPreventiveAction().add((AdverseEventPreventiveActionComponent) value); // AdverseEventPreventiveActionComponent
3216          return value;
3217        case 1992862383: // mitigatingAction
3218          this.getMitigatingAction().add((AdverseEventMitigatingActionComponent) value); // AdverseEventMitigatingActionComponent
3219          return value;
3220        case 1922406657: // supportingInfo
3221          this.getSupportingInfo().add((AdverseEventSupportingInfoComponent) value); // AdverseEventSupportingInfoComponent
3222          return value;
3223        case 3387378: // note
3224          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
3225          return value;
3226        default: return super.setProperty(hash, name, value);
3227        }
3228
3229      }
3230
3231      @Override
3232      public Base setProperty(String name, Base value) throws FHIRException {
3233        if (name.equals("identifier")) {
3234          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
3235        } else if (name.equals("status")) {
3236          value = new AdverseEventStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3237          this.status = (Enumeration) value; // Enumeration<AdverseEventStatus>
3238        } else if (name.equals("actuality")) {
3239          value = new AdverseEventActualityEnumFactory().fromType(TypeConvertor.castToCode(value));
3240          this.actuality = (Enumeration) value; // Enumeration<AdverseEventActuality>
3241        } else if (name.equals("category")) {
3242          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
3243        } else if (name.equals("code")) {
3244          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3245        } else if (name.equals("subject")) {
3246          this.subject = TypeConvertor.castToReference(value); // Reference
3247        } else if (name.equals("encounter")) {
3248          this.encounter = TypeConvertor.castToReference(value); // Reference
3249        } else if (name.equals("occurrence[x]")) {
3250          this.occurrence = TypeConvertor.castToType(value); // DataType
3251        } else if (name.equals("detected")) {
3252          this.detected = TypeConvertor.castToDateTime(value); // DateTimeType
3253        } else if (name.equals("recordedDate")) {
3254          this.recordedDate = TypeConvertor.castToDateTime(value); // DateTimeType
3255        } else if (name.equals("resultingCondition")) {
3256          this.getResultingCondition().add(TypeConvertor.castToReference(value));
3257        } else if (name.equals("location")) {
3258          this.location = TypeConvertor.castToReference(value); // Reference
3259        } else if (name.equals("seriousness")) {
3260          this.seriousness = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3261        } else if (name.equals("outcome")) {
3262          this.getOutcome().add(TypeConvertor.castToCodeableConcept(value));
3263        } else if (name.equals("recorder")) {
3264          this.recorder = TypeConvertor.castToReference(value); // Reference
3265        } else if (name.equals("participant")) {
3266          this.getParticipant().add((AdverseEventParticipantComponent) value);
3267        } else if (name.equals("study")) {
3268          this.getStudy().add(TypeConvertor.castToReference(value));
3269        } else if (name.equals("expectedInResearchStudy")) {
3270          this.expectedInResearchStudy = TypeConvertor.castToBoolean(value); // BooleanType
3271        } else if (name.equals("suspectEntity")) {
3272          this.getSuspectEntity().add((AdverseEventSuspectEntityComponent) value);
3273        } else if (name.equals("contributingFactor")) {
3274          this.getContributingFactor().add((AdverseEventContributingFactorComponent) value);
3275        } else if (name.equals("preventiveAction")) {
3276          this.getPreventiveAction().add((AdverseEventPreventiveActionComponent) value);
3277        } else if (name.equals("mitigatingAction")) {
3278          this.getMitigatingAction().add((AdverseEventMitigatingActionComponent) value);
3279        } else if (name.equals("supportingInfo")) {
3280          this.getSupportingInfo().add((AdverseEventSupportingInfoComponent) value);
3281        } else if (name.equals("note")) {
3282          this.getNote().add(TypeConvertor.castToAnnotation(value));
3283        } else
3284          return super.setProperty(name, value);
3285        return value;
3286      }
3287
3288      @Override
3289      public Base makeProperty(int hash, String name) throws FHIRException {
3290        switch (hash) {
3291        case -1618432855:  return addIdentifier(); 
3292        case -892481550:  return getStatusElement();
3293        case 528866400:  return getActualityElement();
3294        case 50511102:  return addCategory(); 
3295        case 3059181:  return getCode();
3296        case -1867885268:  return getSubject();
3297        case 1524132147:  return getEncounter();
3298        case -2022646513:  return getOccurrence();
3299        case 1687874001:  return getOccurrence();
3300        case 1048254082:  return getDetectedElement();
3301        case -1952893826:  return getRecordedDateElement();
3302        case -830261258:  return addResultingCondition(); 
3303        case 1901043637:  return getLocation();
3304        case -1551003909:  return getSeriousness();
3305        case -1106507950:  return addOutcome(); 
3306        case -799233858:  return getRecorder();
3307        case 767422259:  return addParticipant(); 
3308        case 109776329:  return addStudy(); 
3309        case -1071467023:  return getExpectedInResearchStudyElement();
3310        case -1957422662:  return addSuspectEntity(); 
3311        case -219647527:  return addContributingFactor(); 
3312        case 2052341334:  return addPreventiveAction(); 
3313        case 1992862383:  return addMitigatingAction(); 
3314        case 1922406657:  return addSupportingInfo(); 
3315        case 3387378:  return addNote(); 
3316        default: return super.makeProperty(hash, name);
3317        }
3318
3319      }
3320
3321      @Override
3322      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3323        switch (hash) {
3324        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3325        case -892481550: /*status*/ return new String[] {"code"};
3326        case 528866400: /*actuality*/ return new String[] {"code"};
3327        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
3328        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3329        case -1867885268: /*subject*/ return new String[] {"Reference"};
3330        case 1524132147: /*encounter*/ return new String[] {"Reference"};
3331        case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"};
3332        case 1048254082: /*detected*/ return new String[] {"dateTime"};
3333        case -1952893826: /*recordedDate*/ return new String[] {"dateTime"};
3334        case -830261258: /*resultingCondition*/ return new String[] {"Reference"};
3335        case 1901043637: /*location*/ return new String[] {"Reference"};
3336        case -1551003909: /*seriousness*/ return new String[] {"CodeableConcept"};
3337        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
3338        case -799233858: /*recorder*/ return new String[] {"Reference"};
3339        case 767422259: /*participant*/ return new String[] {};
3340        case 109776329: /*study*/ return new String[] {"Reference"};
3341        case -1071467023: /*expectedInResearchStudy*/ return new String[] {"boolean"};
3342        case -1957422662: /*suspectEntity*/ return new String[] {};
3343        case -219647527: /*contributingFactor*/ return new String[] {};
3344        case 2052341334: /*preventiveAction*/ return new String[] {};
3345        case 1992862383: /*mitigatingAction*/ return new String[] {};
3346        case 1922406657: /*supportingInfo*/ return new String[] {};
3347        case 3387378: /*note*/ return new String[] {"Annotation"};
3348        default: return super.getTypesForProperty(hash, name);
3349        }
3350
3351      }
3352
3353      @Override
3354      public Base addChild(String name) throws FHIRException {
3355        if (name.equals("identifier")) {
3356          return addIdentifier();
3357        }
3358        else if (name.equals("status")) {
3359          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.status");
3360        }
3361        else if (name.equals("actuality")) {
3362          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.actuality");
3363        }
3364        else if (name.equals("category")) {
3365          return addCategory();
3366        }
3367        else if (name.equals("code")) {
3368          this.code = new CodeableConcept();
3369          return this.code;
3370        }
3371        else if (name.equals("subject")) {
3372          this.subject = new Reference();
3373          return this.subject;
3374        }
3375        else if (name.equals("encounter")) {
3376          this.encounter = new Reference();
3377          return this.encounter;
3378        }
3379        else if (name.equals("occurrenceDateTime")) {
3380          this.occurrence = new DateTimeType();
3381          return this.occurrence;
3382        }
3383        else if (name.equals("occurrencePeriod")) {
3384          this.occurrence = new Period();
3385          return this.occurrence;
3386        }
3387        else if (name.equals("occurrenceTiming")) {
3388          this.occurrence = new Timing();
3389          return this.occurrence;
3390        }
3391        else if (name.equals("detected")) {
3392          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.detected");
3393        }
3394        else if (name.equals("recordedDate")) {
3395          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.recordedDate");
3396        }
3397        else if (name.equals("resultingCondition")) {
3398          return addResultingCondition();
3399        }
3400        else if (name.equals("location")) {
3401          this.location = new Reference();
3402          return this.location;
3403        }
3404        else if (name.equals("seriousness")) {
3405          this.seriousness = new CodeableConcept();
3406          return this.seriousness;
3407        }
3408        else if (name.equals("outcome")) {
3409          return addOutcome();
3410        }
3411        else if (name.equals("recorder")) {
3412          this.recorder = new Reference();
3413          return this.recorder;
3414        }
3415        else if (name.equals("participant")) {
3416          return addParticipant();
3417        }
3418        else if (name.equals("study")) {
3419          return addStudy();
3420        }
3421        else if (name.equals("expectedInResearchStudy")) {
3422          throw new FHIRException("Cannot call addChild on a primitive type AdverseEvent.expectedInResearchStudy");
3423        }
3424        else if (name.equals("suspectEntity")) {
3425          return addSuspectEntity();
3426        }
3427        else if (name.equals("contributingFactor")) {
3428          return addContributingFactor();
3429        }
3430        else if (name.equals("preventiveAction")) {
3431          return addPreventiveAction();
3432        }
3433        else if (name.equals("mitigatingAction")) {
3434          return addMitigatingAction();
3435        }
3436        else if (name.equals("supportingInfo")) {
3437          return addSupportingInfo();
3438        }
3439        else if (name.equals("note")) {
3440          return addNote();
3441        }
3442        else
3443          return super.addChild(name);
3444      }
3445
3446  public String fhirType() {
3447    return "AdverseEvent";
3448
3449  }
3450
3451      public AdverseEvent copy() {
3452        AdverseEvent dst = new AdverseEvent();
3453        copyValues(dst);
3454        return dst;
3455      }
3456
3457      public void copyValues(AdverseEvent dst) {
3458        super.copyValues(dst);
3459        if (identifier != null) {
3460          dst.identifier = new ArrayList<Identifier>();
3461          for (Identifier i : identifier)
3462            dst.identifier.add(i.copy());
3463        };
3464        dst.status = status == null ? null : status.copy();
3465        dst.actuality = actuality == null ? null : actuality.copy();
3466        if (category != null) {
3467          dst.category = new ArrayList<CodeableConcept>();
3468          for (CodeableConcept i : category)
3469            dst.category.add(i.copy());
3470        };
3471        dst.code = code == null ? null : code.copy();
3472        dst.subject = subject == null ? null : subject.copy();
3473        dst.encounter = encounter == null ? null : encounter.copy();
3474        dst.occurrence = occurrence == null ? null : occurrence.copy();
3475        dst.detected = detected == null ? null : detected.copy();
3476        dst.recordedDate = recordedDate == null ? null : recordedDate.copy();
3477        if (resultingCondition != null) {
3478          dst.resultingCondition = new ArrayList<Reference>();
3479          for (Reference i : resultingCondition)
3480            dst.resultingCondition.add(i.copy());
3481        };
3482        dst.location = location == null ? null : location.copy();
3483        dst.seriousness = seriousness == null ? null : seriousness.copy();
3484        if (outcome != null) {
3485          dst.outcome = new ArrayList<CodeableConcept>();
3486          for (CodeableConcept i : outcome)
3487            dst.outcome.add(i.copy());
3488        };
3489        dst.recorder = recorder == null ? null : recorder.copy();
3490        if (participant != null) {
3491          dst.participant = new ArrayList<AdverseEventParticipantComponent>();
3492          for (AdverseEventParticipantComponent i : participant)
3493            dst.participant.add(i.copy());
3494        };
3495        if (study != null) {
3496          dst.study = new ArrayList<Reference>();
3497          for (Reference i : study)
3498            dst.study.add(i.copy());
3499        };
3500        dst.expectedInResearchStudy = expectedInResearchStudy == null ? null : expectedInResearchStudy.copy();
3501        if (suspectEntity != null) {
3502          dst.suspectEntity = new ArrayList<AdverseEventSuspectEntityComponent>();
3503          for (AdverseEventSuspectEntityComponent i : suspectEntity)
3504            dst.suspectEntity.add(i.copy());
3505        };
3506        if (contributingFactor != null) {
3507          dst.contributingFactor = new ArrayList<AdverseEventContributingFactorComponent>();
3508          for (AdverseEventContributingFactorComponent i : contributingFactor)
3509            dst.contributingFactor.add(i.copy());
3510        };
3511        if (preventiveAction != null) {
3512          dst.preventiveAction = new ArrayList<AdverseEventPreventiveActionComponent>();
3513          for (AdverseEventPreventiveActionComponent i : preventiveAction)
3514            dst.preventiveAction.add(i.copy());
3515        };
3516        if (mitigatingAction != null) {
3517          dst.mitigatingAction = new ArrayList<AdverseEventMitigatingActionComponent>();
3518          for (AdverseEventMitigatingActionComponent i : mitigatingAction)
3519            dst.mitigatingAction.add(i.copy());
3520        };
3521        if (supportingInfo != null) {
3522          dst.supportingInfo = new ArrayList<AdverseEventSupportingInfoComponent>();
3523          for (AdverseEventSupportingInfoComponent i : supportingInfo)
3524            dst.supportingInfo.add(i.copy());
3525        };
3526        if (note != null) {
3527          dst.note = new ArrayList<Annotation>();
3528          for (Annotation i : note)
3529            dst.note.add(i.copy());
3530        };
3531      }
3532
3533      protected AdverseEvent typedCopy() {
3534        return copy();
3535      }
3536
3537      @Override
3538      public boolean equalsDeep(Base other_) {
3539        if (!super.equalsDeep(other_))
3540          return false;
3541        if (!(other_ instanceof AdverseEvent))
3542          return false;
3543        AdverseEvent o = (AdverseEvent) other_;
3544        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(actuality, o.actuality, true)
3545           && compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
3546           && compareDeep(encounter, o.encounter, true) && compareDeep(occurrence, o.occurrence, true) && compareDeep(detected, o.detected, true)
3547           && compareDeep(recordedDate, o.recordedDate, true) && compareDeep(resultingCondition, o.resultingCondition, true)
3548           && compareDeep(location, o.location, true) && compareDeep(seriousness, o.seriousness, true) && compareDeep(outcome, o.outcome, true)
3549           && compareDeep(recorder, o.recorder, true) && compareDeep(participant, o.participant, true) && compareDeep(study, o.study, true)
3550           && compareDeep(expectedInResearchStudy, o.expectedInResearchStudy, true) && compareDeep(suspectEntity, o.suspectEntity, true)
3551           && compareDeep(contributingFactor, o.contributingFactor, true) && compareDeep(preventiveAction, o.preventiveAction, true)
3552           && compareDeep(mitigatingAction, o.mitigatingAction, true) && compareDeep(supportingInfo, o.supportingInfo, true)
3553           && compareDeep(note, o.note, true);
3554      }
3555
3556      @Override
3557      public boolean equalsShallow(Base other_) {
3558        if (!super.equalsShallow(other_))
3559          return false;
3560        if (!(other_ instanceof AdverseEvent))
3561          return false;
3562        AdverseEvent o = (AdverseEvent) other_;
3563        return compareValues(status, o.status, true) && compareValues(actuality, o.actuality, true) && compareValues(detected, o.detected, true)
3564           && compareValues(recordedDate, o.recordedDate, true) && compareValues(expectedInResearchStudy, o.expectedInResearchStudy, true)
3565          ;
3566      }
3567
3568      public boolean isEmpty() {
3569        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, actuality
3570          , category, code, subject, encounter, occurrence, detected, recordedDate, resultingCondition
3571          , location, seriousness, outcome, recorder, participant, study, expectedInResearchStudy
3572          , suspectEntity, contributingFactor, preventiveAction, mitigatingAction, supportingInfo
3573          , note);
3574      }
3575
3576  @Override
3577  public ResourceType getResourceType() {
3578    return ResourceType.AdverseEvent;
3579   }
3580
3581 /**
3582   * Search parameter: <b>actuality</b>
3583   * <p>
3584   * Description: <b>actual | potential</b><br>
3585   * Type: <b>token</b><br>
3586   * Path: <b>AdverseEvent.actuality</b><br>
3587   * </p>
3588   */
3589  @SearchParamDefinition(name="actuality", path="AdverseEvent.actuality", description="actual | potential", type="token" )
3590  public static final String SP_ACTUALITY = "actuality";
3591 /**
3592   * <b>Fluent Client</b> search parameter constant for <b>actuality</b>
3593   * <p>
3594   * Description: <b>actual | potential</b><br>
3595   * Type: <b>token</b><br>
3596   * Path: <b>AdverseEvent.actuality</b><br>
3597   * </p>
3598   */
3599  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ACTUALITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ACTUALITY);
3600
3601 /**
3602   * Search parameter: <b>category</b>
3603   * <p>
3604   * Description: <b>wrong-patient | procedure-mishap | medication-mishap | device | unsafe-physical-environment | hospital-aquired-infection | wrong-body-site</b><br>
3605   * Type: <b>token</b><br>
3606   * Path: <b>AdverseEvent.category</b><br>
3607   * </p>
3608   */
3609  @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" )
3610  public static final String SP_CATEGORY = "category";
3611 /**
3612   * <b>Fluent Client</b> search parameter constant for <b>category</b>
3613   * <p>
3614   * Description: <b>wrong-patient | procedure-mishap | medication-mishap | device | unsafe-physical-environment | hospital-aquired-infection | wrong-body-site</b><br>
3615   * Type: <b>token</b><br>
3616   * Path: <b>AdverseEvent.category</b><br>
3617   * </p>
3618   */
3619  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
3620
3621 /**
3622   * Search parameter: <b>code</b>
3623   * <p>
3624   * Description: <b>Event or incident that occurred or was averted</b><br>
3625   * Type: <b>token</b><br>
3626   * Path: <b>AdverseEvent.code</b><br>
3627   * </p>
3628   */
3629  @SearchParamDefinition(name="code", path="AdverseEvent.code", description="Event or incident that occurred or was averted", type="token" )
3630  public static final String SP_CODE = "code";
3631 /**
3632   * <b>Fluent Client</b> search parameter constant for <b>code</b>
3633   * <p>
3634   * Description: <b>Event or incident that occurred or was averted</b><br>
3635   * Type: <b>token</b><br>
3636   * Path: <b>AdverseEvent.code</b><br>
3637   * </p>
3638   */
3639  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
3640
3641 /**
3642   * Search parameter: <b>date</b>
3643   * <p>
3644   * Description: <b>When the event occurred</b><br>
3645   * Type: <b>date</b><br>
3646   * Path: <b>AdverseEvent.occurrence</b><br>
3647   * </p>
3648   */
3649  @SearchParamDefinition(name="date", path="AdverseEvent.occurrence", description="When the event occurred", type="date" )
3650  public static final String SP_DATE = "date";
3651 /**
3652   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3653   * <p>
3654   * Description: <b>When the event occurred</b><br>
3655   * Type: <b>date</b><br>
3656   * Path: <b>AdverseEvent.occurrence</b><br>
3657   * </p>
3658   */
3659  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
3660
3661 /**
3662   * Search parameter: <b>identifier</b>
3663   * <p>
3664   * Description: <b>Business identifier for the event</b><br>
3665   * Type: <b>token</b><br>
3666   * Path: <b>AdverseEvent.identifier</b><br>
3667   * </p>
3668   */
3669  @SearchParamDefinition(name="identifier", path="AdverseEvent.identifier", description="Business identifier for the event", type="token" )
3670  public static final String SP_IDENTIFIER = "identifier";
3671 /**
3672   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3673   * <p>
3674   * Description: <b>Business identifier for the event</b><br>
3675   * Type: <b>token</b><br>
3676   * Path: <b>AdverseEvent.identifier</b><br>
3677   * </p>
3678   */
3679  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3680
3681 /**
3682   * Search parameter: <b>location</b>
3683   * <p>
3684   * Description: <b>Location where adverse event occurred</b><br>
3685   * Type: <b>reference</b><br>
3686   * Path: <b>AdverseEvent.location</b><br>
3687   * </p>
3688   */
3689  @SearchParamDefinition(name="location", path="AdverseEvent.location", description="Location where adverse event occurred", type="reference", target={Location.class } )
3690  public static final String SP_LOCATION = "location";
3691 /**
3692   * <b>Fluent Client</b> search parameter constant for <b>location</b>
3693   * <p>
3694   * Description: <b>Location where adverse event occurred</b><br>
3695   * Type: <b>reference</b><br>
3696   * Path: <b>AdverseEvent.location</b><br>
3697   * </p>
3698   */
3699  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
3700
3701/**
3702   * Constant for fluent queries to be used to add include statements. Specifies
3703   * the path value of "<b>AdverseEvent:location</b>".
3704   */
3705  public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("AdverseEvent:location").toLocked();
3706
3707 /**
3708   * Search parameter: <b>patient</b>
3709   * <p>
3710   * Description: <b>Subject impacted by event</b><br>
3711   * Type: <b>reference</b><br>
3712   * Path: <b>AdverseEvent.subject</b><br>
3713   * </p>
3714   */
3715  @SearchParamDefinition(name="patient", path="AdverseEvent.subject", description="Subject impacted by event", type="reference", target={Group.class, Patient.class, Practitioner.class, RelatedPerson.class, ResearchSubject.class } )
3716  public static final String SP_PATIENT = "patient";
3717 /**
3718   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3719   * <p>
3720   * Description: <b>Subject impacted by event</b><br>
3721   * Type: <b>reference</b><br>
3722   * Path: <b>AdverseEvent.subject</b><br>
3723   * </p>
3724   */
3725  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3726
3727/**
3728   * Constant for fluent queries to be used to add include statements. Specifies
3729   * the path value of "<b>AdverseEvent:patient</b>".
3730   */
3731  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AdverseEvent:patient").toLocked();
3732
3733 /**
3734   * Search parameter: <b>recorder</b>
3735   * <p>
3736   * Description: <b>Who recorded the adverse event</b><br>
3737   * Type: <b>reference</b><br>
3738   * Path: <b>AdverseEvent.recorder</b><br>
3739   * </p>
3740   */
3741  @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, ResearchSubject.class } )
3742  public static final String SP_RECORDER = "recorder";
3743 /**
3744   * <b>Fluent Client</b> search parameter constant for <b>recorder</b>
3745   * <p>
3746   * Description: <b>Who recorded the adverse event</b><br>
3747   * Type: <b>reference</b><br>
3748   * Path: <b>AdverseEvent.recorder</b><br>
3749   * </p>
3750   */
3751  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECORDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECORDER);
3752
3753/**
3754   * Constant for fluent queries to be used to add include statements. Specifies
3755   * the path value of "<b>AdverseEvent:recorder</b>".
3756   */
3757  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECORDER = new ca.uhn.fhir.model.api.Include("AdverseEvent:recorder").toLocked();
3758
3759 /**
3760   * Search parameter: <b>resultingcondition</b>
3761   * <p>
3762   * Description: <b>Effect on the subject due to this event</b><br>
3763   * Type: <b>reference</b><br>
3764   * Path: <b>AdverseEvent.resultingCondition</b><br>
3765   * </p>
3766   */
3767  @SearchParamDefinition(name="resultingcondition", path="AdverseEvent.resultingCondition", description="Effect on the subject due to this event", type="reference", target={Condition.class } )
3768  public static final String SP_RESULTINGCONDITION = "resultingcondition";
3769 /**
3770   * <b>Fluent Client</b> search parameter constant for <b>resultingcondition</b>
3771   * <p>
3772   * Description: <b>Effect on the subject due to this event</b><br>
3773   * Type: <b>reference</b><br>
3774   * Path: <b>AdverseEvent.resultingCondition</b><br>
3775   * </p>
3776   */
3777  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESULTINGCONDITION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RESULTINGCONDITION);
3778
3779/**
3780   * Constant for fluent queries to be used to add include statements. Specifies
3781   * the path value of "<b>AdverseEvent:resultingcondition</b>".
3782   */
3783  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESULTINGCONDITION = new ca.uhn.fhir.model.api.Include("AdverseEvent:resultingcondition").toLocked();
3784
3785 /**
3786   * Search parameter: <b>seriousness</b>
3787   * <p>
3788   * Description: <b>Seriousness or gravity of the event</b><br>
3789   * Type: <b>token</b><br>
3790   * Path: <b>AdverseEvent.seriousness</b><br>
3791   * </p>
3792   */
3793  @SearchParamDefinition(name="seriousness", path="AdverseEvent.seriousness", description="Seriousness or gravity of the event", type="token" )
3794  public static final String SP_SERIOUSNESS = "seriousness";
3795 /**
3796   * <b>Fluent Client</b> search parameter constant for <b>seriousness</b>
3797   * <p>
3798   * Description: <b>Seriousness or gravity of the event</b><br>
3799   * Type: <b>token</b><br>
3800   * Path: <b>AdverseEvent.seriousness</b><br>
3801   * </p>
3802   */
3803  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERIOUSNESS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERIOUSNESS);
3804
3805 /**
3806   * Search parameter: <b>status</b>
3807   * <p>
3808   * Description: <b>in-progress | completed | entered-in-error | unknown</b><br>
3809   * Type: <b>token</b><br>
3810   * Path: <b>AdverseEvent.status</b><br>
3811   * </p>
3812   */
3813  @SearchParamDefinition(name="status", path="AdverseEvent.status", description="in-progress | completed | entered-in-error | unknown", type="token" )
3814  public static final String SP_STATUS = "status";
3815 /**
3816   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3817   * <p>
3818   * Description: <b>in-progress | completed | entered-in-error | unknown</b><br>
3819   * Type: <b>token</b><br>
3820   * Path: <b>AdverseEvent.status</b><br>
3821   * </p>
3822   */
3823  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3824
3825 /**
3826   * Search parameter: <b>study</b>
3827   * <p>
3828   * Description: <b>Research study that the subject is enrolled in</b><br>
3829   * Type: <b>reference</b><br>
3830   * Path: <b>AdverseEvent.study</b><br>
3831   * </p>
3832   */
3833  @SearchParamDefinition(name="study", path="AdverseEvent.study", description="Research study that the subject is enrolled in", type="reference", target={ResearchStudy.class } )
3834  public static final String SP_STUDY = "study";
3835 /**
3836   * <b>Fluent Client</b> search parameter constant for <b>study</b>
3837   * <p>
3838   * Description: <b>Research study that the subject is enrolled in</b><br>
3839   * Type: <b>reference</b><br>
3840   * Path: <b>AdverseEvent.study</b><br>
3841   * </p>
3842   */
3843  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam STUDY = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_STUDY);
3844
3845/**
3846   * Constant for fluent queries to be used to add include statements. Specifies
3847   * the path value of "<b>AdverseEvent:study</b>".
3848   */
3849  public static final ca.uhn.fhir.model.api.Include INCLUDE_STUDY = new ca.uhn.fhir.model.api.Include("AdverseEvent:study").toLocked();
3850
3851 /**
3852   * Search parameter: <b>subject</b>
3853   * <p>
3854   * Description: <b>Subject impacted by event</b><br>
3855   * Type: <b>reference</b><br>
3856   * Path: <b>AdverseEvent.subject</b><br>
3857   * </p>
3858   */
3859  @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, ResearchSubject.class } )
3860  public static final String SP_SUBJECT = "subject";
3861 /**
3862   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3863   * <p>
3864   * Description: <b>Subject impacted by event</b><br>
3865   * Type: <b>reference</b><br>
3866   * Path: <b>AdverseEvent.subject</b><br>
3867   * </p>
3868   */
3869  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3870
3871/**
3872   * Constant for fluent queries to be used to add include statements. Specifies
3873   * the path value of "<b>AdverseEvent:subject</b>".
3874   */
3875  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("AdverseEvent:subject").toLocked();
3876
3877 /**
3878   * Search parameter: <b>substance</b>
3879   * <p>
3880   * Description: <b>Refers to the specific entity that caused the adverse event</b><br>
3881   * Type: <b>reference</b><br>
3882   * Path: <b>(AdverseEvent.suspectEntity.instance as Reference)</b><br>
3883   * </p>
3884   */
3885  @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 } )
3886  public static final String SP_SUBSTANCE = "substance";
3887 /**
3888   * <b>Fluent Client</b> search parameter constant for <b>substance</b>
3889   * <p>
3890   * Description: <b>Refers to the specific entity that caused the adverse event</b><br>
3891   * Type: <b>reference</b><br>
3892   * Path: <b>(AdverseEvent.suspectEntity.instance as Reference)</b><br>
3893   * </p>
3894   */
3895  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSTANCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSTANCE);
3896
3897/**
3898   * Constant for fluent queries to be used to add include statements. Specifies
3899   * the path value of "<b>AdverseEvent:substance</b>".
3900   */
3901  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSTANCE = new ca.uhn.fhir.model.api.Include("AdverseEvent:substance").toLocked();
3902
3903
3904}
3905