001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import ca.uhn.fhir.model.api.annotation.ResourceDef;
037import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.ChildOrder;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.Block;
042import org.hl7.fhir.instance.model.api.*;
043import org.hl7.fhir.exceptions.FHIRException;
044/**
045 * Indication for the Medicinal Product.
046 */
047@ResourceDef(name="MedicinalProductIndication", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductIndication")
048public class MedicinalProductIndication extends DomainResource {
049
050    @Block()
051    public static class MedicinalProductIndicationOtherTherapyComponent extends BackboneElement implements IBaseBackboneElement {
052        /**
053         * The type of relationship between the medicinal product indication or contraindication and another therapy.
054         */
055        @Child(name = "therapyRelationshipType", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
056        @Description(shortDefinition="The type of relationship between the medicinal product indication or contraindication and another therapy", formalDefinition="The type of relationship between the medicinal product indication or contraindication and another therapy." )
057        protected CodeableConcept therapyRelationshipType;
058
059        /**
060         * Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.
061         */
062        @Child(name = "medication", type = {CodeableConcept.class, MedicinalProduct.class, Medication.class, Substance.class, SubstanceSpecification.class}, order=2, min=1, max=1, modifier=false, summary=true)
063        @Description(shortDefinition="Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication", formalDefinition="Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication." )
064        protected Type medication;
065
066        private static final long serialVersionUID = 1438478115L;
067
068    /**
069     * Constructor
070     */
071      public MedicinalProductIndicationOtherTherapyComponent() {
072        super();
073      }
074
075    /**
076     * Constructor
077     */
078      public MedicinalProductIndicationOtherTherapyComponent(CodeableConcept therapyRelationshipType, Type medication) {
079        super();
080        this.therapyRelationshipType = therapyRelationshipType;
081        this.medication = medication;
082      }
083
084        /**
085         * @return {@link #therapyRelationshipType} (The type of relationship between the medicinal product indication or contraindication and another therapy.)
086         */
087        public CodeableConcept getTherapyRelationshipType() { 
088          if (this.therapyRelationshipType == null)
089            if (Configuration.errorOnAutoCreate())
090              throw new Error("Attempt to auto-create MedicinalProductIndicationOtherTherapyComponent.therapyRelationshipType");
091            else if (Configuration.doAutoCreate())
092              this.therapyRelationshipType = new CodeableConcept(); // cc
093          return this.therapyRelationshipType;
094        }
095
096        public boolean hasTherapyRelationshipType() { 
097          return this.therapyRelationshipType != null && !this.therapyRelationshipType.isEmpty();
098        }
099
100        /**
101         * @param value {@link #therapyRelationshipType} (The type of relationship between the medicinal product indication or contraindication and another therapy.)
102         */
103        public MedicinalProductIndicationOtherTherapyComponent setTherapyRelationshipType(CodeableConcept value) { 
104          this.therapyRelationshipType = value;
105          return this;
106        }
107
108        /**
109         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
110         */
111        public Type getMedication() { 
112          return this.medication;
113        }
114
115        /**
116         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
117         */
118        public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 
119          if (this.medication == null)
120            return null;
121          if (!(this.medication instanceof CodeableConcept))
122            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered");
123          return (CodeableConcept) this.medication;
124        }
125
126        public boolean hasMedicationCodeableConcept() { 
127          return this != null && this.medication instanceof CodeableConcept;
128        }
129
130        /**
131         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
132         */
133        public Reference getMedicationReference() throws FHIRException { 
134          if (this.medication == null)
135            return null;
136          if (!(this.medication instanceof Reference))
137            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered");
138          return (Reference) this.medication;
139        }
140
141        public boolean hasMedicationReference() { 
142          return this != null && this.medication instanceof Reference;
143        }
144
145        public boolean hasMedication() { 
146          return this.medication != null && !this.medication.isEmpty();
147        }
148
149        /**
150         * @param value {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
151         */
152        public MedicinalProductIndicationOtherTherapyComponent setMedication(Type value) { 
153          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
154            throw new Error("Not the right type for MedicinalProductIndication.otherTherapy.medication[x]: "+value.fhirType());
155          this.medication = value;
156          return this;
157        }
158
159        protected void listChildren(List<Property> children) {
160          super.listChildren(children);
161          children.add(new Property("therapyRelationshipType", "CodeableConcept", "The type of relationship between the medicinal product indication or contraindication and another therapy.", 0, 1, therapyRelationshipType));
162          children.add(new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication));
163        }
164
165        @Override
166        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
167          switch (_hash) {
168          case -551658469: /*therapyRelationshipType*/  return new Property("therapyRelationshipType", "CodeableConcept", "The type of relationship between the medicinal product indication or contraindication and another therapy.", 0, 1, therapyRelationshipType);
169          case 1458402129: /*medication[x]*/  return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication);
170          case 1998965455: /*medication*/  return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication);
171          case -209845038: /*medicationCodeableConcept*/  return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication);
172          case 2104315196: /*medicationReference*/  return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProduct|Medication|Substance|SubstanceSpecification)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication);
173          default: return super.getNamedProperty(_hash, _name, _checkValid);
174          }
175
176        }
177
178      @Override
179      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
180        switch (hash) {
181        case -551658469: /*therapyRelationshipType*/ return this.therapyRelationshipType == null ? new Base[0] : new Base[] {this.therapyRelationshipType}; // CodeableConcept
182        case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type
183        default: return super.getProperty(hash, name, checkValid);
184        }
185
186      }
187
188      @Override
189      public Base setProperty(int hash, String name, Base value) throws FHIRException {
190        switch (hash) {
191        case -551658469: // therapyRelationshipType
192          this.therapyRelationshipType = castToCodeableConcept(value); // CodeableConcept
193          return value;
194        case 1998965455: // medication
195          this.medication = castToType(value); // Type
196          return value;
197        default: return super.setProperty(hash, name, value);
198        }
199
200      }
201
202      @Override
203      public Base setProperty(String name, Base value) throws FHIRException {
204        if (name.equals("therapyRelationshipType")) {
205          this.therapyRelationshipType = castToCodeableConcept(value); // CodeableConcept
206        } else if (name.equals("medication[x]")) {
207          this.medication = castToType(value); // Type
208        } else
209          return super.setProperty(name, value);
210        return value;
211      }
212
213      @Override
214      public Base makeProperty(int hash, String name) throws FHIRException {
215        switch (hash) {
216        case -551658469:  return getTherapyRelationshipType(); 
217        case 1458402129:  return getMedication(); 
218        case 1998965455:  return getMedication(); 
219        default: return super.makeProperty(hash, name);
220        }
221
222      }
223
224      @Override
225      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
226        switch (hash) {
227        case -551658469: /*therapyRelationshipType*/ return new String[] {"CodeableConcept"};
228        case 1998965455: /*medication*/ return new String[] {"CodeableConcept", "Reference"};
229        default: return super.getTypesForProperty(hash, name);
230        }
231
232      }
233
234      @Override
235      public Base addChild(String name) throws FHIRException {
236        if (name.equals("therapyRelationshipType")) {
237          this.therapyRelationshipType = new CodeableConcept();
238          return this.therapyRelationshipType;
239        }
240        else if (name.equals("medicationCodeableConcept")) {
241          this.medication = new CodeableConcept();
242          return this.medication;
243        }
244        else if (name.equals("medicationReference")) {
245          this.medication = new Reference();
246          return this.medication;
247        }
248        else
249          return super.addChild(name);
250      }
251
252      public MedicinalProductIndicationOtherTherapyComponent copy() {
253        MedicinalProductIndicationOtherTherapyComponent dst = new MedicinalProductIndicationOtherTherapyComponent();
254        copyValues(dst);
255        dst.therapyRelationshipType = therapyRelationshipType == null ? null : therapyRelationshipType.copy();
256        dst.medication = medication == null ? null : medication.copy();
257        return dst;
258      }
259
260      @Override
261      public boolean equalsDeep(Base other_) {
262        if (!super.equalsDeep(other_))
263          return false;
264        if (!(other_ instanceof MedicinalProductIndicationOtherTherapyComponent))
265          return false;
266        MedicinalProductIndicationOtherTherapyComponent o = (MedicinalProductIndicationOtherTherapyComponent) other_;
267        return compareDeep(therapyRelationshipType, o.therapyRelationshipType, true) && compareDeep(medication, o.medication, true)
268          ;
269      }
270
271      @Override
272      public boolean equalsShallow(Base other_) {
273        if (!super.equalsShallow(other_))
274          return false;
275        if (!(other_ instanceof MedicinalProductIndicationOtherTherapyComponent))
276          return false;
277        MedicinalProductIndicationOtherTherapyComponent o = (MedicinalProductIndicationOtherTherapyComponent) other_;
278        return true;
279      }
280
281      public boolean isEmpty() {
282        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(therapyRelationshipType, medication
283          );
284      }
285
286  public String fhirType() {
287    return "MedicinalProductIndication.otherTherapy";
288
289  }
290
291  }
292
293    @Block()
294    public static class MedicinalProductIndicationPopulationComponent extends BackboneElement implements IBaseBackboneElement {
295        /**
296         * The age of the specific population.
297         */
298        @Child(name = "age", type = {Range.class, CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
299        @Description(shortDefinition="The age of the specific population", formalDefinition="The age of the specific population." )
300        protected Type age;
301
302        /**
303         * The gender of the specific population.
304         */
305        @Child(name = "gender", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
306        @Description(shortDefinition="The gender of the specific population", formalDefinition="The gender of the specific population." )
307        protected CodeableConcept gender;
308
309        /**
310         * Race of the specific population.
311         */
312        @Child(name = "race", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
313        @Description(shortDefinition="Race of the specific population", formalDefinition="Race of the specific population." )
314        protected CodeableConcept race;
315
316        /**
317         * The existing physiological conditions of the specific population to which this applies.
318         */
319        @Child(name = "physiologicalCondition", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
320        @Description(shortDefinition="The existing physiological conditions of the specific population to which this applies", formalDefinition="The existing physiological conditions of the specific population to which this applies." )
321        protected CodeableConcept physiologicalCondition;
322
323        private static final long serialVersionUID = -394311584L;
324
325    /**
326     * Constructor
327     */
328      public MedicinalProductIndicationPopulationComponent() {
329        super();
330      }
331
332        /**
333         * @return {@link #age} (The age of the specific population.)
334         */
335        public Type getAge() { 
336          return this.age;
337        }
338
339        /**
340         * @return {@link #age} (The age of the specific population.)
341         */
342        public Range getAgeRange() throws FHIRException { 
343          if (this.age == null)
344            return null;
345          if (!(this.age instanceof Range))
346            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.age.getClass().getName()+" was encountered");
347          return (Range) this.age;
348        }
349
350        public boolean hasAgeRange() { 
351          return this != null && this.age instanceof Range;
352        }
353
354        /**
355         * @return {@link #age} (The age of the specific population.)
356         */
357        public CodeableConcept getAgeCodeableConcept() throws FHIRException { 
358          if (this.age == null)
359            return null;
360          if (!(this.age instanceof CodeableConcept))
361            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.age.getClass().getName()+" was encountered");
362          return (CodeableConcept) this.age;
363        }
364
365        public boolean hasAgeCodeableConcept() { 
366          return this != null && this.age instanceof CodeableConcept;
367        }
368
369        public boolean hasAge() { 
370          return this.age != null && !this.age.isEmpty();
371        }
372
373        /**
374         * @param value {@link #age} (The age of the specific population.)
375         */
376        public MedicinalProductIndicationPopulationComponent setAge(Type value) { 
377          if (value != null && !(value instanceof Range || value instanceof CodeableConcept))
378            throw new Error("Not the right type for MedicinalProductIndication.population.age[x]: "+value.fhirType());
379          this.age = value;
380          return this;
381        }
382
383        /**
384         * @return {@link #gender} (The gender of the specific population.)
385         */
386        public CodeableConcept getGender() { 
387          if (this.gender == null)
388            if (Configuration.errorOnAutoCreate())
389              throw new Error("Attempt to auto-create MedicinalProductIndicationPopulationComponent.gender");
390            else if (Configuration.doAutoCreate())
391              this.gender = new CodeableConcept(); // cc
392          return this.gender;
393        }
394
395        public boolean hasGender() { 
396          return this.gender != null && !this.gender.isEmpty();
397        }
398
399        /**
400         * @param value {@link #gender} (The gender of the specific population.)
401         */
402        public MedicinalProductIndicationPopulationComponent setGender(CodeableConcept value) { 
403          this.gender = value;
404          return this;
405        }
406
407        /**
408         * @return {@link #race} (Race of the specific population.)
409         */
410        public CodeableConcept getRace() { 
411          if (this.race == null)
412            if (Configuration.errorOnAutoCreate())
413              throw new Error("Attempt to auto-create MedicinalProductIndicationPopulationComponent.race");
414            else if (Configuration.doAutoCreate())
415              this.race = new CodeableConcept(); // cc
416          return this.race;
417        }
418
419        public boolean hasRace() { 
420          return this.race != null && !this.race.isEmpty();
421        }
422
423        /**
424         * @param value {@link #race} (Race of the specific population.)
425         */
426        public MedicinalProductIndicationPopulationComponent setRace(CodeableConcept value) { 
427          this.race = value;
428          return this;
429        }
430
431        /**
432         * @return {@link #physiologicalCondition} (The existing physiological conditions of the specific population to which this applies.)
433         */
434        public CodeableConcept getPhysiologicalCondition() { 
435          if (this.physiologicalCondition == null)
436            if (Configuration.errorOnAutoCreate())
437              throw new Error("Attempt to auto-create MedicinalProductIndicationPopulationComponent.physiologicalCondition");
438            else if (Configuration.doAutoCreate())
439              this.physiologicalCondition = new CodeableConcept(); // cc
440          return this.physiologicalCondition;
441        }
442
443        public boolean hasPhysiologicalCondition() { 
444          return this.physiologicalCondition != null && !this.physiologicalCondition.isEmpty();
445        }
446
447        /**
448         * @param value {@link #physiologicalCondition} (The existing physiological conditions of the specific population to which this applies.)
449         */
450        public MedicinalProductIndicationPopulationComponent setPhysiologicalCondition(CodeableConcept value) { 
451          this.physiologicalCondition = value;
452          return this;
453        }
454
455        protected void listChildren(List<Property> children) {
456          super.listChildren(children);
457          children.add(new Property("age[x]", "Range|CodeableConcept", "The age of the specific population.", 0, 1, age));
458          children.add(new Property("gender", "CodeableConcept", "The gender of the specific population.", 0, 1, gender));
459          children.add(new Property("race", "CodeableConcept", "Race of the specific population.", 0, 1, race));
460          children.add(new Property("physiologicalCondition", "CodeableConcept", "The existing physiological conditions of the specific population to which this applies.", 0, 1, physiologicalCondition));
461        }
462
463        @Override
464        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
465          switch (_hash) {
466          case -1419716831: /*age[x]*/  return new Property("age[x]", "Range|CodeableConcept", "The age of the specific population.", 0, 1, age);
467          case 96511: /*age*/  return new Property("age[x]", "Range|CodeableConcept", "The age of the specific population.", 0, 1, age);
468          case 1442748286: /*ageRange*/  return new Property("age[x]", "Range|CodeableConcept", "The age of the specific population.", 0, 1, age);
469          case -1452658526: /*ageCodeableConcept*/  return new Property("age[x]", "Range|CodeableConcept", "The age of the specific population.", 0, 1, age);
470          case -1249512767: /*gender*/  return new Property("gender", "CodeableConcept", "The gender of the specific population.", 0, 1, gender);
471          case 3492561: /*race*/  return new Property("race", "CodeableConcept", "Race of the specific population.", 0, 1, race);
472          case -62715190: /*physiologicalCondition*/  return new Property("physiologicalCondition", "CodeableConcept", "The existing physiological conditions of the specific population to which this applies.", 0, 1, physiologicalCondition);
473          default: return super.getNamedProperty(_hash, _name, _checkValid);
474          }
475
476        }
477
478      @Override
479      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
480        switch (hash) {
481        case 96511: /*age*/ return this.age == null ? new Base[0] : new Base[] {this.age}; // Type
482        case -1249512767: /*gender*/ return this.gender == null ? new Base[0] : new Base[] {this.gender}; // CodeableConcept
483        case 3492561: /*race*/ return this.race == null ? new Base[0] : new Base[] {this.race}; // CodeableConcept
484        case -62715190: /*physiologicalCondition*/ return this.physiologicalCondition == null ? new Base[0] : new Base[] {this.physiologicalCondition}; // CodeableConcept
485        default: return super.getProperty(hash, name, checkValid);
486        }
487
488      }
489
490      @Override
491      public Base setProperty(int hash, String name, Base value) throws FHIRException {
492        switch (hash) {
493        case 96511: // age
494          this.age = castToType(value); // Type
495          return value;
496        case -1249512767: // gender
497          this.gender = castToCodeableConcept(value); // CodeableConcept
498          return value;
499        case 3492561: // race
500          this.race = castToCodeableConcept(value); // CodeableConcept
501          return value;
502        case -62715190: // physiologicalCondition
503          this.physiologicalCondition = castToCodeableConcept(value); // CodeableConcept
504          return value;
505        default: return super.setProperty(hash, name, value);
506        }
507
508      }
509
510      @Override
511      public Base setProperty(String name, Base value) throws FHIRException {
512        if (name.equals("age[x]")) {
513          this.age = castToType(value); // Type
514        } else if (name.equals("gender")) {
515          this.gender = castToCodeableConcept(value); // CodeableConcept
516        } else if (name.equals("race")) {
517          this.race = castToCodeableConcept(value); // CodeableConcept
518        } else if (name.equals("physiologicalCondition")) {
519          this.physiologicalCondition = castToCodeableConcept(value); // CodeableConcept
520        } else
521          return super.setProperty(name, value);
522        return value;
523      }
524
525      @Override
526      public Base makeProperty(int hash, String name) throws FHIRException {
527        switch (hash) {
528        case -1419716831:  return getAge(); 
529        case 96511:  return getAge(); 
530        case -1249512767:  return getGender(); 
531        case 3492561:  return getRace(); 
532        case -62715190:  return getPhysiologicalCondition(); 
533        default: return super.makeProperty(hash, name);
534        }
535
536      }
537
538      @Override
539      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
540        switch (hash) {
541        case 96511: /*age*/ return new String[] {"Range", "CodeableConcept"};
542        case -1249512767: /*gender*/ return new String[] {"CodeableConcept"};
543        case 3492561: /*race*/ return new String[] {"CodeableConcept"};
544        case -62715190: /*physiologicalCondition*/ return new String[] {"CodeableConcept"};
545        default: return super.getTypesForProperty(hash, name);
546        }
547
548      }
549
550      @Override
551      public Base addChild(String name) throws FHIRException {
552        if (name.equals("ageRange")) {
553          this.age = new Range();
554          return this.age;
555        }
556        else if (name.equals("ageCodeableConcept")) {
557          this.age = new CodeableConcept();
558          return this.age;
559        }
560        else if (name.equals("gender")) {
561          this.gender = new CodeableConcept();
562          return this.gender;
563        }
564        else if (name.equals("race")) {
565          this.race = new CodeableConcept();
566          return this.race;
567        }
568        else if (name.equals("physiologicalCondition")) {
569          this.physiologicalCondition = new CodeableConcept();
570          return this.physiologicalCondition;
571        }
572        else
573          return super.addChild(name);
574      }
575
576      public MedicinalProductIndicationPopulationComponent copy() {
577        MedicinalProductIndicationPopulationComponent dst = new MedicinalProductIndicationPopulationComponent();
578        copyValues(dst);
579        dst.age = age == null ? null : age.copy();
580        dst.gender = gender == null ? null : gender.copy();
581        dst.race = race == null ? null : race.copy();
582        dst.physiologicalCondition = physiologicalCondition == null ? null : physiologicalCondition.copy();
583        return dst;
584      }
585
586      @Override
587      public boolean equalsDeep(Base other_) {
588        if (!super.equalsDeep(other_))
589          return false;
590        if (!(other_ instanceof MedicinalProductIndicationPopulationComponent))
591          return false;
592        MedicinalProductIndicationPopulationComponent o = (MedicinalProductIndicationPopulationComponent) other_;
593        return compareDeep(age, o.age, true) && compareDeep(gender, o.gender, true) && compareDeep(race, o.race, true)
594           && compareDeep(physiologicalCondition, o.physiologicalCondition, true);
595      }
596
597      @Override
598      public boolean equalsShallow(Base other_) {
599        if (!super.equalsShallow(other_))
600          return false;
601        if (!(other_ instanceof MedicinalProductIndicationPopulationComponent))
602          return false;
603        MedicinalProductIndicationPopulationComponent o = (MedicinalProductIndicationPopulationComponent) other_;
604        return true;
605      }
606
607      public boolean isEmpty() {
608        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(age, gender, race, physiologicalCondition
609          );
610      }
611
612  public String fhirType() {
613    return "MedicinalProductIndication.population";
614
615  }
616
617  }
618
619    /**
620     * The medication for which this is an indication.
621     */
622    @Child(name = "subject", type = {MedicinalProduct.class, Medication.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
623    @Description(shortDefinition="The medication for which this is an indication", formalDefinition="The medication for which this is an indication." )
624    protected List<Reference> subject;
625    /**
626     * The actual objects that are the target of the reference (The medication for which this is an indication.)
627     */
628    protected List<Resource> subjectTarget;
629
630
631    /**
632     * The disease, symptom or procedure that is the indication for treatment.
633     */
634    @Child(name = "diseaseSymptomProcedure", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
635    @Description(shortDefinition="The disease, symptom or procedure that is the indication for treatment", formalDefinition="The disease, symptom or procedure that is the indication for treatment." )
636    protected CodeableConcept diseaseSymptomProcedure;
637
638    /**
639     * The status of the disease or symptom for which the indication applies.
640     */
641    @Child(name = "diseaseStatus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
642    @Description(shortDefinition="The status of the disease or symptom for which the indication applies", formalDefinition="The status of the disease or symptom for which the indication applies." )
643    protected CodeableConcept diseaseStatus;
644
645    /**
646     * Comorbidity (concurrent condition) or co-infection as part of the indication.
647     */
648    @Child(name = "comorbidity", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
649    @Description(shortDefinition="Comorbidity (concurrent condition) or co-infection as part of the indication", formalDefinition="Comorbidity (concurrent condition) or co-infection as part of the indication." )
650    protected List<CodeableConcept> comorbidity;
651
652    /**
653     * The intended effect, aim or strategy to be achieved by the indication.
654     */
655    @Child(name = "intendedEffect", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
656    @Description(shortDefinition="The intended effect, aim or strategy to be achieved by the indication", formalDefinition="The intended effect, aim or strategy to be achieved by the indication." )
657    protected CodeableConcept intendedEffect;
658
659    /**
660     * Timing or duration information as part of the indication.
661     */
662    @Child(name = "duration", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=true)
663    @Description(shortDefinition="Timing or duration information as part of the indication", formalDefinition="Timing or duration information as part of the indication." )
664    protected Quantity duration;
665
666    /**
667     * Information about the use of the medicinal product in relation to other therapies described as part of the indication.
668     */
669    @Child(name = "otherTherapy", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
670    @Description(shortDefinition="Information about the use of the medicinal product in relation to other therapies described as part of the indication", formalDefinition="Information about the use of the medicinal product in relation to other therapies described as part of the indication." )
671    protected List<MedicinalProductIndicationOtherTherapyComponent> otherTherapy;
672
673    /**
674     * Describe the undesirable effects of the medicinal product.
675     */
676    @Child(name = "undesirableEffect", type = {MedicinalProductUndesirableEffect.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
677    @Description(shortDefinition="Describe the undesirable effects of the medicinal product", formalDefinition="Describe the undesirable effects of the medicinal product." )
678    protected List<Reference> undesirableEffect;
679    /**
680     * The actual objects that are the target of the reference (Describe the undesirable effects of the medicinal product.)
681     */
682    protected List<MedicinalProductUndesirableEffect> undesirableEffectTarget;
683
684
685    /**
686     * The population group to which this applies.
687     */
688    @Child(name = "population", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
689    @Description(shortDefinition="The population group to which this applies", formalDefinition="The population group to which this applies." )
690    protected List<MedicinalProductIndicationPopulationComponent> population;
691
692    private static final long serialVersionUID = -1449636358L;
693
694  /**
695   * Constructor
696   */
697    public MedicinalProductIndication() {
698      super();
699    }
700
701    /**
702     * @return {@link #subject} (The medication for which this is an indication.)
703     */
704    public List<Reference> getSubject() { 
705      if (this.subject == null)
706        this.subject = new ArrayList<Reference>();
707      return this.subject;
708    }
709
710    /**
711     * @return Returns a reference to <code>this</code> for easy method chaining
712     */
713    public MedicinalProductIndication setSubject(List<Reference> theSubject) { 
714      this.subject = theSubject;
715      return this;
716    }
717
718    public boolean hasSubject() { 
719      if (this.subject == null)
720        return false;
721      for (Reference item : this.subject)
722        if (!item.isEmpty())
723          return true;
724      return false;
725    }
726
727    public Reference addSubject() { //3
728      Reference t = new Reference();
729      if (this.subject == null)
730        this.subject = new ArrayList<Reference>();
731      this.subject.add(t);
732      return t;
733    }
734
735    public MedicinalProductIndication addSubject(Reference t) { //3
736      if (t == null)
737        return this;
738      if (this.subject == null)
739        this.subject = new ArrayList<Reference>();
740      this.subject.add(t);
741      return this;
742    }
743
744    /**
745     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
746     */
747    public Reference getSubjectFirstRep() { 
748      if (getSubject().isEmpty()) {
749        addSubject();
750      }
751      return getSubject().get(0);
752    }
753
754    /**
755     * @deprecated Use Reference#setResource(IBaseResource) instead
756     */
757    @Deprecated
758    public List<Resource> getSubjectTarget() { 
759      if (this.subjectTarget == null)
760        this.subjectTarget = new ArrayList<Resource>();
761      return this.subjectTarget;
762    }
763
764    /**
765     * @return {@link #diseaseSymptomProcedure} (The disease, symptom or procedure that is the indication for treatment.)
766     */
767    public CodeableConcept getDiseaseSymptomProcedure() { 
768      if (this.diseaseSymptomProcedure == null)
769        if (Configuration.errorOnAutoCreate())
770          throw new Error("Attempt to auto-create MedicinalProductIndication.diseaseSymptomProcedure");
771        else if (Configuration.doAutoCreate())
772          this.diseaseSymptomProcedure = new CodeableConcept(); // cc
773      return this.diseaseSymptomProcedure;
774    }
775
776    public boolean hasDiseaseSymptomProcedure() { 
777      return this.diseaseSymptomProcedure != null && !this.diseaseSymptomProcedure.isEmpty();
778    }
779
780    /**
781     * @param value {@link #diseaseSymptomProcedure} (The disease, symptom or procedure that is the indication for treatment.)
782     */
783    public MedicinalProductIndication setDiseaseSymptomProcedure(CodeableConcept value) { 
784      this.diseaseSymptomProcedure = value;
785      return this;
786    }
787
788    /**
789     * @return {@link #diseaseStatus} (The status of the disease or symptom for which the indication applies.)
790     */
791    public CodeableConcept getDiseaseStatus() { 
792      if (this.diseaseStatus == null)
793        if (Configuration.errorOnAutoCreate())
794          throw new Error("Attempt to auto-create MedicinalProductIndication.diseaseStatus");
795        else if (Configuration.doAutoCreate())
796          this.diseaseStatus = new CodeableConcept(); // cc
797      return this.diseaseStatus;
798    }
799
800    public boolean hasDiseaseStatus() { 
801      return this.diseaseStatus != null && !this.diseaseStatus.isEmpty();
802    }
803
804    /**
805     * @param value {@link #diseaseStatus} (The status of the disease or symptom for which the indication applies.)
806     */
807    public MedicinalProductIndication setDiseaseStatus(CodeableConcept value) { 
808      this.diseaseStatus = value;
809      return this;
810    }
811
812    /**
813     * @return {@link #comorbidity} (Comorbidity (concurrent condition) or co-infection as part of the indication.)
814     */
815    public List<CodeableConcept> getComorbidity() { 
816      if (this.comorbidity == null)
817        this.comorbidity = new ArrayList<CodeableConcept>();
818      return this.comorbidity;
819    }
820
821    /**
822     * @return Returns a reference to <code>this</code> for easy method chaining
823     */
824    public MedicinalProductIndication setComorbidity(List<CodeableConcept> theComorbidity) { 
825      this.comorbidity = theComorbidity;
826      return this;
827    }
828
829    public boolean hasComorbidity() { 
830      if (this.comorbidity == null)
831        return false;
832      for (CodeableConcept item : this.comorbidity)
833        if (!item.isEmpty())
834          return true;
835      return false;
836    }
837
838    public CodeableConcept addComorbidity() { //3
839      CodeableConcept t = new CodeableConcept();
840      if (this.comorbidity == null)
841        this.comorbidity = new ArrayList<CodeableConcept>();
842      this.comorbidity.add(t);
843      return t;
844    }
845
846    public MedicinalProductIndication addComorbidity(CodeableConcept t) { //3
847      if (t == null)
848        return this;
849      if (this.comorbidity == null)
850        this.comorbidity = new ArrayList<CodeableConcept>();
851      this.comorbidity.add(t);
852      return this;
853    }
854
855    /**
856     * @return The first repetition of repeating field {@link #comorbidity}, creating it if it does not already exist
857     */
858    public CodeableConcept getComorbidityFirstRep() { 
859      if (getComorbidity().isEmpty()) {
860        addComorbidity();
861      }
862      return getComorbidity().get(0);
863    }
864
865    /**
866     * @return {@link #intendedEffect} (The intended effect, aim or strategy to be achieved by the indication.)
867     */
868    public CodeableConcept getIntendedEffect() { 
869      if (this.intendedEffect == null)
870        if (Configuration.errorOnAutoCreate())
871          throw new Error("Attempt to auto-create MedicinalProductIndication.intendedEffect");
872        else if (Configuration.doAutoCreate())
873          this.intendedEffect = new CodeableConcept(); // cc
874      return this.intendedEffect;
875    }
876
877    public boolean hasIntendedEffect() { 
878      return this.intendedEffect != null && !this.intendedEffect.isEmpty();
879    }
880
881    /**
882     * @param value {@link #intendedEffect} (The intended effect, aim or strategy to be achieved by the indication.)
883     */
884    public MedicinalProductIndication setIntendedEffect(CodeableConcept value) { 
885      this.intendedEffect = value;
886      return this;
887    }
888
889    /**
890     * @return {@link #duration} (Timing or duration information as part of the indication.)
891     */
892    public Quantity getDuration() { 
893      if (this.duration == null)
894        if (Configuration.errorOnAutoCreate())
895          throw new Error("Attempt to auto-create MedicinalProductIndication.duration");
896        else if (Configuration.doAutoCreate())
897          this.duration = new Quantity(); // cc
898      return this.duration;
899    }
900
901    public boolean hasDuration() { 
902      return this.duration != null && !this.duration.isEmpty();
903    }
904
905    /**
906     * @param value {@link #duration} (Timing or duration information as part of the indication.)
907     */
908    public MedicinalProductIndication setDuration(Quantity value) { 
909      this.duration = value;
910      return this;
911    }
912
913    /**
914     * @return {@link #otherTherapy} (Information about the use of the medicinal product in relation to other therapies described as part of the indication.)
915     */
916    public List<MedicinalProductIndicationOtherTherapyComponent> getOtherTherapy() { 
917      if (this.otherTherapy == null)
918        this.otherTherapy = new ArrayList<MedicinalProductIndicationOtherTherapyComponent>();
919      return this.otherTherapy;
920    }
921
922    /**
923     * @return Returns a reference to <code>this</code> for easy method chaining
924     */
925    public MedicinalProductIndication setOtherTherapy(List<MedicinalProductIndicationOtherTherapyComponent> theOtherTherapy) { 
926      this.otherTherapy = theOtherTherapy;
927      return this;
928    }
929
930    public boolean hasOtherTherapy() { 
931      if (this.otherTherapy == null)
932        return false;
933      for (MedicinalProductIndicationOtherTherapyComponent item : this.otherTherapy)
934        if (!item.isEmpty())
935          return true;
936      return false;
937    }
938
939    public MedicinalProductIndicationOtherTherapyComponent addOtherTherapy() { //3
940      MedicinalProductIndicationOtherTherapyComponent t = new MedicinalProductIndicationOtherTherapyComponent();
941      if (this.otherTherapy == null)
942        this.otherTherapy = new ArrayList<MedicinalProductIndicationOtherTherapyComponent>();
943      this.otherTherapy.add(t);
944      return t;
945    }
946
947    public MedicinalProductIndication addOtherTherapy(MedicinalProductIndicationOtherTherapyComponent t) { //3
948      if (t == null)
949        return this;
950      if (this.otherTherapy == null)
951        this.otherTherapy = new ArrayList<MedicinalProductIndicationOtherTherapyComponent>();
952      this.otherTherapy.add(t);
953      return this;
954    }
955
956    /**
957     * @return The first repetition of repeating field {@link #otherTherapy}, creating it if it does not already exist
958     */
959    public MedicinalProductIndicationOtherTherapyComponent getOtherTherapyFirstRep() { 
960      if (getOtherTherapy().isEmpty()) {
961        addOtherTherapy();
962      }
963      return getOtherTherapy().get(0);
964    }
965
966    /**
967     * @return {@link #undesirableEffect} (Describe the undesirable effects of the medicinal product.)
968     */
969    public List<Reference> getUndesirableEffect() { 
970      if (this.undesirableEffect == null)
971        this.undesirableEffect = new ArrayList<Reference>();
972      return this.undesirableEffect;
973    }
974
975    /**
976     * @return Returns a reference to <code>this</code> for easy method chaining
977     */
978    public MedicinalProductIndication setUndesirableEffect(List<Reference> theUndesirableEffect) { 
979      this.undesirableEffect = theUndesirableEffect;
980      return this;
981    }
982
983    public boolean hasUndesirableEffect() { 
984      if (this.undesirableEffect == null)
985        return false;
986      for (Reference item : this.undesirableEffect)
987        if (!item.isEmpty())
988          return true;
989      return false;
990    }
991
992    public Reference addUndesirableEffect() { //3
993      Reference t = new Reference();
994      if (this.undesirableEffect == null)
995        this.undesirableEffect = new ArrayList<Reference>();
996      this.undesirableEffect.add(t);
997      return t;
998    }
999
1000    public MedicinalProductIndication addUndesirableEffect(Reference t) { //3
1001      if (t == null)
1002        return this;
1003      if (this.undesirableEffect == null)
1004        this.undesirableEffect = new ArrayList<Reference>();
1005      this.undesirableEffect.add(t);
1006      return this;
1007    }
1008
1009    /**
1010     * @return The first repetition of repeating field {@link #undesirableEffect}, creating it if it does not already exist
1011     */
1012    public Reference getUndesirableEffectFirstRep() { 
1013      if (getUndesirableEffect().isEmpty()) {
1014        addUndesirableEffect();
1015      }
1016      return getUndesirableEffect().get(0);
1017    }
1018
1019    /**
1020     * @deprecated Use Reference#setResource(IBaseResource) instead
1021     */
1022    @Deprecated
1023    public List<MedicinalProductUndesirableEffect> getUndesirableEffectTarget() { 
1024      if (this.undesirableEffectTarget == null)
1025        this.undesirableEffectTarget = new ArrayList<MedicinalProductUndesirableEffect>();
1026      return this.undesirableEffectTarget;
1027    }
1028
1029    /**
1030     * @deprecated Use Reference#setResource(IBaseResource) instead
1031     */
1032    @Deprecated
1033    public MedicinalProductUndesirableEffect addUndesirableEffectTarget() { 
1034      MedicinalProductUndesirableEffect r = new MedicinalProductUndesirableEffect();
1035      if (this.undesirableEffectTarget == null)
1036        this.undesirableEffectTarget = new ArrayList<MedicinalProductUndesirableEffect>();
1037      this.undesirableEffectTarget.add(r);
1038      return r;
1039    }
1040
1041    /**
1042     * @return {@link #population} (The population group to which this applies.)
1043     */
1044    public List<MedicinalProductIndicationPopulationComponent> getPopulation() { 
1045      if (this.population == null)
1046        this.population = new ArrayList<MedicinalProductIndicationPopulationComponent>();
1047      return this.population;
1048    }
1049
1050    /**
1051     * @return Returns a reference to <code>this</code> for easy method chaining
1052     */
1053    public MedicinalProductIndication setPopulation(List<MedicinalProductIndicationPopulationComponent> thePopulation) { 
1054      this.population = thePopulation;
1055      return this;
1056    }
1057
1058    public boolean hasPopulation() { 
1059      if (this.population == null)
1060        return false;
1061      for (MedicinalProductIndicationPopulationComponent item : this.population)
1062        if (!item.isEmpty())
1063          return true;
1064      return false;
1065    }
1066
1067    public MedicinalProductIndicationPopulationComponent addPopulation() { //3
1068      MedicinalProductIndicationPopulationComponent t = new MedicinalProductIndicationPopulationComponent();
1069      if (this.population == null)
1070        this.population = new ArrayList<MedicinalProductIndicationPopulationComponent>();
1071      this.population.add(t);
1072      return t;
1073    }
1074
1075    public MedicinalProductIndication addPopulation(MedicinalProductIndicationPopulationComponent t) { //3
1076      if (t == null)
1077        return this;
1078      if (this.population == null)
1079        this.population = new ArrayList<MedicinalProductIndicationPopulationComponent>();
1080      this.population.add(t);
1081      return this;
1082    }
1083
1084    /**
1085     * @return The first repetition of repeating field {@link #population}, creating it if it does not already exist
1086     */
1087    public MedicinalProductIndicationPopulationComponent getPopulationFirstRep() { 
1088      if (getPopulation().isEmpty()) {
1089        addPopulation();
1090      }
1091      return getPopulation().get(0);
1092    }
1093
1094      protected void listChildren(List<Property> children) {
1095        super.listChildren(children);
1096        children.add(new Property("subject", "Reference(MedicinalProduct|Medication)", "The medication for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject));
1097        children.add(new Property("diseaseSymptomProcedure", "CodeableConcept", "The disease, symptom or procedure that is the indication for treatment.", 0, 1, diseaseSymptomProcedure));
1098        children.add(new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for which the indication applies.", 0, 1, diseaseStatus));
1099        children.add(new Property("comorbidity", "CodeableConcept", "Comorbidity (concurrent condition) or co-infection as part of the indication.", 0, java.lang.Integer.MAX_VALUE, comorbidity));
1100        children.add(new Property("intendedEffect", "CodeableConcept", "The intended effect, aim or strategy to be achieved by the indication.", 0, 1, intendedEffect));
1101        children.add(new Property("duration", "Quantity", "Timing or duration information as part of the indication.", 0, 1, duration));
1102        children.add(new Property("otherTherapy", "", "Information about the use of the medicinal product in relation to other therapies described as part of the indication.", 0, java.lang.Integer.MAX_VALUE, otherTherapy));
1103        children.add(new Property("undesirableEffect", "Reference(MedicinalProductUndesirableEffect)", "Describe the undesirable effects of the medicinal product.", 0, java.lang.Integer.MAX_VALUE, undesirableEffect));
1104        children.add(new Property("population", "", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population));
1105      }
1106
1107      @Override
1108      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1109        switch (_hash) {
1110        case -1867885268: /*subject*/  return new Property("subject", "Reference(MedicinalProduct|Medication)", "The medication for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject);
1111        case -1497395130: /*diseaseSymptomProcedure*/  return new Property("diseaseSymptomProcedure", "CodeableConcept", "The disease, symptom or procedure that is the indication for treatment.", 0, 1, diseaseSymptomProcedure);
1112        case -505503602: /*diseaseStatus*/  return new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for which the indication applies.", 0, 1, diseaseStatus);
1113        case -406395211: /*comorbidity*/  return new Property("comorbidity", "CodeableConcept", "Comorbidity (concurrent condition) or co-infection as part of the indication.", 0, java.lang.Integer.MAX_VALUE, comorbidity);
1114        case 1587112348: /*intendedEffect*/  return new Property("intendedEffect", "CodeableConcept", "The intended effect, aim or strategy to be achieved by the indication.", 0, 1, intendedEffect);
1115        case -1992012396: /*duration*/  return new Property("duration", "Quantity", "Timing or duration information as part of the indication.", 0, 1, duration);
1116        case -544509127: /*otherTherapy*/  return new Property("otherTherapy", "", "Information about the use of the medicinal product in relation to other therapies described as part of the indication.", 0, java.lang.Integer.MAX_VALUE, otherTherapy);
1117        case 444367565: /*undesirableEffect*/  return new Property("undesirableEffect", "Reference(MedicinalProductUndesirableEffect)", "Describe the undesirable effects of the medicinal product.", 0, java.lang.Integer.MAX_VALUE, undesirableEffect);
1118        case -2023558323: /*population*/  return new Property("population", "", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population);
1119        default: return super.getNamedProperty(_hash, _name, _checkValid);
1120        }
1121
1122      }
1123
1124      @Override
1125      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1126        switch (hash) {
1127        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
1128        case -1497395130: /*diseaseSymptomProcedure*/ return this.diseaseSymptomProcedure == null ? new Base[0] : new Base[] {this.diseaseSymptomProcedure}; // CodeableConcept
1129        case -505503602: /*diseaseStatus*/ return this.diseaseStatus == null ? new Base[0] : new Base[] {this.diseaseStatus}; // CodeableConcept
1130        case -406395211: /*comorbidity*/ return this.comorbidity == null ? new Base[0] : this.comorbidity.toArray(new Base[this.comorbidity.size()]); // CodeableConcept
1131        case 1587112348: /*intendedEffect*/ return this.intendedEffect == null ? new Base[0] : new Base[] {this.intendedEffect}; // CodeableConcept
1132        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Quantity
1133        case -544509127: /*otherTherapy*/ return this.otherTherapy == null ? new Base[0] : this.otherTherapy.toArray(new Base[this.otherTherapy.size()]); // MedicinalProductIndicationOtherTherapyComponent
1134        case 444367565: /*undesirableEffect*/ return this.undesirableEffect == null ? new Base[0] : this.undesirableEffect.toArray(new Base[this.undesirableEffect.size()]); // Reference
1135        case -2023558323: /*population*/ return this.population == null ? new Base[0] : this.population.toArray(new Base[this.population.size()]); // MedicinalProductIndicationPopulationComponent
1136        default: return super.getProperty(hash, name, checkValid);
1137        }
1138
1139      }
1140
1141      @Override
1142      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1143        switch (hash) {
1144        case -1867885268: // subject
1145          this.getSubject().add(castToReference(value)); // Reference
1146          return value;
1147        case -1497395130: // diseaseSymptomProcedure
1148          this.diseaseSymptomProcedure = castToCodeableConcept(value); // CodeableConcept
1149          return value;
1150        case -505503602: // diseaseStatus
1151          this.diseaseStatus = castToCodeableConcept(value); // CodeableConcept
1152          return value;
1153        case -406395211: // comorbidity
1154          this.getComorbidity().add(castToCodeableConcept(value)); // CodeableConcept
1155          return value;
1156        case 1587112348: // intendedEffect
1157          this.intendedEffect = castToCodeableConcept(value); // CodeableConcept
1158          return value;
1159        case -1992012396: // duration
1160          this.duration = castToQuantity(value); // Quantity
1161          return value;
1162        case -544509127: // otherTherapy
1163          this.getOtherTherapy().add((MedicinalProductIndicationOtherTherapyComponent) value); // MedicinalProductIndicationOtherTherapyComponent
1164          return value;
1165        case 444367565: // undesirableEffect
1166          this.getUndesirableEffect().add(castToReference(value)); // Reference
1167          return value;
1168        case -2023558323: // population
1169          this.getPopulation().add((MedicinalProductIndicationPopulationComponent) value); // MedicinalProductIndicationPopulationComponent
1170          return value;
1171        default: return super.setProperty(hash, name, value);
1172        }
1173
1174      }
1175
1176      @Override
1177      public Base setProperty(String name, Base value) throws FHIRException {
1178        if (name.equals("subject")) {
1179          this.getSubject().add(castToReference(value));
1180        } else if (name.equals("diseaseSymptomProcedure")) {
1181          this.diseaseSymptomProcedure = castToCodeableConcept(value); // CodeableConcept
1182        } else if (name.equals("diseaseStatus")) {
1183          this.diseaseStatus = castToCodeableConcept(value); // CodeableConcept
1184        } else if (name.equals("comorbidity")) {
1185          this.getComorbidity().add(castToCodeableConcept(value));
1186        } else if (name.equals("intendedEffect")) {
1187          this.intendedEffect = castToCodeableConcept(value); // CodeableConcept
1188        } else if (name.equals("duration")) {
1189          this.duration = castToQuantity(value); // Quantity
1190        } else if (name.equals("otherTherapy")) {
1191          this.getOtherTherapy().add((MedicinalProductIndicationOtherTherapyComponent) value);
1192        } else if (name.equals("undesirableEffect")) {
1193          this.getUndesirableEffect().add(castToReference(value));
1194        } else if (name.equals("population")) {
1195          this.getPopulation().add((MedicinalProductIndicationPopulationComponent) value);
1196        } else
1197          return super.setProperty(name, value);
1198        return value;
1199      }
1200
1201      @Override
1202      public Base makeProperty(int hash, String name) throws FHIRException {
1203        switch (hash) {
1204        case -1867885268:  return addSubject(); 
1205        case -1497395130:  return getDiseaseSymptomProcedure(); 
1206        case -505503602:  return getDiseaseStatus(); 
1207        case -406395211:  return addComorbidity(); 
1208        case 1587112348:  return getIntendedEffect(); 
1209        case -1992012396:  return getDuration(); 
1210        case -544509127:  return addOtherTherapy(); 
1211        case 444367565:  return addUndesirableEffect(); 
1212        case -2023558323:  return addPopulation(); 
1213        default: return super.makeProperty(hash, name);
1214        }
1215
1216      }
1217
1218      @Override
1219      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1220        switch (hash) {
1221        case -1867885268: /*subject*/ return new String[] {"Reference"};
1222        case -1497395130: /*diseaseSymptomProcedure*/ return new String[] {"CodeableConcept"};
1223        case -505503602: /*diseaseStatus*/ return new String[] {"CodeableConcept"};
1224        case -406395211: /*comorbidity*/ return new String[] {"CodeableConcept"};
1225        case 1587112348: /*intendedEffect*/ return new String[] {"CodeableConcept"};
1226        case -1992012396: /*duration*/ return new String[] {"Quantity"};
1227        case -544509127: /*otherTherapy*/ return new String[] {};
1228        case 444367565: /*undesirableEffect*/ return new String[] {"Reference"};
1229        case -2023558323: /*population*/ return new String[] {};
1230        default: return super.getTypesForProperty(hash, name);
1231        }
1232
1233      }
1234
1235      @Override
1236      public Base addChild(String name) throws FHIRException {
1237        if (name.equals("subject")) {
1238          return addSubject();
1239        }
1240        else if (name.equals("diseaseSymptomProcedure")) {
1241          this.diseaseSymptomProcedure = new CodeableConcept();
1242          return this.diseaseSymptomProcedure;
1243        }
1244        else if (name.equals("diseaseStatus")) {
1245          this.diseaseStatus = new CodeableConcept();
1246          return this.diseaseStatus;
1247        }
1248        else if (name.equals("comorbidity")) {
1249          return addComorbidity();
1250        }
1251        else if (name.equals("intendedEffect")) {
1252          this.intendedEffect = new CodeableConcept();
1253          return this.intendedEffect;
1254        }
1255        else if (name.equals("duration")) {
1256          this.duration = new Quantity();
1257          return this.duration;
1258        }
1259        else if (name.equals("otherTherapy")) {
1260          return addOtherTherapy();
1261        }
1262        else if (name.equals("undesirableEffect")) {
1263          return addUndesirableEffect();
1264        }
1265        else if (name.equals("population")) {
1266          return addPopulation();
1267        }
1268        else
1269          return super.addChild(name);
1270      }
1271
1272  public String fhirType() {
1273    return "MedicinalProductIndication";
1274
1275  }
1276
1277      public MedicinalProductIndication copy() {
1278        MedicinalProductIndication dst = new MedicinalProductIndication();
1279        copyValues(dst);
1280        if (subject != null) {
1281          dst.subject = new ArrayList<Reference>();
1282          for (Reference i : subject)
1283            dst.subject.add(i.copy());
1284        };
1285        dst.diseaseSymptomProcedure = diseaseSymptomProcedure == null ? null : diseaseSymptomProcedure.copy();
1286        dst.diseaseStatus = diseaseStatus == null ? null : diseaseStatus.copy();
1287        if (comorbidity != null) {
1288          dst.comorbidity = new ArrayList<CodeableConcept>();
1289          for (CodeableConcept i : comorbidity)
1290            dst.comorbidity.add(i.copy());
1291        };
1292        dst.intendedEffect = intendedEffect == null ? null : intendedEffect.copy();
1293        dst.duration = duration == null ? null : duration.copy();
1294        if (otherTherapy != null) {
1295          dst.otherTherapy = new ArrayList<MedicinalProductIndicationOtherTherapyComponent>();
1296          for (MedicinalProductIndicationOtherTherapyComponent i : otherTherapy)
1297            dst.otherTherapy.add(i.copy());
1298        };
1299        if (undesirableEffect != null) {
1300          dst.undesirableEffect = new ArrayList<Reference>();
1301          for (Reference i : undesirableEffect)
1302            dst.undesirableEffect.add(i.copy());
1303        };
1304        if (population != null) {
1305          dst.population = new ArrayList<MedicinalProductIndicationPopulationComponent>();
1306          for (MedicinalProductIndicationPopulationComponent i : population)
1307            dst.population.add(i.copy());
1308        };
1309        return dst;
1310      }
1311
1312      protected MedicinalProductIndication typedCopy() {
1313        return copy();
1314      }
1315
1316      @Override
1317      public boolean equalsDeep(Base other_) {
1318        if (!super.equalsDeep(other_))
1319          return false;
1320        if (!(other_ instanceof MedicinalProductIndication))
1321          return false;
1322        MedicinalProductIndication o = (MedicinalProductIndication) other_;
1323        return compareDeep(subject, o.subject, true) && compareDeep(diseaseSymptomProcedure, o.diseaseSymptomProcedure, true)
1324           && compareDeep(diseaseStatus, o.diseaseStatus, true) && compareDeep(comorbidity, o.comorbidity, true)
1325           && compareDeep(intendedEffect, o.intendedEffect, true) && compareDeep(duration, o.duration, true)
1326           && compareDeep(otherTherapy, o.otherTherapy, true) && compareDeep(undesirableEffect, o.undesirableEffect, true)
1327           && compareDeep(population, o.population, true);
1328      }
1329
1330      @Override
1331      public boolean equalsShallow(Base other_) {
1332        if (!super.equalsShallow(other_))
1333          return false;
1334        if (!(other_ instanceof MedicinalProductIndication))
1335          return false;
1336        MedicinalProductIndication o = (MedicinalProductIndication) other_;
1337        return true;
1338      }
1339
1340      public boolean isEmpty() {
1341        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subject, diseaseSymptomProcedure
1342          , diseaseStatus, comorbidity, intendedEffect, duration, otherTherapy, undesirableEffect
1343          , population);
1344      }
1345
1346  @Override
1347  public ResourceType getResourceType() {
1348    return ResourceType.MedicinalProductIndication;
1349   }
1350
1351 /**
1352   * Search parameter: <b>subject</b>
1353   * <p>
1354   * Description: <b>The medication for which this is an indication</b><br>
1355   * Type: <b>reference</b><br>
1356   * Path: <b>MedicinalProductIndication.subject</b><br>
1357   * </p>
1358   */
1359  @SearchParamDefinition(name="subject", path="MedicinalProductIndication.subject", description="The medication for which this is an indication", type="reference", target={Medication.class, MedicinalProduct.class } )
1360  public static final String SP_SUBJECT = "subject";
1361 /**
1362   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
1363   * <p>
1364   * Description: <b>The medication for which this is an indication</b><br>
1365   * Type: <b>reference</b><br>
1366   * Path: <b>MedicinalProductIndication.subject</b><br>
1367   * </p>
1368   */
1369  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
1370
1371/**
1372   * Constant for fluent queries to be used to add include statements. Specifies
1373   * the path value of "<b>MedicinalProductIndication:subject</b>".
1374   */
1375  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductIndication:subject").toLocked();
1376
1377
1378}
1379