001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * A pharmaceutical product described in terms of its composition and dose form.
050 */
051@ResourceDef(name="MedicinalProductPharmaceutical", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductPharmaceutical")
052public class MedicinalProductPharmaceutical extends DomainResource {
053
054    @Block()
055    public static class MedicinalProductPharmaceuticalCharacteristicsComponent extends BackboneElement implements IBaseBackboneElement {
056        /**
057         * A coded characteristic.
058         */
059        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
060        @Description(shortDefinition="A coded characteristic", formalDefinition="A coded characteristic." )
061        protected CodeableConcept code;
062
063        /**
064         * The status of characteristic e.g. assigned or pending.
065         */
066        @Child(name = "status", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
067        @Description(shortDefinition="The status of characteristic e.g. assigned or pending", formalDefinition="The status of characteristic e.g. assigned or pending." )
068        protected CodeableConcept status;
069
070        private static final long serialVersionUID = 1414556635L;
071
072    /**
073     * Constructor
074     */
075      public MedicinalProductPharmaceuticalCharacteristicsComponent() {
076        super();
077      }
078
079    /**
080     * Constructor
081     */
082      public MedicinalProductPharmaceuticalCharacteristicsComponent(CodeableConcept code) {
083        super();
084        this.code = code;
085      }
086
087        /**
088         * @return {@link #code} (A coded characteristic.)
089         */
090        public CodeableConcept getCode() { 
091          if (this.code == null)
092            if (Configuration.errorOnAutoCreate())
093              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalCharacteristicsComponent.code");
094            else if (Configuration.doAutoCreate())
095              this.code = new CodeableConcept(); // cc
096          return this.code;
097        }
098
099        public boolean hasCode() { 
100          return this.code != null && !this.code.isEmpty();
101        }
102
103        /**
104         * @param value {@link #code} (A coded characteristic.)
105         */
106        public MedicinalProductPharmaceuticalCharacteristicsComponent setCode(CodeableConcept value) { 
107          this.code = value;
108          return this;
109        }
110
111        /**
112         * @return {@link #status} (The status of characteristic e.g. assigned or pending.)
113         */
114        public CodeableConcept getStatus() { 
115          if (this.status == null)
116            if (Configuration.errorOnAutoCreate())
117              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalCharacteristicsComponent.status");
118            else if (Configuration.doAutoCreate())
119              this.status = new CodeableConcept(); // cc
120          return this.status;
121        }
122
123        public boolean hasStatus() { 
124          return this.status != null && !this.status.isEmpty();
125        }
126
127        /**
128         * @param value {@link #status} (The status of characteristic e.g. assigned or pending.)
129         */
130        public MedicinalProductPharmaceuticalCharacteristicsComponent setStatus(CodeableConcept value) { 
131          this.status = value;
132          return this;
133        }
134
135        protected void listChildren(List<Property> children) {
136          super.listChildren(children);
137          children.add(new Property("code", "CodeableConcept", "A coded characteristic.", 0, 1, code));
138          children.add(new Property("status", "CodeableConcept", "The status of characteristic e.g. assigned or pending.", 0, 1, status));
139        }
140
141        @Override
142        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
143          switch (_hash) {
144          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A coded characteristic.", 0, 1, code);
145          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status of characteristic e.g. assigned or pending.", 0, 1, status);
146          default: return super.getNamedProperty(_hash, _name, _checkValid);
147          }
148
149        }
150
151      @Override
152      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
153        switch (hash) {
154        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
155        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
156        default: return super.getProperty(hash, name, checkValid);
157        }
158
159      }
160
161      @Override
162      public Base setProperty(int hash, String name, Base value) throws FHIRException {
163        switch (hash) {
164        case 3059181: // code
165          this.code = castToCodeableConcept(value); // CodeableConcept
166          return value;
167        case -892481550: // status
168          this.status = castToCodeableConcept(value); // CodeableConcept
169          return value;
170        default: return super.setProperty(hash, name, value);
171        }
172
173      }
174
175      @Override
176      public Base setProperty(String name, Base value) throws FHIRException {
177        if (name.equals("code")) {
178          this.code = castToCodeableConcept(value); // CodeableConcept
179        } else if (name.equals("status")) {
180          this.status = castToCodeableConcept(value); // CodeableConcept
181        } else
182          return super.setProperty(name, value);
183        return value;
184      }
185
186      @Override
187      public Base makeProperty(int hash, String name) throws FHIRException {
188        switch (hash) {
189        case 3059181:  return getCode(); 
190        case -892481550:  return getStatus(); 
191        default: return super.makeProperty(hash, name);
192        }
193
194      }
195
196      @Override
197      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
198        switch (hash) {
199        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
200        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
201        default: return super.getTypesForProperty(hash, name);
202        }
203
204      }
205
206      @Override
207      public Base addChild(String name) throws FHIRException {
208        if (name.equals("code")) {
209          this.code = new CodeableConcept();
210          return this.code;
211        }
212        else if (name.equals("status")) {
213          this.status = new CodeableConcept();
214          return this.status;
215        }
216        else
217          return super.addChild(name);
218      }
219
220      public MedicinalProductPharmaceuticalCharacteristicsComponent copy() {
221        MedicinalProductPharmaceuticalCharacteristicsComponent dst = new MedicinalProductPharmaceuticalCharacteristicsComponent();
222        copyValues(dst);
223        return dst;
224      }
225
226      public void copyValues(MedicinalProductPharmaceuticalCharacteristicsComponent dst) {
227        super.copyValues(dst);
228        dst.code = code == null ? null : code.copy();
229        dst.status = status == null ? null : status.copy();
230      }
231
232      @Override
233      public boolean equalsDeep(Base other_) {
234        if (!super.equalsDeep(other_))
235          return false;
236        if (!(other_ instanceof MedicinalProductPharmaceuticalCharacteristicsComponent))
237          return false;
238        MedicinalProductPharmaceuticalCharacteristicsComponent o = (MedicinalProductPharmaceuticalCharacteristicsComponent) other_;
239        return compareDeep(code, o.code, true) && compareDeep(status, o.status, true);
240      }
241
242      @Override
243      public boolean equalsShallow(Base other_) {
244        if (!super.equalsShallow(other_))
245          return false;
246        if (!(other_ instanceof MedicinalProductPharmaceuticalCharacteristicsComponent))
247          return false;
248        MedicinalProductPharmaceuticalCharacteristicsComponent o = (MedicinalProductPharmaceuticalCharacteristicsComponent) other_;
249        return true;
250      }
251
252      public boolean isEmpty() {
253        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, status);
254      }
255
256  public String fhirType() {
257    return "MedicinalProductPharmaceutical.characteristics";
258
259  }
260
261  }
262
263    @Block()
264    public static class MedicinalProductPharmaceuticalRouteOfAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
265        /**
266         * Coded expression for the route.
267         */
268        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
269        @Description(shortDefinition="Coded expression for the route", formalDefinition="Coded expression for the route." )
270        protected CodeableConcept code;
271
272        /**
273         * The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.
274         */
275        @Child(name = "firstDose", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=true)
276        @Description(shortDefinition="The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement", formalDefinition="The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement." )
277        protected Quantity firstDose;
278
279        /**
280         * The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.
281         */
282        @Child(name = "maxSingleDose", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true)
283        @Description(shortDefinition="The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement", formalDefinition="The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement." )
284        protected Quantity maxSingleDose;
285
286        /**
287         * The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation.
288         */
289        @Child(name = "maxDosePerDay", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=true)
290        @Description(shortDefinition="The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation", formalDefinition="The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation." )
291        protected Quantity maxDosePerDay;
292
293        /**
294         * The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.
295         */
296        @Child(name = "maxDosePerTreatmentPeriod", type = {Ratio.class}, order=5, min=0, max=1, modifier=false, summary=true)
297        @Description(shortDefinition="The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation", formalDefinition="The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation." )
298        protected Ratio maxDosePerTreatmentPeriod;
299
300        /**
301         * The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.
302         */
303        @Child(name = "maxTreatmentPeriod", type = {Duration.class}, order=6, min=0, max=1, modifier=false, summary=true)
304        @Description(shortDefinition="The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation", formalDefinition="The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation." )
305        protected Duration maxTreatmentPeriod;
306
307        /**
308         * A species for which this route applies.
309         */
310        @Child(name = "targetSpecies", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
311        @Description(shortDefinition="A species for which this route applies", formalDefinition="A species for which this route applies." )
312        protected List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent> targetSpecies;
313
314        private static final long serialVersionUID = 854394783L;
315
316    /**
317     * Constructor
318     */
319      public MedicinalProductPharmaceuticalRouteOfAdministrationComponent() {
320        super();
321      }
322
323    /**
324     * Constructor
325     */
326      public MedicinalProductPharmaceuticalRouteOfAdministrationComponent(CodeableConcept code) {
327        super();
328        this.code = code;
329      }
330
331        /**
332         * @return {@link #code} (Coded expression for the route.)
333         */
334        public CodeableConcept getCode() { 
335          if (this.code == null)
336            if (Configuration.errorOnAutoCreate())
337              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.code");
338            else if (Configuration.doAutoCreate())
339              this.code = new CodeableConcept(); // cc
340          return this.code;
341        }
342
343        public boolean hasCode() { 
344          return this.code != null && !this.code.isEmpty();
345        }
346
347        /**
348         * @param value {@link #code} (Coded expression for the route.)
349         */
350        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setCode(CodeableConcept value) { 
351          this.code = value;
352          return this;
353        }
354
355        /**
356         * @return {@link #firstDose} (The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.)
357         */
358        public Quantity getFirstDose() { 
359          if (this.firstDose == null)
360            if (Configuration.errorOnAutoCreate())
361              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.firstDose");
362            else if (Configuration.doAutoCreate())
363              this.firstDose = new Quantity(); // cc
364          return this.firstDose;
365        }
366
367        public boolean hasFirstDose() { 
368          return this.firstDose != null && !this.firstDose.isEmpty();
369        }
370
371        /**
372         * @param value {@link #firstDose} (The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.)
373         */
374        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setFirstDose(Quantity value) { 
375          this.firstDose = value;
376          return this;
377        }
378
379        /**
380         * @return {@link #maxSingleDose} (The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.)
381         */
382        public Quantity getMaxSingleDose() { 
383          if (this.maxSingleDose == null)
384            if (Configuration.errorOnAutoCreate())
385              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.maxSingleDose");
386            else if (Configuration.doAutoCreate())
387              this.maxSingleDose = new Quantity(); // cc
388          return this.maxSingleDose;
389        }
390
391        public boolean hasMaxSingleDose() { 
392          return this.maxSingleDose != null && !this.maxSingleDose.isEmpty();
393        }
394
395        /**
396         * @param value {@link #maxSingleDose} (The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.)
397         */
398        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setMaxSingleDose(Quantity value) { 
399          this.maxSingleDose = value;
400          return this;
401        }
402
403        /**
404         * @return {@link #maxDosePerDay} (The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation.)
405         */
406        public Quantity getMaxDosePerDay() { 
407          if (this.maxDosePerDay == null)
408            if (Configuration.errorOnAutoCreate())
409              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.maxDosePerDay");
410            else if (Configuration.doAutoCreate())
411              this.maxDosePerDay = new Quantity(); // cc
412          return this.maxDosePerDay;
413        }
414
415        public boolean hasMaxDosePerDay() { 
416          return this.maxDosePerDay != null && !this.maxDosePerDay.isEmpty();
417        }
418
419        /**
420         * @param value {@link #maxDosePerDay} (The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation.)
421         */
422        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setMaxDosePerDay(Quantity value) { 
423          this.maxDosePerDay = value;
424          return this;
425        }
426
427        /**
428         * @return {@link #maxDosePerTreatmentPeriod} (The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.)
429         */
430        public Ratio getMaxDosePerTreatmentPeriod() { 
431          if (this.maxDosePerTreatmentPeriod == null)
432            if (Configuration.errorOnAutoCreate())
433              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.maxDosePerTreatmentPeriod");
434            else if (Configuration.doAutoCreate())
435              this.maxDosePerTreatmentPeriod = new Ratio(); // cc
436          return this.maxDosePerTreatmentPeriod;
437        }
438
439        public boolean hasMaxDosePerTreatmentPeriod() { 
440          return this.maxDosePerTreatmentPeriod != null && !this.maxDosePerTreatmentPeriod.isEmpty();
441        }
442
443        /**
444         * @param value {@link #maxDosePerTreatmentPeriod} (The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.)
445         */
446        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setMaxDosePerTreatmentPeriod(Ratio value) { 
447          this.maxDosePerTreatmentPeriod = value;
448          return this;
449        }
450
451        /**
452         * @return {@link #maxTreatmentPeriod} (The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.)
453         */
454        public Duration getMaxTreatmentPeriod() { 
455          if (this.maxTreatmentPeriod == null)
456            if (Configuration.errorOnAutoCreate())
457              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.maxTreatmentPeriod");
458            else if (Configuration.doAutoCreate())
459              this.maxTreatmentPeriod = new Duration(); // cc
460          return this.maxTreatmentPeriod;
461        }
462
463        public boolean hasMaxTreatmentPeriod() { 
464          return this.maxTreatmentPeriod != null && !this.maxTreatmentPeriod.isEmpty();
465        }
466
467        /**
468         * @param value {@link #maxTreatmentPeriod} (The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.)
469         */
470        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setMaxTreatmentPeriod(Duration value) { 
471          this.maxTreatmentPeriod = value;
472          return this;
473        }
474
475        /**
476         * @return {@link #targetSpecies} (A species for which this route applies.)
477         */
478        public List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent> getTargetSpecies() { 
479          if (this.targetSpecies == null)
480            this.targetSpecies = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent>();
481          return this.targetSpecies;
482        }
483
484        /**
485         * @return Returns a reference to <code>this</code> for easy method chaining
486         */
487        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setTargetSpecies(List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent> theTargetSpecies) { 
488          this.targetSpecies = theTargetSpecies;
489          return this;
490        }
491
492        public boolean hasTargetSpecies() { 
493          if (this.targetSpecies == null)
494            return false;
495          for (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent item : this.targetSpecies)
496            if (!item.isEmpty())
497              return true;
498          return false;
499        }
500
501        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent addTargetSpecies() { //3
502          MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent t = new MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
503          if (this.targetSpecies == null)
504            this.targetSpecies = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent>();
505          this.targetSpecies.add(t);
506          return t;
507        }
508
509        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent addTargetSpecies(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent t) { //3
510          if (t == null)
511            return this;
512          if (this.targetSpecies == null)
513            this.targetSpecies = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent>();
514          this.targetSpecies.add(t);
515          return this;
516        }
517
518        /**
519         * @return The first repetition of repeating field {@link #targetSpecies}, creating it if it does not already exist
520         */
521        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent getTargetSpeciesFirstRep() { 
522          if (getTargetSpecies().isEmpty()) {
523            addTargetSpecies();
524          }
525          return getTargetSpecies().get(0);
526        }
527
528        protected void listChildren(List<Property> children) {
529          super.listChildren(children);
530          children.add(new Property("code", "CodeableConcept", "Coded expression for the route.", 0, 1, code));
531          children.add(new Property("firstDose", "Quantity", "The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.", 0, 1, firstDose));
532          children.add(new Property("maxSingleDose", "Quantity", "The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.", 0, 1, maxSingleDose));
533          children.add(new Property("maxDosePerDay", "Quantity", "The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxDosePerDay));
534          children.add(new Property("maxDosePerTreatmentPeriod", "Ratio", "The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxDosePerTreatmentPeriod));
535          children.add(new Property("maxTreatmentPeriod", "Duration", "The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxTreatmentPeriod));
536          children.add(new Property("targetSpecies", "", "A species for which this route applies.", 0, java.lang.Integer.MAX_VALUE, targetSpecies));
537        }
538
539        @Override
540        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
541          switch (_hash) {
542          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded expression for the route.", 0, 1, code);
543          case 132551405: /*firstDose*/  return new Property("firstDose", "Quantity", "The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.", 0, 1, firstDose);
544          case -259207927: /*maxSingleDose*/  return new Property("maxSingleDose", "Quantity", "The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.", 0, 1, maxSingleDose);
545          case -2017475520: /*maxDosePerDay*/  return new Property("maxDosePerDay", "Quantity", "The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxDosePerDay);
546          case -608040195: /*maxDosePerTreatmentPeriod*/  return new Property("maxDosePerTreatmentPeriod", "Ratio", "The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxDosePerTreatmentPeriod);
547          case 920698453: /*maxTreatmentPeriod*/  return new Property("maxTreatmentPeriod", "Duration", "The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxTreatmentPeriod);
548          case 295481963: /*targetSpecies*/  return new Property("targetSpecies", "", "A species for which this route applies.", 0, java.lang.Integer.MAX_VALUE, targetSpecies);
549          default: return super.getNamedProperty(_hash, _name, _checkValid);
550          }
551
552        }
553
554      @Override
555      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
556        switch (hash) {
557        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
558        case 132551405: /*firstDose*/ return this.firstDose == null ? new Base[0] : new Base[] {this.firstDose}; // Quantity
559        case -259207927: /*maxSingleDose*/ return this.maxSingleDose == null ? new Base[0] : new Base[] {this.maxSingleDose}; // Quantity
560        case -2017475520: /*maxDosePerDay*/ return this.maxDosePerDay == null ? new Base[0] : new Base[] {this.maxDosePerDay}; // Quantity
561        case -608040195: /*maxDosePerTreatmentPeriod*/ return this.maxDosePerTreatmentPeriod == null ? new Base[0] : new Base[] {this.maxDosePerTreatmentPeriod}; // Ratio
562        case 920698453: /*maxTreatmentPeriod*/ return this.maxTreatmentPeriod == null ? new Base[0] : new Base[] {this.maxTreatmentPeriod}; // Duration
563        case 295481963: /*targetSpecies*/ return this.targetSpecies == null ? new Base[0] : this.targetSpecies.toArray(new Base[this.targetSpecies.size()]); // MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent
564        default: return super.getProperty(hash, name, checkValid);
565        }
566
567      }
568
569      @Override
570      public Base setProperty(int hash, String name, Base value) throws FHIRException {
571        switch (hash) {
572        case 3059181: // code
573          this.code = castToCodeableConcept(value); // CodeableConcept
574          return value;
575        case 132551405: // firstDose
576          this.firstDose = castToQuantity(value); // Quantity
577          return value;
578        case -259207927: // maxSingleDose
579          this.maxSingleDose = castToQuantity(value); // Quantity
580          return value;
581        case -2017475520: // maxDosePerDay
582          this.maxDosePerDay = castToQuantity(value); // Quantity
583          return value;
584        case -608040195: // maxDosePerTreatmentPeriod
585          this.maxDosePerTreatmentPeriod = castToRatio(value); // Ratio
586          return value;
587        case 920698453: // maxTreatmentPeriod
588          this.maxTreatmentPeriod = castToDuration(value); // Duration
589          return value;
590        case 295481963: // targetSpecies
591          this.getTargetSpecies().add((MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent) value); // MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent
592          return value;
593        default: return super.setProperty(hash, name, value);
594        }
595
596      }
597
598      @Override
599      public Base setProperty(String name, Base value) throws FHIRException {
600        if (name.equals("code")) {
601          this.code = castToCodeableConcept(value); // CodeableConcept
602        } else if (name.equals("firstDose")) {
603          this.firstDose = castToQuantity(value); // Quantity
604        } else if (name.equals("maxSingleDose")) {
605          this.maxSingleDose = castToQuantity(value); // Quantity
606        } else if (name.equals("maxDosePerDay")) {
607          this.maxDosePerDay = castToQuantity(value); // Quantity
608        } else if (name.equals("maxDosePerTreatmentPeriod")) {
609          this.maxDosePerTreatmentPeriod = castToRatio(value); // Ratio
610        } else if (name.equals("maxTreatmentPeriod")) {
611          this.maxTreatmentPeriod = castToDuration(value); // Duration
612        } else if (name.equals("targetSpecies")) {
613          this.getTargetSpecies().add((MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent) value);
614        } else
615          return super.setProperty(name, value);
616        return value;
617      }
618
619      @Override
620      public Base makeProperty(int hash, String name) throws FHIRException {
621        switch (hash) {
622        case 3059181:  return getCode(); 
623        case 132551405:  return getFirstDose(); 
624        case -259207927:  return getMaxSingleDose(); 
625        case -2017475520:  return getMaxDosePerDay(); 
626        case -608040195:  return getMaxDosePerTreatmentPeriod(); 
627        case 920698453:  return getMaxTreatmentPeriod(); 
628        case 295481963:  return addTargetSpecies(); 
629        default: return super.makeProperty(hash, name);
630        }
631
632      }
633
634      @Override
635      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
636        switch (hash) {
637        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
638        case 132551405: /*firstDose*/ return new String[] {"Quantity"};
639        case -259207927: /*maxSingleDose*/ return new String[] {"Quantity"};
640        case -2017475520: /*maxDosePerDay*/ return new String[] {"Quantity"};
641        case -608040195: /*maxDosePerTreatmentPeriod*/ return new String[] {"Ratio"};
642        case 920698453: /*maxTreatmentPeriod*/ return new String[] {"Duration"};
643        case 295481963: /*targetSpecies*/ return new String[] {};
644        default: return super.getTypesForProperty(hash, name);
645        }
646
647      }
648
649      @Override
650      public Base addChild(String name) throws FHIRException {
651        if (name.equals("code")) {
652          this.code = new CodeableConcept();
653          return this.code;
654        }
655        else if (name.equals("firstDose")) {
656          this.firstDose = new Quantity();
657          return this.firstDose;
658        }
659        else if (name.equals("maxSingleDose")) {
660          this.maxSingleDose = new Quantity();
661          return this.maxSingleDose;
662        }
663        else if (name.equals("maxDosePerDay")) {
664          this.maxDosePerDay = new Quantity();
665          return this.maxDosePerDay;
666        }
667        else if (name.equals("maxDosePerTreatmentPeriod")) {
668          this.maxDosePerTreatmentPeriod = new Ratio();
669          return this.maxDosePerTreatmentPeriod;
670        }
671        else if (name.equals("maxTreatmentPeriod")) {
672          this.maxTreatmentPeriod = new Duration();
673          return this.maxTreatmentPeriod;
674        }
675        else if (name.equals("targetSpecies")) {
676          return addTargetSpecies();
677        }
678        else
679          return super.addChild(name);
680      }
681
682      public MedicinalProductPharmaceuticalRouteOfAdministrationComponent copy() {
683        MedicinalProductPharmaceuticalRouteOfAdministrationComponent dst = new MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
684        copyValues(dst);
685        return dst;
686      }
687
688      public void copyValues(MedicinalProductPharmaceuticalRouteOfAdministrationComponent dst) {
689        super.copyValues(dst);
690        dst.code = code == null ? null : code.copy();
691        dst.firstDose = firstDose == null ? null : firstDose.copy();
692        dst.maxSingleDose = maxSingleDose == null ? null : maxSingleDose.copy();
693        dst.maxDosePerDay = maxDosePerDay == null ? null : maxDosePerDay.copy();
694        dst.maxDosePerTreatmentPeriod = maxDosePerTreatmentPeriod == null ? null : maxDosePerTreatmentPeriod.copy();
695        dst.maxTreatmentPeriod = maxTreatmentPeriod == null ? null : maxTreatmentPeriod.copy();
696        if (targetSpecies != null) {
697          dst.targetSpecies = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent>();
698          for (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent i : targetSpecies)
699            dst.targetSpecies.add(i.copy());
700        };
701      }
702
703      @Override
704      public boolean equalsDeep(Base other_) {
705        if (!super.equalsDeep(other_))
706          return false;
707        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationComponent))
708          return false;
709        MedicinalProductPharmaceuticalRouteOfAdministrationComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationComponent) other_;
710        return compareDeep(code, o.code, true) && compareDeep(firstDose, o.firstDose, true) && compareDeep(maxSingleDose, o.maxSingleDose, true)
711           && compareDeep(maxDosePerDay, o.maxDosePerDay, true) && compareDeep(maxDosePerTreatmentPeriod, o.maxDosePerTreatmentPeriod, true)
712           && compareDeep(maxTreatmentPeriod, o.maxTreatmentPeriod, true) && compareDeep(targetSpecies, o.targetSpecies, true)
713          ;
714      }
715
716      @Override
717      public boolean equalsShallow(Base other_) {
718        if (!super.equalsShallow(other_))
719          return false;
720        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationComponent))
721          return false;
722        MedicinalProductPharmaceuticalRouteOfAdministrationComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationComponent) other_;
723        return true;
724      }
725
726      public boolean isEmpty() {
727        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, firstDose, maxSingleDose
728          , maxDosePerDay, maxDosePerTreatmentPeriod, maxTreatmentPeriod, targetSpecies);
729      }
730
731  public String fhirType() {
732    return "MedicinalProductPharmaceutical.routeOfAdministration";
733
734  }
735
736  }
737
738    @Block()
739    public static class MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent extends BackboneElement implements IBaseBackboneElement {
740        /**
741         * Coded expression for the species.
742         */
743        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
744        @Description(shortDefinition="Coded expression for the species", formalDefinition="Coded expression for the species." )
745        protected CodeableConcept code;
746
747        /**
748         * A species specific time during which consumption of animal product is not appropriate.
749         */
750        @Child(name = "withdrawalPeriod", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
751        @Description(shortDefinition="A species specific time during which consumption of animal product is not appropriate", formalDefinition="A species specific time during which consumption of animal product is not appropriate." )
752        protected List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> withdrawalPeriod;
753
754        private static final long serialVersionUID = -664052812L;
755
756    /**
757     * Constructor
758     */
759      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent() {
760        super();
761      }
762
763    /**
764     * Constructor
765     */
766      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(CodeableConcept code) {
767        super();
768        this.code = code;
769      }
770
771        /**
772         * @return {@link #code} (Coded expression for the species.)
773         */
774        public CodeableConcept getCode() { 
775          if (this.code == null)
776            if (Configuration.errorOnAutoCreate())
777              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent.code");
778            else if (Configuration.doAutoCreate())
779              this.code = new CodeableConcept(); // cc
780          return this.code;
781        }
782
783        public boolean hasCode() { 
784          return this.code != null && !this.code.isEmpty();
785        }
786
787        /**
788         * @param value {@link #code} (Coded expression for the species.)
789         */
790        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent setCode(CodeableConcept value) { 
791          this.code = value;
792          return this;
793        }
794
795        /**
796         * @return {@link #withdrawalPeriod} (A species specific time during which consumption of animal product is not appropriate.)
797         */
798        public List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> getWithdrawalPeriod() { 
799          if (this.withdrawalPeriod == null)
800            this.withdrawalPeriod = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
801          return this.withdrawalPeriod;
802        }
803
804        /**
805         * @return Returns a reference to <code>this</code> for easy method chaining
806         */
807        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent setWithdrawalPeriod(List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> theWithdrawalPeriod) { 
808          this.withdrawalPeriod = theWithdrawalPeriod;
809          return this;
810        }
811
812        public boolean hasWithdrawalPeriod() { 
813          if (this.withdrawalPeriod == null)
814            return false;
815          for (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent item : this.withdrawalPeriod)
816            if (!item.isEmpty())
817              return true;
818          return false;
819        }
820
821        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent addWithdrawalPeriod() { //3
822          MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent t = new MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
823          if (this.withdrawalPeriod == null)
824            this.withdrawalPeriod = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
825          this.withdrawalPeriod.add(t);
826          return t;
827        }
828
829        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent addWithdrawalPeriod(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent t) { //3
830          if (t == null)
831            return this;
832          if (this.withdrawalPeriod == null)
833            this.withdrawalPeriod = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
834          this.withdrawalPeriod.add(t);
835          return this;
836        }
837
838        /**
839         * @return The first repetition of repeating field {@link #withdrawalPeriod}, creating it if it does not already exist
840         */
841        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent getWithdrawalPeriodFirstRep() { 
842          if (getWithdrawalPeriod().isEmpty()) {
843            addWithdrawalPeriod();
844          }
845          return getWithdrawalPeriod().get(0);
846        }
847
848        protected void listChildren(List<Property> children) {
849          super.listChildren(children);
850          children.add(new Property("code", "CodeableConcept", "Coded expression for the species.", 0, 1, code));
851          children.add(new Property("withdrawalPeriod", "", "A species specific time during which consumption of animal product is not appropriate.", 0, java.lang.Integer.MAX_VALUE, withdrawalPeriod));
852        }
853
854        @Override
855        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
856          switch (_hash) {
857          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded expression for the species.", 0, 1, code);
858          case -98450730: /*withdrawalPeriod*/  return new Property("withdrawalPeriod", "", "A species specific time during which consumption of animal product is not appropriate.", 0, java.lang.Integer.MAX_VALUE, withdrawalPeriod);
859          default: return super.getNamedProperty(_hash, _name, _checkValid);
860          }
861
862        }
863
864      @Override
865      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
866        switch (hash) {
867        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
868        case -98450730: /*withdrawalPeriod*/ return this.withdrawalPeriod == null ? new Base[0] : this.withdrawalPeriod.toArray(new Base[this.withdrawalPeriod.size()]); // MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent
869        default: return super.getProperty(hash, name, checkValid);
870        }
871
872      }
873
874      @Override
875      public Base setProperty(int hash, String name, Base value) throws FHIRException {
876        switch (hash) {
877        case 3059181: // code
878          this.code = castToCodeableConcept(value); // CodeableConcept
879          return value;
880        case -98450730: // withdrawalPeriod
881          this.getWithdrawalPeriod().add((MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) value); // MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent
882          return value;
883        default: return super.setProperty(hash, name, value);
884        }
885
886      }
887
888      @Override
889      public Base setProperty(String name, Base value) throws FHIRException {
890        if (name.equals("code")) {
891          this.code = castToCodeableConcept(value); // CodeableConcept
892        } else if (name.equals("withdrawalPeriod")) {
893          this.getWithdrawalPeriod().add((MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) value);
894        } else
895          return super.setProperty(name, value);
896        return value;
897      }
898
899      @Override
900      public Base makeProperty(int hash, String name) throws FHIRException {
901        switch (hash) {
902        case 3059181:  return getCode(); 
903        case -98450730:  return addWithdrawalPeriod(); 
904        default: return super.makeProperty(hash, name);
905        }
906
907      }
908
909      @Override
910      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
911        switch (hash) {
912        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
913        case -98450730: /*withdrawalPeriod*/ return new String[] {};
914        default: return super.getTypesForProperty(hash, name);
915        }
916
917      }
918
919      @Override
920      public Base addChild(String name) throws FHIRException {
921        if (name.equals("code")) {
922          this.code = new CodeableConcept();
923          return this.code;
924        }
925        else if (name.equals("withdrawalPeriod")) {
926          return addWithdrawalPeriod();
927        }
928        else
929          return super.addChild(name);
930      }
931
932      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent copy() {
933        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent dst = new MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
934        copyValues(dst);
935        return dst;
936      }
937
938      public void copyValues(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent dst) {
939        super.copyValues(dst);
940        dst.code = code == null ? null : code.copy();
941        if (withdrawalPeriod != null) {
942          dst.withdrawalPeriod = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
943          for (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent i : withdrawalPeriod)
944            dst.withdrawalPeriod.add(i.copy());
945        };
946      }
947
948      @Override
949      public boolean equalsDeep(Base other_) {
950        if (!super.equalsDeep(other_))
951          return false;
952        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent))
953          return false;
954        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent) other_;
955        return compareDeep(code, o.code, true) && compareDeep(withdrawalPeriod, o.withdrawalPeriod, true)
956          ;
957      }
958
959      @Override
960      public boolean equalsShallow(Base other_) {
961        if (!super.equalsShallow(other_))
962          return false;
963        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent))
964          return false;
965        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent) other_;
966        return true;
967      }
968
969      public boolean isEmpty() {
970        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, withdrawalPeriod);
971      }
972
973  public String fhirType() {
974    return "MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies";
975
976  }
977
978  }
979
980    @Block()
981    public static class MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent extends BackboneElement implements IBaseBackboneElement {
982        /**
983         * Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.
984         */
985        @Child(name = "tissue", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
986        @Description(shortDefinition="Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk", formalDefinition="Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk." )
987        protected CodeableConcept tissue;
988
989        /**
990         * A value for the time.
991         */
992        @Child(name = "value", type = {Quantity.class}, order=2, min=1, max=1, modifier=false, summary=true)
993        @Description(shortDefinition="A value for the time", formalDefinition="A value for the time." )
994        protected Quantity value;
995
996        /**
997         * Extra information about the withdrawal period.
998         */
999        @Child(name = "supportingInformation", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1000        @Description(shortDefinition="Extra information about the withdrawal period", formalDefinition="Extra information about the withdrawal period." )
1001        protected StringType supportingInformation;
1002
1003        private static final long serialVersionUID = -1113691238L;
1004
1005    /**
1006     * Constructor
1007     */
1008      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent() {
1009        super();
1010      }
1011
1012    /**
1013     * Constructor
1014     */
1015      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(CodeableConcept tissue, Quantity value) {
1016        super();
1017        this.tissue = tissue;
1018        this.value = value;
1019      }
1020
1021        /**
1022         * @return {@link #tissue} (Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.)
1023         */
1024        public CodeableConcept getTissue() { 
1025          if (this.tissue == null)
1026            if (Configuration.errorOnAutoCreate())
1027              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.tissue");
1028            else if (Configuration.doAutoCreate())
1029              this.tissue = new CodeableConcept(); // cc
1030          return this.tissue;
1031        }
1032
1033        public boolean hasTissue() { 
1034          return this.tissue != null && !this.tissue.isEmpty();
1035        }
1036
1037        /**
1038         * @param value {@link #tissue} (Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.)
1039         */
1040        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setTissue(CodeableConcept value) { 
1041          this.tissue = value;
1042          return this;
1043        }
1044
1045        /**
1046         * @return {@link #value} (A value for the time.)
1047         */
1048        public Quantity getValue() { 
1049          if (this.value == null)
1050            if (Configuration.errorOnAutoCreate())
1051              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.value");
1052            else if (Configuration.doAutoCreate())
1053              this.value = new Quantity(); // cc
1054          return this.value;
1055        }
1056
1057        public boolean hasValue() { 
1058          return this.value != null && !this.value.isEmpty();
1059        }
1060
1061        /**
1062         * @param value {@link #value} (A value for the time.)
1063         */
1064        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setValue(Quantity value) { 
1065          this.value = value;
1066          return this;
1067        }
1068
1069        /**
1070         * @return {@link #supportingInformation} (Extra information about the withdrawal period.). This is the underlying object with id, value and extensions. The accessor "getSupportingInformation" gives direct access to the value
1071         */
1072        public StringType getSupportingInformationElement() { 
1073          if (this.supportingInformation == null)
1074            if (Configuration.errorOnAutoCreate())
1075              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.supportingInformation");
1076            else if (Configuration.doAutoCreate())
1077              this.supportingInformation = new StringType(); // bb
1078          return this.supportingInformation;
1079        }
1080
1081        public boolean hasSupportingInformationElement() { 
1082          return this.supportingInformation != null && !this.supportingInformation.isEmpty();
1083        }
1084
1085        public boolean hasSupportingInformation() { 
1086          return this.supportingInformation != null && !this.supportingInformation.isEmpty();
1087        }
1088
1089        /**
1090         * @param value {@link #supportingInformation} (Extra information about the withdrawal period.). This is the underlying object with id, value and extensions. The accessor "getSupportingInformation" gives direct access to the value
1091         */
1092        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setSupportingInformationElement(StringType value) { 
1093          this.supportingInformation = value;
1094          return this;
1095        }
1096
1097        /**
1098         * @return Extra information about the withdrawal period.
1099         */
1100        public String getSupportingInformation() { 
1101          return this.supportingInformation == null ? null : this.supportingInformation.getValue();
1102        }
1103
1104        /**
1105         * @param value Extra information about the withdrawal period.
1106         */
1107        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setSupportingInformation(String value) { 
1108          if (Utilities.noString(value))
1109            this.supportingInformation = null;
1110          else {
1111            if (this.supportingInformation == null)
1112              this.supportingInformation = new StringType();
1113            this.supportingInformation.setValue(value);
1114          }
1115          return this;
1116        }
1117
1118        protected void listChildren(List<Property> children) {
1119          super.listChildren(children);
1120          children.add(new Property("tissue", "CodeableConcept", "Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.", 0, 1, tissue));
1121          children.add(new Property("value", "Quantity", "A value for the time.", 0, 1, value));
1122          children.add(new Property("supportingInformation", "string", "Extra information about the withdrawal period.", 0, 1, supportingInformation));
1123        }
1124
1125        @Override
1126        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1127          switch (_hash) {
1128          case -873475867: /*tissue*/  return new Property("tissue", "CodeableConcept", "Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.", 0, 1, tissue);
1129          case 111972721: /*value*/  return new Property("value", "Quantity", "A value for the time.", 0, 1, value);
1130          case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "string", "Extra information about the withdrawal period.", 0, 1, supportingInformation);
1131          default: return super.getNamedProperty(_hash, _name, _checkValid);
1132          }
1133
1134        }
1135
1136      @Override
1137      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1138        switch (hash) {
1139        case -873475867: /*tissue*/ return this.tissue == null ? new Base[0] : new Base[] {this.tissue}; // CodeableConcept
1140        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Quantity
1141        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : new Base[] {this.supportingInformation}; // StringType
1142        default: return super.getProperty(hash, name, checkValid);
1143        }
1144
1145      }
1146
1147      @Override
1148      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1149        switch (hash) {
1150        case -873475867: // tissue
1151          this.tissue = castToCodeableConcept(value); // CodeableConcept
1152          return value;
1153        case 111972721: // value
1154          this.value = castToQuantity(value); // Quantity
1155          return value;
1156        case -1248768647: // supportingInformation
1157          this.supportingInformation = castToString(value); // StringType
1158          return value;
1159        default: return super.setProperty(hash, name, value);
1160        }
1161
1162      }
1163
1164      @Override
1165      public Base setProperty(String name, Base value) throws FHIRException {
1166        if (name.equals("tissue")) {
1167          this.tissue = castToCodeableConcept(value); // CodeableConcept
1168        } else if (name.equals("value")) {
1169          this.value = castToQuantity(value); // Quantity
1170        } else if (name.equals("supportingInformation")) {
1171          this.supportingInformation = castToString(value); // StringType
1172        } else
1173          return super.setProperty(name, value);
1174        return value;
1175      }
1176
1177      @Override
1178      public Base makeProperty(int hash, String name) throws FHIRException {
1179        switch (hash) {
1180        case -873475867:  return getTissue(); 
1181        case 111972721:  return getValue(); 
1182        case -1248768647:  return getSupportingInformationElement();
1183        default: return super.makeProperty(hash, name);
1184        }
1185
1186      }
1187
1188      @Override
1189      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1190        switch (hash) {
1191        case -873475867: /*tissue*/ return new String[] {"CodeableConcept"};
1192        case 111972721: /*value*/ return new String[] {"Quantity"};
1193        case -1248768647: /*supportingInformation*/ return new String[] {"string"};
1194        default: return super.getTypesForProperty(hash, name);
1195        }
1196
1197      }
1198
1199      @Override
1200      public Base addChild(String name) throws FHIRException {
1201        if (name.equals("tissue")) {
1202          this.tissue = new CodeableConcept();
1203          return this.tissue;
1204        }
1205        else if (name.equals("value")) {
1206          this.value = new Quantity();
1207          return this.value;
1208        }
1209        else if (name.equals("supportingInformation")) {
1210          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductPharmaceutical.supportingInformation");
1211        }
1212        else
1213          return super.addChild(name);
1214      }
1215
1216      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent copy() {
1217        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent dst = new MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
1218        copyValues(dst);
1219        return dst;
1220      }
1221
1222      public void copyValues(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent dst) {
1223        super.copyValues(dst);
1224        dst.tissue = tissue == null ? null : tissue.copy();
1225        dst.value = value == null ? null : value.copy();
1226        dst.supportingInformation = supportingInformation == null ? null : supportingInformation.copy();
1227      }
1228
1229      @Override
1230      public boolean equalsDeep(Base other_) {
1231        if (!super.equalsDeep(other_))
1232          return false;
1233        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent))
1234          return false;
1235        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) other_;
1236        return compareDeep(tissue, o.tissue, true) && compareDeep(value, o.value, true) && compareDeep(supportingInformation, o.supportingInformation, true)
1237          ;
1238      }
1239
1240      @Override
1241      public boolean equalsShallow(Base other_) {
1242        if (!super.equalsShallow(other_))
1243          return false;
1244        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent))
1245          return false;
1246        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) other_;
1247        return compareValues(supportingInformation, o.supportingInformation, true);
1248      }
1249
1250      public boolean isEmpty() {
1251        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(tissue, value, supportingInformation
1252          );
1253      }
1254
1255  public String fhirType() {
1256    return "MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies.withdrawalPeriod";
1257
1258  }
1259
1260  }
1261
1262    /**
1263     * An identifier for the pharmaceutical medicinal product.
1264     */
1265    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1266    @Description(shortDefinition="An identifier for the pharmaceutical medicinal product", formalDefinition="An identifier for the pharmaceutical medicinal product." )
1267    protected List<Identifier> identifier;
1268
1269    /**
1270     * The administrable dose form, after necessary reconstitution.
1271     */
1272    @Child(name = "administrableDoseForm", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1273    @Description(shortDefinition="The administrable dose form, after necessary reconstitution", formalDefinition="The administrable dose form, after necessary reconstitution." )
1274    protected CodeableConcept administrableDoseForm;
1275
1276    /**
1277     * Todo.
1278     */
1279    @Child(name = "unitOfPresentation", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1280    @Description(shortDefinition="Todo", formalDefinition="Todo." )
1281    protected CodeableConcept unitOfPresentation;
1282
1283    /**
1284     * Ingredient.
1285     */
1286    @Child(name = "ingredient", type = {MedicinalProductIngredient.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1287    @Description(shortDefinition="Ingredient", formalDefinition="Ingredient." )
1288    protected List<Reference> ingredient;
1289    /**
1290     * The actual objects that are the target of the reference (Ingredient.)
1291     */
1292    protected List<MedicinalProductIngredient> ingredientTarget;
1293
1294
1295    /**
1296     * Accompanying device.
1297     */
1298    @Child(name = "device", type = {DeviceDefinition.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1299    @Description(shortDefinition="Accompanying device", formalDefinition="Accompanying device." )
1300    protected List<Reference> device;
1301    /**
1302     * The actual objects that are the target of the reference (Accompanying device.)
1303     */
1304    protected List<DeviceDefinition> deviceTarget;
1305
1306
1307    /**
1308     * Characteristics e.g. a products onset of action.
1309     */
1310    @Child(name = "characteristics", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1311    @Description(shortDefinition="Characteristics e.g. a products onset of action", formalDefinition="Characteristics e.g. a products onset of action." )
1312    protected List<MedicinalProductPharmaceuticalCharacteristicsComponent> characteristics;
1313
1314    /**
1315     * The path by which the pharmaceutical product is taken into or makes contact with the body.
1316     */
1317    @Child(name = "routeOfAdministration", type = {}, order=6, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1318    @Description(shortDefinition="The path by which the pharmaceutical product is taken into or makes contact with the body", formalDefinition="The path by which the pharmaceutical product is taken into or makes contact with the body." )
1319    protected List<MedicinalProductPharmaceuticalRouteOfAdministrationComponent> routeOfAdministration;
1320
1321    private static final long serialVersionUID = -1201548050L;
1322
1323  /**
1324   * Constructor
1325   */
1326    public MedicinalProductPharmaceutical() {
1327      super();
1328    }
1329
1330  /**
1331   * Constructor
1332   */
1333    public MedicinalProductPharmaceutical(CodeableConcept administrableDoseForm) {
1334      super();
1335      this.administrableDoseForm = administrableDoseForm;
1336    }
1337
1338    /**
1339     * @return {@link #identifier} (An identifier for the pharmaceutical medicinal product.)
1340     */
1341    public List<Identifier> getIdentifier() { 
1342      if (this.identifier == null)
1343        this.identifier = new ArrayList<Identifier>();
1344      return this.identifier;
1345    }
1346
1347    /**
1348     * @return Returns a reference to <code>this</code> for easy method chaining
1349     */
1350    public MedicinalProductPharmaceutical setIdentifier(List<Identifier> theIdentifier) { 
1351      this.identifier = theIdentifier;
1352      return this;
1353    }
1354
1355    public boolean hasIdentifier() { 
1356      if (this.identifier == null)
1357        return false;
1358      for (Identifier item : this.identifier)
1359        if (!item.isEmpty())
1360          return true;
1361      return false;
1362    }
1363
1364    public Identifier addIdentifier() { //3
1365      Identifier t = new Identifier();
1366      if (this.identifier == null)
1367        this.identifier = new ArrayList<Identifier>();
1368      this.identifier.add(t);
1369      return t;
1370    }
1371
1372    public MedicinalProductPharmaceutical addIdentifier(Identifier t) { //3
1373      if (t == null)
1374        return this;
1375      if (this.identifier == null)
1376        this.identifier = new ArrayList<Identifier>();
1377      this.identifier.add(t);
1378      return this;
1379    }
1380
1381    /**
1382     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1383     */
1384    public Identifier getIdentifierFirstRep() { 
1385      if (getIdentifier().isEmpty()) {
1386        addIdentifier();
1387      }
1388      return getIdentifier().get(0);
1389    }
1390
1391    /**
1392     * @return {@link #administrableDoseForm} (The administrable dose form, after necessary reconstitution.)
1393     */
1394    public CodeableConcept getAdministrableDoseForm() { 
1395      if (this.administrableDoseForm == null)
1396        if (Configuration.errorOnAutoCreate())
1397          throw new Error("Attempt to auto-create MedicinalProductPharmaceutical.administrableDoseForm");
1398        else if (Configuration.doAutoCreate())
1399          this.administrableDoseForm = new CodeableConcept(); // cc
1400      return this.administrableDoseForm;
1401    }
1402
1403    public boolean hasAdministrableDoseForm() { 
1404      return this.administrableDoseForm != null && !this.administrableDoseForm.isEmpty();
1405    }
1406
1407    /**
1408     * @param value {@link #administrableDoseForm} (The administrable dose form, after necessary reconstitution.)
1409     */
1410    public MedicinalProductPharmaceutical setAdministrableDoseForm(CodeableConcept value) { 
1411      this.administrableDoseForm = value;
1412      return this;
1413    }
1414
1415    /**
1416     * @return {@link #unitOfPresentation} (Todo.)
1417     */
1418    public CodeableConcept getUnitOfPresentation() { 
1419      if (this.unitOfPresentation == null)
1420        if (Configuration.errorOnAutoCreate())
1421          throw new Error("Attempt to auto-create MedicinalProductPharmaceutical.unitOfPresentation");
1422        else if (Configuration.doAutoCreate())
1423          this.unitOfPresentation = new CodeableConcept(); // cc
1424      return this.unitOfPresentation;
1425    }
1426
1427    public boolean hasUnitOfPresentation() { 
1428      return this.unitOfPresentation != null && !this.unitOfPresentation.isEmpty();
1429    }
1430
1431    /**
1432     * @param value {@link #unitOfPresentation} (Todo.)
1433     */
1434    public MedicinalProductPharmaceutical setUnitOfPresentation(CodeableConcept value) { 
1435      this.unitOfPresentation = value;
1436      return this;
1437    }
1438
1439    /**
1440     * @return {@link #ingredient} (Ingredient.)
1441     */
1442    public List<Reference> getIngredient() { 
1443      if (this.ingredient == null)
1444        this.ingredient = new ArrayList<Reference>();
1445      return this.ingredient;
1446    }
1447
1448    /**
1449     * @return Returns a reference to <code>this</code> for easy method chaining
1450     */
1451    public MedicinalProductPharmaceutical setIngredient(List<Reference> theIngredient) { 
1452      this.ingredient = theIngredient;
1453      return this;
1454    }
1455
1456    public boolean hasIngredient() { 
1457      if (this.ingredient == null)
1458        return false;
1459      for (Reference item : this.ingredient)
1460        if (!item.isEmpty())
1461          return true;
1462      return false;
1463    }
1464
1465    public Reference addIngredient() { //3
1466      Reference t = new Reference();
1467      if (this.ingredient == null)
1468        this.ingredient = new ArrayList<Reference>();
1469      this.ingredient.add(t);
1470      return t;
1471    }
1472
1473    public MedicinalProductPharmaceutical addIngredient(Reference t) { //3
1474      if (t == null)
1475        return this;
1476      if (this.ingredient == null)
1477        this.ingredient = new ArrayList<Reference>();
1478      this.ingredient.add(t);
1479      return this;
1480    }
1481
1482    /**
1483     * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist
1484     */
1485    public Reference getIngredientFirstRep() { 
1486      if (getIngredient().isEmpty()) {
1487        addIngredient();
1488      }
1489      return getIngredient().get(0);
1490    }
1491
1492    /**
1493     * @deprecated Use Reference#setResource(IBaseResource) instead
1494     */
1495    @Deprecated
1496    public List<MedicinalProductIngredient> getIngredientTarget() { 
1497      if (this.ingredientTarget == null)
1498        this.ingredientTarget = new ArrayList<MedicinalProductIngredient>();
1499      return this.ingredientTarget;
1500    }
1501
1502    /**
1503     * @deprecated Use Reference#setResource(IBaseResource) instead
1504     */
1505    @Deprecated
1506    public MedicinalProductIngredient addIngredientTarget() { 
1507      MedicinalProductIngredient r = new MedicinalProductIngredient();
1508      if (this.ingredientTarget == null)
1509        this.ingredientTarget = new ArrayList<MedicinalProductIngredient>();
1510      this.ingredientTarget.add(r);
1511      return r;
1512    }
1513
1514    /**
1515     * @return {@link #device} (Accompanying device.)
1516     */
1517    public List<Reference> getDevice() { 
1518      if (this.device == null)
1519        this.device = new ArrayList<Reference>();
1520      return this.device;
1521    }
1522
1523    /**
1524     * @return Returns a reference to <code>this</code> for easy method chaining
1525     */
1526    public MedicinalProductPharmaceutical setDevice(List<Reference> theDevice) { 
1527      this.device = theDevice;
1528      return this;
1529    }
1530
1531    public boolean hasDevice() { 
1532      if (this.device == null)
1533        return false;
1534      for (Reference item : this.device)
1535        if (!item.isEmpty())
1536          return true;
1537      return false;
1538    }
1539
1540    public Reference addDevice() { //3
1541      Reference t = new Reference();
1542      if (this.device == null)
1543        this.device = new ArrayList<Reference>();
1544      this.device.add(t);
1545      return t;
1546    }
1547
1548    public MedicinalProductPharmaceutical addDevice(Reference t) { //3
1549      if (t == null)
1550        return this;
1551      if (this.device == null)
1552        this.device = new ArrayList<Reference>();
1553      this.device.add(t);
1554      return this;
1555    }
1556
1557    /**
1558     * @return The first repetition of repeating field {@link #device}, creating it if it does not already exist
1559     */
1560    public Reference getDeviceFirstRep() { 
1561      if (getDevice().isEmpty()) {
1562        addDevice();
1563      }
1564      return getDevice().get(0);
1565    }
1566
1567    /**
1568     * @deprecated Use Reference#setResource(IBaseResource) instead
1569     */
1570    @Deprecated
1571    public List<DeviceDefinition> getDeviceTarget() { 
1572      if (this.deviceTarget == null)
1573        this.deviceTarget = new ArrayList<DeviceDefinition>();
1574      return this.deviceTarget;
1575    }
1576
1577    /**
1578     * @deprecated Use Reference#setResource(IBaseResource) instead
1579     */
1580    @Deprecated
1581    public DeviceDefinition addDeviceTarget() { 
1582      DeviceDefinition r = new DeviceDefinition();
1583      if (this.deviceTarget == null)
1584        this.deviceTarget = new ArrayList<DeviceDefinition>();
1585      this.deviceTarget.add(r);
1586      return r;
1587    }
1588
1589    /**
1590     * @return {@link #characteristics} (Characteristics e.g. a products onset of action.)
1591     */
1592    public List<MedicinalProductPharmaceuticalCharacteristicsComponent> getCharacteristics() { 
1593      if (this.characteristics == null)
1594        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1595      return this.characteristics;
1596    }
1597
1598    /**
1599     * @return Returns a reference to <code>this</code> for easy method chaining
1600     */
1601    public MedicinalProductPharmaceutical setCharacteristics(List<MedicinalProductPharmaceuticalCharacteristicsComponent> theCharacteristics) { 
1602      this.characteristics = theCharacteristics;
1603      return this;
1604    }
1605
1606    public boolean hasCharacteristics() { 
1607      if (this.characteristics == null)
1608        return false;
1609      for (MedicinalProductPharmaceuticalCharacteristicsComponent item : this.characteristics)
1610        if (!item.isEmpty())
1611          return true;
1612      return false;
1613    }
1614
1615    public MedicinalProductPharmaceuticalCharacteristicsComponent addCharacteristics() { //3
1616      MedicinalProductPharmaceuticalCharacteristicsComponent t = new MedicinalProductPharmaceuticalCharacteristicsComponent();
1617      if (this.characteristics == null)
1618        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1619      this.characteristics.add(t);
1620      return t;
1621    }
1622
1623    public MedicinalProductPharmaceutical addCharacteristics(MedicinalProductPharmaceuticalCharacteristicsComponent t) { //3
1624      if (t == null)
1625        return this;
1626      if (this.characteristics == null)
1627        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1628      this.characteristics.add(t);
1629      return this;
1630    }
1631
1632    /**
1633     * @return The first repetition of repeating field {@link #characteristics}, creating it if it does not already exist
1634     */
1635    public MedicinalProductPharmaceuticalCharacteristicsComponent getCharacteristicsFirstRep() { 
1636      if (getCharacteristics().isEmpty()) {
1637        addCharacteristics();
1638      }
1639      return getCharacteristics().get(0);
1640    }
1641
1642    /**
1643     * @return {@link #routeOfAdministration} (The path by which the pharmaceutical product is taken into or makes contact with the body.)
1644     */
1645    public List<MedicinalProductPharmaceuticalRouteOfAdministrationComponent> getRouteOfAdministration() { 
1646      if (this.routeOfAdministration == null)
1647        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1648      return this.routeOfAdministration;
1649    }
1650
1651    /**
1652     * @return Returns a reference to <code>this</code> for easy method chaining
1653     */
1654    public MedicinalProductPharmaceutical setRouteOfAdministration(List<MedicinalProductPharmaceuticalRouteOfAdministrationComponent> theRouteOfAdministration) { 
1655      this.routeOfAdministration = theRouteOfAdministration;
1656      return this;
1657    }
1658
1659    public boolean hasRouteOfAdministration() { 
1660      if (this.routeOfAdministration == null)
1661        return false;
1662      for (MedicinalProductPharmaceuticalRouteOfAdministrationComponent item : this.routeOfAdministration)
1663        if (!item.isEmpty())
1664          return true;
1665      return false;
1666    }
1667
1668    public MedicinalProductPharmaceuticalRouteOfAdministrationComponent addRouteOfAdministration() { //3
1669      MedicinalProductPharmaceuticalRouteOfAdministrationComponent t = new MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
1670      if (this.routeOfAdministration == null)
1671        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1672      this.routeOfAdministration.add(t);
1673      return t;
1674    }
1675
1676    public MedicinalProductPharmaceutical addRouteOfAdministration(MedicinalProductPharmaceuticalRouteOfAdministrationComponent t) { //3
1677      if (t == null)
1678        return this;
1679      if (this.routeOfAdministration == null)
1680        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1681      this.routeOfAdministration.add(t);
1682      return this;
1683    }
1684
1685    /**
1686     * @return The first repetition of repeating field {@link #routeOfAdministration}, creating it if it does not already exist
1687     */
1688    public MedicinalProductPharmaceuticalRouteOfAdministrationComponent getRouteOfAdministrationFirstRep() { 
1689      if (getRouteOfAdministration().isEmpty()) {
1690        addRouteOfAdministration();
1691      }
1692      return getRouteOfAdministration().get(0);
1693    }
1694
1695      protected void listChildren(List<Property> children) {
1696        super.listChildren(children);
1697        children.add(new Property("identifier", "Identifier", "An identifier for the pharmaceutical medicinal product.", 0, java.lang.Integer.MAX_VALUE, identifier));
1698        children.add(new Property("administrableDoseForm", "CodeableConcept", "The administrable dose form, after necessary reconstitution.", 0, 1, administrableDoseForm));
1699        children.add(new Property("unitOfPresentation", "CodeableConcept", "Todo.", 0, 1, unitOfPresentation));
1700        children.add(new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0, java.lang.Integer.MAX_VALUE, ingredient));
1701        children.add(new Property("device", "Reference(DeviceDefinition)", "Accompanying device.", 0, java.lang.Integer.MAX_VALUE, device));
1702        children.add(new Property("characteristics", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, characteristics));
1703        children.add(new Property("routeOfAdministration", "", "The path by which the pharmaceutical product is taken into or makes contact with the body.", 0, java.lang.Integer.MAX_VALUE, routeOfAdministration));
1704      }
1705
1706      @Override
1707      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1708        switch (_hash) {
1709        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "An identifier for the pharmaceutical medicinal product.", 0, java.lang.Integer.MAX_VALUE, identifier);
1710        case 1446105202: /*administrableDoseForm*/  return new Property("administrableDoseForm", "CodeableConcept", "The administrable dose form, after necessary reconstitution.", 0, 1, administrableDoseForm);
1711        case -1427765963: /*unitOfPresentation*/  return new Property("unitOfPresentation", "CodeableConcept", "Todo.", 0, 1, unitOfPresentation);
1712        case -206409263: /*ingredient*/  return new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0, java.lang.Integer.MAX_VALUE, ingredient);
1713        case -1335157162: /*device*/  return new Property("device", "Reference(DeviceDefinition)", "Accompanying device.", 0, java.lang.Integer.MAX_VALUE, device);
1714        case -1529171400: /*characteristics*/  return new Property("characteristics", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, characteristics);
1715        case 1742084734: /*routeOfAdministration*/  return new Property("routeOfAdministration", "", "The path by which the pharmaceutical product is taken into or makes contact with the body.", 0, java.lang.Integer.MAX_VALUE, routeOfAdministration);
1716        default: return super.getNamedProperty(_hash, _name, _checkValid);
1717        }
1718
1719      }
1720
1721      @Override
1722      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1723        switch (hash) {
1724        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1725        case 1446105202: /*administrableDoseForm*/ return this.administrableDoseForm == null ? new Base[0] : new Base[] {this.administrableDoseForm}; // CodeableConcept
1726        case -1427765963: /*unitOfPresentation*/ return this.unitOfPresentation == null ? new Base[0] : new Base[] {this.unitOfPresentation}; // CodeableConcept
1727        case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // Reference
1728        case -1335157162: /*device*/ return this.device == null ? new Base[0] : this.device.toArray(new Base[this.device.size()]); // Reference
1729        case -1529171400: /*characteristics*/ return this.characteristics == null ? new Base[0] : this.characteristics.toArray(new Base[this.characteristics.size()]); // MedicinalProductPharmaceuticalCharacteristicsComponent
1730        case 1742084734: /*routeOfAdministration*/ return this.routeOfAdministration == null ? new Base[0] : this.routeOfAdministration.toArray(new Base[this.routeOfAdministration.size()]); // MedicinalProductPharmaceuticalRouteOfAdministrationComponent
1731        default: return super.getProperty(hash, name, checkValid);
1732        }
1733
1734      }
1735
1736      @Override
1737      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1738        switch (hash) {
1739        case -1618432855: // identifier
1740          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1741          return value;
1742        case 1446105202: // administrableDoseForm
1743          this.administrableDoseForm = castToCodeableConcept(value); // CodeableConcept
1744          return value;
1745        case -1427765963: // unitOfPresentation
1746          this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept
1747          return value;
1748        case -206409263: // ingredient
1749          this.getIngredient().add(castToReference(value)); // Reference
1750          return value;
1751        case -1335157162: // device
1752          this.getDevice().add(castToReference(value)); // Reference
1753          return value;
1754        case -1529171400: // characteristics
1755          this.getCharacteristics().add((MedicinalProductPharmaceuticalCharacteristicsComponent) value); // MedicinalProductPharmaceuticalCharacteristicsComponent
1756          return value;
1757        case 1742084734: // routeOfAdministration
1758          this.getRouteOfAdministration().add((MedicinalProductPharmaceuticalRouteOfAdministrationComponent) value); // MedicinalProductPharmaceuticalRouteOfAdministrationComponent
1759          return value;
1760        default: return super.setProperty(hash, name, value);
1761        }
1762
1763      }
1764
1765      @Override
1766      public Base setProperty(String name, Base value) throws FHIRException {
1767        if (name.equals("identifier")) {
1768          this.getIdentifier().add(castToIdentifier(value));
1769        } else if (name.equals("administrableDoseForm")) {
1770          this.administrableDoseForm = castToCodeableConcept(value); // CodeableConcept
1771        } else if (name.equals("unitOfPresentation")) {
1772          this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept
1773        } else if (name.equals("ingredient")) {
1774          this.getIngredient().add(castToReference(value));
1775        } else if (name.equals("device")) {
1776          this.getDevice().add(castToReference(value));
1777        } else if (name.equals("characteristics")) {
1778          this.getCharacteristics().add((MedicinalProductPharmaceuticalCharacteristicsComponent) value);
1779        } else if (name.equals("routeOfAdministration")) {
1780          this.getRouteOfAdministration().add((MedicinalProductPharmaceuticalRouteOfAdministrationComponent) value);
1781        } else
1782          return super.setProperty(name, value);
1783        return value;
1784      }
1785
1786      @Override
1787      public Base makeProperty(int hash, String name) throws FHIRException {
1788        switch (hash) {
1789        case -1618432855:  return addIdentifier(); 
1790        case 1446105202:  return getAdministrableDoseForm(); 
1791        case -1427765963:  return getUnitOfPresentation(); 
1792        case -206409263:  return addIngredient(); 
1793        case -1335157162:  return addDevice(); 
1794        case -1529171400:  return addCharacteristics(); 
1795        case 1742084734:  return addRouteOfAdministration(); 
1796        default: return super.makeProperty(hash, name);
1797        }
1798
1799      }
1800
1801      @Override
1802      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1803        switch (hash) {
1804        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1805        case 1446105202: /*administrableDoseForm*/ return new String[] {"CodeableConcept"};
1806        case -1427765963: /*unitOfPresentation*/ return new String[] {"CodeableConcept"};
1807        case -206409263: /*ingredient*/ return new String[] {"Reference"};
1808        case -1335157162: /*device*/ return new String[] {"Reference"};
1809        case -1529171400: /*characteristics*/ return new String[] {};
1810        case 1742084734: /*routeOfAdministration*/ return new String[] {};
1811        default: return super.getTypesForProperty(hash, name);
1812        }
1813
1814      }
1815
1816      @Override
1817      public Base addChild(String name) throws FHIRException {
1818        if (name.equals("identifier")) {
1819          return addIdentifier();
1820        }
1821        else if (name.equals("administrableDoseForm")) {
1822          this.administrableDoseForm = new CodeableConcept();
1823          return this.administrableDoseForm;
1824        }
1825        else if (name.equals("unitOfPresentation")) {
1826          this.unitOfPresentation = new CodeableConcept();
1827          return this.unitOfPresentation;
1828        }
1829        else if (name.equals("ingredient")) {
1830          return addIngredient();
1831        }
1832        else if (name.equals("device")) {
1833          return addDevice();
1834        }
1835        else if (name.equals("characteristics")) {
1836          return addCharacteristics();
1837        }
1838        else if (name.equals("routeOfAdministration")) {
1839          return addRouteOfAdministration();
1840        }
1841        else
1842          return super.addChild(name);
1843      }
1844
1845  public String fhirType() {
1846    return "MedicinalProductPharmaceutical";
1847
1848  }
1849
1850      public MedicinalProductPharmaceutical copy() {
1851        MedicinalProductPharmaceutical dst = new MedicinalProductPharmaceutical();
1852        copyValues(dst);
1853        return dst;
1854      }
1855
1856      public void copyValues(MedicinalProductPharmaceutical dst) {
1857        super.copyValues(dst);
1858        if (identifier != null) {
1859          dst.identifier = new ArrayList<Identifier>();
1860          for (Identifier i : identifier)
1861            dst.identifier.add(i.copy());
1862        };
1863        dst.administrableDoseForm = administrableDoseForm == null ? null : administrableDoseForm.copy();
1864        dst.unitOfPresentation = unitOfPresentation == null ? null : unitOfPresentation.copy();
1865        if (ingredient != null) {
1866          dst.ingredient = new ArrayList<Reference>();
1867          for (Reference i : ingredient)
1868            dst.ingredient.add(i.copy());
1869        };
1870        if (device != null) {
1871          dst.device = new ArrayList<Reference>();
1872          for (Reference i : device)
1873            dst.device.add(i.copy());
1874        };
1875        if (characteristics != null) {
1876          dst.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1877          for (MedicinalProductPharmaceuticalCharacteristicsComponent i : characteristics)
1878            dst.characteristics.add(i.copy());
1879        };
1880        if (routeOfAdministration != null) {
1881          dst.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1882          for (MedicinalProductPharmaceuticalRouteOfAdministrationComponent i : routeOfAdministration)
1883            dst.routeOfAdministration.add(i.copy());
1884        };
1885      }
1886
1887      protected MedicinalProductPharmaceutical typedCopy() {
1888        return copy();
1889      }
1890
1891      @Override
1892      public boolean equalsDeep(Base other_) {
1893        if (!super.equalsDeep(other_))
1894          return false;
1895        if (!(other_ instanceof MedicinalProductPharmaceutical))
1896          return false;
1897        MedicinalProductPharmaceutical o = (MedicinalProductPharmaceutical) other_;
1898        return compareDeep(identifier, o.identifier, true) && compareDeep(administrableDoseForm, o.administrableDoseForm, true)
1899           && compareDeep(unitOfPresentation, o.unitOfPresentation, true) && compareDeep(ingredient, o.ingredient, true)
1900           && compareDeep(device, o.device, true) && compareDeep(characteristics, o.characteristics, true)
1901           && compareDeep(routeOfAdministration, o.routeOfAdministration, true);
1902      }
1903
1904      @Override
1905      public boolean equalsShallow(Base other_) {
1906        if (!super.equalsShallow(other_))
1907          return false;
1908        if (!(other_ instanceof MedicinalProductPharmaceutical))
1909          return false;
1910        MedicinalProductPharmaceutical o = (MedicinalProductPharmaceutical) other_;
1911        return true;
1912      }
1913
1914      public boolean isEmpty() {
1915        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, administrableDoseForm
1916          , unitOfPresentation, ingredient, device, characteristics, routeOfAdministration);
1917      }
1918
1919  @Override
1920  public ResourceType getResourceType() {
1921    return ResourceType.MedicinalProductPharmaceutical;
1922   }
1923
1924 /**
1925   * Search parameter: <b>identifier</b>
1926   * <p>
1927   * Description: <b>An identifier for the pharmaceutical medicinal product</b><br>
1928   * Type: <b>token</b><br>
1929   * Path: <b>MedicinalProductPharmaceutical.identifier</b><br>
1930   * </p>
1931   */
1932  @SearchParamDefinition(name="identifier", path="MedicinalProductPharmaceutical.identifier", description="An identifier for the pharmaceutical medicinal product", type="token" )
1933  public static final String SP_IDENTIFIER = "identifier";
1934 /**
1935   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1936   * <p>
1937   * Description: <b>An identifier for the pharmaceutical medicinal product</b><br>
1938   * Type: <b>token</b><br>
1939   * Path: <b>MedicinalProductPharmaceutical.identifier</b><br>
1940   * </p>
1941   */
1942  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1943
1944 /**
1945   * Search parameter: <b>route</b>
1946   * <p>
1947   * Description: <b>Coded expression for the route</b><br>
1948   * Type: <b>token</b><br>
1949   * Path: <b>MedicinalProductPharmaceutical.routeOfAdministration.code</b><br>
1950   * </p>
1951   */
1952  @SearchParamDefinition(name="route", path="MedicinalProductPharmaceutical.routeOfAdministration.code", description="Coded expression for the route", type="token" )
1953  public static final String SP_ROUTE = "route";
1954 /**
1955   * <b>Fluent Client</b> search parameter constant for <b>route</b>
1956   * <p>
1957   * Description: <b>Coded expression for the route</b><br>
1958   * Type: <b>token</b><br>
1959   * Path: <b>MedicinalProductPharmaceutical.routeOfAdministration.code</b><br>
1960   * </p>
1961   */
1962  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ROUTE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ROUTE);
1963
1964 /**
1965   * Search parameter: <b>target-species</b>
1966   * <p>
1967   * Description: <b>Coded expression for the species</b><br>
1968   * Type: <b>token</b><br>
1969   * Path: <b>MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies.code</b><br>
1970   * </p>
1971   */
1972  @SearchParamDefinition(name="target-species", path="MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies.code", description="Coded expression for the species", type="token" )
1973  public static final String SP_TARGET_SPECIES = "target-species";
1974 /**
1975   * <b>Fluent Client</b> search parameter constant for <b>target-species</b>
1976   * <p>
1977   * Description: <b>Coded expression for the species</b><br>
1978   * Type: <b>token</b><br>
1979   * Path: <b>MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies.code</b><br>
1980   * </p>
1981   */
1982  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TARGET_SPECIES = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TARGET_SPECIES);
1983
1984
1985}