001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import org.hl7.fhir.utilities.Utilities;
058import org.hl7.fhir.r5.model.Enumerations.*;
059import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
060import org.hl7.fhir.exceptions.FHIRException;
061import org.hl7.fhir.instance.model.api.ICompositeType;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069
070/**
071 * A single usage issue - either an indication, contraindication, interaction or an undesirable effect for a medicinal product, medication, device or procedure.
072 */
073@ResourceDef(name="ClinicalUseIssue", profile="http://hl7.org/fhir/StructureDefinition/ClinicalUseIssue")
074public class ClinicalUseIssue extends DomainResource {
075
076    public enum ClinicalUseIssueType {
077        /**
078         * A reason for giving the medicaton.
079         */
080        INDICATION, 
081        /**
082         * A reason for not giving the medicaition.
083         */
084        CONTRAINDICATION, 
085        /**
086         * Interactions between the medication and other substances.
087         */
088        INTERACTION, 
089        /**
090         * Side effects or adverse effects associated with the medication.
091         */
092        UNDESIRABLEEFFECT, 
093        /**
094         * Other.
095         */
096        OTHER, 
097        /**
098         * added to help the parsers with the generic types
099         */
100        NULL;
101        public static ClinicalUseIssueType fromCode(String codeString) throws FHIRException {
102            if (codeString == null || "".equals(codeString))
103                return null;
104        if ("indication".equals(codeString))
105          return INDICATION;
106        if ("contraindication".equals(codeString))
107          return CONTRAINDICATION;
108        if ("interaction".equals(codeString))
109          return INTERACTION;
110        if ("undesirable-effect".equals(codeString))
111          return UNDESIRABLEEFFECT;
112        if ("other".equals(codeString))
113          return OTHER;
114        if (Configuration.isAcceptInvalidEnums())
115          return null;
116        else
117          throw new FHIRException("Unknown ClinicalUseIssueType code '"+codeString+"'");
118        }
119        public String toCode() {
120          switch (this) {
121            case INDICATION: return "indication";
122            case CONTRAINDICATION: return "contraindication";
123            case INTERACTION: return "interaction";
124            case UNDESIRABLEEFFECT: return "undesirable-effect";
125            case OTHER: return "other";
126            default: return "?";
127          }
128        }
129        public String getSystem() {
130          switch (this) {
131            case INDICATION: return "http://hl7.org/fhir/clinical-use-issue-type";
132            case CONTRAINDICATION: return "http://hl7.org/fhir/clinical-use-issue-type";
133            case INTERACTION: return "http://hl7.org/fhir/clinical-use-issue-type";
134            case UNDESIRABLEEFFECT: return "http://hl7.org/fhir/clinical-use-issue-type";
135            case OTHER: return "http://hl7.org/fhir/clinical-use-issue-type";
136            default: return "?";
137          }
138        }
139        public String getDefinition() {
140          switch (this) {
141            case INDICATION: return "A reason for giving the medicaton.";
142            case CONTRAINDICATION: return "A reason for not giving the medicaition.";
143            case INTERACTION: return "Interactions between the medication and other substances.";
144            case UNDESIRABLEEFFECT: return "Side effects or adverse effects associated with the medication.";
145            case OTHER: return "Other.";
146            default: return "?";
147          }
148        }
149        public String getDisplay() {
150          switch (this) {
151            case INDICATION: return "Indication";
152            case CONTRAINDICATION: return "Contraindication";
153            case INTERACTION: return "Interaction";
154            case UNDESIRABLEEFFECT: return "Undesirable Effect";
155            case OTHER: return "Other";
156            default: return "?";
157          }
158        }
159    }
160
161  public static class ClinicalUseIssueTypeEnumFactory implements EnumFactory<ClinicalUseIssueType> {
162    public ClinicalUseIssueType fromCode(String codeString) throws IllegalArgumentException {
163      if (codeString == null || "".equals(codeString))
164            if (codeString == null || "".equals(codeString))
165                return null;
166        if ("indication".equals(codeString))
167          return ClinicalUseIssueType.INDICATION;
168        if ("contraindication".equals(codeString))
169          return ClinicalUseIssueType.CONTRAINDICATION;
170        if ("interaction".equals(codeString))
171          return ClinicalUseIssueType.INTERACTION;
172        if ("undesirable-effect".equals(codeString))
173          return ClinicalUseIssueType.UNDESIRABLEEFFECT;
174        if ("other".equals(codeString))
175          return ClinicalUseIssueType.OTHER;
176        throw new IllegalArgumentException("Unknown ClinicalUseIssueType code '"+codeString+"'");
177        }
178        public Enumeration<ClinicalUseIssueType> fromType(Base code) throws FHIRException {
179          if (code == null)
180            return null;
181          if (code.isEmpty())
182            return new Enumeration<ClinicalUseIssueType>(this);
183          String codeString = ((PrimitiveType) code).asStringValue();
184          if (codeString == null || "".equals(codeString))
185            return null;
186        if ("indication".equals(codeString))
187          return new Enumeration<ClinicalUseIssueType>(this, ClinicalUseIssueType.INDICATION);
188        if ("contraindication".equals(codeString))
189          return new Enumeration<ClinicalUseIssueType>(this, ClinicalUseIssueType.CONTRAINDICATION);
190        if ("interaction".equals(codeString))
191          return new Enumeration<ClinicalUseIssueType>(this, ClinicalUseIssueType.INTERACTION);
192        if ("undesirable-effect".equals(codeString))
193          return new Enumeration<ClinicalUseIssueType>(this, ClinicalUseIssueType.UNDESIRABLEEFFECT);
194        if ("other".equals(codeString))
195          return new Enumeration<ClinicalUseIssueType>(this, ClinicalUseIssueType.OTHER);
196        throw new FHIRException("Unknown ClinicalUseIssueType code '"+codeString+"'");
197        }
198    public String toCode(ClinicalUseIssueType code) {
199      if (code == ClinicalUseIssueType.INDICATION)
200        return "indication";
201      if (code == ClinicalUseIssueType.CONTRAINDICATION)
202        return "contraindication";
203      if (code == ClinicalUseIssueType.INTERACTION)
204        return "interaction";
205      if (code == ClinicalUseIssueType.UNDESIRABLEEFFECT)
206        return "undesirable-effect";
207      if (code == ClinicalUseIssueType.OTHER)
208        return "other";
209      return "?";
210      }
211    public String toSystem(ClinicalUseIssueType code) {
212      return code.getSystem();
213      }
214    }
215
216    @Block()
217    public static class ClinicalUseIssueContraindicationComponent extends BackboneElement implements IBaseBackboneElement {
218        /**
219         * The situation that is being documented as contraindicating against this item.
220         */
221        @Child(name = "diseaseSymptomProcedure", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
222        @Description(shortDefinition="The situation that is being documented as contraindicating against this item", formalDefinition="The situation that is being documented as contraindicating against this item." )
223        protected CodeableConcept diseaseSymptomProcedure;
224
225        /**
226         * The status of the disease or symptom for the contraindication.
227         */
228        @Child(name = "diseaseStatus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
229        @Description(shortDefinition="The status of the disease or symptom for the contraindication", formalDefinition="The status of the disease or symptom for the contraindication." )
230        protected CodeableConcept diseaseStatus;
231
232        /**
233         * A comorbidity (concurrent condition) or coinfection.
234         */
235        @Child(name = "comorbidity", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
236        @Description(shortDefinition="A comorbidity (concurrent condition) or coinfection", formalDefinition="A comorbidity (concurrent condition) or coinfection." )
237        protected List<CodeableConcept> comorbidity;
238
239        /**
240         * The indication which this is a contraidication for.
241         */
242        @Child(name = "indication", type = {ClinicalUseIssue.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
243        @Description(shortDefinition="The indication which this is a contraidication for", formalDefinition="The indication which this is a contraidication for." )
244        protected List<Reference> indication;
245
246        /**
247         * Information about the use of the medicinal product in relation to other therapies described as part of the indication.
248         */
249        @Child(name = "otherTherapy", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
250        @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." )
251        protected List<ClinicalUseIssueContraindicationOtherTherapyComponent> otherTherapy;
252
253        private static final long serialVersionUID = -165584476L;
254
255    /**
256     * Constructor
257     */
258      public ClinicalUseIssueContraindicationComponent() {
259        super();
260      }
261
262        /**
263         * @return {@link #diseaseSymptomProcedure} (The situation that is being documented as contraindicating against this item.)
264         */
265        public CodeableConcept getDiseaseSymptomProcedure() { 
266          if (this.diseaseSymptomProcedure == null)
267            if (Configuration.errorOnAutoCreate())
268              throw new Error("Attempt to auto-create ClinicalUseIssueContraindicationComponent.diseaseSymptomProcedure");
269            else if (Configuration.doAutoCreate())
270              this.diseaseSymptomProcedure = new CodeableConcept(); // cc
271          return this.diseaseSymptomProcedure;
272        }
273
274        public boolean hasDiseaseSymptomProcedure() { 
275          return this.diseaseSymptomProcedure != null && !this.diseaseSymptomProcedure.isEmpty();
276        }
277
278        /**
279         * @param value {@link #diseaseSymptomProcedure} (The situation that is being documented as contraindicating against this item.)
280         */
281        public ClinicalUseIssueContraindicationComponent setDiseaseSymptomProcedure(CodeableConcept value) { 
282          this.diseaseSymptomProcedure = value;
283          return this;
284        }
285
286        /**
287         * @return {@link #diseaseStatus} (The status of the disease or symptom for the contraindication.)
288         */
289        public CodeableConcept getDiseaseStatus() { 
290          if (this.diseaseStatus == null)
291            if (Configuration.errorOnAutoCreate())
292              throw new Error("Attempt to auto-create ClinicalUseIssueContraindicationComponent.diseaseStatus");
293            else if (Configuration.doAutoCreate())
294              this.diseaseStatus = new CodeableConcept(); // cc
295          return this.diseaseStatus;
296        }
297
298        public boolean hasDiseaseStatus() { 
299          return this.diseaseStatus != null && !this.diseaseStatus.isEmpty();
300        }
301
302        /**
303         * @param value {@link #diseaseStatus} (The status of the disease or symptom for the contraindication.)
304         */
305        public ClinicalUseIssueContraindicationComponent setDiseaseStatus(CodeableConcept value) { 
306          this.diseaseStatus = value;
307          return this;
308        }
309
310        /**
311         * @return {@link #comorbidity} (A comorbidity (concurrent condition) or coinfection.)
312         */
313        public List<CodeableConcept> getComorbidity() { 
314          if (this.comorbidity == null)
315            this.comorbidity = new ArrayList<CodeableConcept>();
316          return this.comorbidity;
317        }
318
319        /**
320         * @return Returns a reference to <code>this</code> for easy method chaining
321         */
322        public ClinicalUseIssueContraindicationComponent setComorbidity(List<CodeableConcept> theComorbidity) { 
323          this.comorbidity = theComorbidity;
324          return this;
325        }
326
327        public boolean hasComorbidity() { 
328          if (this.comorbidity == null)
329            return false;
330          for (CodeableConcept item : this.comorbidity)
331            if (!item.isEmpty())
332              return true;
333          return false;
334        }
335
336        public CodeableConcept addComorbidity() { //3
337          CodeableConcept t = new CodeableConcept();
338          if (this.comorbidity == null)
339            this.comorbidity = new ArrayList<CodeableConcept>();
340          this.comorbidity.add(t);
341          return t;
342        }
343
344        public ClinicalUseIssueContraindicationComponent addComorbidity(CodeableConcept t) { //3
345          if (t == null)
346            return this;
347          if (this.comorbidity == null)
348            this.comorbidity = new ArrayList<CodeableConcept>();
349          this.comorbidity.add(t);
350          return this;
351        }
352
353        /**
354         * @return The first repetition of repeating field {@link #comorbidity}, creating it if it does not already exist {3}
355         */
356        public CodeableConcept getComorbidityFirstRep() { 
357          if (getComorbidity().isEmpty()) {
358            addComorbidity();
359          }
360          return getComorbidity().get(0);
361        }
362
363        /**
364         * @return {@link #indication} (The indication which this is a contraidication for.)
365         */
366        public List<Reference> getIndication() { 
367          if (this.indication == null)
368            this.indication = new ArrayList<Reference>();
369          return this.indication;
370        }
371
372        /**
373         * @return Returns a reference to <code>this</code> for easy method chaining
374         */
375        public ClinicalUseIssueContraindicationComponent setIndication(List<Reference> theIndication) { 
376          this.indication = theIndication;
377          return this;
378        }
379
380        public boolean hasIndication() { 
381          if (this.indication == null)
382            return false;
383          for (Reference item : this.indication)
384            if (!item.isEmpty())
385              return true;
386          return false;
387        }
388
389        public Reference addIndication() { //3
390          Reference t = new Reference();
391          if (this.indication == null)
392            this.indication = new ArrayList<Reference>();
393          this.indication.add(t);
394          return t;
395        }
396
397        public ClinicalUseIssueContraindicationComponent addIndication(Reference t) { //3
398          if (t == null)
399            return this;
400          if (this.indication == null)
401            this.indication = new ArrayList<Reference>();
402          this.indication.add(t);
403          return this;
404        }
405
406        /**
407         * @return The first repetition of repeating field {@link #indication}, creating it if it does not already exist {3}
408         */
409        public Reference getIndicationFirstRep() { 
410          if (getIndication().isEmpty()) {
411            addIndication();
412          }
413          return getIndication().get(0);
414        }
415
416        /**
417         * @return {@link #otherTherapy} (Information about the use of the medicinal product in relation to other therapies described as part of the indication.)
418         */
419        public List<ClinicalUseIssueContraindicationOtherTherapyComponent> getOtherTherapy() { 
420          if (this.otherTherapy == null)
421            this.otherTherapy = new ArrayList<ClinicalUseIssueContraindicationOtherTherapyComponent>();
422          return this.otherTherapy;
423        }
424
425        /**
426         * @return Returns a reference to <code>this</code> for easy method chaining
427         */
428        public ClinicalUseIssueContraindicationComponent setOtherTherapy(List<ClinicalUseIssueContraindicationOtherTherapyComponent> theOtherTherapy) { 
429          this.otherTherapy = theOtherTherapy;
430          return this;
431        }
432
433        public boolean hasOtherTherapy() { 
434          if (this.otherTherapy == null)
435            return false;
436          for (ClinicalUseIssueContraindicationOtherTherapyComponent item : this.otherTherapy)
437            if (!item.isEmpty())
438              return true;
439          return false;
440        }
441
442        public ClinicalUseIssueContraindicationOtherTherapyComponent addOtherTherapy() { //3
443          ClinicalUseIssueContraindicationOtherTherapyComponent t = new ClinicalUseIssueContraindicationOtherTherapyComponent();
444          if (this.otherTherapy == null)
445            this.otherTherapy = new ArrayList<ClinicalUseIssueContraindicationOtherTherapyComponent>();
446          this.otherTherapy.add(t);
447          return t;
448        }
449
450        public ClinicalUseIssueContraindicationComponent addOtherTherapy(ClinicalUseIssueContraindicationOtherTherapyComponent t) { //3
451          if (t == null)
452            return this;
453          if (this.otherTherapy == null)
454            this.otherTherapy = new ArrayList<ClinicalUseIssueContraindicationOtherTherapyComponent>();
455          this.otherTherapy.add(t);
456          return this;
457        }
458
459        /**
460         * @return The first repetition of repeating field {@link #otherTherapy}, creating it if it does not already exist {3}
461         */
462        public ClinicalUseIssueContraindicationOtherTherapyComponent getOtherTherapyFirstRep() { 
463          if (getOtherTherapy().isEmpty()) {
464            addOtherTherapy();
465          }
466          return getOtherTherapy().get(0);
467        }
468
469        protected void listChildren(List<Property> children) {
470          super.listChildren(children);
471          children.add(new Property("diseaseSymptomProcedure", "CodeableConcept", "The situation that is being documented as contraindicating against this item.", 0, 1, diseaseSymptomProcedure));
472          children.add(new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for the contraindication.", 0, 1, diseaseStatus));
473          children.add(new Property("comorbidity", "CodeableConcept", "A comorbidity (concurrent condition) or coinfection.", 0, java.lang.Integer.MAX_VALUE, comorbidity));
474          children.add(new Property("indication", "Reference(ClinicalUseIssue)", "The indication which this is a contraidication for.", 0, java.lang.Integer.MAX_VALUE, indication));
475          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));
476        }
477
478        @Override
479        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
480          switch (_hash) {
481          case -1497395130: /*diseaseSymptomProcedure*/  return new Property("diseaseSymptomProcedure", "CodeableConcept", "The situation that is being documented as contraindicating against this item.", 0, 1, diseaseSymptomProcedure);
482          case -505503602: /*diseaseStatus*/  return new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for the contraindication.", 0, 1, diseaseStatus);
483          case -406395211: /*comorbidity*/  return new Property("comorbidity", "CodeableConcept", "A comorbidity (concurrent condition) or coinfection.", 0, java.lang.Integer.MAX_VALUE, comorbidity);
484          case -597168804: /*indication*/  return new Property("indication", "Reference(ClinicalUseIssue)", "The indication which this is a contraidication for.", 0, java.lang.Integer.MAX_VALUE, indication);
485          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);
486          default: return super.getNamedProperty(_hash, _name, _checkValid);
487          }
488
489        }
490
491      @Override
492      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
493        switch (hash) {
494        case -1497395130: /*diseaseSymptomProcedure*/ return this.diseaseSymptomProcedure == null ? new Base[0] : new Base[] {this.diseaseSymptomProcedure}; // CodeableConcept
495        case -505503602: /*diseaseStatus*/ return this.diseaseStatus == null ? new Base[0] : new Base[] {this.diseaseStatus}; // CodeableConcept
496        case -406395211: /*comorbidity*/ return this.comorbidity == null ? new Base[0] : this.comorbidity.toArray(new Base[this.comorbidity.size()]); // CodeableConcept
497        case -597168804: /*indication*/ return this.indication == null ? new Base[0] : this.indication.toArray(new Base[this.indication.size()]); // Reference
498        case -544509127: /*otherTherapy*/ return this.otherTherapy == null ? new Base[0] : this.otherTherapy.toArray(new Base[this.otherTherapy.size()]); // ClinicalUseIssueContraindicationOtherTherapyComponent
499        default: return super.getProperty(hash, name, checkValid);
500        }
501
502      }
503
504      @Override
505      public Base setProperty(int hash, String name, Base value) throws FHIRException {
506        switch (hash) {
507        case -1497395130: // diseaseSymptomProcedure
508          this.diseaseSymptomProcedure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
509          return value;
510        case -505503602: // diseaseStatus
511          this.diseaseStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
512          return value;
513        case -406395211: // comorbidity
514          this.getComorbidity().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
515          return value;
516        case -597168804: // indication
517          this.getIndication().add(TypeConvertor.castToReference(value)); // Reference
518          return value;
519        case -544509127: // otherTherapy
520          this.getOtherTherapy().add((ClinicalUseIssueContraindicationOtherTherapyComponent) value); // ClinicalUseIssueContraindicationOtherTherapyComponent
521          return value;
522        default: return super.setProperty(hash, name, value);
523        }
524
525      }
526
527      @Override
528      public Base setProperty(String name, Base value) throws FHIRException {
529        if (name.equals("diseaseSymptomProcedure")) {
530          this.diseaseSymptomProcedure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
531        } else if (name.equals("diseaseStatus")) {
532          this.diseaseStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
533        } else if (name.equals("comorbidity")) {
534          this.getComorbidity().add(TypeConvertor.castToCodeableConcept(value));
535        } else if (name.equals("indication")) {
536          this.getIndication().add(TypeConvertor.castToReference(value));
537        } else if (name.equals("otherTherapy")) {
538          this.getOtherTherapy().add((ClinicalUseIssueContraindicationOtherTherapyComponent) value);
539        } else
540          return super.setProperty(name, value);
541        return value;
542      }
543
544      @Override
545      public Base makeProperty(int hash, String name) throws FHIRException {
546        switch (hash) {
547        case -1497395130:  return getDiseaseSymptomProcedure();
548        case -505503602:  return getDiseaseStatus();
549        case -406395211:  return addComorbidity(); 
550        case -597168804:  return addIndication(); 
551        case -544509127:  return addOtherTherapy(); 
552        default: return super.makeProperty(hash, name);
553        }
554
555      }
556
557      @Override
558      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
559        switch (hash) {
560        case -1497395130: /*diseaseSymptomProcedure*/ return new String[] {"CodeableConcept"};
561        case -505503602: /*diseaseStatus*/ return new String[] {"CodeableConcept"};
562        case -406395211: /*comorbidity*/ return new String[] {"CodeableConcept"};
563        case -597168804: /*indication*/ return new String[] {"Reference"};
564        case -544509127: /*otherTherapy*/ return new String[] {};
565        default: return super.getTypesForProperty(hash, name);
566        }
567
568      }
569
570      @Override
571      public Base addChild(String name) throws FHIRException {
572        if (name.equals("diseaseSymptomProcedure")) {
573          this.diseaseSymptomProcedure = new CodeableConcept();
574          return this.diseaseSymptomProcedure;
575        }
576        else if (name.equals("diseaseStatus")) {
577          this.diseaseStatus = new CodeableConcept();
578          return this.diseaseStatus;
579        }
580        else if (name.equals("comorbidity")) {
581          return addComorbidity();
582        }
583        else if (name.equals("indication")) {
584          return addIndication();
585        }
586        else if (name.equals("otherTherapy")) {
587          return addOtherTherapy();
588        }
589        else
590          return super.addChild(name);
591      }
592
593      public ClinicalUseIssueContraindicationComponent copy() {
594        ClinicalUseIssueContraindicationComponent dst = new ClinicalUseIssueContraindicationComponent();
595        copyValues(dst);
596        return dst;
597      }
598
599      public void copyValues(ClinicalUseIssueContraindicationComponent dst) {
600        super.copyValues(dst);
601        dst.diseaseSymptomProcedure = diseaseSymptomProcedure == null ? null : diseaseSymptomProcedure.copy();
602        dst.diseaseStatus = diseaseStatus == null ? null : diseaseStatus.copy();
603        if (comorbidity != null) {
604          dst.comorbidity = new ArrayList<CodeableConcept>();
605          for (CodeableConcept i : comorbidity)
606            dst.comorbidity.add(i.copy());
607        };
608        if (indication != null) {
609          dst.indication = new ArrayList<Reference>();
610          for (Reference i : indication)
611            dst.indication.add(i.copy());
612        };
613        if (otherTherapy != null) {
614          dst.otherTherapy = new ArrayList<ClinicalUseIssueContraindicationOtherTherapyComponent>();
615          for (ClinicalUseIssueContraindicationOtherTherapyComponent i : otherTherapy)
616            dst.otherTherapy.add(i.copy());
617        };
618      }
619
620      @Override
621      public boolean equalsDeep(Base other_) {
622        if (!super.equalsDeep(other_))
623          return false;
624        if (!(other_ instanceof ClinicalUseIssueContraindicationComponent))
625          return false;
626        ClinicalUseIssueContraindicationComponent o = (ClinicalUseIssueContraindicationComponent) other_;
627        return compareDeep(diseaseSymptomProcedure, o.diseaseSymptomProcedure, true) && compareDeep(diseaseStatus, o.diseaseStatus, true)
628           && compareDeep(comorbidity, o.comorbidity, true) && compareDeep(indication, o.indication, true)
629           && compareDeep(otherTherapy, o.otherTherapy, true);
630      }
631
632      @Override
633      public boolean equalsShallow(Base other_) {
634        if (!super.equalsShallow(other_))
635          return false;
636        if (!(other_ instanceof ClinicalUseIssueContraindicationComponent))
637          return false;
638        ClinicalUseIssueContraindicationComponent o = (ClinicalUseIssueContraindicationComponent) other_;
639        return true;
640      }
641
642      public boolean isEmpty() {
643        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(diseaseSymptomProcedure, diseaseStatus
644          , comorbidity, indication, otherTherapy);
645      }
646
647  public String fhirType() {
648    return "ClinicalUseIssue.contraindication";
649
650  }
651
652  }
653
654    @Block()
655    public static class ClinicalUseIssueContraindicationOtherTherapyComponent extends BackboneElement implements IBaseBackboneElement {
656        /**
657         * The type of relationship between the medicinal product indication or contraindication and another therapy.
658         */
659        @Child(name = "therapyRelationshipType", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
660        @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." )
661        protected CodeableConcept therapyRelationshipType;
662
663        /**
664         * Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.
665         */
666        @Child(name = "medication", type = {CodeableConcept.class, MedicinalProductDefinition.class, Medication.class, Substance.class, SubstanceDefinition.class}, order=2, min=1, max=1, modifier=false, summary=true)
667        @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." )
668        protected DataType medication;
669
670        private static final long serialVersionUID = -923241363L;
671
672    /**
673     * Constructor
674     */
675      public ClinicalUseIssueContraindicationOtherTherapyComponent() {
676        super();
677      }
678
679    /**
680     * Constructor
681     */
682      public ClinicalUseIssueContraindicationOtherTherapyComponent(CodeableConcept therapyRelationshipType, DataType medication) {
683        super();
684        this.setTherapyRelationshipType(therapyRelationshipType);
685        this.setMedication(medication);
686      }
687
688        /**
689         * @return {@link #therapyRelationshipType} (The type of relationship between the medicinal product indication or contraindication and another therapy.)
690         */
691        public CodeableConcept getTherapyRelationshipType() { 
692          if (this.therapyRelationshipType == null)
693            if (Configuration.errorOnAutoCreate())
694              throw new Error("Attempt to auto-create ClinicalUseIssueContraindicationOtherTherapyComponent.therapyRelationshipType");
695            else if (Configuration.doAutoCreate())
696              this.therapyRelationshipType = new CodeableConcept(); // cc
697          return this.therapyRelationshipType;
698        }
699
700        public boolean hasTherapyRelationshipType() { 
701          return this.therapyRelationshipType != null && !this.therapyRelationshipType.isEmpty();
702        }
703
704        /**
705         * @param value {@link #therapyRelationshipType} (The type of relationship between the medicinal product indication or contraindication and another therapy.)
706         */
707        public ClinicalUseIssueContraindicationOtherTherapyComponent setTherapyRelationshipType(CodeableConcept value) { 
708          this.therapyRelationshipType = value;
709          return this;
710        }
711
712        /**
713         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
714         */
715        public DataType getMedication() { 
716          return this.medication;
717        }
718
719        /**
720         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
721         */
722        public CodeableConcept getMedicationCodeableConcept() throws FHIRException { 
723          if (this.medication == null)
724            this.medication = new CodeableConcept();
725          if (!(this.medication instanceof CodeableConcept))
726            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered");
727          return (CodeableConcept) this.medication;
728        }
729
730        public boolean hasMedicationCodeableConcept() { 
731          return this != null && this.medication instanceof CodeableConcept;
732        }
733
734        /**
735         * @return {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
736         */
737        public Reference getMedicationReference() throws FHIRException { 
738          if (this.medication == null)
739            this.medication = new Reference();
740          if (!(this.medication instanceof Reference))
741            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered");
742          return (Reference) this.medication;
743        }
744
745        public boolean hasMedicationReference() { 
746          return this != null && this.medication instanceof Reference;
747        }
748
749        public boolean hasMedication() { 
750          return this.medication != null && !this.medication.isEmpty();
751        }
752
753        /**
754         * @param value {@link #medication} (Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.)
755         */
756        public ClinicalUseIssueContraindicationOtherTherapyComponent setMedication(DataType value) { 
757          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
758            throw new Error("Not the right type for ClinicalUseIssue.contraindication.otherTherapy.medication[x]: "+value.fhirType());
759          this.medication = value;
760          return this;
761        }
762
763        protected void listChildren(List<Property> children) {
764          super.listChildren(children);
765          children.add(new Property("therapyRelationshipType", "CodeableConcept", "The type of relationship between the medicinal product indication or contraindication and another therapy.", 0, 1, therapyRelationshipType));
766          children.add(new Property("medication[x]", "CodeableConcept|Reference(MedicinalProductDefinition|Medication|Substance|SubstanceDefinition)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication));
767        }
768
769        @Override
770        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
771          switch (_hash) {
772          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);
773          case 1458402129: /*medication[x]*/  return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProductDefinition|Medication|Substance|SubstanceDefinition)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication);
774          case 1998965455: /*medication*/  return new Property("medication[x]", "CodeableConcept|Reference(MedicinalProductDefinition|Medication|Substance|SubstanceDefinition)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication);
775          case -209845038: /*medicationCodeableConcept*/  return new Property("medication[x]", "CodeableConcept", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication);
776          case 2104315196: /*medicationReference*/  return new Property("medication[x]", "Reference(MedicinalProductDefinition|Medication|Substance|SubstanceDefinition)", "Reference to a specific medication (active substance, medicinal product or class of products) as part of an indication or contraindication.", 0, 1, medication);
777          default: return super.getNamedProperty(_hash, _name, _checkValid);
778          }
779
780        }
781
782      @Override
783      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
784        switch (hash) {
785        case -551658469: /*therapyRelationshipType*/ return this.therapyRelationshipType == null ? new Base[0] : new Base[] {this.therapyRelationshipType}; // CodeableConcept
786        case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // DataType
787        default: return super.getProperty(hash, name, checkValid);
788        }
789
790      }
791
792      @Override
793      public Base setProperty(int hash, String name, Base value) throws FHIRException {
794        switch (hash) {
795        case -551658469: // therapyRelationshipType
796          this.therapyRelationshipType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
797          return value;
798        case 1998965455: // medication
799          this.medication = TypeConvertor.castToType(value); // DataType
800          return value;
801        default: return super.setProperty(hash, name, value);
802        }
803
804      }
805
806      @Override
807      public Base setProperty(String name, Base value) throws FHIRException {
808        if (name.equals("therapyRelationshipType")) {
809          this.therapyRelationshipType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
810        } else if (name.equals("medication[x]")) {
811          this.medication = TypeConvertor.castToType(value); // DataType
812        } else
813          return super.setProperty(name, value);
814        return value;
815      }
816
817      @Override
818      public Base makeProperty(int hash, String name) throws FHIRException {
819        switch (hash) {
820        case -551658469:  return getTherapyRelationshipType();
821        case 1458402129:  return getMedication();
822        case 1998965455:  return getMedication();
823        default: return super.makeProperty(hash, name);
824        }
825
826      }
827
828      @Override
829      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
830        switch (hash) {
831        case -551658469: /*therapyRelationshipType*/ return new String[] {"CodeableConcept"};
832        case 1998965455: /*medication*/ return new String[] {"CodeableConcept", "Reference"};
833        default: return super.getTypesForProperty(hash, name);
834        }
835
836      }
837
838      @Override
839      public Base addChild(String name) throws FHIRException {
840        if (name.equals("therapyRelationshipType")) {
841          this.therapyRelationshipType = new CodeableConcept();
842          return this.therapyRelationshipType;
843        }
844        else if (name.equals("medicationCodeableConcept")) {
845          this.medication = new CodeableConcept();
846          return this.medication;
847        }
848        else if (name.equals("medicationReference")) {
849          this.medication = new Reference();
850          return this.medication;
851        }
852        else
853          return super.addChild(name);
854      }
855
856      public ClinicalUseIssueContraindicationOtherTherapyComponent copy() {
857        ClinicalUseIssueContraindicationOtherTherapyComponent dst = new ClinicalUseIssueContraindicationOtherTherapyComponent();
858        copyValues(dst);
859        return dst;
860      }
861
862      public void copyValues(ClinicalUseIssueContraindicationOtherTherapyComponent dst) {
863        super.copyValues(dst);
864        dst.therapyRelationshipType = therapyRelationshipType == null ? null : therapyRelationshipType.copy();
865        dst.medication = medication == null ? null : medication.copy();
866      }
867
868      @Override
869      public boolean equalsDeep(Base other_) {
870        if (!super.equalsDeep(other_))
871          return false;
872        if (!(other_ instanceof ClinicalUseIssueContraindicationOtherTherapyComponent))
873          return false;
874        ClinicalUseIssueContraindicationOtherTherapyComponent o = (ClinicalUseIssueContraindicationOtherTherapyComponent) other_;
875        return compareDeep(therapyRelationshipType, o.therapyRelationshipType, true) && compareDeep(medication, o.medication, true)
876          ;
877      }
878
879      @Override
880      public boolean equalsShallow(Base other_) {
881        if (!super.equalsShallow(other_))
882          return false;
883        if (!(other_ instanceof ClinicalUseIssueContraindicationOtherTherapyComponent))
884          return false;
885        ClinicalUseIssueContraindicationOtherTherapyComponent o = (ClinicalUseIssueContraindicationOtherTherapyComponent) other_;
886        return true;
887      }
888
889      public boolean isEmpty() {
890        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(therapyRelationshipType, medication
891          );
892      }
893
894  public String fhirType() {
895    return "ClinicalUseIssue.contraindication.otherTherapy";
896
897  }
898
899  }
900
901    @Block()
902    public static class ClinicalUseIssueIndicationComponent extends BackboneElement implements IBaseBackboneElement {
903        /**
904         * The situation that is being documented as an indicaton for this item.
905         */
906        @Child(name = "diseaseSymptomProcedure", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
907        @Description(shortDefinition="The situation that is being documented as an indicaton for this item", formalDefinition="The situation that is being documented as an indicaton for this item." )
908        protected CodeableConcept diseaseSymptomProcedure;
909
910        /**
911         * The status of the disease or symptom for the indication.
912         */
913        @Child(name = "diseaseStatus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
914        @Description(shortDefinition="The status of the disease or symptom for the indication", formalDefinition="The status of the disease or symptom for the indication." )
915        protected CodeableConcept diseaseStatus;
916
917        /**
918         * A comorbidity (concurrent condition) or coinfection as part of the indication.
919         */
920        @Child(name = "comorbidity", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
921        @Description(shortDefinition="A comorbidity (concurrent condition) or coinfection as part of the indication", formalDefinition="A comorbidity (concurrent condition) or coinfection as part of the indication." )
922        protected List<CodeableConcept> comorbidity;
923
924        /**
925         * For an indication - the intended effect, aim or strategy to be achieved.
926         */
927        @Child(name = "intendedEffect", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
928        @Description(shortDefinition="For an indication - the intended effect, aim or strategy to be achieved", formalDefinition="For an indication - the intended effect, aim or strategy to be achieved." )
929        protected CodeableConcept intendedEffect;
930
931        /**
932         * For an indication - timing or duration information.
933         */
934        @Child(name = "duration", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=true)
935        @Description(shortDefinition="For an indication - timing or duration information", formalDefinition="For an indication - timing or duration information." )
936        protected Quantity duration;
937
938        /**
939         * For an indicaton - the specific undesirable effects of the medicinal product.
940         */
941        @Child(name = "undesirableEffect", type = {ClinicalUseIssue.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
942        @Description(shortDefinition="For an indicaton - the specific undesirable effects of the medicinal product", formalDefinition="For an indicaton - the specific undesirable effects of the medicinal product." )
943        protected List<Reference> undesirableEffect;
944
945        /**
946         * Information about the use of the medicinal product in relation to other therapies described as part of the contraindication.
947         */
948        @Child(name = "otherTherapy", type = {ClinicalUseIssueContraindicationOtherTherapyComponent.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
949        @Description(shortDefinition="Information about the use of the medicinal product in relation to other therapies described as part of the contraindication", formalDefinition="Information about the use of the medicinal product in relation to other therapies described as part of the contraindication." )
950        protected List<ClinicalUseIssueContraindicationOtherTherapyComponent> otherTherapy;
951
952        private static final long serialVersionUID = -631720121L;
953
954    /**
955     * Constructor
956     */
957      public ClinicalUseIssueIndicationComponent() {
958        super();
959      }
960
961        /**
962         * @return {@link #diseaseSymptomProcedure} (The situation that is being documented as an indicaton for this item.)
963         */
964        public CodeableConcept getDiseaseSymptomProcedure() { 
965          if (this.diseaseSymptomProcedure == null)
966            if (Configuration.errorOnAutoCreate())
967              throw new Error("Attempt to auto-create ClinicalUseIssueIndicationComponent.diseaseSymptomProcedure");
968            else if (Configuration.doAutoCreate())
969              this.diseaseSymptomProcedure = new CodeableConcept(); // cc
970          return this.diseaseSymptomProcedure;
971        }
972
973        public boolean hasDiseaseSymptomProcedure() { 
974          return this.diseaseSymptomProcedure != null && !this.diseaseSymptomProcedure.isEmpty();
975        }
976
977        /**
978         * @param value {@link #diseaseSymptomProcedure} (The situation that is being documented as an indicaton for this item.)
979         */
980        public ClinicalUseIssueIndicationComponent setDiseaseSymptomProcedure(CodeableConcept value) { 
981          this.diseaseSymptomProcedure = value;
982          return this;
983        }
984
985        /**
986         * @return {@link #diseaseStatus} (The status of the disease or symptom for the indication.)
987         */
988        public CodeableConcept getDiseaseStatus() { 
989          if (this.diseaseStatus == null)
990            if (Configuration.errorOnAutoCreate())
991              throw new Error("Attempt to auto-create ClinicalUseIssueIndicationComponent.diseaseStatus");
992            else if (Configuration.doAutoCreate())
993              this.diseaseStatus = new CodeableConcept(); // cc
994          return this.diseaseStatus;
995        }
996
997        public boolean hasDiseaseStatus() { 
998          return this.diseaseStatus != null && !this.diseaseStatus.isEmpty();
999        }
1000
1001        /**
1002         * @param value {@link #diseaseStatus} (The status of the disease or symptom for the indication.)
1003         */
1004        public ClinicalUseIssueIndicationComponent setDiseaseStatus(CodeableConcept value) { 
1005          this.diseaseStatus = value;
1006          return this;
1007        }
1008
1009        /**
1010         * @return {@link #comorbidity} (A comorbidity (concurrent condition) or coinfection as part of the indication.)
1011         */
1012        public List<CodeableConcept> getComorbidity() { 
1013          if (this.comorbidity == null)
1014            this.comorbidity = new ArrayList<CodeableConcept>();
1015          return this.comorbidity;
1016        }
1017
1018        /**
1019         * @return Returns a reference to <code>this</code> for easy method chaining
1020         */
1021        public ClinicalUseIssueIndicationComponent setComorbidity(List<CodeableConcept> theComorbidity) { 
1022          this.comorbidity = theComorbidity;
1023          return this;
1024        }
1025
1026        public boolean hasComorbidity() { 
1027          if (this.comorbidity == null)
1028            return false;
1029          for (CodeableConcept item : this.comorbidity)
1030            if (!item.isEmpty())
1031              return true;
1032          return false;
1033        }
1034
1035        public CodeableConcept addComorbidity() { //3
1036          CodeableConcept t = new CodeableConcept();
1037          if (this.comorbidity == null)
1038            this.comorbidity = new ArrayList<CodeableConcept>();
1039          this.comorbidity.add(t);
1040          return t;
1041        }
1042
1043        public ClinicalUseIssueIndicationComponent addComorbidity(CodeableConcept t) { //3
1044          if (t == null)
1045            return this;
1046          if (this.comorbidity == null)
1047            this.comorbidity = new ArrayList<CodeableConcept>();
1048          this.comorbidity.add(t);
1049          return this;
1050        }
1051
1052        /**
1053         * @return The first repetition of repeating field {@link #comorbidity}, creating it if it does not already exist {3}
1054         */
1055        public CodeableConcept getComorbidityFirstRep() { 
1056          if (getComorbidity().isEmpty()) {
1057            addComorbidity();
1058          }
1059          return getComorbidity().get(0);
1060        }
1061
1062        /**
1063         * @return {@link #intendedEffect} (For an indication - the intended effect, aim or strategy to be achieved.)
1064         */
1065        public CodeableConcept getIntendedEffect() { 
1066          if (this.intendedEffect == null)
1067            if (Configuration.errorOnAutoCreate())
1068              throw new Error("Attempt to auto-create ClinicalUseIssueIndicationComponent.intendedEffect");
1069            else if (Configuration.doAutoCreate())
1070              this.intendedEffect = new CodeableConcept(); // cc
1071          return this.intendedEffect;
1072        }
1073
1074        public boolean hasIntendedEffect() { 
1075          return this.intendedEffect != null && !this.intendedEffect.isEmpty();
1076        }
1077
1078        /**
1079         * @param value {@link #intendedEffect} (For an indication - the intended effect, aim or strategy to be achieved.)
1080         */
1081        public ClinicalUseIssueIndicationComponent setIntendedEffect(CodeableConcept value) { 
1082          this.intendedEffect = value;
1083          return this;
1084        }
1085
1086        /**
1087         * @return {@link #duration} (For an indication - timing or duration information.)
1088         */
1089        public Quantity getDuration() { 
1090          if (this.duration == null)
1091            if (Configuration.errorOnAutoCreate())
1092              throw new Error("Attempt to auto-create ClinicalUseIssueIndicationComponent.duration");
1093            else if (Configuration.doAutoCreate())
1094              this.duration = new Quantity(); // cc
1095          return this.duration;
1096        }
1097
1098        public boolean hasDuration() { 
1099          return this.duration != null && !this.duration.isEmpty();
1100        }
1101
1102        /**
1103         * @param value {@link #duration} (For an indication - timing or duration information.)
1104         */
1105        public ClinicalUseIssueIndicationComponent setDuration(Quantity value) { 
1106          this.duration = value;
1107          return this;
1108        }
1109
1110        /**
1111         * @return {@link #undesirableEffect} (For an indicaton - the specific undesirable effects of the medicinal product.)
1112         */
1113        public List<Reference> getUndesirableEffect() { 
1114          if (this.undesirableEffect == null)
1115            this.undesirableEffect = new ArrayList<Reference>();
1116          return this.undesirableEffect;
1117        }
1118
1119        /**
1120         * @return Returns a reference to <code>this</code> for easy method chaining
1121         */
1122        public ClinicalUseIssueIndicationComponent setUndesirableEffect(List<Reference> theUndesirableEffect) { 
1123          this.undesirableEffect = theUndesirableEffect;
1124          return this;
1125        }
1126
1127        public boolean hasUndesirableEffect() { 
1128          if (this.undesirableEffect == null)
1129            return false;
1130          for (Reference item : this.undesirableEffect)
1131            if (!item.isEmpty())
1132              return true;
1133          return false;
1134        }
1135
1136        public Reference addUndesirableEffect() { //3
1137          Reference t = new Reference();
1138          if (this.undesirableEffect == null)
1139            this.undesirableEffect = new ArrayList<Reference>();
1140          this.undesirableEffect.add(t);
1141          return t;
1142        }
1143
1144        public ClinicalUseIssueIndicationComponent addUndesirableEffect(Reference t) { //3
1145          if (t == null)
1146            return this;
1147          if (this.undesirableEffect == null)
1148            this.undesirableEffect = new ArrayList<Reference>();
1149          this.undesirableEffect.add(t);
1150          return this;
1151        }
1152
1153        /**
1154         * @return The first repetition of repeating field {@link #undesirableEffect}, creating it if it does not already exist {3}
1155         */
1156        public Reference getUndesirableEffectFirstRep() { 
1157          if (getUndesirableEffect().isEmpty()) {
1158            addUndesirableEffect();
1159          }
1160          return getUndesirableEffect().get(0);
1161        }
1162
1163        /**
1164         * @return {@link #otherTherapy} (Information about the use of the medicinal product in relation to other therapies described as part of the contraindication.)
1165         */
1166        public List<ClinicalUseIssueContraindicationOtherTherapyComponent> getOtherTherapy() { 
1167          if (this.otherTherapy == null)
1168            this.otherTherapy = new ArrayList<ClinicalUseIssueContraindicationOtherTherapyComponent>();
1169          return this.otherTherapy;
1170        }
1171
1172        /**
1173         * @return Returns a reference to <code>this</code> for easy method chaining
1174         */
1175        public ClinicalUseIssueIndicationComponent setOtherTherapy(List<ClinicalUseIssueContraindicationOtherTherapyComponent> theOtherTherapy) { 
1176          this.otherTherapy = theOtherTherapy;
1177          return this;
1178        }
1179
1180        public boolean hasOtherTherapy() { 
1181          if (this.otherTherapy == null)
1182            return false;
1183          for (ClinicalUseIssueContraindicationOtherTherapyComponent item : this.otherTherapy)
1184            if (!item.isEmpty())
1185              return true;
1186          return false;
1187        }
1188
1189        public ClinicalUseIssueContraindicationOtherTherapyComponent addOtherTherapy() { //3
1190          ClinicalUseIssueContraindicationOtherTherapyComponent t = new ClinicalUseIssueContraindicationOtherTherapyComponent();
1191          if (this.otherTherapy == null)
1192            this.otherTherapy = new ArrayList<ClinicalUseIssueContraindicationOtherTherapyComponent>();
1193          this.otherTherapy.add(t);
1194          return t;
1195        }
1196
1197        public ClinicalUseIssueIndicationComponent addOtherTherapy(ClinicalUseIssueContraindicationOtherTherapyComponent t) { //3
1198          if (t == null)
1199            return this;
1200          if (this.otherTherapy == null)
1201            this.otherTherapy = new ArrayList<ClinicalUseIssueContraindicationOtherTherapyComponent>();
1202          this.otherTherapy.add(t);
1203          return this;
1204        }
1205
1206        /**
1207         * @return The first repetition of repeating field {@link #otherTherapy}, creating it if it does not already exist {3}
1208         */
1209        public ClinicalUseIssueContraindicationOtherTherapyComponent getOtherTherapyFirstRep() { 
1210          if (getOtherTherapy().isEmpty()) {
1211            addOtherTherapy();
1212          }
1213          return getOtherTherapy().get(0);
1214        }
1215
1216        protected void listChildren(List<Property> children) {
1217          super.listChildren(children);
1218          children.add(new Property("diseaseSymptomProcedure", "CodeableConcept", "The situation that is being documented as an indicaton for this item.", 0, 1, diseaseSymptomProcedure));
1219          children.add(new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for the indication.", 0, 1, diseaseStatus));
1220          children.add(new Property("comorbidity", "CodeableConcept", "A comorbidity (concurrent condition) or coinfection as part of the indication.", 0, java.lang.Integer.MAX_VALUE, comorbidity));
1221          children.add(new Property("intendedEffect", "CodeableConcept", "For an indication - the intended effect, aim or strategy to be achieved.", 0, 1, intendedEffect));
1222          children.add(new Property("duration", "Quantity", "For an indication - timing or duration information.", 0, 1, duration));
1223          children.add(new Property("undesirableEffect", "Reference(ClinicalUseIssue)", "For an indicaton - the specific undesirable effects of the medicinal product.", 0, java.lang.Integer.MAX_VALUE, undesirableEffect));
1224          children.add(new Property("otherTherapy", "@ClinicalUseIssue.contraindication.otherTherapy", "Information about the use of the medicinal product in relation to other therapies described as part of the contraindication.", 0, java.lang.Integer.MAX_VALUE, otherTherapy));
1225        }
1226
1227        @Override
1228        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1229          switch (_hash) {
1230          case -1497395130: /*diseaseSymptomProcedure*/  return new Property("diseaseSymptomProcedure", "CodeableConcept", "The situation that is being documented as an indicaton for this item.", 0, 1, diseaseSymptomProcedure);
1231          case -505503602: /*diseaseStatus*/  return new Property("diseaseStatus", "CodeableConcept", "The status of the disease or symptom for the indication.", 0, 1, diseaseStatus);
1232          case -406395211: /*comorbidity*/  return new Property("comorbidity", "CodeableConcept", "A comorbidity (concurrent condition) or coinfection as part of the indication.", 0, java.lang.Integer.MAX_VALUE, comorbidity);
1233          case 1587112348: /*intendedEffect*/  return new Property("intendedEffect", "CodeableConcept", "For an indication - the intended effect, aim or strategy to be achieved.", 0, 1, intendedEffect);
1234          case -1992012396: /*duration*/  return new Property("duration", "Quantity", "For an indication - timing or duration information.", 0, 1, duration);
1235          case 444367565: /*undesirableEffect*/  return new Property("undesirableEffect", "Reference(ClinicalUseIssue)", "For an indicaton - the specific undesirable effects of the medicinal product.", 0, java.lang.Integer.MAX_VALUE, undesirableEffect);
1236          case -544509127: /*otherTherapy*/  return new Property("otherTherapy", "@ClinicalUseIssue.contraindication.otherTherapy", "Information about the use of the medicinal product in relation to other therapies described as part of the contraindication.", 0, java.lang.Integer.MAX_VALUE, otherTherapy);
1237          default: return super.getNamedProperty(_hash, _name, _checkValid);
1238          }
1239
1240        }
1241
1242      @Override
1243      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1244        switch (hash) {
1245        case -1497395130: /*diseaseSymptomProcedure*/ return this.diseaseSymptomProcedure == null ? new Base[0] : new Base[] {this.diseaseSymptomProcedure}; // CodeableConcept
1246        case -505503602: /*diseaseStatus*/ return this.diseaseStatus == null ? new Base[0] : new Base[] {this.diseaseStatus}; // CodeableConcept
1247        case -406395211: /*comorbidity*/ return this.comorbidity == null ? new Base[0] : this.comorbidity.toArray(new Base[this.comorbidity.size()]); // CodeableConcept
1248        case 1587112348: /*intendedEffect*/ return this.intendedEffect == null ? new Base[0] : new Base[] {this.intendedEffect}; // CodeableConcept
1249        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Quantity
1250        case 444367565: /*undesirableEffect*/ return this.undesirableEffect == null ? new Base[0] : this.undesirableEffect.toArray(new Base[this.undesirableEffect.size()]); // Reference
1251        case -544509127: /*otherTherapy*/ return this.otherTherapy == null ? new Base[0] : this.otherTherapy.toArray(new Base[this.otherTherapy.size()]); // ClinicalUseIssueContraindicationOtherTherapyComponent
1252        default: return super.getProperty(hash, name, checkValid);
1253        }
1254
1255      }
1256
1257      @Override
1258      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1259        switch (hash) {
1260        case -1497395130: // diseaseSymptomProcedure
1261          this.diseaseSymptomProcedure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1262          return value;
1263        case -505503602: // diseaseStatus
1264          this.diseaseStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1265          return value;
1266        case -406395211: // comorbidity
1267          this.getComorbidity().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1268          return value;
1269        case 1587112348: // intendedEffect
1270          this.intendedEffect = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1271          return value;
1272        case -1992012396: // duration
1273          this.duration = TypeConvertor.castToQuantity(value); // Quantity
1274          return value;
1275        case 444367565: // undesirableEffect
1276          this.getUndesirableEffect().add(TypeConvertor.castToReference(value)); // Reference
1277          return value;
1278        case -544509127: // otherTherapy
1279          this.getOtherTherapy().add((ClinicalUseIssueContraindicationOtherTherapyComponent) value); // ClinicalUseIssueContraindicationOtherTherapyComponent
1280          return value;
1281        default: return super.setProperty(hash, name, value);
1282        }
1283
1284      }
1285
1286      @Override
1287      public Base setProperty(String name, Base value) throws FHIRException {
1288        if (name.equals("diseaseSymptomProcedure")) {
1289          this.diseaseSymptomProcedure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1290        } else if (name.equals("diseaseStatus")) {
1291          this.diseaseStatus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1292        } else if (name.equals("comorbidity")) {
1293          this.getComorbidity().add(TypeConvertor.castToCodeableConcept(value));
1294        } else if (name.equals("intendedEffect")) {
1295          this.intendedEffect = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1296        } else if (name.equals("duration")) {
1297          this.duration = TypeConvertor.castToQuantity(value); // Quantity
1298        } else if (name.equals("undesirableEffect")) {
1299          this.getUndesirableEffect().add(TypeConvertor.castToReference(value));
1300        } else if (name.equals("otherTherapy")) {
1301          this.getOtherTherapy().add((ClinicalUseIssueContraindicationOtherTherapyComponent) value);
1302        } else
1303          return super.setProperty(name, value);
1304        return value;
1305      }
1306
1307      @Override
1308      public Base makeProperty(int hash, String name) throws FHIRException {
1309        switch (hash) {
1310        case -1497395130:  return getDiseaseSymptomProcedure();
1311        case -505503602:  return getDiseaseStatus();
1312        case -406395211:  return addComorbidity(); 
1313        case 1587112348:  return getIntendedEffect();
1314        case -1992012396:  return getDuration();
1315        case 444367565:  return addUndesirableEffect(); 
1316        case -544509127:  return addOtherTherapy(); 
1317        default: return super.makeProperty(hash, name);
1318        }
1319
1320      }
1321
1322      @Override
1323      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1324        switch (hash) {
1325        case -1497395130: /*diseaseSymptomProcedure*/ return new String[] {"CodeableConcept"};
1326        case -505503602: /*diseaseStatus*/ return new String[] {"CodeableConcept"};
1327        case -406395211: /*comorbidity*/ return new String[] {"CodeableConcept"};
1328        case 1587112348: /*intendedEffect*/ return new String[] {"CodeableConcept"};
1329        case -1992012396: /*duration*/ return new String[] {"Quantity"};
1330        case 444367565: /*undesirableEffect*/ return new String[] {"Reference"};
1331        case -544509127: /*otherTherapy*/ return new String[] {"@ClinicalUseIssue.contraindication.otherTherapy"};
1332        default: return super.getTypesForProperty(hash, name);
1333        }
1334
1335      }
1336
1337      @Override
1338      public Base addChild(String name) throws FHIRException {
1339        if (name.equals("diseaseSymptomProcedure")) {
1340          this.diseaseSymptomProcedure = new CodeableConcept();
1341          return this.diseaseSymptomProcedure;
1342        }
1343        else if (name.equals("diseaseStatus")) {
1344          this.diseaseStatus = new CodeableConcept();
1345          return this.diseaseStatus;
1346        }
1347        else if (name.equals("comorbidity")) {
1348          return addComorbidity();
1349        }
1350        else if (name.equals("intendedEffect")) {
1351          this.intendedEffect = new CodeableConcept();
1352          return this.intendedEffect;
1353        }
1354        else if (name.equals("duration")) {
1355          this.duration = new Quantity();
1356          return this.duration;
1357        }
1358        else if (name.equals("undesirableEffect")) {
1359          return addUndesirableEffect();
1360        }
1361        else if (name.equals("otherTherapy")) {
1362          return addOtherTherapy();
1363        }
1364        else
1365          return super.addChild(name);
1366      }
1367
1368      public ClinicalUseIssueIndicationComponent copy() {
1369        ClinicalUseIssueIndicationComponent dst = new ClinicalUseIssueIndicationComponent();
1370        copyValues(dst);
1371        return dst;
1372      }
1373
1374      public void copyValues(ClinicalUseIssueIndicationComponent dst) {
1375        super.copyValues(dst);
1376        dst.diseaseSymptomProcedure = diseaseSymptomProcedure == null ? null : diseaseSymptomProcedure.copy();
1377        dst.diseaseStatus = diseaseStatus == null ? null : diseaseStatus.copy();
1378        if (comorbidity != null) {
1379          dst.comorbidity = new ArrayList<CodeableConcept>();
1380          for (CodeableConcept i : comorbidity)
1381            dst.comorbidity.add(i.copy());
1382        };
1383        dst.intendedEffect = intendedEffect == null ? null : intendedEffect.copy();
1384        dst.duration = duration == null ? null : duration.copy();
1385        if (undesirableEffect != null) {
1386          dst.undesirableEffect = new ArrayList<Reference>();
1387          for (Reference i : undesirableEffect)
1388            dst.undesirableEffect.add(i.copy());
1389        };
1390        if (otherTherapy != null) {
1391          dst.otherTherapy = new ArrayList<ClinicalUseIssueContraindicationOtherTherapyComponent>();
1392          for (ClinicalUseIssueContraindicationOtherTherapyComponent i : otherTherapy)
1393            dst.otherTherapy.add(i.copy());
1394        };
1395      }
1396
1397      @Override
1398      public boolean equalsDeep(Base other_) {
1399        if (!super.equalsDeep(other_))
1400          return false;
1401        if (!(other_ instanceof ClinicalUseIssueIndicationComponent))
1402          return false;
1403        ClinicalUseIssueIndicationComponent o = (ClinicalUseIssueIndicationComponent) other_;
1404        return compareDeep(diseaseSymptomProcedure, o.diseaseSymptomProcedure, true) && compareDeep(diseaseStatus, o.diseaseStatus, true)
1405           && compareDeep(comorbidity, o.comorbidity, true) && compareDeep(intendedEffect, o.intendedEffect, true)
1406           && compareDeep(duration, o.duration, true) && compareDeep(undesirableEffect, o.undesirableEffect, true)
1407           && compareDeep(otherTherapy, o.otherTherapy, true);
1408      }
1409
1410      @Override
1411      public boolean equalsShallow(Base other_) {
1412        if (!super.equalsShallow(other_))
1413          return false;
1414        if (!(other_ instanceof ClinicalUseIssueIndicationComponent))
1415          return false;
1416        ClinicalUseIssueIndicationComponent o = (ClinicalUseIssueIndicationComponent) other_;
1417        return true;
1418      }
1419
1420      public boolean isEmpty() {
1421        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(diseaseSymptomProcedure, diseaseStatus
1422          , comorbidity, intendedEffect, duration, undesirableEffect, otherTherapy);
1423      }
1424
1425  public String fhirType() {
1426    return "ClinicalUseIssue.indication";
1427
1428  }
1429
1430  }
1431
1432    @Block()
1433    public static class ClinicalUseIssueInteractionComponent extends BackboneElement implements IBaseBackboneElement {
1434        /**
1435         * The specific medication, food or laboratory test that interacts.
1436         */
1437        @Child(name = "interactant", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1438        @Description(shortDefinition="The specific medication, food or laboratory test that interacts", formalDefinition="The specific medication, food or laboratory test that interacts." )
1439        protected List<ClinicalUseIssueInteractionInteractantComponent> interactant;
1440
1441        /**
1442         * The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.
1443         */
1444        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1445        @Description(shortDefinition="The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction", formalDefinition="The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction." )
1446        protected CodeableConcept type;
1447
1448        /**
1449         * The effect of the interaction, for example "reduced gastric absorption of primary medication".
1450         */
1451        @Child(name = "effect", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1452        @Description(shortDefinition="The effect of the interaction, for example \"reduced gastric absorption of primary medication\"", formalDefinition="The effect of the interaction, for example \"reduced gastric absorption of primary medication\"." )
1453        protected CodeableConcept effect;
1454
1455        /**
1456         * The incidence of the interaction, e.g. theoretical, observed.
1457         */
1458        @Child(name = "incidence", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1459        @Description(shortDefinition="The incidence of the interaction, e.g. theoretical, observed", formalDefinition="The incidence of the interaction, e.g. theoretical, observed." )
1460        protected CodeableConcept incidence;
1461
1462        /**
1463         * Actions for managing the interaction.
1464         */
1465        @Child(name = "management", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
1466        @Description(shortDefinition="Actions for managing the interaction", formalDefinition="Actions for managing the interaction." )
1467        protected CodeableConcept management;
1468
1469        private static final long serialVersionUID = -910262208L;
1470
1471    /**
1472     * Constructor
1473     */
1474      public ClinicalUseIssueInteractionComponent() {
1475        super();
1476      }
1477
1478        /**
1479         * @return {@link #interactant} (The specific medication, food or laboratory test that interacts.)
1480         */
1481        public List<ClinicalUseIssueInteractionInteractantComponent> getInteractant() { 
1482          if (this.interactant == null)
1483            this.interactant = new ArrayList<ClinicalUseIssueInteractionInteractantComponent>();
1484          return this.interactant;
1485        }
1486
1487        /**
1488         * @return Returns a reference to <code>this</code> for easy method chaining
1489         */
1490        public ClinicalUseIssueInteractionComponent setInteractant(List<ClinicalUseIssueInteractionInteractantComponent> theInteractant) { 
1491          this.interactant = theInteractant;
1492          return this;
1493        }
1494
1495        public boolean hasInteractant() { 
1496          if (this.interactant == null)
1497            return false;
1498          for (ClinicalUseIssueInteractionInteractantComponent item : this.interactant)
1499            if (!item.isEmpty())
1500              return true;
1501          return false;
1502        }
1503
1504        public ClinicalUseIssueInteractionInteractantComponent addInteractant() { //3
1505          ClinicalUseIssueInteractionInteractantComponent t = new ClinicalUseIssueInteractionInteractantComponent();
1506          if (this.interactant == null)
1507            this.interactant = new ArrayList<ClinicalUseIssueInteractionInteractantComponent>();
1508          this.interactant.add(t);
1509          return t;
1510        }
1511
1512        public ClinicalUseIssueInteractionComponent addInteractant(ClinicalUseIssueInteractionInteractantComponent t) { //3
1513          if (t == null)
1514            return this;
1515          if (this.interactant == null)
1516            this.interactant = new ArrayList<ClinicalUseIssueInteractionInteractantComponent>();
1517          this.interactant.add(t);
1518          return this;
1519        }
1520
1521        /**
1522         * @return The first repetition of repeating field {@link #interactant}, creating it if it does not already exist {3}
1523         */
1524        public ClinicalUseIssueInteractionInteractantComponent getInteractantFirstRep() { 
1525          if (getInteractant().isEmpty()) {
1526            addInteractant();
1527          }
1528          return getInteractant().get(0);
1529        }
1530
1531        /**
1532         * @return {@link #type} (The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.)
1533         */
1534        public CodeableConcept getType() { 
1535          if (this.type == null)
1536            if (Configuration.errorOnAutoCreate())
1537              throw new Error("Attempt to auto-create ClinicalUseIssueInteractionComponent.type");
1538            else if (Configuration.doAutoCreate())
1539              this.type = new CodeableConcept(); // cc
1540          return this.type;
1541        }
1542
1543        public boolean hasType() { 
1544          return this.type != null && !this.type.isEmpty();
1545        }
1546
1547        /**
1548         * @param value {@link #type} (The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.)
1549         */
1550        public ClinicalUseIssueInteractionComponent setType(CodeableConcept value) { 
1551          this.type = value;
1552          return this;
1553        }
1554
1555        /**
1556         * @return {@link #effect} (The effect of the interaction, for example "reduced gastric absorption of primary medication".)
1557         */
1558        public CodeableConcept getEffect() { 
1559          if (this.effect == null)
1560            if (Configuration.errorOnAutoCreate())
1561              throw new Error("Attempt to auto-create ClinicalUseIssueInteractionComponent.effect");
1562            else if (Configuration.doAutoCreate())
1563              this.effect = new CodeableConcept(); // cc
1564          return this.effect;
1565        }
1566
1567        public boolean hasEffect() { 
1568          return this.effect != null && !this.effect.isEmpty();
1569        }
1570
1571        /**
1572         * @param value {@link #effect} (The effect of the interaction, for example "reduced gastric absorption of primary medication".)
1573         */
1574        public ClinicalUseIssueInteractionComponent setEffect(CodeableConcept value) { 
1575          this.effect = value;
1576          return this;
1577        }
1578
1579        /**
1580         * @return {@link #incidence} (The incidence of the interaction, e.g. theoretical, observed.)
1581         */
1582        public CodeableConcept getIncidence() { 
1583          if (this.incidence == null)
1584            if (Configuration.errorOnAutoCreate())
1585              throw new Error("Attempt to auto-create ClinicalUseIssueInteractionComponent.incidence");
1586            else if (Configuration.doAutoCreate())
1587              this.incidence = new CodeableConcept(); // cc
1588          return this.incidence;
1589        }
1590
1591        public boolean hasIncidence() { 
1592          return this.incidence != null && !this.incidence.isEmpty();
1593        }
1594
1595        /**
1596         * @param value {@link #incidence} (The incidence of the interaction, e.g. theoretical, observed.)
1597         */
1598        public ClinicalUseIssueInteractionComponent setIncidence(CodeableConcept value) { 
1599          this.incidence = value;
1600          return this;
1601        }
1602
1603        /**
1604         * @return {@link #management} (Actions for managing the interaction.)
1605         */
1606        public CodeableConcept getManagement() { 
1607          if (this.management == null)
1608            if (Configuration.errorOnAutoCreate())
1609              throw new Error("Attempt to auto-create ClinicalUseIssueInteractionComponent.management");
1610            else if (Configuration.doAutoCreate())
1611              this.management = new CodeableConcept(); // cc
1612          return this.management;
1613        }
1614
1615        public boolean hasManagement() { 
1616          return this.management != null && !this.management.isEmpty();
1617        }
1618
1619        /**
1620         * @param value {@link #management} (Actions for managing the interaction.)
1621         */
1622        public ClinicalUseIssueInteractionComponent setManagement(CodeableConcept value) { 
1623          this.management = value;
1624          return this;
1625        }
1626
1627        protected void listChildren(List<Property> children) {
1628          super.listChildren(children);
1629          children.add(new Property("interactant", "", "The specific medication, food or laboratory test that interacts.", 0, java.lang.Integer.MAX_VALUE, interactant));
1630          children.add(new Property("type", "CodeableConcept", "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.", 0, 1, type));
1631          children.add(new Property("effect", "CodeableConcept", "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".", 0, 1, effect));
1632          children.add(new Property("incidence", "CodeableConcept", "The incidence of the interaction, e.g. theoretical, observed.", 0, 1, incidence));
1633          children.add(new Property("management", "CodeableConcept", "Actions for managing the interaction.", 0, 1, management));
1634        }
1635
1636        @Override
1637        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1638          switch (_hash) {
1639          case 1844097009: /*interactant*/  return new Property("interactant", "", "The specific medication, food or laboratory test that interacts.", 0, java.lang.Integer.MAX_VALUE, interactant);
1640          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.", 0, 1, type);
1641          case -1306084975: /*effect*/  return new Property("effect", "CodeableConcept", "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".", 0, 1, effect);
1642          case -1598467132: /*incidence*/  return new Property("incidence", "CodeableConcept", "The incidence of the interaction, e.g. theoretical, observed.", 0, 1, incidence);
1643          case -1799980989: /*management*/  return new Property("management", "CodeableConcept", "Actions for managing the interaction.", 0, 1, management);
1644          default: return super.getNamedProperty(_hash, _name, _checkValid);
1645          }
1646
1647        }
1648
1649      @Override
1650      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1651        switch (hash) {
1652        case 1844097009: /*interactant*/ return this.interactant == null ? new Base[0] : this.interactant.toArray(new Base[this.interactant.size()]); // ClinicalUseIssueInteractionInteractantComponent
1653        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1654        case -1306084975: /*effect*/ return this.effect == null ? new Base[0] : new Base[] {this.effect}; // CodeableConcept
1655        case -1598467132: /*incidence*/ return this.incidence == null ? new Base[0] : new Base[] {this.incidence}; // CodeableConcept
1656        case -1799980989: /*management*/ return this.management == null ? new Base[0] : new Base[] {this.management}; // CodeableConcept
1657        default: return super.getProperty(hash, name, checkValid);
1658        }
1659
1660      }
1661
1662      @Override
1663      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1664        switch (hash) {
1665        case 1844097009: // interactant
1666          this.getInteractant().add((ClinicalUseIssueInteractionInteractantComponent) value); // ClinicalUseIssueInteractionInteractantComponent
1667          return value;
1668        case 3575610: // type
1669          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1670          return value;
1671        case -1306084975: // effect
1672          this.effect = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1673          return value;
1674        case -1598467132: // incidence
1675          this.incidence = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1676          return value;
1677        case -1799980989: // management
1678          this.management = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1679          return value;
1680        default: return super.setProperty(hash, name, value);
1681        }
1682
1683      }
1684
1685      @Override
1686      public Base setProperty(String name, Base value) throws FHIRException {
1687        if (name.equals("interactant")) {
1688          this.getInteractant().add((ClinicalUseIssueInteractionInteractantComponent) value);
1689        } else if (name.equals("type")) {
1690          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1691        } else if (name.equals("effect")) {
1692          this.effect = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1693        } else if (name.equals("incidence")) {
1694          this.incidence = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1695        } else if (name.equals("management")) {
1696          this.management = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1697        } else
1698          return super.setProperty(name, value);
1699        return value;
1700      }
1701
1702      @Override
1703      public Base makeProperty(int hash, String name) throws FHIRException {
1704        switch (hash) {
1705        case 1844097009:  return addInteractant(); 
1706        case 3575610:  return getType();
1707        case -1306084975:  return getEffect();
1708        case -1598467132:  return getIncidence();
1709        case -1799980989:  return getManagement();
1710        default: return super.makeProperty(hash, name);
1711        }
1712
1713      }
1714
1715      @Override
1716      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1717        switch (hash) {
1718        case 1844097009: /*interactant*/ return new String[] {};
1719        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1720        case -1306084975: /*effect*/ return new String[] {"CodeableConcept"};
1721        case -1598467132: /*incidence*/ return new String[] {"CodeableConcept"};
1722        case -1799980989: /*management*/ return new String[] {"CodeableConcept"};
1723        default: return super.getTypesForProperty(hash, name);
1724        }
1725
1726      }
1727
1728      @Override
1729      public Base addChild(String name) throws FHIRException {
1730        if (name.equals("interactant")) {
1731          return addInteractant();
1732        }
1733        else if (name.equals("type")) {
1734          this.type = new CodeableConcept();
1735          return this.type;
1736        }
1737        else if (name.equals("effect")) {
1738          this.effect = new CodeableConcept();
1739          return this.effect;
1740        }
1741        else if (name.equals("incidence")) {
1742          this.incidence = new CodeableConcept();
1743          return this.incidence;
1744        }
1745        else if (name.equals("management")) {
1746          this.management = new CodeableConcept();
1747          return this.management;
1748        }
1749        else
1750          return super.addChild(name);
1751      }
1752
1753      public ClinicalUseIssueInteractionComponent copy() {
1754        ClinicalUseIssueInteractionComponent dst = new ClinicalUseIssueInteractionComponent();
1755        copyValues(dst);
1756        return dst;
1757      }
1758
1759      public void copyValues(ClinicalUseIssueInteractionComponent dst) {
1760        super.copyValues(dst);
1761        if (interactant != null) {
1762          dst.interactant = new ArrayList<ClinicalUseIssueInteractionInteractantComponent>();
1763          for (ClinicalUseIssueInteractionInteractantComponent i : interactant)
1764            dst.interactant.add(i.copy());
1765        };
1766        dst.type = type == null ? null : type.copy();
1767        dst.effect = effect == null ? null : effect.copy();
1768        dst.incidence = incidence == null ? null : incidence.copy();
1769        dst.management = management == null ? null : management.copy();
1770      }
1771
1772      @Override
1773      public boolean equalsDeep(Base other_) {
1774        if (!super.equalsDeep(other_))
1775          return false;
1776        if (!(other_ instanceof ClinicalUseIssueInteractionComponent))
1777          return false;
1778        ClinicalUseIssueInteractionComponent o = (ClinicalUseIssueInteractionComponent) other_;
1779        return compareDeep(interactant, o.interactant, true) && compareDeep(type, o.type, true) && compareDeep(effect, o.effect, true)
1780           && compareDeep(incidence, o.incidence, true) && compareDeep(management, o.management, true);
1781      }
1782
1783      @Override
1784      public boolean equalsShallow(Base other_) {
1785        if (!super.equalsShallow(other_))
1786          return false;
1787        if (!(other_ instanceof ClinicalUseIssueInteractionComponent))
1788          return false;
1789        ClinicalUseIssueInteractionComponent o = (ClinicalUseIssueInteractionComponent) other_;
1790        return true;
1791      }
1792
1793      public boolean isEmpty() {
1794        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(interactant, type, effect
1795          , incidence, management);
1796      }
1797
1798  public String fhirType() {
1799    return "ClinicalUseIssue.interaction";
1800
1801  }
1802
1803  }
1804
1805    @Block()
1806    public static class ClinicalUseIssueInteractionInteractantComponent extends BackboneElement implements IBaseBackboneElement {
1807        /**
1808         * The specific medication, food or laboratory test that interacts.
1809         */
1810        @Child(name = "item", type = {MedicinalProductDefinition.class, Medication.class, Substance.class, ObservationDefinition.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1811        @Description(shortDefinition="The specific medication, food or laboratory test that interacts", formalDefinition="The specific medication, food or laboratory test that interacts." )
1812        protected DataType item;
1813
1814        private static final long serialVersionUID = 1847936859L;
1815
1816    /**
1817     * Constructor
1818     */
1819      public ClinicalUseIssueInteractionInteractantComponent() {
1820        super();
1821      }
1822
1823    /**
1824     * Constructor
1825     */
1826      public ClinicalUseIssueInteractionInteractantComponent(DataType item) {
1827        super();
1828        this.setItem(item);
1829      }
1830
1831        /**
1832         * @return {@link #item} (The specific medication, food or laboratory test that interacts.)
1833         */
1834        public DataType getItem() { 
1835          return this.item;
1836        }
1837
1838        /**
1839         * @return {@link #item} (The specific medication, food or laboratory test that interacts.)
1840         */
1841        public Reference getItemReference() throws FHIRException { 
1842          if (this.item == null)
1843            this.item = new Reference();
1844          if (!(this.item instanceof Reference))
1845            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered");
1846          return (Reference) this.item;
1847        }
1848
1849        public boolean hasItemReference() { 
1850          return this != null && this.item instanceof Reference;
1851        }
1852
1853        /**
1854         * @return {@link #item} (The specific medication, food or laboratory test that interacts.)
1855         */
1856        public CodeableConcept getItemCodeableConcept() throws FHIRException { 
1857          if (this.item == null)
1858            this.item = new CodeableConcept();
1859          if (!(this.item instanceof CodeableConcept))
1860            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered");
1861          return (CodeableConcept) this.item;
1862        }
1863
1864        public boolean hasItemCodeableConcept() { 
1865          return this != null && this.item instanceof CodeableConcept;
1866        }
1867
1868        public boolean hasItem() { 
1869          return this.item != null && !this.item.isEmpty();
1870        }
1871
1872        /**
1873         * @param value {@link #item} (The specific medication, food or laboratory test that interacts.)
1874         */
1875        public ClinicalUseIssueInteractionInteractantComponent setItem(DataType value) { 
1876          if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
1877            throw new Error("Not the right type for ClinicalUseIssue.interaction.interactant.item[x]: "+value.fhirType());
1878          this.item = value;
1879          return this;
1880        }
1881
1882        protected void listChildren(List<Property> children) {
1883          super.listChildren(children);
1884          children.add(new Property("item[x]", "Reference(MedicinalProductDefinition|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item));
1885        }
1886
1887        @Override
1888        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1889          switch (_hash) {
1890          case 2116201613: /*item[x]*/  return new Property("item[x]", "Reference(MedicinalProductDefinition|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item);
1891          case 3242771: /*item*/  return new Property("item[x]", "Reference(MedicinalProductDefinition|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item);
1892          case 1376364920: /*itemReference*/  return new Property("item[x]", "Reference(MedicinalProductDefinition|Medication|Substance|ObservationDefinition)", "The specific medication, food or laboratory test that interacts.", 0, 1, item);
1893          case 106644494: /*itemCodeableConcept*/  return new Property("item[x]", "CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item);
1894          default: return super.getNamedProperty(_hash, _name, _checkValid);
1895          }
1896
1897        }
1898
1899      @Override
1900      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1901        switch (hash) {
1902        case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // DataType
1903        default: return super.getProperty(hash, name, checkValid);
1904        }
1905
1906      }
1907
1908      @Override
1909      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1910        switch (hash) {
1911        case 3242771: // item
1912          this.item = TypeConvertor.castToType(value); // DataType
1913          return value;
1914        default: return super.setProperty(hash, name, value);
1915        }
1916
1917      }
1918
1919      @Override
1920      public Base setProperty(String name, Base value) throws FHIRException {
1921        if (name.equals("item[x]")) {
1922          this.item = TypeConvertor.castToType(value); // DataType
1923        } else
1924          return super.setProperty(name, value);
1925        return value;
1926      }
1927
1928      @Override
1929      public Base makeProperty(int hash, String name) throws FHIRException {
1930        switch (hash) {
1931        case 2116201613:  return getItem();
1932        case 3242771:  return getItem();
1933        default: return super.makeProperty(hash, name);
1934        }
1935
1936      }
1937
1938      @Override
1939      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1940        switch (hash) {
1941        case 3242771: /*item*/ return new String[] {"Reference", "CodeableConcept"};
1942        default: return super.getTypesForProperty(hash, name);
1943        }
1944
1945      }
1946
1947      @Override
1948      public Base addChild(String name) throws FHIRException {
1949        if (name.equals("itemReference")) {
1950          this.item = new Reference();
1951          return this.item;
1952        }
1953        else if (name.equals("itemCodeableConcept")) {
1954          this.item = new CodeableConcept();
1955          return this.item;
1956        }
1957        else
1958          return super.addChild(name);
1959      }
1960
1961      public ClinicalUseIssueInteractionInteractantComponent copy() {
1962        ClinicalUseIssueInteractionInteractantComponent dst = new ClinicalUseIssueInteractionInteractantComponent();
1963        copyValues(dst);
1964        return dst;
1965      }
1966
1967      public void copyValues(ClinicalUseIssueInteractionInteractantComponent dst) {
1968        super.copyValues(dst);
1969        dst.item = item == null ? null : item.copy();
1970      }
1971
1972      @Override
1973      public boolean equalsDeep(Base other_) {
1974        if (!super.equalsDeep(other_))
1975          return false;
1976        if (!(other_ instanceof ClinicalUseIssueInteractionInteractantComponent))
1977          return false;
1978        ClinicalUseIssueInteractionInteractantComponent o = (ClinicalUseIssueInteractionInteractantComponent) other_;
1979        return compareDeep(item, o.item, true);
1980      }
1981
1982      @Override
1983      public boolean equalsShallow(Base other_) {
1984        if (!super.equalsShallow(other_))
1985          return false;
1986        if (!(other_ instanceof ClinicalUseIssueInteractionInteractantComponent))
1987          return false;
1988        ClinicalUseIssueInteractionInteractantComponent o = (ClinicalUseIssueInteractionInteractantComponent) other_;
1989        return true;
1990      }
1991
1992      public boolean isEmpty() {
1993        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item);
1994      }
1995
1996  public String fhirType() {
1997    return "ClinicalUseIssue.interaction.interactant";
1998
1999  }
2000
2001  }
2002
2003    @Block()
2004    public static class ClinicalUseIssueUndesirableEffectComponent extends BackboneElement implements IBaseBackboneElement {
2005        /**
2006         * The situation in which the undesirable effect may manifest.
2007         */
2008        @Child(name = "symptomConditionEffect", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
2009        @Description(shortDefinition="The situation in which the undesirable effect may manifest", formalDefinition="The situation in which the undesirable effect may manifest." )
2010        protected CodeableConcept symptomConditionEffect;
2011
2012        /**
2013         * High level classification of the effect.
2014         */
2015        @Child(name = "classification", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
2016        @Description(shortDefinition="High level classification of the effect", formalDefinition="High level classification of the effect." )
2017        protected CodeableConcept classification;
2018
2019        /**
2020         * How often the effect is seen.
2021         */
2022        @Child(name = "frequencyOfOccurrence", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
2023        @Description(shortDefinition="How often the effect is seen", formalDefinition="How often the effect is seen." )
2024        protected CodeableConcept frequencyOfOccurrence;
2025
2026        private static final long serialVersionUID = 503141026L;
2027
2028    /**
2029     * Constructor
2030     */
2031      public ClinicalUseIssueUndesirableEffectComponent() {
2032        super();
2033      }
2034
2035        /**
2036         * @return {@link #symptomConditionEffect} (The situation in which the undesirable effect may manifest.)
2037         */
2038        public CodeableConcept getSymptomConditionEffect() { 
2039          if (this.symptomConditionEffect == null)
2040            if (Configuration.errorOnAutoCreate())
2041              throw new Error("Attempt to auto-create ClinicalUseIssueUndesirableEffectComponent.symptomConditionEffect");
2042            else if (Configuration.doAutoCreate())
2043              this.symptomConditionEffect = new CodeableConcept(); // cc
2044          return this.symptomConditionEffect;
2045        }
2046
2047        public boolean hasSymptomConditionEffect() { 
2048          return this.symptomConditionEffect != null && !this.symptomConditionEffect.isEmpty();
2049        }
2050
2051        /**
2052         * @param value {@link #symptomConditionEffect} (The situation in which the undesirable effect may manifest.)
2053         */
2054        public ClinicalUseIssueUndesirableEffectComponent setSymptomConditionEffect(CodeableConcept value) { 
2055          this.symptomConditionEffect = value;
2056          return this;
2057        }
2058
2059        /**
2060         * @return {@link #classification} (High level classification of the effect.)
2061         */
2062        public CodeableConcept getClassification() { 
2063          if (this.classification == null)
2064            if (Configuration.errorOnAutoCreate())
2065              throw new Error("Attempt to auto-create ClinicalUseIssueUndesirableEffectComponent.classification");
2066            else if (Configuration.doAutoCreate())
2067              this.classification = new CodeableConcept(); // cc
2068          return this.classification;
2069        }
2070
2071        public boolean hasClassification() { 
2072          return this.classification != null && !this.classification.isEmpty();
2073        }
2074
2075        /**
2076         * @param value {@link #classification} (High level classification of the effect.)
2077         */
2078        public ClinicalUseIssueUndesirableEffectComponent setClassification(CodeableConcept value) { 
2079          this.classification = value;
2080          return this;
2081        }
2082
2083        /**
2084         * @return {@link #frequencyOfOccurrence} (How often the effect is seen.)
2085         */
2086        public CodeableConcept getFrequencyOfOccurrence() { 
2087          if (this.frequencyOfOccurrence == null)
2088            if (Configuration.errorOnAutoCreate())
2089              throw new Error("Attempt to auto-create ClinicalUseIssueUndesirableEffectComponent.frequencyOfOccurrence");
2090            else if (Configuration.doAutoCreate())
2091              this.frequencyOfOccurrence = new CodeableConcept(); // cc
2092          return this.frequencyOfOccurrence;
2093        }
2094
2095        public boolean hasFrequencyOfOccurrence() { 
2096          return this.frequencyOfOccurrence != null && !this.frequencyOfOccurrence.isEmpty();
2097        }
2098
2099        /**
2100         * @param value {@link #frequencyOfOccurrence} (How often the effect is seen.)
2101         */
2102        public ClinicalUseIssueUndesirableEffectComponent setFrequencyOfOccurrence(CodeableConcept value) { 
2103          this.frequencyOfOccurrence = value;
2104          return this;
2105        }
2106
2107        protected void listChildren(List<Property> children) {
2108          super.listChildren(children);
2109          children.add(new Property("symptomConditionEffect", "CodeableConcept", "The situation in which the undesirable effect may manifest.", 0, 1, symptomConditionEffect));
2110          children.add(new Property("classification", "CodeableConcept", "High level classification of the effect.", 0, 1, classification));
2111          children.add(new Property("frequencyOfOccurrence", "CodeableConcept", "How often the effect is seen.", 0, 1, frequencyOfOccurrence));
2112        }
2113
2114        @Override
2115        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2116          switch (_hash) {
2117          case -650549981: /*symptomConditionEffect*/  return new Property("symptomConditionEffect", "CodeableConcept", "The situation in which the undesirable effect may manifest.", 0, 1, symptomConditionEffect);
2118          case 382350310: /*classification*/  return new Property("classification", "CodeableConcept", "High level classification of the effect.", 0, 1, classification);
2119          case 791175812: /*frequencyOfOccurrence*/  return new Property("frequencyOfOccurrence", "CodeableConcept", "How often the effect is seen.", 0, 1, frequencyOfOccurrence);
2120          default: return super.getNamedProperty(_hash, _name, _checkValid);
2121          }
2122
2123        }
2124
2125      @Override
2126      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2127        switch (hash) {
2128        case -650549981: /*symptomConditionEffect*/ return this.symptomConditionEffect == null ? new Base[0] : new Base[] {this.symptomConditionEffect}; // CodeableConcept
2129        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // CodeableConcept
2130        case 791175812: /*frequencyOfOccurrence*/ return this.frequencyOfOccurrence == null ? new Base[0] : new Base[] {this.frequencyOfOccurrence}; // CodeableConcept
2131        default: return super.getProperty(hash, name, checkValid);
2132        }
2133
2134      }
2135
2136      @Override
2137      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2138        switch (hash) {
2139        case -650549981: // symptomConditionEffect
2140          this.symptomConditionEffect = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2141          return value;
2142        case 382350310: // classification
2143          this.classification = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2144          return value;
2145        case 791175812: // frequencyOfOccurrence
2146          this.frequencyOfOccurrence = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2147          return value;
2148        default: return super.setProperty(hash, name, value);
2149        }
2150
2151      }
2152
2153      @Override
2154      public Base setProperty(String name, Base value) throws FHIRException {
2155        if (name.equals("symptomConditionEffect")) {
2156          this.symptomConditionEffect = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2157        } else if (name.equals("classification")) {
2158          this.classification = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2159        } else if (name.equals("frequencyOfOccurrence")) {
2160          this.frequencyOfOccurrence = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2161        } else
2162          return super.setProperty(name, value);
2163        return value;
2164      }
2165
2166      @Override
2167      public Base makeProperty(int hash, String name) throws FHIRException {
2168        switch (hash) {
2169        case -650549981:  return getSymptomConditionEffect();
2170        case 382350310:  return getClassification();
2171        case 791175812:  return getFrequencyOfOccurrence();
2172        default: return super.makeProperty(hash, name);
2173        }
2174
2175      }
2176
2177      @Override
2178      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2179        switch (hash) {
2180        case -650549981: /*symptomConditionEffect*/ return new String[] {"CodeableConcept"};
2181        case 382350310: /*classification*/ return new String[] {"CodeableConcept"};
2182        case 791175812: /*frequencyOfOccurrence*/ return new String[] {"CodeableConcept"};
2183        default: return super.getTypesForProperty(hash, name);
2184        }
2185
2186      }
2187
2188      @Override
2189      public Base addChild(String name) throws FHIRException {
2190        if (name.equals("symptomConditionEffect")) {
2191          this.symptomConditionEffect = new CodeableConcept();
2192          return this.symptomConditionEffect;
2193        }
2194        else if (name.equals("classification")) {
2195          this.classification = new CodeableConcept();
2196          return this.classification;
2197        }
2198        else if (name.equals("frequencyOfOccurrence")) {
2199          this.frequencyOfOccurrence = new CodeableConcept();
2200          return this.frequencyOfOccurrence;
2201        }
2202        else
2203          return super.addChild(name);
2204      }
2205
2206      public ClinicalUseIssueUndesirableEffectComponent copy() {
2207        ClinicalUseIssueUndesirableEffectComponent dst = new ClinicalUseIssueUndesirableEffectComponent();
2208        copyValues(dst);
2209        return dst;
2210      }
2211
2212      public void copyValues(ClinicalUseIssueUndesirableEffectComponent dst) {
2213        super.copyValues(dst);
2214        dst.symptomConditionEffect = symptomConditionEffect == null ? null : symptomConditionEffect.copy();
2215        dst.classification = classification == null ? null : classification.copy();
2216        dst.frequencyOfOccurrence = frequencyOfOccurrence == null ? null : frequencyOfOccurrence.copy();
2217      }
2218
2219      @Override
2220      public boolean equalsDeep(Base other_) {
2221        if (!super.equalsDeep(other_))
2222          return false;
2223        if (!(other_ instanceof ClinicalUseIssueUndesirableEffectComponent))
2224          return false;
2225        ClinicalUseIssueUndesirableEffectComponent o = (ClinicalUseIssueUndesirableEffectComponent) other_;
2226        return compareDeep(symptomConditionEffect, o.symptomConditionEffect, true) && compareDeep(classification, o.classification, true)
2227           && compareDeep(frequencyOfOccurrence, o.frequencyOfOccurrence, true);
2228      }
2229
2230      @Override
2231      public boolean equalsShallow(Base other_) {
2232        if (!super.equalsShallow(other_))
2233          return false;
2234        if (!(other_ instanceof ClinicalUseIssueUndesirableEffectComponent))
2235          return false;
2236        ClinicalUseIssueUndesirableEffectComponent o = (ClinicalUseIssueUndesirableEffectComponent) other_;
2237        return true;
2238      }
2239
2240      public boolean isEmpty() {
2241        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(symptomConditionEffect, classification
2242          , frequencyOfOccurrence);
2243      }
2244
2245  public String fhirType() {
2246    return "ClinicalUseIssue.undesirableEffect";
2247
2248  }
2249
2250  }
2251
2252    /**
2253     * Business identifier for this issue.
2254     */
2255    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2256    @Description(shortDefinition="Business identifier for this issue", formalDefinition="Business identifier for this issue." )
2257    protected List<Identifier> identifier;
2258
2259    /**
2260     * indication | contraindication | interaction | undesirable-effect | other.
2261     */
2262    @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2263    @Description(shortDefinition="indication | contraindication | interaction | undesirable-effect | other", formalDefinition="indication | contraindication | interaction | undesirable-effect | other." )
2264    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-use-issue-type")
2265    protected Enumeration<ClinicalUseIssueType> type;
2266
2267    /**
2268     * The medication or procedure for which this is an indication.
2269     */
2270    @Child(name = "subject", type = {MedicinalProductDefinition.class, Medication.class, ActivityDefinition.class, PlanDefinition.class, Device.class, DeviceDefinition.class, Substance.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2271    @Description(shortDefinition="The medication or procedure for which this is an indication", formalDefinition="The medication or procedure for which this is an indication." )
2272    protected List<Reference> subject;
2273
2274    /**
2275     * General description.
2276     */
2277    @Child(name = "status", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
2278    @Description(shortDefinition="General description", formalDefinition="General description." )
2279    protected CodeableConcept status;
2280
2281    /**
2282     * General description.
2283     */
2284    @Child(name = "description", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=true)
2285    @Description(shortDefinition="General description", formalDefinition="General description." )
2286    protected MarkdownType description;
2287
2288    /**
2289     * Specifics for when this is a contraindication.
2290     */
2291    @Child(name = "contraindication", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
2292    @Description(shortDefinition="Specifics for when this is a contraindication", formalDefinition="Specifics for when this is a contraindication." )
2293    protected ClinicalUseIssueContraindicationComponent contraindication;
2294
2295    /**
2296     * Specifics for when this is an indication.
2297     */
2298    @Child(name = "indication", type = {}, order=6, min=0, max=1, modifier=false, summary=true)
2299    @Description(shortDefinition="Specifics for when this is an indication", formalDefinition="Specifics for when this is an indication." )
2300    protected ClinicalUseIssueIndicationComponent indication;
2301
2302    /**
2303     * Specifics for when this is an interaction.
2304     */
2305    @Child(name = "interaction", type = {}, order=7, min=0, max=1, modifier=false, summary=true)
2306    @Description(shortDefinition="Specifics for when this is an interaction", formalDefinition="Specifics for when this is an interaction." )
2307    protected ClinicalUseIssueInteractionComponent interaction;
2308
2309    /**
2310     * The population group to which this applies.
2311     */
2312    @Child(name = "population", type = {Population.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2313    @Description(shortDefinition="The population group to which this applies", formalDefinition="The population group to which this applies." )
2314    protected List<Population> population;
2315
2316    /**
2317     * Describe the undesirable effects of the medicinal product.
2318     */
2319    @Child(name = "undesirableEffect", type = {}, order=9, min=0, max=1, modifier=false, summary=true)
2320    @Description(shortDefinition="A possible negative outcome from the use of this treatment", formalDefinition="Describe the undesirable effects of the medicinal product." )
2321    protected ClinicalUseIssueUndesirableEffectComponent undesirableEffect;
2322
2323    private static final long serialVersionUID = -1817506487L;
2324
2325  /**
2326   * Constructor
2327   */
2328    public ClinicalUseIssue() {
2329      super();
2330    }
2331
2332  /**
2333   * Constructor
2334   */
2335    public ClinicalUseIssue(ClinicalUseIssueType type) {
2336      super();
2337      this.setType(type);
2338    }
2339
2340    /**
2341     * @return {@link #identifier} (Business identifier for this issue.)
2342     */
2343    public List<Identifier> getIdentifier() { 
2344      if (this.identifier == null)
2345        this.identifier = new ArrayList<Identifier>();
2346      return this.identifier;
2347    }
2348
2349    /**
2350     * @return Returns a reference to <code>this</code> for easy method chaining
2351     */
2352    public ClinicalUseIssue setIdentifier(List<Identifier> theIdentifier) { 
2353      this.identifier = theIdentifier;
2354      return this;
2355    }
2356
2357    public boolean hasIdentifier() { 
2358      if (this.identifier == null)
2359        return false;
2360      for (Identifier item : this.identifier)
2361        if (!item.isEmpty())
2362          return true;
2363      return false;
2364    }
2365
2366    public Identifier addIdentifier() { //3
2367      Identifier t = new Identifier();
2368      if (this.identifier == null)
2369        this.identifier = new ArrayList<Identifier>();
2370      this.identifier.add(t);
2371      return t;
2372    }
2373
2374    public ClinicalUseIssue addIdentifier(Identifier t) { //3
2375      if (t == null)
2376        return this;
2377      if (this.identifier == null)
2378        this.identifier = new ArrayList<Identifier>();
2379      this.identifier.add(t);
2380      return this;
2381    }
2382
2383    /**
2384     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
2385     */
2386    public Identifier getIdentifierFirstRep() { 
2387      if (getIdentifier().isEmpty()) {
2388        addIdentifier();
2389      }
2390      return getIdentifier().get(0);
2391    }
2392
2393    /**
2394     * @return {@link #type} (indication | contraindication | interaction | undesirable-effect | other.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2395     */
2396    public Enumeration<ClinicalUseIssueType> getTypeElement() { 
2397      if (this.type == null)
2398        if (Configuration.errorOnAutoCreate())
2399          throw new Error("Attempt to auto-create ClinicalUseIssue.type");
2400        else if (Configuration.doAutoCreate())
2401          this.type = new Enumeration<ClinicalUseIssueType>(new ClinicalUseIssueTypeEnumFactory()); // bb
2402      return this.type;
2403    }
2404
2405    public boolean hasTypeElement() { 
2406      return this.type != null && !this.type.isEmpty();
2407    }
2408
2409    public boolean hasType() { 
2410      return this.type != null && !this.type.isEmpty();
2411    }
2412
2413    /**
2414     * @param value {@link #type} (indication | contraindication | interaction | undesirable-effect | other.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2415     */
2416    public ClinicalUseIssue setTypeElement(Enumeration<ClinicalUseIssueType> value) { 
2417      this.type = value;
2418      return this;
2419    }
2420
2421    /**
2422     * @return indication | contraindication | interaction | undesirable-effect | other.
2423     */
2424    public ClinicalUseIssueType getType() { 
2425      return this.type == null ? null : this.type.getValue();
2426    }
2427
2428    /**
2429     * @param value indication | contraindication | interaction | undesirable-effect | other.
2430     */
2431    public ClinicalUseIssue setType(ClinicalUseIssueType value) { 
2432        if (this.type == null)
2433          this.type = new Enumeration<ClinicalUseIssueType>(new ClinicalUseIssueTypeEnumFactory());
2434        this.type.setValue(value);
2435      return this;
2436    }
2437
2438    /**
2439     * @return {@link #subject} (The medication or procedure for which this is an indication.)
2440     */
2441    public List<Reference> getSubject() { 
2442      if (this.subject == null)
2443        this.subject = new ArrayList<Reference>();
2444      return this.subject;
2445    }
2446
2447    /**
2448     * @return Returns a reference to <code>this</code> for easy method chaining
2449     */
2450    public ClinicalUseIssue setSubject(List<Reference> theSubject) { 
2451      this.subject = theSubject;
2452      return this;
2453    }
2454
2455    public boolean hasSubject() { 
2456      if (this.subject == null)
2457        return false;
2458      for (Reference item : this.subject)
2459        if (!item.isEmpty())
2460          return true;
2461      return false;
2462    }
2463
2464    public Reference addSubject() { //3
2465      Reference t = new Reference();
2466      if (this.subject == null)
2467        this.subject = new ArrayList<Reference>();
2468      this.subject.add(t);
2469      return t;
2470    }
2471
2472    public ClinicalUseIssue addSubject(Reference t) { //3
2473      if (t == null)
2474        return this;
2475      if (this.subject == null)
2476        this.subject = new ArrayList<Reference>();
2477      this.subject.add(t);
2478      return this;
2479    }
2480
2481    /**
2482     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
2483     */
2484    public Reference getSubjectFirstRep() { 
2485      if (getSubject().isEmpty()) {
2486        addSubject();
2487      }
2488      return getSubject().get(0);
2489    }
2490
2491    /**
2492     * @return {@link #status} (General description.)
2493     */
2494    public CodeableConcept getStatus() { 
2495      if (this.status == null)
2496        if (Configuration.errorOnAutoCreate())
2497          throw new Error("Attempt to auto-create ClinicalUseIssue.status");
2498        else if (Configuration.doAutoCreate())
2499          this.status = new CodeableConcept(); // cc
2500      return this.status;
2501    }
2502
2503    public boolean hasStatus() { 
2504      return this.status != null && !this.status.isEmpty();
2505    }
2506
2507    /**
2508     * @param value {@link #status} (General description.)
2509     */
2510    public ClinicalUseIssue setStatus(CodeableConcept value) { 
2511      this.status = value;
2512      return this;
2513    }
2514
2515    /**
2516     * @return {@link #description} (General description.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2517     */
2518    public MarkdownType getDescriptionElement() { 
2519      if (this.description == null)
2520        if (Configuration.errorOnAutoCreate())
2521          throw new Error("Attempt to auto-create ClinicalUseIssue.description");
2522        else if (Configuration.doAutoCreate())
2523          this.description = new MarkdownType(); // bb
2524      return this.description;
2525    }
2526
2527    public boolean hasDescriptionElement() { 
2528      return this.description != null && !this.description.isEmpty();
2529    }
2530
2531    public boolean hasDescription() { 
2532      return this.description != null && !this.description.isEmpty();
2533    }
2534
2535    /**
2536     * @param value {@link #description} (General description.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2537     */
2538    public ClinicalUseIssue setDescriptionElement(MarkdownType value) { 
2539      this.description = value;
2540      return this;
2541    }
2542
2543    /**
2544     * @return General description.
2545     */
2546    public String getDescription() { 
2547      return this.description == null ? null : this.description.getValue();
2548    }
2549
2550    /**
2551     * @param value General description.
2552     */
2553    public ClinicalUseIssue setDescription(String value) { 
2554      if (value == null)
2555        this.description = null;
2556      else {
2557        if (this.description == null)
2558          this.description = new MarkdownType();
2559        this.description.setValue(value);
2560      }
2561      return this;
2562    }
2563
2564    /**
2565     * @return {@link #contraindication} (Specifics for when this is a contraindication.)
2566     */
2567    public ClinicalUseIssueContraindicationComponent getContraindication() { 
2568      if (this.contraindication == null)
2569        if (Configuration.errorOnAutoCreate())
2570          throw new Error("Attempt to auto-create ClinicalUseIssue.contraindication");
2571        else if (Configuration.doAutoCreate())
2572          this.contraindication = new ClinicalUseIssueContraindicationComponent(); // cc
2573      return this.contraindication;
2574    }
2575
2576    public boolean hasContraindication() { 
2577      return this.contraindication != null && !this.contraindication.isEmpty();
2578    }
2579
2580    /**
2581     * @param value {@link #contraindication} (Specifics for when this is a contraindication.)
2582     */
2583    public ClinicalUseIssue setContraindication(ClinicalUseIssueContraindicationComponent value) { 
2584      this.contraindication = value;
2585      return this;
2586    }
2587
2588    /**
2589     * @return {@link #indication} (Specifics for when this is an indication.)
2590     */
2591    public ClinicalUseIssueIndicationComponent getIndication() { 
2592      if (this.indication == null)
2593        if (Configuration.errorOnAutoCreate())
2594          throw new Error("Attempt to auto-create ClinicalUseIssue.indication");
2595        else if (Configuration.doAutoCreate())
2596          this.indication = new ClinicalUseIssueIndicationComponent(); // cc
2597      return this.indication;
2598    }
2599
2600    public boolean hasIndication() { 
2601      return this.indication != null && !this.indication.isEmpty();
2602    }
2603
2604    /**
2605     * @param value {@link #indication} (Specifics for when this is an indication.)
2606     */
2607    public ClinicalUseIssue setIndication(ClinicalUseIssueIndicationComponent value) { 
2608      this.indication = value;
2609      return this;
2610    }
2611
2612    /**
2613     * @return {@link #interaction} (Specifics for when this is an interaction.)
2614     */
2615    public ClinicalUseIssueInteractionComponent getInteraction() { 
2616      if (this.interaction == null)
2617        if (Configuration.errorOnAutoCreate())
2618          throw new Error("Attempt to auto-create ClinicalUseIssue.interaction");
2619        else if (Configuration.doAutoCreate())
2620          this.interaction = new ClinicalUseIssueInteractionComponent(); // cc
2621      return this.interaction;
2622    }
2623
2624    public boolean hasInteraction() { 
2625      return this.interaction != null && !this.interaction.isEmpty();
2626    }
2627
2628    /**
2629     * @param value {@link #interaction} (Specifics for when this is an interaction.)
2630     */
2631    public ClinicalUseIssue setInteraction(ClinicalUseIssueInteractionComponent value) { 
2632      this.interaction = value;
2633      return this;
2634    }
2635
2636    /**
2637     * @return {@link #population} (The population group to which this applies.)
2638     */
2639    public List<Population> getPopulation() { 
2640      if (this.population == null)
2641        this.population = new ArrayList<Population>();
2642      return this.population;
2643    }
2644
2645    /**
2646     * @return Returns a reference to <code>this</code> for easy method chaining
2647     */
2648    public ClinicalUseIssue setPopulation(List<Population> thePopulation) { 
2649      this.population = thePopulation;
2650      return this;
2651    }
2652
2653    public boolean hasPopulation() { 
2654      if (this.population == null)
2655        return false;
2656      for (Population item : this.population)
2657        if (!item.isEmpty())
2658          return true;
2659      return false;
2660    }
2661
2662    public Population addPopulation() { //3
2663      Population t = new Population();
2664      if (this.population == null)
2665        this.population = new ArrayList<Population>();
2666      this.population.add(t);
2667      return t;
2668    }
2669
2670    public ClinicalUseIssue addPopulation(Population t) { //3
2671      if (t == null)
2672        return this;
2673      if (this.population == null)
2674        this.population = new ArrayList<Population>();
2675      this.population.add(t);
2676      return this;
2677    }
2678
2679    /**
2680     * @return The first repetition of repeating field {@link #population}, creating it if it does not already exist {3}
2681     */
2682    public Population getPopulationFirstRep() { 
2683      if (getPopulation().isEmpty()) {
2684        addPopulation();
2685      }
2686      return getPopulation().get(0);
2687    }
2688
2689    /**
2690     * @return {@link #undesirableEffect} (Describe the undesirable effects of the medicinal product.)
2691     */
2692    public ClinicalUseIssueUndesirableEffectComponent getUndesirableEffect() { 
2693      if (this.undesirableEffect == null)
2694        if (Configuration.errorOnAutoCreate())
2695          throw new Error("Attempt to auto-create ClinicalUseIssue.undesirableEffect");
2696        else if (Configuration.doAutoCreate())
2697          this.undesirableEffect = new ClinicalUseIssueUndesirableEffectComponent(); // cc
2698      return this.undesirableEffect;
2699    }
2700
2701    public boolean hasUndesirableEffect() { 
2702      return this.undesirableEffect != null && !this.undesirableEffect.isEmpty();
2703    }
2704
2705    /**
2706     * @param value {@link #undesirableEffect} (Describe the undesirable effects of the medicinal product.)
2707     */
2708    public ClinicalUseIssue setUndesirableEffect(ClinicalUseIssueUndesirableEffectComponent value) { 
2709      this.undesirableEffect = value;
2710      return this;
2711    }
2712
2713      protected void listChildren(List<Property> children) {
2714        super.listChildren(children);
2715        children.add(new Property("identifier", "Identifier", "Business identifier for this issue.", 0, java.lang.Integer.MAX_VALUE, identifier));
2716        children.add(new Property("type", "code", "indication | contraindication | interaction | undesirable-effect | other.", 0, 1, type));
2717        children.add(new Property("subject", "Reference(MedicinalProductDefinition|Medication|ActivityDefinition|PlanDefinition|Device|DeviceDefinition|Substance)", "The medication or procedure for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject));
2718        children.add(new Property("status", "CodeableConcept", "General description.", 0, 1, status));
2719        children.add(new Property("description", "markdown", "General description.", 0, 1, description));
2720        children.add(new Property("contraindication", "", "Specifics for when this is a contraindication.", 0, 1, contraindication));
2721        children.add(new Property("indication", "", "Specifics for when this is an indication.", 0, 1, indication));
2722        children.add(new Property("interaction", "", "Specifics for when this is an interaction.", 0, 1, interaction));
2723        children.add(new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population));
2724        children.add(new Property("undesirableEffect", "", "Describe the undesirable effects of the medicinal product.", 0, 1, undesirableEffect));
2725      }
2726
2727      @Override
2728      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2729        switch (_hash) {
2730        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifier for this issue.", 0, java.lang.Integer.MAX_VALUE, identifier);
2731        case 3575610: /*type*/  return new Property("type", "code", "indication | contraindication | interaction | undesirable-effect | other.", 0, 1, type);
2732        case -1867885268: /*subject*/  return new Property("subject", "Reference(MedicinalProductDefinition|Medication|ActivityDefinition|PlanDefinition|Device|DeviceDefinition|Substance)", "The medication or procedure for which this is an indication.", 0, java.lang.Integer.MAX_VALUE, subject);
2733        case -892481550: /*status*/  return new Property("status", "CodeableConcept", "General description.", 0, 1, status);
2734        case -1724546052: /*description*/  return new Property("description", "markdown", "General description.", 0, 1, description);
2735        case 107135229: /*contraindication*/  return new Property("contraindication", "", "Specifics for when this is a contraindication.", 0, 1, contraindication);
2736        case -597168804: /*indication*/  return new Property("indication", "", "Specifics for when this is an indication.", 0, 1, indication);
2737        case 1844104722: /*interaction*/  return new Property("interaction", "", "Specifics for when this is an interaction.", 0, 1, interaction);
2738        case -2023558323: /*population*/  return new Property("population", "Population", "The population group to which this applies.", 0, java.lang.Integer.MAX_VALUE, population);
2739        case 444367565: /*undesirableEffect*/  return new Property("undesirableEffect", "", "Describe the undesirable effects of the medicinal product.", 0, 1, undesirableEffect);
2740        default: return super.getNamedProperty(_hash, _name, _checkValid);
2741        }
2742
2743      }
2744
2745      @Override
2746      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2747        switch (hash) {
2748        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2749        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<ClinicalUseIssueType>
2750        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
2751        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
2752        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
2753        case 107135229: /*contraindication*/ return this.contraindication == null ? new Base[0] : new Base[] {this.contraindication}; // ClinicalUseIssueContraindicationComponent
2754        case -597168804: /*indication*/ return this.indication == null ? new Base[0] : new Base[] {this.indication}; // ClinicalUseIssueIndicationComponent
2755        case 1844104722: /*interaction*/ return this.interaction == null ? new Base[0] : new Base[] {this.interaction}; // ClinicalUseIssueInteractionComponent
2756        case -2023558323: /*population*/ return this.population == null ? new Base[0] : this.population.toArray(new Base[this.population.size()]); // Population
2757        case 444367565: /*undesirableEffect*/ return this.undesirableEffect == null ? new Base[0] : new Base[] {this.undesirableEffect}; // ClinicalUseIssueUndesirableEffectComponent
2758        default: return super.getProperty(hash, name, checkValid);
2759        }
2760
2761      }
2762
2763      @Override
2764      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2765        switch (hash) {
2766        case -1618432855: // identifier
2767          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2768          return value;
2769        case 3575610: // type
2770          value = new ClinicalUseIssueTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
2771          this.type = (Enumeration) value; // Enumeration<ClinicalUseIssueType>
2772          return value;
2773        case -1867885268: // subject
2774          this.getSubject().add(TypeConvertor.castToReference(value)); // Reference
2775          return value;
2776        case -892481550: // status
2777          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2778          return value;
2779        case -1724546052: // description
2780          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
2781          return value;
2782        case 107135229: // contraindication
2783          this.contraindication = (ClinicalUseIssueContraindicationComponent) value; // ClinicalUseIssueContraindicationComponent
2784          return value;
2785        case -597168804: // indication
2786          this.indication = (ClinicalUseIssueIndicationComponent) value; // ClinicalUseIssueIndicationComponent
2787          return value;
2788        case 1844104722: // interaction
2789          this.interaction = (ClinicalUseIssueInteractionComponent) value; // ClinicalUseIssueInteractionComponent
2790          return value;
2791        case -2023558323: // population
2792          this.getPopulation().add(TypeConvertor.castToPopulation(value)); // Population
2793          return value;
2794        case 444367565: // undesirableEffect
2795          this.undesirableEffect = (ClinicalUseIssueUndesirableEffectComponent) value; // ClinicalUseIssueUndesirableEffectComponent
2796          return value;
2797        default: return super.setProperty(hash, name, value);
2798        }
2799
2800      }
2801
2802      @Override
2803      public Base setProperty(String name, Base value) throws FHIRException {
2804        if (name.equals("identifier")) {
2805          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2806        } else if (name.equals("type")) {
2807          value = new ClinicalUseIssueTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
2808          this.type = (Enumeration) value; // Enumeration<ClinicalUseIssueType>
2809        } else if (name.equals("subject")) {
2810          this.getSubject().add(TypeConvertor.castToReference(value));
2811        } else if (name.equals("status")) {
2812          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2813        } else if (name.equals("description")) {
2814          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
2815        } else if (name.equals("contraindication")) {
2816          this.contraindication = (ClinicalUseIssueContraindicationComponent) value; // ClinicalUseIssueContraindicationComponent
2817        } else if (name.equals("indication")) {
2818          this.indication = (ClinicalUseIssueIndicationComponent) value; // ClinicalUseIssueIndicationComponent
2819        } else if (name.equals("interaction")) {
2820          this.interaction = (ClinicalUseIssueInteractionComponent) value; // ClinicalUseIssueInteractionComponent
2821        } else if (name.equals("population")) {
2822          this.getPopulation().add(TypeConvertor.castToPopulation(value));
2823        } else if (name.equals("undesirableEffect")) {
2824          this.undesirableEffect = (ClinicalUseIssueUndesirableEffectComponent) value; // ClinicalUseIssueUndesirableEffectComponent
2825        } else
2826          return super.setProperty(name, value);
2827        return value;
2828      }
2829
2830      @Override
2831      public Base makeProperty(int hash, String name) throws FHIRException {
2832        switch (hash) {
2833        case -1618432855:  return addIdentifier(); 
2834        case 3575610:  return getTypeElement();
2835        case -1867885268:  return addSubject(); 
2836        case -892481550:  return getStatus();
2837        case -1724546052:  return getDescriptionElement();
2838        case 107135229:  return getContraindication();
2839        case -597168804:  return getIndication();
2840        case 1844104722:  return getInteraction();
2841        case -2023558323:  return addPopulation(); 
2842        case 444367565:  return getUndesirableEffect();
2843        default: return super.makeProperty(hash, name);
2844        }
2845
2846      }
2847
2848      @Override
2849      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2850        switch (hash) {
2851        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2852        case 3575610: /*type*/ return new String[] {"code"};
2853        case -1867885268: /*subject*/ return new String[] {"Reference"};
2854        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
2855        case -1724546052: /*description*/ return new String[] {"markdown"};
2856        case 107135229: /*contraindication*/ return new String[] {};
2857        case -597168804: /*indication*/ return new String[] {};
2858        case 1844104722: /*interaction*/ return new String[] {};
2859        case -2023558323: /*population*/ return new String[] {"Population"};
2860        case 444367565: /*undesirableEffect*/ return new String[] {};
2861        default: return super.getTypesForProperty(hash, name);
2862        }
2863
2864      }
2865
2866      @Override
2867      public Base addChild(String name) throws FHIRException {
2868        if (name.equals("identifier")) {
2869          return addIdentifier();
2870        }
2871        else if (name.equals("type")) {
2872          throw new FHIRException("Cannot call addChild on a primitive type ClinicalUseIssue.type");
2873        }
2874        else if (name.equals("subject")) {
2875          return addSubject();
2876        }
2877        else if (name.equals("status")) {
2878          this.status = new CodeableConcept();
2879          return this.status;
2880        }
2881        else if (name.equals("description")) {
2882          throw new FHIRException("Cannot call addChild on a primitive type ClinicalUseIssue.description");
2883        }
2884        else if (name.equals("contraindication")) {
2885          this.contraindication = new ClinicalUseIssueContraindicationComponent();
2886          return this.contraindication;
2887        }
2888        else if (name.equals("indication")) {
2889          this.indication = new ClinicalUseIssueIndicationComponent();
2890          return this.indication;
2891        }
2892        else if (name.equals("interaction")) {
2893          this.interaction = new ClinicalUseIssueInteractionComponent();
2894          return this.interaction;
2895        }
2896        else if (name.equals("population")) {
2897          return addPopulation();
2898        }
2899        else if (name.equals("undesirableEffect")) {
2900          this.undesirableEffect = new ClinicalUseIssueUndesirableEffectComponent();
2901          return this.undesirableEffect;
2902        }
2903        else
2904          return super.addChild(name);
2905      }
2906
2907  public String fhirType() {
2908    return "ClinicalUseIssue";
2909
2910  }
2911
2912      public ClinicalUseIssue copy() {
2913        ClinicalUseIssue dst = new ClinicalUseIssue();
2914        copyValues(dst);
2915        return dst;
2916      }
2917
2918      public void copyValues(ClinicalUseIssue dst) {
2919        super.copyValues(dst);
2920        if (identifier != null) {
2921          dst.identifier = new ArrayList<Identifier>();
2922          for (Identifier i : identifier)
2923            dst.identifier.add(i.copy());
2924        };
2925        dst.type = type == null ? null : type.copy();
2926        if (subject != null) {
2927          dst.subject = new ArrayList<Reference>();
2928          for (Reference i : subject)
2929            dst.subject.add(i.copy());
2930        };
2931        dst.status = status == null ? null : status.copy();
2932        dst.description = description == null ? null : description.copy();
2933        dst.contraindication = contraindication == null ? null : contraindication.copy();
2934        dst.indication = indication == null ? null : indication.copy();
2935        dst.interaction = interaction == null ? null : interaction.copy();
2936        if (population != null) {
2937          dst.population = new ArrayList<Population>();
2938          for (Population i : population)
2939            dst.population.add(i.copy());
2940        };
2941        dst.undesirableEffect = undesirableEffect == null ? null : undesirableEffect.copy();
2942      }
2943
2944      protected ClinicalUseIssue typedCopy() {
2945        return copy();
2946      }
2947
2948      @Override
2949      public boolean equalsDeep(Base other_) {
2950        if (!super.equalsDeep(other_))
2951          return false;
2952        if (!(other_ instanceof ClinicalUseIssue))
2953          return false;
2954        ClinicalUseIssue o = (ClinicalUseIssue) other_;
2955        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(subject, o.subject, true)
2956           && compareDeep(status, o.status, true) && compareDeep(description, o.description, true) && compareDeep(contraindication, o.contraindication, true)
2957           && compareDeep(indication, o.indication, true) && compareDeep(interaction, o.interaction, true)
2958           && compareDeep(population, o.population, true) && compareDeep(undesirableEffect, o.undesirableEffect, true)
2959          ;
2960      }
2961
2962      @Override
2963      public boolean equalsShallow(Base other_) {
2964        if (!super.equalsShallow(other_))
2965          return false;
2966        if (!(other_ instanceof ClinicalUseIssue))
2967          return false;
2968        ClinicalUseIssue o = (ClinicalUseIssue) other_;
2969        return compareValues(type, o.type, true) && compareValues(description, o.description, true);
2970      }
2971
2972      public boolean isEmpty() {
2973        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, subject
2974          , status, description, contraindication, indication, interaction, population, undesirableEffect
2975          );
2976      }
2977
2978  @Override
2979  public ResourceType getResourceType() {
2980    return ResourceType.ClinicalUseIssue;
2981   }
2982
2983 /**
2984   * Search parameter: <b>contraindication</b>
2985   * <p>
2986   * Description: <b>The situation that is being documented as contraindicating against this item</b><br>
2987   * Type: <b>token</b><br>
2988   * Path: <b>ClinicalUseIssue.contraindication.diseaseSymptomProcedure</b><br>
2989   * </p>
2990   */
2991  @SearchParamDefinition(name="contraindication", path="ClinicalUseIssue.contraindication.diseaseSymptomProcedure", description="The situation that is being documented as contraindicating against this item", type="token" )
2992  public static final String SP_CONTRAINDICATION = "contraindication";
2993 /**
2994   * <b>Fluent Client</b> search parameter constant for <b>contraindication</b>
2995   * <p>
2996   * Description: <b>The situation that is being documented as contraindicating against this item</b><br>
2997   * Type: <b>token</b><br>
2998   * Path: <b>ClinicalUseIssue.contraindication.diseaseSymptomProcedure</b><br>
2999   * </p>
3000   */
3001  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTRAINDICATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTRAINDICATION);
3002
3003 /**
3004   * Search parameter: <b>effect</b>
3005   * <p>
3006   * Description: <b>The situation in which the undesirable effect may manifest</b><br>
3007   * Type: <b>token</b><br>
3008   * Path: <b>ClinicalUseIssue.undesirableEffect.symptomConditionEffect</b><br>
3009   * </p>
3010   */
3011  @SearchParamDefinition(name="effect", path="ClinicalUseIssue.undesirableEffect.symptomConditionEffect", description="The situation in which the undesirable effect may manifest", type="token" )
3012  public static final String SP_EFFECT = "effect";
3013 /**
3014   * <b>Fluent Client</b> search parameter constant for <b>effect</b>
3015   * <p>
3016   * Description: <b>The situation in which the undesirable effect may manifest</b><br>
3017   * Type: <b>token</b><br>
3018   * Path: <b>ClinicalUseIssue.undesirableEffect.symptomConditionEffect</b><br>
3019   * </p>
3020   */
3021  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EFFECT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EFFECT);
3022
3023 /**
3024   * Search parameter: <b>identifier</b>
3025   * <p>
3026   * Description: <b>Business identifier for this issue</b><br>
3027   * Type: <b>token</b><br>
3028   * Path: <b>ClinicalUseIssue.identifier</b><br>
3029   * </p>
3030   */
3031  @SearchParamDefinition(name="identifier", path="ClinicalUseIssue.identifier", description="Business identifier for this issue", type="token" )
3032  public static final String SP_IDENTIFIER = "identifier";
3033 /**
3034   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3035   * <p>
3036   * Description: <b>Business identifier for this issue</b><br>
3037   * Type: <b>token</b><br>
3038   * Path: <b>ClinicalUseIssue.identifier</b><br>
3039   * </p>
3040   */
3041  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3042
3043 /**
3044   * Search parameter: <b>indication</b>
3045   * <p>
3046   * Description: <b>The situation that is being documented as an indicaton for this item</b><br>
3047   * Type: <b>token</b><br>
3048   * Path: <b>ClinicalUseIssue.indication.diseaseSymptomProcedure</b><br>
3049   * </p>
3050   */
3051  @SearchParamDefinition(name="indication", path="ClinicalUseIssue.indication.diseaseSymptomProcedure", description="The situation that is being documented as an indicaton for this item", type="token" )
3052  public static final String SP_INDICATION = "indication";
3053 /**
3054   * <b>Fluent Client</b> search parameter constant for <b>indication</b>
3055   * <p>
3056   * Description: <b>The situation that is being documented as an indicaton for this item</b><br>
3057   * Type: <b>token</b><br>
3058   * Path: <b>ClinicalUseIssue.indication.diseaseSymptomProcedure</b><br>
3059   * </p>
3060   */
3061  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INDICATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INDICATION);
3062
3063 /**
3064   * Search parameter: <b>interaction</b>
3065   * <p>
3066   * Description: <b>The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction</b><br>
3067   * Type: <b>token</b><br>
3068   * Path: <b>ClinicalUseIssue.interaction.type</b><br>
3069   * </p>
3070   */
3071  @SearchParamDefinition(name="interaction", path="ClinicalUseIssue.interaction.type", description="The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction", type="token" )
3072  public static final String SP_INTERACTION = "interaction";
3073 /**
3074   * <b>Fluent Client</b> search parameter constant for <b>interaction</b>
3075   * <p>
3076   * Description: <b>The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction</b><br>
3077   * Type: <b>token</b><br>
3078   * Path: <b>ClinicalUseIssue.interaction.type</b><br>
3079   * </p>
3080   */
3081  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTERACTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTERACTION);
3082
3083 /**
3084   * Search parameter: <b>product</b>
3085   * <p>
3086   * Description: <b>The medicinal product for which this is a clinical usage issue</b><br>
3087   * Type: <b>reference</b><br>
3088   * Path: <b>ClinicalUseIssue.subject.where(resolve() is MedicinalProductDefinition)</b><br>
3089   * </p>
3090   */
3091  @SearchParamDefinition(name="product", path="ClinicalUseIssue.subject.where(resolve() is MedicinalProductDefinition)", description="The medicinal product for which this is a clinical usage issue", type="reference", target={MedicinalProductDefinition.class } )
3092  public static final String SP_PRODUCT = "product";
3093 /**
3094   * <b>Fluent Client</b> search parameter constant for <b>product</b>
3095   * <p>
3096   * Description: <b>The medicinal product for which this is a clinical usage issue</b><br>
3097   * Type: <b>reference</b><br>
3098   * Path: <b>ClinicalUseIssue.subject.where(resolve() is MedicinalProductDefinition)</b><br>
3099   * </p>
3100   */
3101  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRODUCT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRODUCT);
3102
3103/**
3104   * Constant for fluent queries to be used to add include statements. Specifies
3105   * the path value of "<b>ClinicalUseIssue:product</b>".
3106   */
3107  public static final ca.uhn.fhir.model.api.Include INCLUDE_PRODUCT = new ca.uhn.fhir.model.api.Include("ClinicalUseIssue:product").toLocked();
3108
3109 /**
3110   * Search parameter: <b>subject</b>
3111   * <p>
3112   * Description: <b>The resource for which this is a clinical usage issue</b><br>
3113   * Type: <b>reference</b><br>
3114   * Path: <b>ClinicalUseIssue.subject</b><br>
3115   * </p>
3116   */
3117  @SearchParamDefinition(name="subject", path="ClinicalUseIssue.subject", description="The resource for which this is a clinical usage issue", type="reference", target={ActivityDefinition.class, Device.class, DeviceDefinition.class, Medication.class, MedicinalProductDefinition.class, PlanDefinition.class, Substance.class } )
3118  public static final String SP_SUBJECT = "subject";
3119 /**
3120   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3121   * <p>
3122   * Description: <b>The resource for which this is a clinical usage issue</b><br>
3123   * Type: <b>reference</b><br>
3124   * Path: <b>ClinicalUseIssue.subject</b><br>
3125   * </p>
3126   */
3127  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
3128
3129/**
3130   * Constant for fluent queries to be used to add include statements. Specifies
3131   * the path value of "<b>ClinicalUseIssue:subject</b>".
3132   */
3133  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("ClinicalUseIssue:subject").toLocked();
3134
3135 /**
3136   * Search parameter: <b>type</b>
3137   * <p>
3138   * Description: <b>indication | contraindication | interaction | undesirable-effect | other</b><br>
3139   * Type: <b>token</b><br>
3140   * Path: <b>ClinicalUseIssue.type</b><br>
3141   * </p>
3142   */
3143  @SearchParamDefinition(name="type", path="ClinicalUseIssue.type", description="indication | contraindication | interaction | undesirable-effect | other", type="token" )
3144  public static final String SP_TYPE = "type";
3145 /**
3146   * <b>Fluent Client</b> search parameter constant for <b>type</b>
3147   * <p>
3148   * Description: <b>indication | contraindication | interaction | undesirable-effect | other</b><br>
3149   * Type: <b>token</b><br>
3150   * Path: <b>ClinicalUseIssue.type</b><br>
3151   * </p>
3152   */
3153  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
3154
3155
3156}
3157