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