001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import org.hl7.fhir.utilities.Utilities;
058import org.hl7.fhir.r5.model.Enumerations.*;
059import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
060import org.hl7.fhir.exceptions.FHIRException;
061import org.hl7.fhir.instance.model.api.ICompositeType;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069
070/**
071 * A medicinal product in a container or package.
072 */
073@ResourceDef(name="PackagedProductDefinition", profile="http://hl7.org/fhir/StructureDefinition/PackagedProductDefinition")
074public class PackagedProductDefinition extends DomainResource {
075
076    @Block()
077    public static class PackagedProductDefinitionBatchIdentifierComponent extends BackboneElement implements IBaseBackboneElement {
078        /**
079         * A number appearing on the outer packaging of a specific batch.
080         */
081        @Child(name = "outerPackaging", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=true)
082        @Description(shortDefinition="A number appearing on the outer packaging of a specific batch", formalDefinition="A number appearing on the outer packaging of a specific batch." )
083        protected Identifier outerPackaging;
084
085        /**
086         * A number appearing on the immediate packaging (and not the outer packaging).
087         */
088        @Child(name = "immediatePackaging", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=true)
089        @Description(shortDefinition="A number appearing on the immediate packaging (and not the outer packaging)", formalDefinition="A number appearing on the immediate packaging (and not the outer packaging)." )
090        protected Identifier immediatePackaging;
091
092        private static final long serialVersionUID = 1187365068L;
093
094    /**
095     * Constructor
096     */
097      public PackagedProductDefinitionBatchIdentifierComponent() {
098        super();
099      }
100
101    /**
102     * Constructor
103     */
104      public PackagedProductDefinitionBatchIdentifierComponent(Identifier outerPackaging) {
105        super();
106        this.setOuterPackaging(outerPackaging);
107      }
108
109        /**
110         * @return {@link #outerPackaging} (A number appearing on the outer packaging of a specific batch.)
111         */
112        public Identifier getOuterPackaging() { 
113          if (this.outerPackaging == null)
114            if (Configuration.errorOnAutoCreate())
115              throw new Error("Attempt to auto-create PackagedProductDefinitionBatchIdentifierComponent.outerPackaging");
116            else if (Configuration.doAutoCreate())
117              this.outerPackaging = new Identifier(); // cc
118          return this.outerPackaging;
119        }
120
121        public boolean hasOuterPackaging() { 
122          return this.outerPackaging != null && !this.outerPackaging.isEmpty();
123        }
124
125        /**
126         * @param value {@link #outerPackaging} (A number appearing on the outer packaging of a specific batch.)
127         */
128        public PackagedProductDefinitionBatchIdentifierComponent setOuterPackaging(Identifier value) { 
129          this.outerPackaging = value;
130          return this;
131        }
132
133        /**
134         * @return {@link #immediatePackaging} (A number appearing on the immediate packaging (and not the outer packaging).)
135         */
136        public Identifier getImmediatePackaging() { 
137          if (this.immediatePackaging == null)
138            if (Configuration.errorOnAutoCreate())
139              throw new Error("Attempt to auto-create PackagedProductDefinitionBatchIdentifierComponent.immediatePackaging");
140            else if (Configuration.doAutoCreate())
141              this.immediatePackaging = new Identifier(); // cc
142          return this.immediatePackaging;
143        }
144
145        public boolean hasImmediatePackaging() { 
146          return this.immediatePackaging != null && !this.immediatePackaging.isEmpty();
147        }
148
149        /**
150         * @param value {@link #immediatePackaging} (A number appearing on the immediate packaging (and not the outer packaging).)
151         */
152        public PackagedProductDefinitionBatchIdentifierComponent setImmediatePackaging(Identifier value) { 
153          this.immediatePackaging = value;
154          return this;
155        }
156
157        protected void listChildren(List<Property> children) {
158          super.listChildren(children);
159          children.add(new Property("outerPackaging", "Identifier", "A number appearing on the outer packaging of a specific batch.", 0, 1, outerPackaging));
160          children.add(new Property("immediatePackaging", "Identifier", "A number appearing on the immediate packaging (and not the outer packaging).", 0, 1, immediatePackaging));
161        }
162
163        @Override
164        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
165          switch (_hash) {
166          case -682249912: /*outerPackaging*/  return new Property("outerPackaging", "Identifier", "A number appearing on the outer packaging of a specific batch.", 0, 1, outerPackaging);
167          case 721147602: /*immediatePackaging*/  return new Property("immediatePackaging", "Identifier", "A number appearing on the immediate packaging (and not the outer packaging).", 0, 1, immediatePackaging);
168          default: return super.getNamedProperty(_hash, _name, _checkValid);
169          }
170
171        }
172
173      @Override
174      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
175        switch (hash) {
176        case -682249912: /*outerPackaging*/ return this.outerPackaging == null ? new Base[0] : new Base[] {this.outerPackaging}; // Identifier
177        case 721147602: /*immediatePackaging*/ return this.immediatePackaging == null ? new Base[0] : new Base[] {this.immediatePackaging}; // Identifier
178        default: return super.getProperty(hash, name, checkValid);
179        }
180
181      }
182
183      @Override
184      public Base setProperty(int hash, String name, Base value) throws FHIRException {
185        switch (hash) {
186        case -682249912: // outerPackaging
187          this.outerPackaging = TypeConvertor.castToIdentifier(value); // Identifier
188          return value;
189        case 721147602: // immediatePackaging
190          this.immediatePackaging = TypeConvertor.castToIdentifier(value); // Identifier
191          return value;
192        default: return super.setProperty(hash, name, value);
193        }
194
195      }
196
197      @Override
198      public Base setProperty(String name, Base value) throws FHIRException {
199        if (name.equals("outerPackaging")) {
200          this.outerPackaging = TypeConvertor.castToIdentifier(value); // Identifier
201        } else if (name.equals("immediatePackaging")) {
202          this.immediatePackaging = TypeConvertor.castToIdentifier(value); // Identifier
203        } else
204          return super.setProperty(name, value);
205        return value;
206      }
207
208      @Override
209      public Base makeProperty(int hash, String name) throws FHIRException {
210        switch (hash) {
211        case -682249912:  return getOuterPackaging();
212        case 721147602:  return getImmediatePackaging();
213        default: return super.makeProperty(hash, name);
214        }
215
216      }
217
218      @Override
219      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
220        switch (hash) {
221        case -682249912: /*outerPackaging*/ return new String[] {"Identifier"};
222        case 721147602: /*immediatePackaging*/ return new String[] {"Identifier"};
223        default: return super.getTypesForProperty(hash, name);
224        }
225
226      }
227
228      @Override
229      public Base addChild(String name) throws FHIRException {
230        if (name.equals("outerPackaging")) {
231          this.outerPackaging = new Identifier();
232          return this.outerPackaging;
233        }
234        else if (name.equals("immediatePackaging")) {
235          this.immediatePackaging = new Identifier();
236          return this.immediatePackaging;
237        }
238        else
239          return super.addChild(name);
240      }
241
242      public PackagedProductDefinitionBatchIdentifierComponent copy() {
243        PackagedProductDefinitionBatchIdentifierComponent dst = new PackagedProductDefinitionBatchIdentifierComponent();
244        copyValues(dst);
245        return dst;
246      }
247
248      public void copyValues(PackagedProductDefinitionBatchIdentifierComponent dst) {
249        super.copyValues(dst);
250        dst.outerPackaging = outerPackaging == null ? null : outerPackaging.copy();
251        dst.immediatePackaging = immediatePackaging == null ? null : immediatePackaging.copy();
252      }
253
254      @Override
255      public boolean equalsDeep(Base other_) {
256        if (!super.equalsDeep(other_))
257          return false;
258        if (!(other_ instanceof PackagedProductDefinitionBatchIdentifierComponent))
259          return false;
260        PackagedProductDefinitionBatchIdentifierComponent o = (PackagedProductDefinitionBatchIdentifierComponent) other_;
261        return compareDeep(outerPackaging, o.outerPackaging, true) && compareDeep(immediatePackaging, o.immediatePackaging, true)
262          ;
263      }
264
265      @Override
266      public boolean equalsShallow(Base other_) {
267        if (!super.equalsShallow(other_))
268          return false;
269        if (!(other_ instanceof PackagedProductDefinitionBatchIdentifierComponent))
270          return false;
271        PackagedProductDefinitionBatchIdentifierComponent o = (PackagedProductDefinitionBatchIdentifierComponent) other_;
272        return true;
273      }
274
275      public boolean isEmpty() {
276        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(outerPackaging, immediatePackaging
277          );
278      }
279
280  public String fhirType() {
281    return "PackagedProductDefinition.batchIdentifier";
282
283  }
284
285  }
286
287    @Block()
288    public static class PackagedProductDefinitionPackageComponent extends BackboneElement implements IBaseBackboneElement {
289        /**
290         * Including possibly Data Carrier Identifier.
291         */
292        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
293        @Description(shortDefinition="Including possibly Data Carrier Identifier", formalDefinition="Including possibly Data Carrier Identifier." )
294        protected List<Identifier> identifier;
295
296        /**
297         * The physical type of the container of the medicine.
298         */
299        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
300        @Description(shortDefinition="The physical type of the container of the medicine", formalDefinition="The physical type of the container of the medicine." )
301        protected CodeableConcept type;
302
303        /**
304         * The quantity of this package in the medicinal product, at the current level of packaging. If specified, the outermost level is always 1.
305         */
306        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true)
307        @Description(shortDefinition="The quantity of this package in the medicinal product, at the current level of packaging. If specified, the outermost level is always 1", formalDefinition="The quantity of this package in the medicinal product, at the current level of packaging. If specified, the outermost level is always 1." )
308        protected Quantity quantity;
309
310        /**
311         * Material type of the package item.
312         */
313        @Child(name = "material", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
314        @Description(shortDefinition="Material type of the package item", formalDefinition="Material type of the package item." )
315        protected List<CodeableConcept> material;
316
317        /**
318         * A possible alternate material for the packaging.
319         */
320        @Child(name = "alternateMaterial", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
321        @Description(shortDefinition="A possible alternate material for the packaging", formalDefinition="A possible alternate material for the packaging." )
322        protected List<CodeableConcept> alternateMaterial;
323
324        /**
325         * Shelf Life and storage information.
326         */
327        @Child(name = "shelfLifeStorage", type = {ProductShelfLife.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
328        @Description(shortDefinition="Shelf Life and storage information", formalDefinition="Shelf Life and storage information." )
329        protected List<ProductShelfLife> shelfLifeStorage;
330
331        /**
332         * Manufacturer of this Package Item.
333         */
334        @Child(name = "manufacturer", type = {Organization.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
335        @Description(shortDefinition="Manufacturer of this Package Item", formalDefinition="Manufacturer of this Package Item." )
336        protected List<Reference> manufacturer;
337
338        /**
339         * General characteristics of this item.
340         */
341        @Child(name = "characteristic", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
342        @Description(shortDefinition="General characteristics of this item", formalDefinition="General characteristics of this item." )
343        protected List<PackagedProductDefinitionPackageCharacteristicComponent> characteristic;
344
345        /**
346         * The item(s) within the packaging.
347         */
348        @Child(name = "containedItem", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
349        @Description(shortDefinition="The item(s) within the packaging", formalDefinition="The item(s) within the packaging." )
350        protected List<PackagedProductDefinitionPackageContainedItemComponent> containedItem;
351
352        /**
353         * Allows containers within containers.
354         */
355        @Child(name = "package", type = {PackagedProductDefinitionPackageComponent.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
356        @Description(shortDefinition="Allows containers within containers", formalDefinition="Allows containers within containers." )
357        protected List<PackagedProductDefinitionPackageComponent> package_;
358
359        private static final long serialVersionUID = 8053245L;
360
361    /**
362     * Constructor
363     */
364      public PackagedProductDefinitionPackageComponent() {
365        super();
366      }
367
368        /**
369         * @return {@link #identifier} (Including possibly Data Carrier Identifier.)
370         */
371        public List<Identifier> getIdentifier() { 
372          if (this.identifier == null)
373            this.identifier = new ArrayList<Identifier>();
374          return this.identifier;
375        }
376
377        /**
378         * @return Returns a reference to <code>this</code> for easy method chaining
379         */
380        public PackagedProductDefinitionPackageComponent setIdentifier(List<Identifier> theIdentifier) { 
381          this.identifier = theIdentifier;
382          return this;
383        }
384
385        public boolean hasIdentifier() { 
386          if (this.identifier == null)
387            return false;
388          for (Identifier item : this.identifier)
389            if (!item.isEmpty())
390              return true;
391          return false;
392        }
393
394        public Identifier addIdentifier() { //3
395          Identifier t = new Identifier();
396          if (this.identifier == null)
397            this.identifier = new ArrayList<Identifier>();
398          this.identifier.add(t);
399          return t;
400        }
401
402        public PackagedProductDefinitionPackageComponent addIdentifier(Identifier t) { //3
403          if (t == null)
404            return this;
405          if (this.identifier == null)
406            this.identifier = new ArrayList<Identifier>();
407          this.identifier.add(t);
408          return this;
409        }
410
411        /**
412         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
413         */
414        public Identifier getIdentifierFirstRep() { 
415          if (getIdentifier().isEmpty()) {
416            addIdentifier();
417          }
418          return getIdentifier().get(0);
419        }
420
421        /**
422         * @return {@link #type} (The physical type of the container of the medicine.)
423         */
424        public CodeableConcept getType() { 
425          if (this.type == null)
426            if (Configuration.errorOnAutoCreate())
427              throw new Error("Attempt to auto-create PackagedProductDefinitionPackageComponent.type");
428            else if (Configuration.doAutoCreate())
429              this.type = new CodeableConcept(); // cc
430          return this.type;
431        }
432
433        public boolean hasType() { 
434          return this.type != null && !this.type.isEmpty();
435        }
436
437        /**
438         * @param value {@link #type} (The physical type of the container of the medicine.)
439         */
440        public PackagedProductDefinitionPackageComponent setType(CodeableConcept value) { 
441          this.type = value;
442          return this;
443        }
444
445        /**
446         * @return {@link #quantity} (The quantity of this package in the medicinal product, at the current level of packaging. If specified, the outermost level is always 1.)
447         */
448        public Quantity getQuantity() { 
449          if (this.quantity == null)
450            if (Configuration.errorOnAutoCreate())
451              throw new Error("Attempt to auto-create PackagedProductDefinitionPackageComponent.quantity");
452            else if (Configuration.doAutoCreate())
453              this.quantity = new Quantity(); // cc
454          return this.quantity;
455        }
456
457        public boolean hasQuantity() { 
458          return this.quantity != null && !this.quantity.isEmpty();
459        }
460
461        /**
462         * @param value {@link #quantity} (The quantity of this package in the medicinal product, at the current level of packaging. If specified, the outermost level is always 1.)
463         */
464        public PackagedProductDefinitionPackageComponent setQuantity(Quantity value) { 
465          this.quantity = value;
466          return this;
467        }
468
469        /**
470         * @return {@link #material} (Material type of the package item.)
471         */
472        public List<CodeableConcept> getMaterial() { 
473          if (this.material == null)
474            this.material = new ArrayList<CodeableConcept>();
475          return this.material;
476        }
477
478        /**
479         * @return Returns a reference to <code>this</code> for easy method chaining
480         */
481        public PackagedProductDefinitionPackageComponent setMaterial(List<CodeableConcept> theMaterial) { 
482          this.material = theMaterial;
483          return this;
484        }
485
486        public boolean hasMaterial() { 
487          if (this.material == null)
488            return false;
489          for (CodeableConcept item : this.material)
490            if (!item.isEmpty())
491              return true;
492          return false;
493        }
494
495        public CodeableConcept addMaterial() { //3
496          CodeableConcept t = new CodeableConcept();
497          if (this.material == null)
498            this.material = new ArrayList<CodeableConcept>();
499          this.material.add(t);
500          return t;
501        }
502
503        public PackagedProductDefinitionPackageComponent addMaterial(CodeableConcept t) { //3
504          if (t == null)
505            return this;
506          if (this.material == null)
507            this.material = new ArrayList<CodeableConcept>();
508          this.material.add(t);
509          return this;
510        }
511
512        /**
513         * @return The first repetition of repeating field {@link #material}, creating it if it does not already exist {3}
514         */
515        public CodeableConcept getMaterialFirstRep() { 
516          if (getMaterial().isEmpty()) {
517            addMaterial();
518          }
519          return getMaterial().get(0);
520        }
521
522        /**
523         * @return {@link #alternateMaterial} (A possible alternate material for the packaging.)
524         */
525        public List<CodeableConcept> getAlternateMaterial() { 
526          if (this.alternateMaterial == null)
527            this.alternateMaterial = new ArrayList<CodeableConcept>();
528          return this.alternateMaterial;
529        }
530
531        /**
532         * @return Returns a reference to <code>this</code> for easy method chaining
533         */
534        public PackagedProductDefinitionPackageComponent setAlternateMaterial(List<CodeableConcept> theAlternateMaterial) { 
535          this.alternateMaterial = theAlternateMaterial;
536          return this;
537        }
538
539        public boolean hasAlternateMaterial() { 
540          if (this.alternateMaterial == null)
541            return false;
542          for (CodeableConcept item : this.alternateMaterial)
543            if (!item.isEmpty())
544              return true;
545          return false;
546        }
547
548        public CodeableConcept addAlternateMaterial() { //3
549          CodeableConcept t = new CodeableConcept();
550          if (this.alternateMaterial == null)
551            this.alternateMaterial = new ArrayList<CodeableConcept>();
552          this.alternateMaterial.add(t);
553          return t;
554        }
555
556        public PackagedProductDefinitionPackageComponent addAlternateMaterial(CodeableConcept t) { //3
557          if (t == null)
558            return this;
559          if (this.alternateMaterial == null)
560            this.alternateMaterial = new ArrayList<CodeableConcept>();
561          this.alternateMaterial.add(t);
562          return this;
563        }
564
565        /**
566         * @return The first repetition of repeating field {@link #alternateMaterial}, creating it if it does not already exist {3}
567         */
568        public CodeableConcept getAlternateMaterialFirstRep() { 
569          if (getAlternateMaterial().isEmpty()) {
570            addAlternateMaterial();
571          }
572          return getAlternateMaterial().get(0);
573        }
574
575        /**
576         * @return {@link #shelfLifeStorage} (Shelf Life and storage information.)
577         */
578        public List<ProductShelfLife> getShelfLifeStorage() { 
579          if (this.shelfLifeStorage == null)
580            this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
581          return this.shelfLifeStorage;
582        }
583
584        /**
585         * @return Returns a reference to <code>this</code> for easy method chaining
586         */
587        public PackagedProductDefinitionPackageComponent setShelfLifeStorage(List<ProductShelfLife> theShelfLifeStorage) { 
588          this.shelfLifeStorage = theShelfLifeStorage;
589          return this;
590        }
591
592        public boolean hasShelfLifeStorage() { 
593          if (this.shelfLifeStorage == null)
594            return false;
595          for (ProductShelfLife item : this.shelfLifeStorage)
596            if (!item.isEmpty())
597              return true;
598          return false;
599        }
600
601        public ProductShelfLife addShelfLifeStorage() { //3
602          ProductShelfLife t = new ProductShelfLife();
603          if (this.shelfLifeStorage == null)
604            this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
605          this.shelfLifeStorage.add(t);
606          return t;
607        }
608
609        public PackagedProductDefinitionPackageComponent addShelfLifeStorage(ProductShelfLife t) { //3
610          if (t == null)
611            return this;
612          if (this.shelfLifeStorage == null)
613            this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
614          this.shelfLifeStorage.add(t);
615          return this;
616        }
617
618        /**
619         * @return The first repetition of repeating field {@link #shelfLifeStorage}, creating it if it does not already exist {3}
620         */
621        public ProductShelfLife getShelfLifeStorageFirstRep() { 
622          if (getShelfLifeStorage().isEmpty()) {
623            addShelfLifeStorage();
624          }
625          return getShelfLifeStorage().get(0);
626        }
627
628        /**
629         * @return {@link #manufacturer} (Manufacturer of this Package Item.)
630         */
631        public List<Reference> getManufacturer() { 
632          if (this.manufacturer == null)
633            this.manufacturer = new ArrayList<Reference>();
634          return this.manufacturer;
635        }
636
637        /**
638         * @return Returns a reference to <code>this</code> for easy method chaining
639         */
640        public PackagedProductDefinitionPackageComponent setManufacturer(List<Reference> theManufacturer) { 
641          this.manufacturer = theManufacturer;
642          return this;
643        }
644
645        public boolean hasManufacturer() { 
646          if (this.manufacturer == null)
647            return false;
648          for (Reference item : this.manufacturer)
649            if (!item.isEmpty())
650              return true;
651          return false;
652        }
653
654        public Reference addManufacturer() { //3
655          Reference t = new Reference();
656          if (this.manufacturer == null)
657            this.manufacturer = new ArrayList<Reference>();
658          this.manufacturer.add(t);
659          return t;
660        }
661
662        public PackagedProductDefinitionPackageComponent addManufacturer(Reference t) { //3
663          if (t == null)
664            return this;
665          if (this.manufacturer == null)
666            this.manufacturer = new ArrayList<Reference>();
667          this.manufacturer.add(t);
668          return this;
669        }
670
671        /**
672         * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist {3}
673         */
674        public Reference getManufacturerFirstRep() { 
675          if (getManufacturer().isEmpty()) {
676            addManufacturer();
677          }
678          return getManufacturer().get(0);
679        }
680
681        /**
682         * @return {@link #characteristic} (General characteristics of this item.)
683         */
684        public List<PackagedProductDefinitionPackageCharacteristicComponent> getCharacteristic() { 
685          if (this.characteristic == null)
686            this.characteristic = new ArrayList<PackagedProductDefinitionPackageCharacteristicComponent>();
687          return this.characteristic;
688        }
689
690        /**
691         * @return Returns a reference to <code>this</code> for easy method chaining
692         */
693        public PackagedProductDefinitionPackageComponent setCharacteristic(List<PackagedProductDefinitionPackageCharacteristicComponent> theCharacteristic) { 
694          this.characteristic = theCharacteristic;
695          return this;
696        }
697
698        public boolean hasCharacteristic() { 
699          if (this.characteristic == null)
700            return false;
701          for (PackagedProductDefinitionPackageCharacteristicComponent item : this.characteristic)
702            if (!item.isEmpty())
703              return true;
704          return false;
705        }
706
707        public PackagedProductDefinitionPackageCharacteristicComponent addCharacteristic() { //3
708          PackagedProductDefinitionPackageCharacteristicComponent t = new PackagedProductDefinitionPackageCharacteristicComponent();
709          if (this.characteristic == null)
710            this.characteristic = new ArrayList<PackagedProductDefinitionPackageCharacteristicComponent>();
711          this.characteristic.add(t);
712          return t;
713        }
714
715        public PackagedProductDefinitionPackageComponent addCharacteristic(PackagedProductDefinitionPackageCharacteristicComponent t) { //3
716          if (t == null)
717            return this;
718          if (this.characteristic == null)
719            this.characteristic = new ArrayList<PackagedProductDefinitionPackageCharacteristicComponent>();
720          this.characteristic.add(t);
721          return this;
722        }
723
724        /**
725         * @return The first repetition of repeating field {@link #characteristic}, creating it if it does not already exist {3}
726         */
727        public PackagedProductDefinitionPackageCharacteristicComponent getCharacteristicFirstRep() { 
728          if (getCharacteristic().isEmpty()) {
729            addCharacteristic();
730          }
731          return getCharacteristic().get(0);
732        }
733
734        /**
735         * @return {@link #containedItem} (The item(s) within the packaging.)
736         */
737        public List<PackagedProductDefinitionPackageContainedItemComponent> getContainedItem() { 
738          if (this.containedItem == null)
739            this.containedItem = new ArrayList<PackagedProductDefinitionPackageContainedItemComponent>();
740          return this.containedItem;
741        }
742
743        /**
744         * @return Returns a reference to <code>this</code> for easy method chaining
745         */
746        public PackagedProductDefinitionPackageComponent setContainedItem(List<PackagedProductDefinitionPackageContainedItemComponent> theContainedItem) { 
747          this.containedItem = theContainedItem;
748          return this;
749        }
750
751        public boolean hasContainedItem() { 
752          if (this.containedItem == null)
753            return false;
754          for (PackagedProductDefinitionPackageContainedItemComponent item : this.containedItem)
755            if (!item.isEmpty())
756              return true;
757          return false;
758        }
759
760        public PackagedProductDefinitionPackageContainedItemComponent addContainedItem() { //3
761          PackagedProductDefinitionPackageContainedItemComponent t = new PackagedProductDefinitionPackageContainedItemComponent();
762          if (this.containedItem == null)
763            this.containedItem = new ArrayList<PackagedProductDefinitionPackageContainedItemComponent>();
764          this.containedItem.add(t);
765          return t;
766        }
767
768        public PackagedProductDefinitionPackageComponent addContainedItem(PackagedProductDefinitionPackageContainedItemComponent t) { //3
769          if (t == null)
770            return this;
771          if (this.containedItem == null)
772            this.containedItem = new ArrayList<PackagedProductDefinitionPackageContainedItemComponent>();
773          this.containedItem.add(t);
774          return this;
775        }
776
777        /**
778         * @return The first repetition of repeating field {@link #containedItem}, creating it if it does not already exist {3}
779         */
780        public PackagedProductDefinitionPackageContainedItemComponent getContainedItemFirstRep() { 
781          if (getContainedItem().isEmpty()) {
782            addContainedItem();
783          }
784          return getContainedItem().get(0);
785        }
786
787        /**
788         * @return {@link #package_} (Allows containers within containers.)
789         */
790        public List<PackagedProductDefinitionPackageComponent> getPackage() { 
791          if (this.package_ == null)
792            this.package_ = new ArrayList<PackagedProductDefinitionPackageComponent>();
793          return this.package_;
794        }
795
796        /**
797         * @return Returns a reference to <code>this</code> for easy method chaining
798         */
799        public PackagedProductDefinitionPackageComponent setPackage(List<PackagedProductDefinitionPackageComponent> thePackage) { 
800          this.package_ = thePackage;
801          return this;
802        }
803
804        public boolean hasPackage() { 
805          if (this.package_ == null)
806            return false;
807          for (PackagedProductDefinitionPackageComponent item : this.package_)
808            if (!item.isEmpty())
809              return true;
810          return false;
811        }
812
813        public PackagedProductDefinitionPackageComponent addPackage() { //3
814          PackagedProductDefinitionPackageComponent t = new PackagedProductDefinitionPackageComponent();
815          if (this.package_ == null)
816            this.package_ = new ArrayList<PackagedProductDefinitionPackageComponent>();
817          this.package_.add(t);
818          return t;
819        }
820
821        public PackagedProductDefinitionPackageComponent addPackage(PackagedProductDefinitionPackageComponent t) { //3
822          if (t == null)
823            return this;
824          if (this.package_ == null)
825            this.package_ = new ArrayList<PackagedProductDefinitionPackageComponent>();
826          this.package_.add(t);
827          return this;
828        }
829
830        /**
831         * @return The first repetition of repeating field {@link #package_}, creating it if it does not already exist {3}
832         */
833        public PackagedProductDefinitionPackageComponent getPackageFirstRep() { 
834          if (getPackage().isEmpty()) {
835            addPackage();
836          }
837          return getPackage().get(0);
838        }
839
840        protected void listChildren(List<Property> children) {
841          super.listChildren(children);
842          children.add(new Property("identifier", "Identifier", "Including possibly Data Carrier Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
843          children.add(new Property("type", "CodeableConcept", "The physical type of the container of the medicine.", 0, 1, type));
844          children.add(new Property("quantity", "Quantity", "The quantity of this package in the medicinal product, at the current level of packaging. If specified, the outermost level is always 1.", 0, 1, quantity));
845          children.add(new Property("material", "CodeableConcept", "Material type of the package item.", 0, java.lang.Integer.MAX_VALUE, material));
846          children.add(new Property("alternateMaterial", "CodeableConcept", "A possible alternate material for the packaging.", 0, java.lang.Integer.MAX_VALUE, alternateMaterial));
847          children.add(new Property("shelfLifeStorage", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLifeStorage));
848          children.add(new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Package Item.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
849          children.add(new Property("characteristic", "", "General characteristics of this item.", 0, java.lang.Integer.MAX_VALUE, characteristic));
850          children.add(new Property("containedItem", "", "The item(s) within the packaging.", 0, java.lang.Integer.MAX_VALUE, containedItem));
851          children.add(new Property("package", "@PackagedProductDefinition.package", "Allows containers within containers.", 0, java.lang.Integer.MAX_VALUE, package_));
852        }
853
854        @Override
855        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
856          switch (_hash) {
857          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Including possibly Data Carrier Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
858          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The physical type of the container of the medicine.", 0, 1, type);
859          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The quantity of this package in the medicinal product, at the current level of packaging. If specified, the outermost level is always 1.", 0, 1, quantity);
860          case 299066663: /*material*/  return new Property("material", "CodeableConcept", "Material type of the package item.", 0, java.lang.Integer.MAX_VALUE, material);
861          case -1021448255: /*alternateMaterial*/  return new Property("alternateMaterial", "CodeableConcept", "A possible alternate material for the packaging.", 0, java.lang.Integer.MAX_VALUE, alternateMaterial);
862          case 172049237: /*shelfLifeStorage*/  return new Property("shelfLifeStorage", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLifeStorage);
863          case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Package Item.", 0, java.lang.Integer.MAX_VALUE, manufacturer);
864          case 366313883: /*characteristic*/  return new Property("characteristic", "", "General characteristics of this item.", 0, java.lang.Integer.MAX_VALUE, characteristic);
865          case 1953679910: /*containedItem*/  return new Property("containedItem", "", "The item(s) within the packaging.", 0, java.lang.Integer.MAX_VALUE, containedItem);
866          case -807062458: /*package*/  return new Property("package", "@PackagedProductDefinition.package", "Allows containers within containers.", 0, java.lang.Integer.MAX_VALUE, package_);
867          default: return super.getNamedProperty(_hash, _name, _checkValid);
868          }
869
870        }
871
872      @Override
873      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
874        switch (hash) {
875        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
876        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
877        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
878        case 299066663: /*material*/ return this.material == null ? new Base[0] : this.material.toArray(new Base[this.material.size()]); // CodeableConcept
879        case -1021448255: /*alternateMaterial*/ return this.alternateMaterial == null ? new Base[0] : this.alternateMaterial.toArray(new Base[this.alternateMaterial.size()]); // CodeableConcept
880        case 172049237: /*shelfLifeStorage*/ return this.shelfLifeStorage == null ? new Base[0] : this.shelfLifeStorage.toArray(new Base[this.shelfLifeStorage.size()]); // ProductShelfLife
881        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
882        case 366313883: /*characteristic*/ return this.characteristic == null ? new Base[0] : this.characteristic.toArray(new Base[this.characteristic.size()]); // PackagedProductDefinitionPackageCharacteristicComponent
883        case 1953679910: /*containedItem*/ return this.containedItem == null ? new Base[0] : this.containedItem.toArray(new Base[this.containedItem.size()]); // PackagedProductDefinitionPackageContainedItemComponent
884        case -807062458: /*package*/ return this.package_ == null ? new Base[0] : this.package_.toArray(new Base[this.package_.size()]); // PackagedProductDefinitionPackageComponent
885        default: return super.getProperty(hash, name, checkValid);
886        }
887
888      }
889
890      @Override
891      public Base setProperty(int hash, String name, Base value) throws FHIRException {
892        switch (hash) {
893        case -1618432855: // identifier
894          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
895          return value;
896        case 3575610: // type
897          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
898          return value;
899        case -1285004149: // quantity
900          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
901          return value;
902        case 299066663: // material
903          this.getMaterial().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
904          return value;
905        case -1021448255: // alternateMaterial
906          this.getAlternateMaterial().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
907          return value;
908        case 172049237: // shelfLifeStorage
909          this.getShelfLifeStorage().add(TypeConvertor.castToProductShelfLife(value)); // ProductShelfLife
910          return value;
911        case -1969347631: // manufacturer
912          this.getManufacturer().add(TypeConvertor.castToReference(value)); // Reference
913          return value;
914        case 366313883: // characteristic
915          this.getCharacteristic().add((PackagedProductDefinitionPackageCharacteristicComponent) value); // PackagedProductDefinitionPackageCharacteristicComponent
916          return value;
917        case 1953679910: // containedItem
918          this.getContainedItem().add((PackagedProductDefinitionPackageContainedItemComponent) value); // PackagedProductDefinitionPackageContainedItemComponent
919          return value;
920        case -807062458: // package
921          this.getPackage().add((PackagedProductDefinitionPackageComponent) value); // PackagedProductDefinitionPackageComponent
922          return value;
923        default: return super.setProperty(hash, name, value);
924        }
925
926      }
927
928      @Override
929      public Base setProperty(String name, Base value) throws FHIRException {
930        if (name.equals("identifier")) {
931          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
932        } else if (name.equals("type")) {
933          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
934        } else if (name.equals("quantity")) {
935          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
936        } else if (name.equals("material")) {
937          this.getMaterial().add(TypeConvertor.castToCodeableConcept(value));
938        } else if (name.equals("alternateMaterial")) {
939          this.getAlternateMaterial().add(TypeConvertor.castToCodeableConcept(value));
940        } else if (name.equals("shelfLifeStorage")) {
941          this.getShelfLifeStorage().add(TypeConvertor.castToProductShelfLife(value));
942        } else if (name.equals("manufacturer")) {
943          this.getManufacturer().add(TypeConvertor.castToReference(value));
944        } else if (name.equals("characteristic")) {
945          this.getCharacteristic().add((PackagedProductDefinitionPackageCharacteristicComponent) value);
946        } else if (name.equals("containedItem")) {
947          this.getContainedItem().add((PackagedProductDefinitionPackageContainedItemComponent) value);
948        } else if (name.equals("package")) {
949          this.getPackage().add((PackagedProductDefinitionPackageComponent) value);
950        } else
951          return super.setProperty(name, value);
952        return value;
953      }
954
955      @Override
956      public Base makeProperty(int hash, String name) throws FHIRException {
957        switch (hash) {
958        case -1618432855:  return addIdentifier(); 
959        case 3575610:  return getType();
960        case -1285004149:  return getQuantity();
961        case 299066663:  return addMaterial(); 
962        case -1021448255:  return addAlternateMaterial(); 
963        case 172049237:  return addShelfLifeStorage(); 
964        case -1969347631:  return addManufacturer(); 
965        case 366313883:  return addCharacteristic(); 
966        case 1953679910:  return addContainedItem(); 
967        case -807062458:  return addPackage(); 
968        default: return super.makeProperty(hash, name);
969        }
970
971      }
972
973      @Override
974      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
975        switch (hash) {
976        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
977        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
978        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
979        case 299066663: /*material*/ return new String[] {"CodeableConcept"};
980        case -1021448255: /*alternateMaterial*/ return new String[] {"CodeableConcept"};
981        case 172049237: /*shelfLifeStorage*/ return new String[] {"ProductShelfLife"};
982        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
983        case 366313883: /*characteristic*/ return new String[] {};
984        case 1953679910: /*containedItem*/ return new String[] {};
985        case -807062458: /*package*/ return new String[] {"@PackagedProductDefinition.package"};
986        default: return super.getTypesForProperty(hash, name);
987        }
988
989      }
990
991      @Override
992      public Base addChild(String name) throws FHIRException {
993        if (name.equals("identifier")) {
994          return addIdentifier();
995        }
996        else if (name.equals("type")) {
997          this.type = new CodeableConcept();
998          return this.type;
999        }
1000        else if (name.equals("quantity")) {
1001          this.quantity = new Quantity();
1002          return this.quantity;
1003        }
1004        else if (name.equals("material")) {
1005          return addMaterial();
1006        }
1007        else if (name.equals("alternateMaterial")) {
1008          return addAlternateMaterial();
1009        }
1010        else if (name.equals("shelfLifeStorage")) {
1011          return addShelfLifeStorage();
1012        }
1013        else if (name.equals("manufacturer")) {
1014          return addManufacturer();
1015        }
1016        else if (name.equals("characteristic")) {
1017          return addCharacteristic();
1018        }
1019        else if (name.equals("containedItem")) {
1020          return addContainedItem();
1021        }
1022        else if (name.equals("package")) {
1023          return addPackage();
1024        }
1025        else
1026          return super.addChild(name);
1027      }
1028
1029      public PackagedProductDefinitionPackageComponent copy() {
1030        PackagedProductDefinitionPackageComponent dst = new PackagedProductDefinitionPackageComponent();
1031        copyValues(dst);
1032        return dst;
1033      }
1034
1035      public void copyValues(PackagedProductDefinitionPackageComponent dst) {
1036        super.copyValues(dst);
1037        if (identifier != null) {
1038          dst.identifier = new ArrayList<Identifier>();
1039          for (Identifier i : identifier)
1040            dst.identifier.add(i.copy());
1041        };
1042        dst.type = type == null ? null : type.copy();
1043        dst.quantity = quantity == null ? null : quantity.copy();
1044        if (material != null) {
1045          dst.material = new ArrayList<CodeableConcept>();
1046          for (CodeableConcept i : material)
1047            dst.material.add(i.copy());
1048        };
1049        if (alternateMaterial != null) {
1050          dst.alternateMaterial = new ArrayList<CodeableConcept>();
1051          for (CodeableConcept i : alternateMaterial)
1052            dst.alternateMaterial.add(i.copy());
1053        };
1054        if (shelfLifeStorage != null) {
1055          dst.shelfLifeStorage = new ArrayList<ProductShelfLife>();
1056          for (ProductShelfLife i : shelfLifeStorage)
1057            dst.shelfLifeStorage.add(i.copy());
1058        };
1059        if (manufacturer != null) {
1060          dst.manufacturer = new ArrayList<Reference>();
1061          for (Reference i : manufacturer)
1062            dst.manufacturer.add(i.copy());
1063        };
1064        if (characteristic != null) {
1065          dst.characteristic = new ArrayList<PackagedProductDefinitionPackageCharacteristicComponent>();
1066          for (PackagedProductDefinitionPackageCharacteristicComponent i : characteristic)
1067            dst.characteristic.add(i.copy());
1068        };
1069        if (containedItem != null) {
1070          dst.containedItem = new ArrayList<PackagedProductDefinitionPackageContainedItemComponent>();
1071          for (PackagedProductDefinitionPackageContainedItemComponent i : containedItem)
1072            dst.containedItem.add(i.copy());
1073        };
1074        if (package_ != null) {
1075          dst.package_ = new ArrayList<PackagedProductDefinitionPackageComponent>();
1076          for (PackagedProductDefinitionPackageComponent i : package_)
1077            dst.package_.add(i.copy());
1078        };
1079      }
1080
1081      @Override
1082      public boolean equalsDeep(Base other_) {
1083        if (!super.equalsDeep(other_))
1084          return false;
1085        if (!(other_ instanceof PackagedProductDefinitionPackageComponent))
1086          return false;
1087        PackagedProductDefinitionPackageComponent o = (PackagedProductDefinitionPackageComponent) other_;
1088        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(quantity, o.quantity, true)
1089           && compareDeep(material, o.material, true) && compareDeep(alternateMaterial, o.alternateMaterial, true)
1090           && compareDeep(shelfLifeStorage, o.shelfLifeStorage, true) && compareDeep(manufacturer, o.manufacturer, true)
1091           && compareDeep(characteristic, o.characteristic, true) && compareDeep(containedItem, o.containedItem, true)
1092           && compareDeep(package_, o.package_, true);
1093      }
1094
1095      @Override
1096      public boolean equalsShallow(Base other_) {
1097        if (!super.equalsShallow(other_))
1098          return false;
1099        if (!(other_ instanceof PackagedProductDefinitionPackageComponent))
1100          return false;
1101        PackagedProductDefinitionPackageComponent o = (PackagedProductDefinitionPackageComponent) other_;
1102        return true;
1103      }
1104
1105      public boolean isEmpty() {
1106        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, quantity
1107          , material, alternateMaterial, shelfLifeStorage, manufacturer, characteristic, containedItem
1108          , package_);
1109      }
1110
1111  public String fhirType() {
1112    return "PackagedProductDefinition.package";
1113
1114  }
1115
1116  }
1117
1118    @Block()
1119    public static class PackagedProductDefinitionPackageCharacteristicComponent extends BackboneElement implements IBaseBackboneElement {
1120        /**
1121         * A code expressing the type of characteristic.
1122         */
1123        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1124        @Description(shortDefinition="A code expressing the type of characteristic", formalDefinition="A code expressing the type of characteristic." )
1125        protected CodeableConcept code;
1126
1127        /**
1128         * A value for the characteristic.
1129         */
1130        @Child(name = "value", type = {Coding.class, Quantity.class, StringType.class, DateType.class, BooleanType.class, Attachment.class}, order=2, min=0, max=1, modifier=false, summary=true)
1131        @Description(shortDefinition="A value for the characteristic", formalDefinition="A value for the characteristic." )
1132        protected DataType value;
1133
1134        private static final long serialVersionUID = -1950789033L;
1135
1136    /**
1137     * Constructor
1138     */
1139      public PackagedProductDefinitionPackageCharacteristicComponent() {
1140        super();
1141      }
1142
1143    /**
1144     * Constructor
1145     */
1146      public PackagedProductDefinitionPackageCharacteristicComponent(CodeableConcept code) {
1147        super();
1148        this.setCode(code);
1149      }
1150
1151        /**
1152         * @return {@link #code} (A code expressing the type of characteristic.)
1153         */
1154        public CodeableConcept getCode() { 
1155          if (this.code == null)
1156            if (Configuration.errorOnAutoCreate())
1157              throw new Error("Attempt to auto-create PackagedProductDefinitionPackageCharacteristicComponent.code");
1158            else if (Configuration.doAutoCreate())
1159              this.code = new CodeableConcept(); // cc
1160          return this.code;
1161        }
1162
1163        public boolean hasCode() { 
1164          return this.code != null && !this.code.isEmpty();
1165        }
1166
1167        /**
1168         * @param value {@link #code} (A code expressing the type of characteristic.)
1169         */
1170        public PackagedProductDefinitionPackageCharacteristicComponent setCode(CodeableConcept value) { 
1171          this.code = value;
1172          return this;
1173        }
1174
1175        /**
1176         * @return {@link #value} (A value for the characteristic.)
1177         */
1178        public DataType getValue() { 
1179          return this.value;
1180        }
1181
1182        /**
1183         * @return {@link #value} (A value for the characteristic.)
1184         */
1185        public Coding getValueCoding() throws FHIRException { 
1186          if (this.value == null)
1187            this.value = new Coding();
1188          if (!(this.value instanceof Coding))
1189            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
1190          return (Coding) this.value;
1191        }
1192
1193        public boolean hasValueCoding() { 
1194          return this != null && this.value instanceof Coding;
1195        }
1196
1197        /**
1198         * @return {@link #value} (A value for the characteristic.)
1199         */
1200        public Quantity getValueQuantity() throws FHIRException { 
1201          if (this.value == null)
1202            this.value = new Quantity();
1203          if (!(this.value instanceof Quantity))
1204            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
1205          return (Quantity) this.value;
1206        }
1207
1208        public boolean hasValueQuantity() { 
1209          return this != null && this.value instanceof Quantity;
1210        }
1211
1212        /**
1213         * @return {@link #value} (A value for the characteristic.)
1214         */
1215        public StringType getValueStringType() throws FHIRException { 
1216          if (this.value == null)
1217            this.value = new StringType();
1218          if (!(this.value instanceof StringType))
1219            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
1220          return (StringType) this.value;
1221        }
1222
1223        public boolean hasValueStringType() { 
1224          return this != null && this.value instanceof StringType;
1225        }
1226
1227        /**
1228         * @return {@link #value} (A value for the characteristic.)
1229         */
1230        public DateType getValueDateType() throws FHIRException { 
1231          if (this.value == null)
1232            this.value = new DateType();
1233          if (!(this.value instanceof DateType))
1234            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
1235          return (DateType) this.value;
1236        }
1237
1238        public boolean hasValueDateType() { 
1239          return this != null && this.value instanceof DateType;
1240        }
1241
1242        /**
1243         * @return {@link #value} (A value for the characteristic.)
1244         */
1245        public BooleanType getValueBooleanType() throws FHIRException { 
1246          if (this.value == null)
1247            this.value = new BooleanType();
1248          if (!(this.value instanceof BooleanType))
1249            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
1250          return (BooleanType) this.value;
1251        }
1252
1253        public boolean hasValueBooleanType() { 
1254          return this != null && this.value instanceof BooleanType;
1255        }
1256
1257        /**
1258         * @return {@link #value} (A value for the characteristic.)
1259         */
1260        public Attachment getValueAttachment() throws FHIRException { 
1261          if (this.value == null)
1262            this.value = new Attachment();
1263          if (!(this.value instanceof Attachment))
1264            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
1265          return (Attachment) this.value;
1266        }
1267
1268        public boolean hasValueAttachment() { 
1269          return this != null && this.value instanceof Attachment;
1270        }
1271
1272        public boolean hasValue() { 
1273          return this.value != null && !this.value.isEmpty();
1274        }
1275
1276        /**
1277         * @param value {@link #value} (A value for the characteristic.)
1278         */
1279        public PackagedProductDefinitionPackageCharacteristicComponent setValue(DataType value) { 
1280          if (value != null && !(value instanceof Coding || value instanceof Quantity || value instanceof StringType || value instanceof DateType || value instanceof BooleanType || value instanceof Attachment))
1281            throw new Error("Not the right type for PackagedProductDefinition.package.characteristic.value[x]: "+value.fhirType());
1282          this.value = value;
1283          return this;
1284        }
1285
1286        protected void listChildren(List<Property> children) {
1287          super.listChildren(children);
1288          children.add(new Property("code", "CodeableConcept", "A code expressing the type of characteristic.", 0, 1, code));
1289          children.add(new Property("value[x]", "Coding|Quantity|string|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value));
1290        }
1291
1292        @Override
1293        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1294          switch (_hash) {
1295          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code expressing the type of characteristic.", 0, 1, code);
1296          case -1410166417: /*value[x]*/  return new Property("value[x]", "Coding|Quantity|string|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value);
1297          case 111972721: /*value*/  return new Property("value[x]", "Coding|Quantity|string|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value);
1298          case -1887705029: /*valueCoding*/  return new Property("value[x]", "Coding", "A value for the characteristic.", 0, 1, value);
1299          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "A value for the characteristic.", 0, 1, value);
1300          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "A value for the characteristic.", 0, 1, value);
1301          case -766192449: /*valueDate*/  return new Property("value[x]", "date", "A value for the characteristic.", 0, 1, value);
1302          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "A value for the characteristic.", 0, 1, value);
1303          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "A value for the characteristic.", 0, 1, value);
1304          default: return super.getNamedProperty(_hash, _name, _checkValid);
1305          }
1306
1307        }
1308
1309      @Override
1310      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1311        switch (hash) {
1312        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1313        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1314        default: return super.getProperty(hash, name, checkValid);
1315        }
1316
1317      }
1318
1319      @Override
1320      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1321        switch (hash) {
1322        case 3059181: // code
1323          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1324          return value;
1325        case 111972721: // value
1326          this.value = TypeConvertor.castToType(value); // DataType
1327          return value;
1328        default: return super.setProperty(hash, name, value);
1329        }
1330
1331      }
1332
1333      @Override
1334      public Base setProperty(String name, Base value) throws FHIRException {
1335        if (name.equals("code")) {
1336          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1337        } else if (name.equals("value[x]")) {
1338          this.value = TypeConvertor.castToType(value); // DataType
1339        } else
1340          return super.setProperty(name, value);
1341        return value;
1342      }
1343
1344      @Override
1345      public Base makeProperty(int hash, String name) throws FHIRException {
1346        switch (hash) {
1347        case 3059181:  return getCode();
1348        case -1410166417:  return getValue();
1349        case 111972721:  return getValue();
1350        default: return super.makeProperty(hash, name);
1351        }
1352
1353      }
1354
1355      @Override
1356      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1357        switch (hash) {
1358        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1359        case 111972721: /*value*/ return new String[] {"Coding", "Quantity", "string", "date", "boolean", "Attachment"};
1360        default: return super.getTypesForProperty(hash, name);
1361        }
1362
1363      }
1364
1365      @Override
1366      public Base addChild(String name) throws FHIRException {
1367        if (name.equals("code")) {
1368          this.code = new CodeableConcept();
1369          return this.code;
1370        }
1371        else if (name.equals("valueCoding")) {
1372          this.value = new Coding();
1373          return this.value;
1374        }
1375        else if (name.equals("valueQuantity")) {
1376          this.value = new Quantity();
1377          return this.value;
1378        }
1379        else if (name.equals("valueString")) {
1380          this.value = new StringType();
1381          return this.value;
1382        }
1383        else if (name.equals("valueDate")) {
1384          this.value = new DateType();
1385          return this.value;
1386        }
1387        else if (name.equals("valueBoolean")) {
1388          this.value = new BooleanType();
1389          return this.value;
1390        }
1391        else if (name.equals("valueAttachment")) {
1392          this.value = new Attachment();
1393          return this.value;
1394        }
1395        else
1396          return super.addChild(name);
1397      }
1398
1399      public PackagedProductDefinitionPackageCharacteristicComponent copy() {
1400        PackagedProductDefinitionPackageCharacteristicComponent dst = new PackagedProductDefinitionPackageCharacteristicComponent();
1401        copyValues(dst);
1402        return dst;
1403      }
1404
1405      public void copyValues(PackagedProductDefinitionPackageCharacteristicComponent dst) {
1406        super.copyValues(dst);
1407        dst.code = code == null ? null : code.copy();
1408        dst.value = value == null ? null : value.copy();
1409      }
1410
1411      @Override
1412      public boolean equalsDeep(Base other_) {
1413        if (!super.equalsDeep(other_))
1414          return false;
1415        if (!(other_ instanceof PackagedProductDefinitionPackageCharacteristicComponent))
1416          return false;
1417        PackagedProductDefinitionPackageCharacteristicComponent o = (PackagedProductDefinitionPackageCharacteristicComponent) other_;
1418        return compareDeep(code, o.code, true) && compareDeep(value, o.value, true);
1419      }
1420
1421      @Override
1422      public boolean equalsShallow(Base other_) {
1423        if (!super.equalsShallow(other_))
1424          return false;
1425        if (!(other_ instanceof PackagedProductDefinitionPackageCharacteristicComponent))
1426          return false;
1427        PackagedProductDefinitionPackageCharacteristicComponent o = (PackagedProductDefinitionPackageCharacteristicComponent) other_;
1428        return true;
1429      }
1430
1431      public boolean isEmpty() {
1432        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, value);
1433      }
1434
1435  public String fhirType() {
1436    return "PackagedProductDefinition.package.characteristic";
1437
1438  }
1439
1440  }
1441
1442    @Block()
1443    public static class PackagedProductDefinitionPackageContainedItemComponent extends BackboneElement implements IBaseBackboneElement {
1444        /**
1445         * The manufactured item or device as contained in the packaged medicinal product.
1446         */
1447        @Child(name = "item", type = {ManufacturedItemDefinition.class, DeviceDefinition.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1448        @Description(shortDefinition="The manufactured item or device as contained in the packaged medicinal product", formalDefinition="The manufactured item or device as contained in the packaged medicinal product." )
1449        protected List<Reference> item;
1450
1451        /**
1452         * The number of this type of item within this packaging.
1453         */
1454        @Child(name = "amount", type = {Quantity.class, IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1455        @Description(shortDefinition="The number of this type of item within this packaging", formalDefinition="The number of this type of item within this packaging." )
1456        protected DataType amount;
1457
1458        private static final long serialVersionUID = 454818874L;
1459
1460    /**
1461     * Constructor
1462     */
1463      public PackagedProductDefinitionPackageContainedItemComponent() {
1464        super();
1465      }
1466
1467        /**
1468         * @return {@link #item} (The manufactured item or device as contained in the packaged medicinal product.)
1469         */
1470        public List<Reference> getItem() { 
1471          if (this.item == null)
1472            this.item = new ArrayList<Reference>();
1473          return this.item;
1474        }
1475
1476        /**
1477         * @return Returns a reference to <code>this</code> for easy method chaining
1478         */
1479        public PackagedProductDefinitionPackageContainedItemComponent setItem(List<Reference> theItem) { 
1480          this.item = theItem;
1481          return this;
1482        }
1483
1484        public boolean hasItem() { 
1485          if (this.item == null)
1486            return false;
1487          for (Reference item : this.item)
1488            if (!item.isEmpty())
1489              return true;
1490          return false;
1491        }
1492
1493        public Reference addItem() { //3
1494          Reference t = new Reference();
1495          if (this.item == null)
1496            this.item = new ArrayList<Reference>();
1497          this.item.add(t);
1498          return t;
1499        }
1500
1501        public PackagedProductDefinitionPackageContainedItemComponent addItem(Reference t) { //3
1502          if (t == null)
1503            return this;
1504          if (this.item == null)
1505            this.item = new ArrayList<Reference>();
1506          this.item.add(t);
1507          return this;
1508        }
1509
1510        /**
1511         * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist {3}
1512         */
1513        public Reference getItemFirstRep() { 
1514          if (getItem().isEmpty()) {
1515            addItem();
1516          }
1517          return getItem().get(0);
1518        }
1519
1520        /**
1521         * @return {@link #amount} (The number of this type of item within this packaging.)
1522         */
1523        public DataType getAmount() { 
1524          return this.amount;
1525        }
1526
1527        /**
1528         * @return {@link #amount} (The number of this type of item within this packaging.)
1529         */
1530        public Quantity getAmountQuantity() throws FHIRException { 
1531          if (this.amount == null)
1532            this.amount = new Quantity();
1533          if (!(this.amount instanceof Quantity))
1534            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.amount.getClass().getName()+" was encountered");
1535          return (Quantity) this.amount;
1536        }
1537
1538        public boolean hasAmountQuantity() { 
1539          return this != null && this.amount instanceof Quantity;
1540        }
1541
1542        /**
1543         * @return {@link #amount} (The number of this type of item within this packaging.)
1544         */
1545        public IntegerType getAmountIntegerType() throws FHIRException { 
1546          if (this.amount == null)
1547            this.amount = new IntegerType();
1548          if (!(this.amount instanceof IntegerType))
1549            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.amount.getClass().getName()+" was encountered");
1550          return (IntegerType) this.amount;
1551        }
1552
1553        public boolean hasAmountIntegerType() { 
1554          return this != null && this.amount instanceof IntegerType;
1555        }
1556
1557        public boolean hasAmount() { 
1558          return this.amount != null && !this.amount.isEmpty();
1559        }
1560
1561        /**
1562         * @param value {@link #amount} (The number of this type of item within this packaging.)
1563         */
1564        public PackagedProductDefinitionPackageContainedItemComponent setAmount(DataType value) { 
1565          if (value != null && !(value instanceof Quantity || value instanceof IntegerType))
1566            throw new Error("Not the right type for PackagedProductDefinition.package.containedItem.amount[x]: "+value.fhirType());
1567          this.amount = value;
1568          return this;
1569        }
1570
1571        protected void listChildren(List<Property> children) {
1572          super.listChildren(children);
1573          children.add(new Property("item", "Reference(ManufacturedItemDefinition|DeviceDefinition)", "The manufactured item or device as contained in the packaged medicinal product.", 0, java.lang.Integer.MAX_VALUE, item));
1574          children.add(new Property("amount[x]", "Quantity|integer", "The number of this type of item within this packaging.", 0, 1, amount));
1575        }
1576
1577        @Override
1578        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1579          switch (_hash) {
1580          case 3242771: /*item*/  return new Property("item", "Reference(ManufacturedItemDefinition|DeviceDefinition)", "The manufactured item or device as contained in the packaged medicinal product.", 0, java.lang.Integer.MAX_VALUE, item);
1581          case 646780200: /*amount[x]*/  return new Property("amount[x]", "Quantity|integer", "The number of this type of item within this packaging.", 0, 1, amount);
1582          case -1413853096: /*amount*/  return new Property("amount[x]", "Quantity|integer", "The number of this type of item within this packaging.", 0, 1, amount);
1583          case 1664303363: /*amountQuantity*/  return new Property("amount[x]", "Quantity", "The number of this type of item within this packaging.", 0, 1, amount);
1584          case 2053191110: /*amountInteger*/  return new Property("amount[x]", "integer", "The number of this type of item within this packaging.", 0, 1, amount);
1585          default: return super.getNamedProperty(_hash, _name, _checkValid);
1586          }
1587
1588        }
1589
1590      @Override
1591      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1592        switch (hash) {
1593        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // Reference
1594        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // DataType
1595        default: return super.getProperty(hash, name, checkValid);
1596        }
1597
1598      }
1599
1600      @Override
1601      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1602        switch (hash) {
1603        case 3242771: // item
1604          this.getItem().add(TypeConvertor.castToReference(value)); // Reference
1605          return value;
1606        case -1413853096: // amount
1607          this.amount = TypeConvertor.castToType(value); // DataType
1608          return value;
1609        default: return super.setProperty(hash, name, value);
1610        }
1611
1612      }
1613
1614      @Override
1615      public Base setProperty(String name, Base value) throws FHIRException {
1616        if (name.equals("item")) {
1617          this.getItem().add(TypeConvertor.castToReference(value));
1618        } else if (name.equals("amount[x]")) {
1619          this.amount = TypeConvertor.castToType(value); // DataType
1620        } else
1621          return super.setProperty(name, value);
1622        return value;
1623      }
1624
1625      @Override
1626      public Base makeProperty(int hash, String name) throws FHIRException {
1627        switch (hash) {
1628        case 3242771:  return addItem(); 
1629        case 646780200:  return getAmount();
1630        case -1413853096:  return getAmount();
1631        default: return super.makeProperty(hash, name);
1632        }
1633
1634      }
1635
1636      @Override
1637      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1638        switch (hash) {
1639        case 3242771: /*item*/ return new String[] {"Reference"};
1640        case -1413853096: /*amount*/ return new String[] {"Quantity", "integer"};
1641        default: return super.getTypesForProperty(hash, name);
1642        }
1643
1644      }
1645
1646      @Override
1647      public Base addChild(String name) throws FHIRException {
1648        if (name.equals("item")) {
1649          return addItem();
1650        }
1651        else if (name.equals("amountQuantity")) {
1652          this.amount = new Quantity();
1653          return this.amount;
1654        }
1655        else if (name.equals("amountInteger")) {
1656          this.amount = new IntegerType();
1657          return this.amount;
1658        }
1659        else
1660          return super.addChild(name);
1661      }
1662
1663      public PackagedProductDefinitionPackageContainedItemComponent copy() {
1664        PackagedProductDefinitionPackageContainedItemComponent dst = new PackagedProductDefinitionPackageContainedItemComponent();
1665        copyValues(dst);
1666        return dst;
1667      }
1668
1669      public void copyValues(PackagedProductDefinitionPackageContainedItemComponent dst) {
1670        super.copyValues(dst);
1671        if (item != null) {
1672          dst.item = new ArrayList<Reference>();
1673          for (Reference i : item)
1674            dst.item.add(i.copy());
1675        };
1676        dst.amount = amount == null ? null : amount.copy();
1677      }
1678
1679      @Override
1680      public boolean equalsDeep(Base other_) {
1681        if (!super.equalsDeep(other_))
1682          return false;
1683        if (!(other_ instanceof PackagedProductDefinitionPackageContainedItemComponent))
1684          return false;
1685        PackagedProductDefinitionPackageContainedItemComponent o = (PackagedProductDefinitionPackageContainedItemComponent) other_;
1686        return compareDeep(item, o.item, true) && compareDeep(amount, o.amount, true);
1687      }
1688
1689      @Override
1690      public boolean equalsShallow(Base other_) {
1691        if (!super.equalsShallow(other_))
1692          return false;
1693        if (!(other_ instanceof PackagedProductDefinitionPackageContainedItemComponent))
1694          return false;
1695        PackagedProductDefinitionPackageContainedItemComponent o = (PackagedProductDefinitionPackageContainedItemComponent) other_;
1696        return true;
1697      }
1698
1699      public boolean isEmpty() {
1700        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, amount);
1701      }
1702
1703  public String fhirType() {
1704    return "PackagedProductDefinition.package.containedItem";
1705
1706  }
1707
1708  }
1709
1710    /**
1711     * Unique identifier.
1712     */
1713    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1714    @Description(shortDefinition="Unique identifier", formalDefinition="Unique identifier." )
1715    protected List<Identifier> identifier;
1716
1717    /**
1718     * The product that this is a pack for.
1719     */
1720    @Child(name = "subject", type = {MedicinalProductDefinition.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1721    @Description(shortDefinition="The product that this is a pack for", formalDefinition="The product that this is a pack for." )
1722    protected List<Reference> subject;
1723
1724    /**
1725     * Textual description.
1726     */
1727    @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1728    @Description(shortDefinition="Textual description", formalDefinition="Textual description." )
1729    protected StringType description;
1730
1731    /**
1732     * The legal status of supply of the medicinal product as classified by the regulator.
1733     */
1734    @Child(name = "legalStatusOfSupply", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1735    @Description(shortDefinition="The legal status of supply of the medicinal product as classified by the regulator", formalDefinition="The legal status of supply of the medicinal product as classified by the regulator." )
1736    protected CodeableConcept legalStatusOfSupply;
1737
1738    /**
1739     * Marketing information.
1740     */
1741    @Child(name = "marketingStatus", type = {MarketingStatus.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1742    @Description(shortDefinition="Marketing information", formalDefinition="Marketing information." )
1743    protected List<MarketingStatus> marketingStatus;
1744
1745    /**
1746     * States whether a drug product is supplied with another item such as a diluent or adjuvant.
1747     */
1748    @Child(name = "copackagedIndicator", type = {BooleanType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1749    @Description(shortDefinition="States whether a drug product is supplied with another item such as a diluent or adjuvant", formalDefinition="States whether a drug product is supplied with another item such as a diluent or adjuvant." )
1750    protected BooleanType copackagedIndicator;
1751
1752    /**
1753     * Manufacturer of this Package Item.
1754     */
1755    @Child(name = "marketingAuthorization", type = {RegulatedAuthorization.class}, order=6, min=0, max=1, modifier=false, summary=true)
1756    @Description(shortDefinition="Manufacturer of this Package Item", formalDefinition="Manufacturer of this Package Item." )
1757    protected Reference marketingAuthorization;
1758
1759    /**
1760     * Manufacturer of this Package Item.
1761     */
1762    @Child(name = "manufacturer", type = {Organization.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1763    @Description(shortDefinition="Manufacturer of this Package Item", formalDefinition="Manufacturer of this Package Item." )
1764    protected List<Reference> manufacturer;
1765
1766    /**
1767     * Batch numbering.
1768     */
1769    @Child(name = "batchIdentifier", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1770    @Description(shortDefinition="Batch numbering", formalDefinition="Batch numbering." )
1771    protected List<PackagedProductDefinitionBatchIdentifierComponent> batchIdentifier;
1772
1773    /**
1774     * A packaging item, as a contained for medicine, possibly with other packaging items within.
1775     */
1776    @Child(name = "package", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1777    @Description(shortDefinition="A packaging item, as a contained for medicine, possibly with other packaging items within", formalDefinition="A packaging item, as a contained for medicine, possibly with other packaging items within." )
1778    protected List<PackagedProductDefinitionPackageComponent> package_;
1779
1780    private static final long serialVersionUID = -246367398L;
1781
1782  /**
1783   * Constructor
1784   */
1785    public PackagedProductDefinition() {
1786      super();
1787    }
1788
1789    /**
1790     * @return {@link #identifier} (Unique identifier.)
1791     */
1792    public List<Identifier> getIdentifier() { 
1793      if (this.identifier == null)
1794        this.identifier = new ArrayList<Identifier>();
1795      return this.identifier;
1796    }
1797
1798    /**
1799     * @return Returns a reference to <code>this</code> for easy method chaining
1800     */
1801    public PackagedProductDefinition setIdentifier(List<Identifier> theIdentifier) { 
1802      this.identifier = theIdentifier;
1803      return this;
1804    }
1805
1806    public boolean hasIdentifier() { 
1807      if (this.identifier == null)
1808        return false;
1809      for (Identifier item : this.identifier)
1810        if (!item.isEmpty())
1811          return true;
1812      return false;
1813    }
1814
1815    public Identifier addIdentifier() { //3
1816      Identifier t = new Identifier();
1817      if (this.identifier == null)
1818        this.identifier = new ArrayList<Identifier>();
1819      this.identifier.add(t);
1820      return t;
1821    }
1822
1823    public PackagedProductDefinition addIdentifier(Identifier t) { //3
1824      if (t == null)
1825        return this;
1826      if (this.identifier == null)
1827        this.identifier = new ArrayList<Identifier>();
1828      this.identifier.add(t);
1829      return this;
1830    }
1831
1832    /**
1833     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1834     */
1835    public Identifier getIdentifierFirstRep() { 
1836      if (getIdentifier().isEmpty()) {
1837        addIdentifier();
1838      }
1839      return getIdentifier().get(0);
1840    }
1841
1842    /**
1843     * @return {@link #subject} (The product that this is a pack for.)
1844     */
1845    public List<Reference> getSubject() { 
1846      if (this.subject == null)
1847        this.subject = new ArrayList<Reference>();
1848      return this.subject;
1849    }
1850
1851    /**
1852     * @return Returns a reference to <code>this</code> for easy method chaining
1853     */
1854    public PackagedProductDefinition setSubject(List<Reference> theSubject) { 
1855      this.subject = theSubject;
1856      return this;
1857    }
1858
1859    public boolean hasSubject() { 
1860      if (this.subject == null)
1861        return false;
1862      for (Reference item : this.subject)
1863        if (!item.isEmpty())
1864          return true;
1865      return false;
1866    }
1867
1868    public Reference addSubject() { //3
1869      Reference t = new Reference();
1870      if (this.subject == null)
1871        this.subject = new ArrayList<Reference>();
1872      this.subject.add(t);
1873      return t;
1874    }
1875
1876    public PackagedProductDefinition addSubject(Reference t) { //3
1877      if (t == null)
1878        return this;
1879      if (this.subject == null)
1880        this.subject = new ArrayList<Reference>();
1881      this.subject.add(t);
1882      return this;
1883    }
1884
1885    /**
1886     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist {3}
1887     */
1888    public Reference getSubjectFirstRep() { 
1889      if (getSubject().isEmpty()) {
1890        addSubject();
1891      }
1892      return getSubject().get(0);
1893    }
1894
1895    /**
1896     * @return {@link #description} (Textual description.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1897     */
1898    public StringType getDescriptionElement() { 
1899      if (this.description == null)
1900        if (Configuration.errorOnAutoCreate())
1901          throw new Error("Attempt to auto-create PackagedProductDefinition.description");
1902        else if (Configuration.doAutoCreate())
1903          this.description = new StringType(); // bb
1904      return this.description;
1905    }
1906
1907    public boolean hasDescriptionElement() { 
1908      return this.description != null && !this.description.isEmpty();
1909    }
1910
1911    public boolean hasDescription() { 
1912      return this.description != null && !this.description.isEmpty();
1913    }
1914
1915    /**
1916     * @param value {@link #description} (Textual description.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1917     */
1918    public PackagedProductDefinition setDescriptionElement(StringType value) { 
1919      this.description = value;
1920      return this;
1921    }
1922
1923    /**
1924     * @return Textual description.
1925     */
1926    public String getDescription() { 
1927      return this.description == null ? null : this.description.getValue();
1928    }
1929
1930    /**
1931     * @param value Textual description.
1932     */
1933    public PackagedProductDefinition setDescription(String value) { 
1934      if (Utilities.noString(value))
1935        this.description = null;
1936      else {
1937        if (this.description == null)
1938          this.description = new StringType();
1939        this.description.setValue(value);
1940      }
1941      return this;
1942    }
1943
1944    /**
1945     * @return {@link #legalStatusOfSupply} (The legal status of supply of the medicinal product as classified by the regulator.)
1946     */
1947    public CodeableConcept getLegalStatusOfSupply() { 
1948      if (this.legalStatusOfSupply == null)
1949        if (Configuration.errorOnAutoCreate())
1950          throw new Error("Attempt to auto-create PackagedProductDefinition.legalStatusOfSupply");
1951        else if (Configuration.doAutoCreate())
1952          this.legalStatusOfSupply = new CodeableConcept(); // cc
1953      return this.legalStatusOfSupply;
1954    }
1955
1956    public boolean hasLegalStatusOfSupply() { 
1957      return this.legalStatusOfSupply != null && !this.legalStatusOfSupply.isEmpty();
1958    }
1959
1960    /**
1961     * @param value {@link #legalStatusOfSupply} (The legal status of supply of the medicinal product as classified by the regulator.)
1962     */
1963    public PackagedProductDefinition setLegalStatusOfSupply(CodeableConcept value) { 
1964      this.legalStatusOfSupply = value;
1965      return this;
1966    }
1967
1968    /**
1969     * @return {@link #marketingStatus} (Marketing information.)
1970     */
1971    public List<MarketingStatus> getMarketingStatus() { 
1972      if (this.marketingStatus == null)
1973        this.marketingStatus = new ArrayList<MarketingStatus>();
1974      return this.marketingStatus;
1975    }
1976
1977    /**
1978     * @return Returns a reference to <code>this</code> for easy method chaining
1979     */
1980    public PackagedProductDefinition setMarketingStatus(List<MarketingStatus> theMarketingStatus) { 
1981      this.marketingStatus = theMarketingStatus;
1982      return this;
1983    }
1984
1985    public boolean hasMarketingStatus() { 
1986      if (this.marketingStatus == null)
1987        return false;
1988      for (MarketingStatus item : this.marketingStatus)
1989        if (!item.isEmpty())
1990          return true;
1991      return false;
1992    }
1993
1994    public MarketingStatus addMarketingStatus() { //3
1995      MarketingStatus t = new MarketingStatus();
1996      if (this.marketingStatus == null)
1997        this.marketingStatus = new ArrayList<MarketingStatus>();
1998      this.marketingStatus.add(t);
1999      return t;
2000    }
2001
2002    public PackagedProductDefinition addMarketingStatus(MarketingStatus t) { //3
2003      if (t == null)
2004        return this;
2005      if (this.marketingStatus == null)
2006        this.marketingStatus = new ArrayList<MarketingStatus>();
2007      this.marketingStatus.add(t);
2008      return this;
2009    }
2010
2011    /**
2012     * @return The first repetition of repeating field {@link #marketingStatus}, creating it if it does not already exist {3}
2013     */
2014    public MarketingStatus getMarketingStatusFirstRep() { 
2015      if (getMarketingStatus().isEmpty()) {
2016        addMarketingStatus();
2017      }
2018      return getMarketingStatus().get(0);
2019    }
2020
2021    /**
2022     * @return {@link #copackagedIndicator} (States whether a drug product is supplied with another item such as a diluent or adjuvant.). This is the underlying object with id, value and extensions. The accessor "getCopackagedIndicator" gives direct access to the value
2023     */
2024    public BooleanType getCopackagedIndicatorElement() { 
2025      if (this.copackagedIndicator == null)
2026        if (Configuration.errorOnAutoCreate())
2027          throw new Error("Attempt to auto-create PackagedProductDefinition.copackagedIndicator");
2028        else if (Configuration.doAutoCreate())
2029          this.copackagedIndicator = new BooleanType(); // bb
2030      return this.copackagedIndicator;
2031    }
2032
2033    public boolean hasCopackagedIndicatorElement() { 
2034      return this.copackagedIndicator != null && !this.copackagedIndicator.isEmpty();
2035    }
2036
2037    public boolean hasCopackagedIndicator() { 
2038      return this.copackagedIndicator != null && !this.copackagedIndicator.isEmpty();
2039    }
2040
2041    /**
2042     * @param value {@link #copackagedIndicator} (States whether a drug product is supplied with another item such as a diluent or adjuvant.). This is the underlying object with id, value and extensions. The accessor "getCopackagedIndicator" gives direct access to the value
2043     */
2044    public PackagedProductDefinition setCopackagedIndicatorElement(BooleanType value) { 
2045      this.copackagedIndicator = value;
2046      return this;
2047    }
2048
2049    /**
2050     * @return States whether a drug product is supplied with another item such as a diluent or adjuvant.
2051     */
2052    public boolean getCopackagedIndicator() { 
2053      return this.copackagedIndicator == null || this.copackagedIndicator.isEmpty() ? false : this.copackagedIndicator.getValue();
2054    }
2055
2056    /**
2057     * @param value States whether a drug product is supplied with another item such as a diluent or adjuvant.
2058     */
2059    public PackagedProductDefinition setCopackagedIndicator(boolean value) { 
2060        if (this.copackagedIndicator == null)
2061          this.copackagedIndicator = new BooleanType();
2062        this.copackagedIndicator.setValue(value);
2063      return this;
2064    }
2065
2066    /**
2067     * @return {@link #marketingAuthorization} (Manufacturer of this Package Item.)
2068     */
2069    public Reference getMarketingAuthorization() { 
2070      if (this.marketingAuthorization == null)
2071        if (Configuration.errorOnAutoCreate())
2072          throw new Error("Attempt to auto-create PackagedProductDefinition.marketingAuthorization");
2073        else if (Configuration.doAutoCreate())
2074          this.marketingAuthorization = new Reference(); // cc
2075      return this.marketingAuthorization;
2076    }
2077
2078    public boolean hasMarketingAuthorization() { 
2079      return this.marketingAuthorization != null && !this.marketingAuthorization.isEmpty();
2080    }
2081
2082    /**
2083     * @param value {@link #marketingAuthorization} (Manufacturer of this Package Item.)
2084     */
2085    public PackagedProductDefinition setMarketingAuthorization(Reference value) { 
2086      this.marketingAuthorization = value;
2087      return this;
2088    }
2089
2090    /**
2091     * @return {@link #manufacturer} (Manufacturer of this Package Item.)
2092     */
2093    public List<Reference> getManufacturer() { 
2094      if (this.manufacturer == null)
2095        this.manufacturer = new ArrayList<Reference>();
2096      return this.manufacturer;
2097    }
2098
2099    /**
2100     * @return Returns a reference to <code>this</code> for easy method chaining
2101     */
2102    public PackagedProductDefinition setManufacturer(List<Reference> theManufacturer) { 
2103      this.manufacturer = theManufacturer;
2104      return this;
2105    }
2106
2107    public boolean hasManufacturer() { 
2108      if (this.manufacturer == null)
2109        return false;
2110      for (Reference item : this.manufacturer)
2111        if (!item.isEmpty())
2112          return true;
2113      return false;
2114    }
2115
2116    public Reference addManufacturer() { //3
2117      Reference t = new Reference();
2118      if (this.manufacturer == null)
2119        this.manufacturer = new ArrayList<Reference>();
2120      this.manufacturer.add(t);
2121      return t;
2122    }
2123
2124    public PackagedProductDefinition addManufacturer(Reference t) { //3
2125      if (t == null)
2126        return this;
2127      if (this.manufacturer == null)
2128        this.manufacturer = new ArrayList<Reference>();
2129      this.manufacturer.add(t);
2130      return this;
2131    }
2132
2133    /**
2134     * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist {3}
2135     */
2136    public Reference getManufacturerFirstRep() { 
2137      if (getManufacturer().isEmpty()) {
2138        addManufacturer();
2139      }
2140      return getManufacturer().get(0);
2141    }
2142
2143    /**
2144     * @return {@link #batchIdentifier} (Batch numbering.)
2145     */
2146    public List<PackagedProductDefinitionBatchIdentifierComponent> getBatchIdentifier() { 
2147      if (this.batchIdentifier == null)
2148        this.batchIdentifier = new ArrayList<PackagedProductDefinitionBatchIdentifierComponent>();
2149      return this.batchIdentifier;
2150    }
2151
2152    /**
2153     * @return Returns a reference to <code>this</code> for easy method chaining
2154     */
2155    public PackagedProductDefinition setBatchIdentifier(List<PackagedProductDefinitionBatchIdentifierComponent> theBatchIdentifier) { 
2156      this.batchIdentifier = theBatchIdentifier;
2157      return this;
2158    }
2159
2160    public boolean hasBatchIdentifier() { 
2161      if (this.batchIdentifier == null)
2162        return false;
2163      for (PackagedProductDefinitionBatchIdentifierComponent item : this.batchIdentifier)
2164        if (!item.isEmpty())
2165          return true;
2166      return false;
2167    }
2168
2169    public PackagedProductDefinitionBatchIdentifierComponent addBatchIdentifier() { //3
2170      PackagedProductDefinitionBatchIdentifierComponent t = new PackagedProductDefinitionBatchIdentifierComponent();
2171      if (this.batchIdentifier == null)
2172        this.batchIdentifier = new ArrayList<PackagedProductDefinitionBatchIdentifierComponent>();
2173      this.batchIdentifier.add(t);
2174      return t;
2175    }
2176
2177    public PackagedProductDefinition addBatchIdentifier(PackagedProductDefinitionBatchIdentifierComponent t) { //3
2178      if (t == null)
2179        return this;
2180      if (this.batchIdentifier == null)
2181        this.batchIdentifier = new ArrayList<PackagedProductDefinitionBatchIdentifierComponent>();
2182      this.batchIdentifier.add(t);
2183      return this;
2184    }
2185
2186    /**
2187     * @return The first repetition of repeating field {@link #batchIdentifier}, creating it if it does not already exist {3}
2188     */
2189    public PackagedProductDefinitionBatchIdentifierComponent getBatchIdentifierFirstRep() { 
2190      if (getBatchIdentifier().isEmpty()) {
2191        addBatchIdentifier();
2192      }
2193      return getBatchIdentifier().get(0);
2194    }
2195
2196    /**
2197     * @return {@link #package_} (A packaging item, as a contained for medicine, possibly with other packaging items within.)
2198     */
2199    public List<PackagedProductDefinitionPackageComponent> getPackage() { 
2200      if (this.package_ == null)
2201        this.package_ = new ArrayList<PackagedProductDefinitionPackageComponent>();
2202      return this.package_;
2203    }
2204
2205    /**
2206     * @return Returns a reference to <code>this</code> for easy method chaining
2207     */
2208    public PackagedProductDefinition setPackage(List<PackagedProductDefinitionPackageComponent> thePackage) { 
2209      this.package_ = thePackage;
2210      return this;
2211    }
2212
2213    public boolean hasPackage() { 
2214      if (this.package_ == null)
2215        return false;
2216      for (PackagedProductDefinitionPackageComponent item : this.package_)
2217        if (!item.isEmpty())
2218          return true;
2219      return false;
2220    }
2221
2222    public PackagedProductDefinitionPackageComponent addPackage() { //3
2223      PackagedProductDefinitionPackageComponent t = new PackagedProductDefinitionPackageComponent();
2224      if (this.package_ == null)
2225        this.package_ = new ArrayList<PackagedProductDefinitionPackageComponent>();
2226      this.package_.add(t);
2227      return t;
2228    }
2229
2230    public PackagedProductDefinition addPackage(PackagedProductDefinitionPackageComponent t) { //3
2231      if (t == null)
2232        return this;
2233      if (this.package_ == null)
2234        this.package_ = new ArrayList<PackagedProductDefinitionPackageComponent>();
2235      this.package_.add(t);
2236      return this;
2237    }
2238
2239    /**
2240     * @return The first repetition of repeating field {@link #package_}, creating it if it does not already exist {3}
2241     */
2242    public PackagedProductDefinitionPackageComponent getPackageFirstRep() { 
2243      if (getPackage().isEmpty()) {
2244        addPackage();
2245      }
2246      return getPackage().get(0);
2247    }
2248
2249      protected void listChildren(List<Property> children) {
2250        super.listChildren(children);
2251        children.add(new Property("identifier", "Identifier", "Unique identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
2252        children.add(new Property("subject", "Reference(MedicinalProductDefinition)", "The product that this is a pack for.", 0, java.lang.Integer.MAX_VALUE, subject));
2253        children.add(new Property("description", "string", "Textual description.", 0, 1, description));
2254        children.add(new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1, legalStatusOfSupply));
2255        children.add(new Property("marketingStatus", "MarketingStatus", "Marketing information.", 0, java.lang.Integer.MAX_VALUE, marketingStatus));
2256        children.add(new Property("copackagedIndicator", "boolean", "States whether a drug product is supplied with another item such as a diluent or adjuvant.", 0, 1, copackagedIndicator));
2257        children.add(new Property("marketingAuthorization", "Reference(RegulatedAuthorization)", "Manufacturer of this Package Item.", 0, 1, marketingAuthorization));
2258        children.add(new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Package Item.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
2259        children.add(new Property("batchIdentifier", "", "Batch numbering.", 0, java.lang.Integer.MAX_VALUE, batchIdentifier));
2260        children.add(new Property("package", "", "A packaging item, as a contained for medicine, possibly with other packaging items within.", 0, java.lang.Integer.MAX_VALUE, package_));
2261      }
2262
2263      @Override
2264      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2265        switch (_hash) {
2266        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
2267        case -1867885268: /*subject*/  return new Property("subject", "Reference(MedicinalProductDefinition)", "The product that this is a pack for.", 0, java.lang.Integer.MAX_VALUE, subject);
2268        case -1724546052: /*description*/  return new Property("description", "string", "Textual description.", 0, 1, description);
2269        case -844874031: /*legalStatusOfSupply*/  return new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1, legalStatusOfSupply);
2270        case 70767032: /*marketingStatus*/  return new Property("marketingStatus", "MarketingStatus", "Marketing information.", 0, java.lang.Integer.MAX_VALUE, marketingStatus);
2271        case -1638663195: /*copackagedIndicator*/  return new Property("copackagedIndicator", "boolean", "States whether a drug product is supplied with another item such as a diluent or adjuvant.", 0, 1, copackagedIndicator);
2272        case 571831283: /*marketingAuthorization*/  return new Property("marketingAuthorization", "Reference(RegulatedAuthorization)", "Manufacturer of this Package Item.", 0, 1, marketingAuthorization);
2273        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Package Item.", 0, java.lang.Integer.MAX_VALUE, manufacturer);
2274        case -1688395901: /*batchIdentifier*/  return new Property("batchIdentifier", "", "Batch numbering.", 0, java.lang.Integer.MAX_VALUE, batchIdentifier);
2275        case -807062458: /*package*/  return new Property("package", "", "A packaging item, as a contained for medicine, possibly with other packaging items within.", 0, java.lang.Integer.MAX_VALUE, package_);
2276        default: return super.getNamedProperty(_hash, _name, _checkValid);
2277        }
2278
2279      }
2280
2281      @Override
2282      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2283        switch (hash) {
2284        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2285        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
2286        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2287        case -844874031: /*legalStatusOfSupply*/ return this.legalStatusOfSupply == null ? new Base[0] : new Base[] {this.legalStatusOfSupply}; // CodeableConcept
2288        case 70767032: /*marketingStatus*/ return this.marketingStatus == null ? new Base[0] : this.marketingStatus.toArray(new Base[this.marketingStatus.size()]); // MarketingStatus
2289        case -1638663195: /*copackagedIndicator*/ return this.copackagedIndicator == null ? new Base[0] : new Base[] {this.copackagedIndicator}; // BooleanType
2290        case 571831283: /*marketingAuthorization*/ return this.marketingAuthorization == null ? new Base[0] : new Base[] {this.marketingAuthorization}; // Reference
2291        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
2292        case -1688395901: /*batchIdentifier*/ return this.batchIdentifier == null ? new Base[0] : this.batchIdentifier.toArray(new Base[this.batchIdentifier.size()]); // PackagedProductDefinitionBatchIdentifierComponent
2293        case -807062458: /*package*/ return this.package_ == null ? new Base[0] : this.package_.toArray(new Base[this.package_.size()]); // PackagedProductDefinitionPackageComponent
2294        default: return super.getProperty(hash, name, checkValid);
2295        }
2296
2297      }
2298
2299      @Override
2300      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2301        switch (hash) {
2302        case -1618432855: // identifier
2303          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2304          return value;
2305        case -1867885268: // subject
2306          this.getSubject().add(TypeConvertor.castToReference(value)); // Reference
2307          return value;
2308        case -1724546052: // description
2309          this.description = TypeConvertor.castToString(value); // StringType
2310          return value;
2311        case -844874031: // legalStatusOfSupply
2312          this.legalStatusOfSupply = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2313          return value;
2314        case 70767032: // marketingStatus
2315          this.getMarketingStatus().add(TypeConvertor.castToMarketingStatus(value)); // MarketingStatus
2316          return value;
2317        case -1638663195: // copackagedIndicator
2318          this.copackagedIndicator = TypeConvertor.castToBoolean(value); // BooleanType
2319          return value;
2320        case 571831283: // marketingAuthorization
2321          this.marketingAuthorization = TypeConvertor.castToReference(value); // Reference
2322          return value;
2323        case -1969347631: // manufacturer
2324          this.getManufacturer().add(TypeConvertor.castToReference(value)); // Reference
2325          return value;
2326        case -1688395901: // batchIdentifier
2327          this.getBatchIdentifier().add((PackagedProductDefinitionBatchIdentifierComponent) value); // PackagedProductDefinitionBatchIdentifierComponent
2328          return value;
2329        case -807062458: // package
2330          this.getPackage().add((PackagedProductDefinitionPackageComponent) value); // PackagedProductDefinitionPackageComponent
2331          return value;
2332        default: return super.setProperty(hash, name, value);
2333        }
2334
2335      }
2336
2337      @Override
2338      public Base setProperty(String name, Base value) throws FHIRException {
2339        if (name.equals("identifier")) {
2340          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2341        } else if (name.equals("subject")) {
2342          this.getSubject().add(TypeConvertor.castToReference(value));
2343        } else if (name.equals("description")) {
2344          this.description = TypeConvertor.castToString(value); // StringType
2345        } else if (name.equals("legalStatusOfSupply")) {
2346          this.legalStatusOfSupply = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2347        } else if (name.equals("marketingStatus")) {
2348          this.getMarketingStatus().add(TypeConvertor.castToMarketingStatus(value));
2349        } else if (name.equals("copackagedIndicator")) {
2350          this.copackagedIndicator = TypeConvertor.castToBoolean(value); // BooleanType
2351        } else if (name.equals("marketingAuthorization")) {
2352          this.marketingAuthorization = TypeConvertor.castToReference(value); // Reference
2353        } else if (name.equals("manufacturer")) {
2354          this.getManufacturer().add(TypeConvertor.castToReference(value));
2355        } else if (name.equals("batchIdentifier")) {
2356          this.getBatchIdentifier().add((PackagedProductDefinitionBatchIdentifierComponent) value);
2357        } else if (name.equals("package")) {
2358          this.getPackage().add((PackagedProductDefinitionPackageComponent) value);
2359        } else
2360          return super.setProperty(name, value);
2361        return value;
2362      }
2363
2364      @Override
2365      public Base makeProperty(int hash, String name) throws FHIRException {
2366        switch (hash) {
2367        case -1618432855:  return addIdentifier(); 
2368        case -1867885268:  return addSubject(); 
2369        case -1724546052:  return getDescriptionElement();
2370        case -844874031:  return getLegalStatusOfSupply();
2371        case 70767032:  return addMarketingStatus(); 
2372        case -1638663195:  return getCopackagedIndicatorElement();
2373        case 571831283:  return getMarketingAuthorization();
2374        case -1969347631:  return addManufacturer(); 
2375        case -1688395901:  return addBatchIdentifier(); 
2376        case -807062458:  return addPackage(); 
2377        default: return super.makeProperty(hash, name);
2378        }
2379
2380      }
2381
2382      @Override
2383      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2384        switch (hash) {
2385        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2386        case -1867885268: /*subject*/ return new String[] {"Reference"};
2387        case -1724546052: /*description*/ return new String[] {"string"};
2388        case -844874031: /*legalStatusOfSupply*/ return new String[] {"CodeableConcept"};
2389        case 70767032: /*marketingStatus*/ return new String[] {"MarketingStatus"};
2390        case -1638663195: /*copackagedIndicator*/ return new String[] {"boolean"};
2391        case 571831283: /*marketingAuthorization*/ return new String[] {"Reference"};
2392        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
2393        case -1688395901: /*batchIdentifier*/ return new String[] {};
2394        case -807062458: /*package*/ return new String[] {};
2395        default: return super.getTypesForProperty(hash, name);
2396        }
2397
2398      }
2399
2400      @Override
2401      public Base addChild(String name) throws FHIRException {
2402        if (name.equals("identifier")) {
2403          return addIdentifier();
2404        }
2405        else if (name.equals("subject")) {
2406          return addSubject();
2407        }
2408        else if (name.equals("description")) {
2409          throw new FHIRException("Cannot call addChild on a primitive type PackagedProductDefinition.description");
2410        }
2411        else if (name.equals("legalStatusOfSupply")) {
2412          this.legalStatusOfSupply = new CodeableConcept();
2413          return this.legalStatusOfSupply;
2414        }
2415        else if (name.equals("marketingStatus")) {
2416          return addMarketingStatus();
2417        }
2418        else if (name.equals("copackagedIndicator")) {
2419          throw new FHIRException("Cannot call addChild on a primitive type PackagedProductDefinition.copackagedIndicator");
2420        }
2421        else if (name.equals("marketingAuthorization")) {
2422          this.marketingAuthorization = new Reference();
2423          return this.marketingAuthorization;
2424        }
2425        else if (name.equals("manufacturer")) {
2426          return addManufacturer();
2427        }
2428        else if (name.equals("batchIdentifier")) {
2429          return addBatchIdentifier();
2430        }
2431        else if (name.equals("package")) {
2432          return addPackage();
2433        }
2434        else
2435          return super.addChild(name);
2436      }
2437
2438  public String fhirType() {
2439    return "PackagedProductDefinition";
2440
2441  }
2442
2443      public PackagedProductDefinition copy() {
2444        PackagedProductDefinition dst = new PackagedProductDefinition();
2445        copyValues(dst);
2446        return dst;
2447      }
2448
2449      public void copyValues(PackagedProductDefinition dst) {
2450        super.copyValues(dst);
2451        if (identifier != null) {
2452          dst.identifier = new ArrayList<Identifier>();
2453          for (Identifier i : identifier)
2454            dst.identifier.add(i.copy());
2455        };
2456        if (subject != null) {
2457          dst.subject = new ArrayList<Reference>();
2458          for (Reference i : subject)
2459            dst.subject.add(i.copy());
2460        };
2461        dst.description = description == null ? null : description.copy();
2462        dst.legalStatusOfSupply = legalStatusOfSupply == null ? null : legalStatusOfSupply.copy();
2463        if (marketingStatus != null) {
2464          dst.marketingStatus = new ArrayList<MarketingStatus>();
2465          for (MarketingStatus i : marketingStatus)
2466            dst.marketingStatus.add(i.copy());
2467        };
2468        dst.copackagedIndicator = copackagedIndicator == null ? null : copackagedIndicator.copy();
2469        dst.marketingAuthorization = marketingAuthorization == null ? null : marketingAuthorization.copy();
2470        if (manufacturer != null) {
2471          dst.manufacturer = new ArrayList<Reference>();
2472          for (Reference i : manufacturer)
2473            dst.manufacturer.add(i.copy());
2474        };
2475        if (batchIdentifier != null) {
2476          dst.batchIdentifier = new ArrayList<PackagedProductDefinitionBatchIdentifierComponent>();
2477          for (PackagedProductDefinitionBatchIdentifierComponent i : batchIdentifier)
2478            dst.batchIdentifier.add(i.copy());
2479        };
2480        if (package_ != null) {
2481          dst.package_ = new ArrayList<PackagedProductDefinitionPackageComponent>();
2482          for (PackagedProductDefinitionPackageComponent i : package_)
2483            dst.package_.add(i.copy());
2484        };
2485      }
2486
2487      protected PackagedProductDefinition typedCopy() {
2488        return copy();
2489      }
2490
2491      @Override
2492      public boolean equalsDeep(Base other_) {
2493        if (!super.equalsDeep(other_))
2494          return false;
2495        if (!(other_ instanceof PackagedProductDefinition))
2496          return false;
2497        PackagedProductDefinition o = (PackagedProductDefinition) other_;
2498        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(description, o.description, true)
2499           && compareDeep(legalStatusOfSupply, o.legalStatusOfSupply, true) && compareDeep(marketingStatus, o.marketingStatus, true)
2500           && compareDeep(copackagedIndicator, o.copackagedIndicator, true) && compareDeep(marketingAuthorization, o.marketingAuthorization, true)
2501           && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(batchIdentifier, o.batchIdentifier, true)
2502           && compareDeep(package_, o.package_, true);
2503      }
2504
2505      @Override
2506      public boolean equalsShallow(Base other_) {
2507        if (!super.equalsShallow(other_))
2508          return false;
2509        if (!(other_ instanceof PackagedProductDefinition))
2510          return false;
2511        PackagedProductDefinition o = (PackagedProductDefinition) other_;
2512        return compareValues(description, o.description, true) && compareValues(copackagedIndicator, o.copackagedIndicator, true)
2513          ;
2514      }
2515
2516      public boolean isEmpty() {
2517        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, subject, description
2518          , legalStatusOfSupply, marketingStatus, copackagedIndicator, marketingAuthorization
2519          , manufacturer, batchIdentifier, package_);
2520      }
2521
2522  @Override
2523  public ResourceType getResourceType() {
2524    return ResourceType.PackagedProductDefinition;
2525   }
2526
2527 /**
2528   * Search parameter: <b>device</b>
2529   * <p>
2530   * Description: <b>A device associated within packaged product</b><br>
2531   * Type: <b>reference</b><br>
2532   * Path: <b>null</b><br>
2533   * </p>
2534   */
2535  @SearchParamDefinition(name="device", path="", description="A device associated within packaged product", type="reference", target={DeviceDefinition.class } )
2536  public static final String SP_DEVICE = "device";
2537 /**
2538   * <b>Fluent Client</b> search parameter constant for <b>device</b>
2539   * <p>
2540   * Description: <b>A device associated within packaged product</b><br>
2541   * Type: <b>reference</b><br>
2542   * Path: <b>null</b><br>
2543   * </p>
2544   */
2545  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE);
2546
2547/**
2548   * Constant for fluent queries to be used to add include statements. Specifies
2549   * the path value of "<b>PackagedProductDefinition:device</b>".
2550   */
2551  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("PackagedProductDefinition:device").toLocked();
2552
2553 /**
2554   * Search parameter: <b>identifier</b>
2555   * <p>
2556   * Description: <b>Unique identifier</b><br>
2557   * Type: <b>token</b><br>
2558   * Path: <b>PackagedProductDefinition.identifier</b><br>
2559   * </p>
2560   */
2561  @SearchParamDefinition(name="identifier", path="PackagedProductDefinition.identifier", description="Unique identifier", type="token" )
2562  public static final String SP_IDENTIFIER = "identifier";
2563 /**
2564   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2565   * <p>
2566   * Description: <b>Unique identifier</b><br>
2567   * Type: <b>token</b><br>
2568   * Path: <b>PackagedProductDefinition.identifier</b><br>
2569   * </p>
2570   */
2571  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2572
2573 /**
2574   * Search parameter: <b>manufactured-item</b>
2575   * <p>
2576   * Description: <b>A manufactured item of medication within this packaged product</b><br>
2577   * Type: <b>reference</b><br>
2578   * Path: <b>null</b><br>
2579   * </p>
2580   */
2581  @SearchParamDefinition(name="manufactured-item", path="", description="A manufactured item of medication within this packaged product", type="reference", target={ManufacturedItemDefinition.class } )
2582  public static final String SP_MANUFACTURED_ITEM = "manufactured-item";
2583 /**
2584   * <b>Fluent Client</b> search parameter constant for <b>manufactured-item</b>
2585   * <p>
2586   * Description: <b>A manufactured item of medication within this packaged product</b><br>
2587   * Type: <b>reference</b><br>
2588   * Path: <b>null</b><br>
2589   * </p>
2590   */
2591  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURED_ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURED_ITEM);
2592
2593/**
2594   * Constant for fluent queries to be used to add include statements. Specifies
2595   * the path value of "<b>PackagedProductDefinition:manufactured-item</b>".
2596   */
2597  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURED_ITEM = new ca.uhn.fhir.model.api.Include("PackagedProductDefinition:manufactured-item").toLocked();
2598
2599 /**
2600   * Search parameter: <b>subject</b>
2601   * <p>
2602   * Description: <b>The product that this is a pack for</b><br>
2603   * Type: <b>reference</b><br>
2604   * Path: <b>PackagedProductDefinition.subject</b><br>
2605   * </p>
2606   */
2607  @SearchParamDefinition(name="subject", path="PackagedProductDefinition.subject", description="The product that this is a pack for", type="reference", target={MedicinalProductDefinition.class } )
2608  public static final String SP_SUBJECT = "subject";
2609 /**
2610   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2611   * <p>
2612   * Description: <b>The product that this is a pack for</b><br>
2613   * Type: <b>reference</b><br>
2614   * Path: <b>PackagedProductDefinition.subject</b><br>
2615   * </p>
2616   */
2617  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2618
2619/**
2620   * Constant for fluent queries to be used to add include statements. Specifies
2621   * the path value of "<b>PackagedProductDefinition:subject</b>".
2622   */
2623  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("PackagedProductDefinition:subject").toLocked();
2624
2625
2626}
2627