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