001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import ca.uhn.fhir.model.api.annotation.ResourceDef;
040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.Block;
045import org.hl7.fhir.instance.model.api.*;
046import org.hl7.fhir.exceptions.FHIRException;
047/**
048 * The clinical particulars - indications, contraindications etc. of a medicinal product, including for regulatory purposes.
049 */
050@ResourceDef(name="MedicinalProductContraindication", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductContraindication")
051public class MedicinalProductContraindication extends DomainResource {
052
053    @Block()
054    public static class MedicinalProductContraindicationOtherTherapyComponent extends BackboneElement implements IBaseBackboneElement {
055        /**
056         * The type of relationship between the medicinal product indication or contraindication and another therapy.
057         */
058        @Child(name = "therapyRelationshipType", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
059        @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." )
060        protected CodeableConcept therapyRelationshipType;
061
062        /**
063         * Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.
064         */
065        @Child(name = "medication", type = {CodeableConcept.class, MedicinalProduct.class, Medication.class, Substance.class, SubstanceSpecification.class}, order=2, min=1, max=1, modifier=false, summary=true)
066        @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." )
067        protected Type medication;
068
069        private static final long serialVersionUID = 1438478115L;
070
071    /**
072     * Constructor
073     */
074      public MedicinalProductContraindicationOtherTherapyComponent() {
075        super();
076      }
077
078    /**
079     * Constructor
080     */
081      public MedicinalProductContraindicationOtherTherapyComponent(CodeableConcept therapyRelationshipType, Type medication) {
082        super();
083        this.therapyRelationshipType = therapyRelationshipType;
084        this.medication = medication;
085      }
086
087        /**
088         * @return {@link #therapyRelationshipType} (The type of relationship between the medicinal product indication or contraindication and another therapy.)
089         */
090        public CodeableConcept getTherapyRelationshipType() { 
091          if (this.therapyRelationshipType == null)
092            if (Configuration.errorOnAutoCreate())
093              throw new Error("Attempt to auto-create MedicinalProductContraindicationOtherTherapyComponent.therapyRelationshipType");
094            else if (Configuration.doAutoCreate())
095              this.therapyRelationshipType = new CodeableConcept(); // cc
096          return this.therapyRelationshipType;
097        }
098
099        public boolean hasTherapyRelationshipType() { 
100          return this.therapyRelationshipType != null && !this.therapyRelationshipType.isEmpty();
101        }
102
103        /**
104         * @param value {@link #therapyRelationshipType} (The type of relationship between the medicinal product indication or contraindication and another therapy.)
105         */
106        public MedicinalProductContraindicationOtherTherapyComponent setTherapyRelationshipType(CodeableConcept value) { 
107          this.therapyRelationshipType = value;
108          return this;
109        }
110
111        /**
112         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
113         */
114        public Type getMedication() { 
115          return this.medication;
116        }
117
118        /**
119         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
120         */
121        public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 
122          if (this.medication == null)
123            this.medication = new CodeableConcept();
124          if (!(this.medication instanceof CodeableConcept))
125            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered");
126          return (CodeableConcept) this.medication;
127        }
128
129        public boolean hasMedicationCodeableConcept() { 
130          return this != null && this.medication instanceof CodeableConcept;
131        }
132
133        /**
134         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
135         */
136        public Reference getMedicationReference() throws FHIRException { 
137          if (this.medication == null)
138            this.medication = new Reference();
139          if (!(this.medication instanceof Reference))
140            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered");
141          return (Reference) this.medication;
142        }
143
144        public boolean hasMedicationReference() { 
145          return this != null && this.medication instanceof Reference;
146        }
147
148        public boolean hasMedication() { 
149          return this.medication != null && !this.medication.isEmpty();
150        }
151
152        /**
153         * @param value {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
154         */
155        public MedicinalProductContraindicationOtherTherapyComponent setMedication(Type value) { 
156          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
157            throw new Error("Not the right type for MedicinalProductContraindication.otherTherapy.medication[x]: "+value.fhirType());
158          this.medication = value;
159          return this;
160        }
161
162        protected void listChildren(List<Property> children) {
163          super.listChildren(children);
164          children.add(new Property("therapyRelationshipType", "CodeableConcept", "The type of relationship between the medicinal product indication or contraindication and another therapy.", 0, 1, therapyRelationshipType));
165          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));
166        }
167
168        @Override
169        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
170          switch (_hash) {
171          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);
172          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);
173          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);
174          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);
175          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);
176          default: return super.getNamedProperty(_hash, _name, _checkValid);
177          }
178
179        }
180
181      @Override
182      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
183        switch (hash) {
184        case -551658469: /*therapyRelationshipType*/ return this.therapyRelationshipType == null ? new Base[0] : new Base[] {this.therapyRelationshipType}; // CodeableConcept
185        case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type
186        default: return super.getProperty(hash, name, checkValid);
187        }
188
189      }
190
191      @Override
192      public Base setProperty(int hash, String name, Base value) throws FHIRException {
193        switch (hash) {
194        case -551658469: // therapyRelationshipType
195          this.therapyRelationshipType = castToCodeableConcept(value); // CodeableConcept
196          return value;
197        case 1998965455: // medication
198          this.medication = castToType(value); // Type
199          return value;
200        default: return super.setProperty(hash, name, value);
201        }
202
203      }
204
205      @Override
206      public Base setProperty(String name, Base value) throws FHIRException {
207        if (name.equals("therapyRelationshipType")) {
208          this.therapyRelationshipType = castToCodeableConcept(value); // CodeableConcept
209        } else if (name.equals("medication[x]")) {
210          this.medication = castToType(value); // Type
211        } else
212          return super.setProperty(name, value);
213        return value;
214      }
215
216      @Override
217      public Base makeProperty(int hash, String name) throws FHIRException {
218        switch (hash) {
219        case -551658469:  return getTherapyRelationshipType(); 
220        case 1458402129:  return getMedication(); 
221        case 1998965455:  return getMedication(); 
222        default: return super.makeProperty(hash, name);
223        }
224
225      }
226
227      @Override
228      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
229        switch (hash) {
230        case -551658469: /*therapyRelationshipType*/ return new String[] {"CodeableConcept"};
231        case 1998965455: /*medication*/ return new String[] {"CodeableConcept", "Reference"};
232        default: return super.getTypesForProperty(hash, name);
233        }
234
235      }
236
237      @Override
238      public Base addChild(String name) throws FHIRException {
239        if (name.equals("therapyRelationshipType")) {
240          this.therapyRelationshipType = new CodeableConcept();
241          return this.therapyRelationshipType;
242        }
243        else if (name.equals("medicationCodeableConcept")) {
244          this.medication = new CodeableConcept();
245          return this.medication;
246        }
247        else if (name.equals("medicationReference")) {
248          this.medication = new Reference();
249          return this.medication;
250        }
251        else
252          return super.addChild(name);
253      }
254
255      public MedicinalProductContraindicationOtherTherapyComponent copy() {
256        MedicinalProductContraindicationOtherTherapyComponent dst = new MedicinalProductContraindicationOtherTherapyComponent();
257        copyValues(dst);
258        return dst;
259      }
260
261      public void copyValues(MedicinalProductContraindicationOtherTherapyComponent dst) {
262        super.copyValues(dst);
263        dst.therapyRelationshipType = therapyRelationshipType == null ? null : therapyRelationshipType.copy();
264        dst.medication = medication == null ? null : medication.copy();
265      }
266
267      @Override
268      public boolean equalsDeep(Base other_) {
269        if (!super.equalsDeep(other_))
270          return false;
271        if (!(other_ instanceof MedicinalProductContraindicationOtherTherapyComponent))
272          return false;
273        MedicinalProductContraindicationOtherTherapyComponent o = (MedicinalProductContraindicationOtherTherapyComponent) other_;
274        return compareDeep(therapyRelationshipType, o.therapyRelationshipType, true) && compareDeep(medication, o.medication, true)
275          ;
276      }
277
278      @Override
279      public boolean equalsShallow(Base other_) {
280        if (!super.equalsShallow(other_))
281          return false;
282        if (!(other_ instanceof MedicinalProductContraindicationOtherTherapyComponent))
283          return false;
284        MedicinalProductContraindicationOtherTherapyComponent o = (MedicinalProductContraindicationOtherTherapyComponent) other_;
285        return true;
286      }
287
288      public boolean isEmpty() {
289        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(therapyRelationshipType, medication
290          );
291      }
292
293  public String fhirType() {
294    return "MedicinalProductContraindication.otherTherapy";
295
296  }
297
298  }
299
300    /**
301     * The medication for which this is an indication.
302     */
303    @Child(name = "subject", type = {MedicinalProduct.class, Medication.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
304    @Description(shortDefinition="The medication for which this is an indication", formalDefinition="The medication for which this is an indication." )
305    protected List<Reference> subject;
306    /**
307     * The actual objects that are the target of the reference (The medication for which this is an indication.)
308     */
309    protected List<Resource> subjectTarget;
310
311
312    /**
313     * The disease, symptom or procedure for the contraindication.
314     */
315    @Child(name = "disease", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
316    @Description(shortDefinition="The disease, symptom or procedure for the contraindication", formalDefinition="The disease, symptom or procedure for the contraindication." )
317    protected CodeableConcept disease;
318
319    /**
320     * The status of the disease or symptom for the contraindication.
321     */
322    @Child(name = "diseaseStatus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
323    @Description(shortDefinition="The status of the disease or symptom for the contraindication", formalDefinition="The status of the disease or symptom for the contraindication." )
324    protected CodeableConcept diseaseStatus;
325
326    /**
327     * A comorbidity (concurrent condition) or coinfection.
328     */
329    @Child(name = "comorbidity", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
330    @Description(shortDefinition="A comorbidity (concurrent condition) or coinfection", formalDefinition="A comorbidity (concurrent condition) or coinfection." )
331    protected List<CodeableConcept> comorbidity;
332
333    /**
334     * Information about the use of the medicinal product in relation to other therapies as part of the indication.
335     */
336    @Child(name = "therapeuticIndication", type = {MedicinalProductIndication.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
337    @Description(shortDefinition="Information about the use of the medicinal product in relation to other therapies as part of the indication", formalDefinition="Information about the use of the medicinal product in relation to other therapies as part of the indication." )
338    protected List<Reference> therapeuticIndication;
339    /**
340     * The actual objects that are the target of the reference (Information about the use of the medicinal product in relation to other therapies as part of the indication.)
341     */
342    protected List<MedicinalProductIndication> therapeuticIndicationTarget;
343
344
345    /**
346     * Information about the use of the medicinal product in relation to other therapies described as part of the indication.
347     */
348    @Child(name = "otherTherapy", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
349    @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." )
350    protected List<MedicinalProductContraindicationOtherTherapyComponent> otherTherapy;
351
352    /**
353     * The population group to which this applies.
354     */
355    @Child(name = "population", type = {Population.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
356    @Description(shortDefinition="The population group to which this applies", formalDefinition="The population group to which this applies." )
357    protected List<Population> population;
358
359    private static final long serialVersionUID = -1746103034L;
360
361  /**
362   * Constructor
363   */
364    public MedicinalProductContraindication() {
365      super();
366    }
367
368    /**
369     * @return {@link #subject} (The medication for which this is an indication.)
370     */
371    public List<Reference> getSubject() { 
372      if (this.subject == null)
373        this.subject = new ArrayList<Reference>();
374      return this.subject;
375    }
376
377    /**
378     * @return Returns a reference to <code>this</code> for easy method chaining
379     */
380    public MedicinalProductContraindication setSubject(List<Reference> theSubject) { 
381      this.subject = theSubject;
382      return this;
383    }
384
385    public boolean hasSubject() { 
386      if (this.subject == null)
387        return false;
388      for (Reference item : this.subject)
389        if (!item.isEmpty())
390          return true;
391      return false;
392    }
393
394    public Reference addSubject() { //3
395      Reference t = new Reference();
396      if (this.subject == null)
397        this.subject = new ArrayList<Reference>();
398      this.subject.add(t);
399      return t;
400    }
401
402    public MedicinalProductContraindication addSubject(Reference t) { //3
403      if (t == null)
404        return this;
405      if (this.subject == null)
406        this.subject = new ArrayList<Reference>();
407      this.subject.add(t);
408      return this;
409    }
410
411    /**
412     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
413     */
414    public Reference getSubjectFirstRep() { 
415      if (getSubject().isEmpty()) {
416        addSubject();
417      }
418      return getSubject().get(0);
419    }
420
421    /**
422     * @deprecated Use Reference#setResource(IBaseResource) instead
423     */
424    @Deprecated
425    public List<Resource> getSubjectTarget() { 
426      if (this.subjectTarget == null)
427        this.subjectTarget = new ArrayList<Resource>();
428      return this.subjectTarget;
429    }
430
431    /**
432     * @return {@link #disease} (The disease, symptom or procedure for the contraindication.)
433     */
434    public CodeableConcept getDisease() { 
435      if (this.disease == null)
436        if (Configuration.errorOnAutoCreate())
437          throw new Error("Attempt to auto-create MedicinalProductContraindication.disease");
438        else if (Configuration.doAutoCreate())
439          this.disease = new CodeableConcept(); // cc
440      return this.disease;
441    }
442
443    public boolean hasDisease() { 
444      return this.disease != null && !this.disease.isEmpty();
445    }
446
447    /**
448     * @param value {@link #disease} (The disease, symptom or procedure for the contraindication.)
449     */
450    public MedicinalProductContraindication setDisease(CodeableConcept value) { 
451      this.disease = value;
452      return this;
453    }
454
455    /**
456     * @return {@link #diseaseStatus} (The status of the disease or symptom for the contraindication.)
457     */
458    public CodeableConcept getDiseaseStatus() { 
459      if (this.diseaseStatus == null)
460        if (Configuration.errorOnAutoCreate())
461          throw new Error("Attempt to auto-create MedicinalProductContraindication.diseaseStatus");
462        else if (Configuration.doAutoCreate())
463          this.diseaseStatus = new CodeableConcept(); // cc
464      return this.diseaseStatus;
465    }
466
467    public boolean hasDiseaseStatus() { 
468      return this.diseaseStatus != null && !this.diseaseStatus.isEmpty();
469    }
470
471    /**
472     * @param value {@link #diseaseStatus} (The status of the disease or symptom for the contraindication.)
473     */
474    public MedicinalProductContraindication setDiseaseStatus(CodeableConcept value) { 
475      this.diseaseStatus = value;
476      return this;
477    }
478
479    /**
480     * @return {@link #comorbidity} (A comorbidity (concurrent condition) or coinfection.)
481     */
482    public List<CodeableConcept> getComorbidity() { 
483      if (this.comorbidity == null)
484        this.comorbidity = new ArrayList<CodeableConcept>();
485      return this.comorbidity;
486    }
487
488    /**
489     * @return Returns a reference to <code>this</code> for easy method chaining
490     */
491    public MedicinalProductContraindication setComorbidity(List<CodeableConcept> theComorbidity) { 
492      this.comorbidity = theComorbidity;
493      return this;
494    }
495
496    public boolean hasComorbidity() { 
497      if (this.comorbidity == null)
498        return false;
499      for (CodeableConcept item : this.comorbidity)
500        if (!item.isEmpty())
501          return true;
502      return false;
503    }
504
505    public CodeableConcept addComorbidity() { //3
506      CodeableConcept t = new CodeableConcept();
507      if (this.comorbidity == null)
508        this.comorbidity = new ArrayList<CodeableConcept>();
509      this.comorbidity.add(t);
510      return t;
511    }
512
513    public MedicinalProductContraindication addComorbidity(CodeableConcept t) { //3
514      if (t == null)
515        return this;
516      if (this.comorbidity == null)
517        this.comorbidity = new ArrayList<CodeableConcept>();
518      this.comorbidity.add(t);
519      return this;
520    }
521
522    /**
523     * @return The first repetition of repeating field {@link #comorbidity}, creating it if it does not already exist
524     */
525    public CodeableConcept getComorbidityFirstRep() { 
526      if (getComorbidity().isEmpty()) {
527        addComorbidity();
528      }
529      return getComorbidity().get(0);
530    }
531
532    /**
533     * @return {@link #therapeuticIndication} (Information about the use of the medicinal product in relation to other therapies as part of the indication.)
534     */
535    public List<Reference> getTherapeuticIndication() { 
536      if (this.therapeuticIndication == null)
537        this.therapeuticIndication = new ArrayList<Reference>();
538      return this.therapeuticIndication;
539    }
540
541    /**
542     * @return Returns a reference to <code>this</code> for easy method chaining
543     */
544    public MedicinalProductContraindication setTherapeuticIndication(List<Reference> theTherapeuticIndication) { 
545      this.therapeuticIndication = theTherapeuticIndication;
546      return this;
547    }
548
549    public boolean hasTherapeuticIndication() { 
550      if (this.therapeuticIndication == null)
551        return false;
552      for (Reference item : this.therapeuticIndication)
553        if (!item.isEmpty())
554          return true;
555      return false;
556    }
557
558    public Reference addTherapeuticIndication() { //3
559      Reference t = new Reference();
560      if (this.therapeuticIndication == null)
561        this.therapeuticIndication = new ArrayList<Reference>();
562      this.therapeuticIndication.add(t);
563      return t;
564    }
565
566    public MedicinalProductContraindication addTherapeuticIndication(Reference t) { //3
567      if (t == null)
568        return this;
569      if (this.therapeuticIndication == null)
570        this.therapeuticIndication = new ArrayList<Reference>();
571      this.therapeuticIndication.add(t);
572      return this;
573    }
574
575    /**
576     * @return The first repetition of repeating field {@link #therapeuticIndication}, creating it if it does not already exist
577     */
578    public Reference getTherapeuticIndicationFirstRep() { 
579      if (getTherapeuticIndication().isEmpty()) {
580        addTherapeuticIndication();
581      }
582      return getTherapeuticIndication().get(0);
583    }
584
585    /**
586     * @deprecated Use Reference#setResource(IBaseResource) instead
587     */
588    @Deprecated
589    public List<MedicinalProductIndication> getTherapeuticIndicationTarget() { 
590      if (this.therapeuticIndicationTarget == null)
591        this.therapeuticIndicationTarget = new ArrayList<MedicinalProductIndication>();
592      return this.therapeuticIndicationTarget;
593    }
594
595    /**
596     * @deprecated Use Reference#setResource(IBaseResource) instead
597     */
598    @Deprecated
599    public MedicinalProductIndication addTherapeuticIndicationTarget() { 
600      MedicinalProductIndication r = new MedicinalProductIndication();
601      if (this.therapeuticIndicationTarget == null)
602        this.therapeuticIndicationTarget = new ArrayList<MedicinalProductIndication>();
603      this.therapeuticIndicationTarget.add(r);
604      return r;
605    }
606
607    /**
608     * @return {@link #otherTherapy} (Information about the use of the medicinal product in relation to other therapies described as part of the indication.)
609     */
610    public List<MedicinalProductContraindicationOtherTherapyComponent> getOtherTherapy() { 
611      if (this.otherTherapy == null)
612        this.otherTherapy = new ArrayList<MedicinalProductContraindicationOtherTherapyComponent>();
613      return this.otherTherapy;
614    }
615
616    /**
617     * @return Returns a reference to <code>this</code> for easy method chaining
618     */
619    public MedicinalProductContraindication setOtherTherapy(List<MedicinalProductContraindicationOtherTherapyComponent> theOtherTherapy) { 
620      this.otherTherapy = theOtherTherapy;
621      return this;
622    }
623
624    public boolean hasOtherTherapy() { 
625      if (this.otherTherapy == null)
626        return false;
627      for (MedicinalProductContraindicationOtherTherapyComponent item : this.otherTherapy)
628        if (!item.isEmpty())
629          return true;
630      return false;
631    }
632
633    public MedicinalProductContraindicationOtherTherapyComponent addOtherTherapy() { //3
634      MedicinalProductContraindicationOtherTherapyComponent t = new MedicinalProductContraindicationOtherTherapyComponent();
635      if (this.otherTherapy == null)
636        this.otherTherapy = new ArrayList<MedicinalProductContraindicationOtherTherapyComponent>();
637      this.otherTherapy.add(t);
638      return t;
639    }
640
641    public MedicinalProductContraindication addOtherTherapy(MedicinalProductContraindicationOtherTherapyComponent t) { //3
642      if (t == null)
643        return this;
644      if (this.otherTherapy == null)
645        this.otherTherapy = new ArrayList<MedicinalProductContraindicationOtherTherapyComponent>();
646      this.otherTherapy.add(t);
647      return this;
648    }
649
650    /**
651     * @return The first repetition of repeating field {@link #otherTherapy}, creating it if it does not already exist
652     */
653    public MedicinalProductContraindicationOtherTherapyComponent getOtherTherapyFirstRep() { 
654      if (getOtherTherapy().isEmpty()) {
655        addOtherTherapy();
656      }
657      return getOtherTherapy().get(0);
658    }
659
660    /**
661     * @return {@link #population} (The population group to which this applies.)
662     */
663    public List<Population> getPopulation() { 
664      if (this.population == null)
665        this.population = new ArrayList<Population>();
666      return this.population;
667    }
668
669    /**
670     * @return Returns a reference to <code>this</code> for easy method chaining
671     */
672    public MedicinalProductContraindication setPopulation(List<Population> thePopulation) { 
673      this.population = thePopulation;
674      return this;
675    }
676
677    public boolean hasPopulation() { 
678      if (this.population == null)
679        return false;
680      for (Population item : this.population)
681        if (!item.isEmpty())
682          return true;
683      return false;
684    }
685
686    public Population addPopulation() { //3
687      Population t = new Population();
688      if (this.population == null)
689        this.population = new ArrayList<Population>();
690      this.population.add(t);
691      return t;
692    }
693
694    public MedicinalProductContraindication addPopulation(Population t) { //3
695      if (t == null)
696        return this;
697      if (this.population == null)
698        this.population = new ArrayList<Population>();
699      this.population.add(t);
700      return this;
701    }
702
703    /**
704     * @return The first repetition of repeating field {@link #population}, creating it if it does not already exist
705     */
706    public Population getPopulationFirstRep() { 
707      if (getPopulation().isEmpty()) {
708        addPopulation();
709      }
710      return getPopulation().get(0);
711    }
712
713      protected void listChildren(List<Property> children) {
714        super.listChildren(children);
715        children.add(new Property("subject", "Reference(MedicinalProduct|Medication)", "The medication for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject));
716        children.add(new Property("disease", "CodeableConcept", "The disease, symptom or procedure for the contraindication.", 0, 1, disease));
717        children.add(new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for the contraindication.", 0, 1, diseaseStatus));
718        children.add(new Property("comorbidity", "CodeableConcept", "A comorbidity (concurrent condition) or coinfection.", 0, java.lang.Integer.MAX_VALUE, comorbidity));
719        children.add(new Property("therapeuticIndication", "Reference(MedicinalProductIndication)", "Information about the use of the medicinal product in relation to other therapies as part of the indication.", 0, java.lang.Integer.MAX_VALUE, therapeuticIndication));
720        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));
721        children.add(new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population));
722      }
723
724      @Override
725      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
726        switch (_hash) {
727        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);
728        case 1671426428: /*disease*/  return new Property("disease", "CodeableConcept", "The disease, symptom or procedure for the contraindication.", 0, 1, disease);
729        case -505503602: /*diseaseStatus*/  return new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for the contraindication.", 0, 1, diseaseStatus);
730        case -406395211: /*comorbidity*/  return new Property("comorbidity", "CodeableConcept", "A comorbidity (concurrent condition) or coinfection.", 0, java.lang.Integer.MAX_VALUE, comorbidity);
731        case -1925150262: /*therapeuticIndication*/  return new Property("therapeuticIndication", "Reference(MedicinalProductIndication)", "Information about the use of the medicinal product in relation to other therapies as part of the indication.", 0, java.lang.Integer.MAX_VALUE, therapeuticIndication);
732        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);
733        case -2023558323: /*population*/  return new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population);
734        default: return super.getNamedProperty(_hash, _name, _checkValid);
735        }
736
737      }
738
739      @Override
740      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
741        switch (hash) {
742        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
743        case 1671426428: /*disease*/ return this.disease == null ? new Base[0] : new Base[] {this.disease}; // CodeableConcept
744        case -505503602: /*diseaseStatus*/ return this.diseaseStatus == null ? new Base[0] : new Base[] {this.diseaseStatus}; // CodeableConcept
745        case -406395211: /*comorbidity*/ return this.comorbidity == null ? new Base[0] : this.comorbidity.toArray(new Base[this.comorbidity.size()]); // CodeableConcept
746        case -1925150262: /*therapeuticIndication*/ return this.therapeuticIndication == null ? new Base[0] : this.therapeuticIndication.toArray(new Base[this.therapeuticIndication.size()]); // Reference
747        case -544509127: /*otherTherapy*/ return this.otherTherapy == null ? new Base[0] : this.otherTherapy.toArray(new Base[this.otherTherapy.size()]); // MedicinalProductContraindicationOtherTherapyComponent
748        case -2023558323: /*population*/ return this.population == null ? new Base[0] : this.population.toArray(new Base[this.population.size()]); // Population
749        default: return super.getProperty(hash, name, checkValid);
750        }
751
752      }
753
754      @Override
755      public Base setProperty(int hash, String name, Base value) throws FHIRException {
756        switch (hash) {
757        case -1867885268: // subject
758          this.getSubject().add(castToReference(value)); // Reference
759          return value;
760        case 1671426428: // disease
761          this.disease = castToCodeableConcept(value); // CodeableConcept
762          return value;
763        case -505503602: // diseaseStatus
764          this.diseaseStatus = castToCodeableConcept(value); // CodeableConcept
765          return value;
766        case -406395211: // comorbidity
767          this.getComorbidity().add(castToCodeableConcept(value)); // CodeableConcept
768          return value;
769        case -1925150262: // therapeuticIndication
770          this.getTherapeuticIndication().add(castToReference(value)); // Reference
771          return value;
772        case -544509127: // otherTherapy
773          this.getOtherTherapy().add((MedicinalProductContraindicationOtherTherapyComponent) value); // MedicinalProductContraindicationOtherTherapyComponent
774          return value;
775        case -2023558323: // population
776          this.getPopulation().add(castToPopulation(value)); // Population
777          return value;
778        default: return super.setProperty(hash, name, value);
779        }
780
781      }
782
783      @Override
784      public Base setProperty(String name, Base value) throws FHIRException {
785        if (name.equals("subject")) {
786          this.getSubject().add(castToReference(value));
787        } else if (name.equals("disease")) {
788          this.disease = castToCodeableConcept(value); // CodeableConcept
789        } else if (name.equals("diseaseStatus")) {
790          this.diseaseStatus = castToCodeableConcept(value); // CodeableConcept
791        } else if (name.equals("comorbidity")) {
792          this.getComorbidity().add(castToCodeableConcept(value));
793        } else if (name.equals("therapeuticIndication")) {
794          this.getTherapeuticIndication().add(castToReference(value));
795        } else if (name.equals("otherTherapy")) {
796          this.getOtherTherapy().add((MedicinalProductContraindicationOtherTherapyComponent) value);
797        } else if (name.equals("population")) {
798          this.getPopulation().add(castToPopulation(value));
799        } else
800          return super.setProperty(name, value);
801        return value;
802      }
803
804      @Override
805      public Base makeProperty(int hash, String name) throws FHIRException {
806        switch (hash) {
807        case -1867885268:  return addSubject(); 
808        case 1671426428:  return getDisease(); 
809        case -505503602:  return getDiseaseStatus(); 
810        case -406395211:  return addComorbidity(); 
811        case -1925150262:  return addTherapeuticIndication(); 
812        case -544509127:  return addOtherTherapy(); 
813        case -2023558323:  return addPopulation(); 
814        default: return super.makeProperty(hash, name);
815        }
816
817      }
818
819      @Override
820      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
821        switch (hash) {
822        case -1867885268: /*subject*/ return new String[] {"Reference"};
823        case 1671426428: /*disease*/ return new String[] {"CodeableConcept"};
824        case -505503602: /*diseaseStatus*/ return new String[] {"CodeableConcept"};
825        case -406395211: /*comorbidity*/ return new String[] {"CodeableConcept"};
826        case -1925150262: /*therapeuticIndication*/ return new String[] {"Reference"};
827        case -544509127: /*otherTherapy*/ return new String[] {};
828        case -2023558323: /*population*/ return new String[] {"Population"};
829        default: return super.getTypesForProperty(hash, name);
830        }
831
832      }
833
834      @Override
835      public Base addChild(String name) throws FHIRException {
836        if (name.equals("subject")) {
837          return addSubject();
838        }
839        else if (name.equals("disease")) {
840          this.disease = new CodeableConcept();
841          return this.disease;
842        }
843        else if (name.equals("diseaseStatus")) {
844          this.diseaseStatus = new CodeableConcept();
845          return this.diseaseStatus;
846        }
847        else if (name.equals("comorbidity")) {
848          return addComorbidity();
849        }
850        else if (name.equals("therapeuticIndication")) {
851          return addTherapeuticIndication();
852        }
853        else if (name.equals("otherTherapy")) {
854          return addOtherTherapy();
855        }
856        else if (name.equals("population")) {
857          return addPopulation();
858        }
859        else
860          return super.addChild(name);
861      }
862
863  public String fhirType() {
864    return "MedicinalProductContraindication";
865
866  }
867
868      public MedicinalProductContraindication copy() {
869        MedicinalProductContraindication dst = new MedicinalProductContraindication();
870        copyValues(dst);
871        return dst;
872      }
873
874      public void copyValues(MedicinalProductContraindication dst) {
875        super.copyValues(dst);
876        if (subject != null) {
877          dst.subject = new ArrayList<Reference>();
878          for (Reference i : subject)
879            dst.subject.add(i.copy());
880        };
881        dst.disease = disease == null ? null : disease.copy();
882        dst.diseaseStatus = diseaseStatus == null ? null : diseaseStatus.copy();
883        if (comorbidity != null) {
884          dst.comorbidity = new ArrayList<CodeableConcept>();
885          for (CodeableConcept i : comorbidity)
886            dst.comorbidity.add(i.copy());
887        };
888        if (therapeuticIndication != null) {
889          dst.therapeuticIndication = new ArrayList<Reference>();
890          for (Reference i : therapeuticIndication)
891            dst.therapeuticIndication.add(i.copy());
892        };
893        if (otherTherapy != null) {
894          dst.otherTherapy = new ArrayList<MedicinalProductContraindicationOtherTherapyComponent>();
895          for (MedicinalProductContraindicationOtherTherapyComponent i : otherTherapy)
896            dst.otherTherapy.add(i.copy());
897        };
898        if (population != null) {
899          dst.population = new ArrayList<Population>();
900          for (Population i : population)
901            dst.population.add(i.copy());
902        };
903      }
904
905      protected MedicinalProductContraindication typedCopy() {
906        return copy();
907      }
908
909      @Override
910      public boolean equalsDeep(Base other_) {
911        if (!super.equalsDeep(other_))
912          return false;
913        if (!(other_ instanceof MedicinalProductContraindication))
914          return false;
915        MedicinalProductContraindication o = (MedicinalProductContraindication) other_;
916        return compareDeep(subject, o.subject, true) && compareDeep(disease, o.disease, true) && compareDeep(diseaseStatus, o.diseaseStatus, true)
917           && compareDeep(comorbidity, o.comorbidity, true) && compareDeep(therapeuticIndication, o.therapeuticIndication, true)
918           && compareDeep(otherTherapy, o.otherTherapy, true) && compareDeep(population, o.population, true)
919          ;
920      }
921
922      @Override
923      public boolean equalsShallow(Base other_) {
924        if (!super.equalsShallow(other_))
925          return false;
926        if (!(other_ instanceof MedicinalProductContraindication))
927          return false;
928        MedicinalProductContraindication o = (MedicinalProductContraindication) other_;
929        return true;
930      }
931
932      public boolean isEmpty() {
933        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subject, disease, diseaseStatus
934          , comorbidity, therapeuticIndication, otherTherapy, population);
935      }
936
937  @Override
938  public ResourceType getResourceType() {
939    return ResourceType.MedicinalProductContraindication;
940   }
941
942 /**
943   * Search parameter: <b>subject</b>
944   * <p>
945   * Description: <b>The medication for which this is an contraindication</b><br>
946   * Type: <b>reference</b><br>
947   * Path: <b>MedicinalProductContraindication.subject</b><br>
948   * </p>
949   */
950  @SearchParamDefinition(name="subject", path="MedicinalProductContraindication.subject", description="The medication for which this is an contraindication", type="reference", target={Medication.class, MedicinalProduct.class } )
951  public static final String SP_SUBJECT = "subject";
952 /**
953   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
954   * <p>
955   * Description: <b>The medication for which this is an contraindication</b><br>
956   * Type: <b>reference</b><br>
957   * Path: <b>MedicinalProductContraindication.subject</b><br>
958   * </p>
959   */
960  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
961
962/**
963   * Constant for fluent queries to be used to add include statements. Specifies
964   * the path value of "<b>MedicinalProductContraindication:subject</b>".
965   */
966  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductContraindication:subject").toLocked();
967
968
969}