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