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