001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * A medicinal product in a container or package.
050 */
051@ResourceDef(name="MedicinalProductPackaged", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductPackaged")
052public class MedicinalProductPackaged extends DomainResource {
053
054    @Block()
055    public static class MedicinalProductPackagedBatchIdentifierComponent extends BackboneElement implements IBaseBackboneElement {
056        /**
057         * A number appearing on the outer packaging of a specific batch.
058         */
059        @Child(name = "outerPackaging", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=true)
060        @Description(shortDefinition="A number appearing on the outer packaging of a specific batch", formalDefinition="A number appearing on the outer packaging of a specific batch." )
061        protected Identifier outerPackaging;
062
063        /**
064         * A number appearing on the immediate packaging (and not the outer packaging).
065         */
066        @Child(name = "immediatePackaging", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=true)
067        @Description(shortDefinition="A number appearing on the immediate packaging (and not the outer packaging)", formalDefinition="A number appearing on the immediate packaging (and not the outer packaging)." )
068        protected Identifier immediatePackaging;
069
070        private static final long serialVersionUID = 1187365068L;
071
072    /**
073     * Constructor
074     */
075      public MedicinalProductPackagedBatchIdentifierComponent() {
076        super();
077      }
078
079    /**
080     * Constructor
081     */
082      public MedicinalProductPackagedBatchIdentifierComponent(Identifier outerPackaging) {
083        super();
084        this.outerPackaging = outerPackaging;
085      }
086
087        /**
088         * @return {@link #outerPackaging} (A number appearing on the outer packaging of a specific batch.)
089         */
090        public Identifier getOuterPackaging() { 
091          if (this.outerPackaging == null)
092            if (Configuration.errorOnAutoCreate())
093              throw new Error("Attempt to auto-create MedicinalProductPackagedBatchIdentifierComponent.outerPackaging");
094            else if (Configuration.doAutoCreate())
095              this.outerPackaging = new Identifier(); // cc
096          return this.outerPackaging;
097        }
098
099        public boolean hasOuterPackaging() { 
100          return this.outerPackaging != null && !this.outerPackaging.isEmpty();
101        }
102
103        /**
104         * @param value {@link #outerPackaging} (A number appearing on the outer packaging of a specific batch.)
105         */
106        public MedicinalProductPackagedBatchIdentifierComponent setOuterPackaging(Identifier value) { 
107          this.outerPackaging = value;
108          return this;
109        }
110
111        /**
112         * @return {@link #immediatePackaging} (A number appearing on the immediate packaging (and not the outer packaging).)
113         */
114        public Identifier getImmediatePackaging() { 
115          if (this.immediatePackaging == null)
116            if (Configuration.errorOnAutoCreate())
117              throw new Error("Attempt to auto-create MedicinalProductPackagedBatchIdentifierComponent.immediatePackaging");
118            else if (Configuration.doAutoCreate())
119              this.immediatePackaging = new Identifier(); // cc
120          return this.immediatePackaging;
121        }
122
123        public boolean hasImmediatePackaging() { 
124          return this.immediatePackaging != null && !this.immediatePackaging.isEmpty();
125        }
126
127        /**
128         * @param value {@link #immediatePackaging} (A number appearing on the immediate packaging (and not the outer packaging).)
129         */
130        public MedicinalProductPackagedBatchIdentifierComponent setImmediatePackaging(Identifier value) { 
131          this.immediatePackaging = value;
132          return this;
133        }
134
135        protected void listChildren(List<Property> children) {
136          super.listChildren(children);
137          children.add(new Property("outerPackaging", "Identifier", "A number appearing on the outer packaging of a specific batch.", 0, 1, outerPackaging));
138          children.add(new Property("immediatePackaging", "Identifier", "A number appearing on the immediate packaging (and not the outer packaging).", 0, 1, immediatePackaging));
139        }
140
141        @Override
142        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
143          switch (_hash) {
144          case -682249912: /*outerPackaging*/  return new Property("outerPackaging", "Identifier", "A number appearing on the outer packaging of a specific batch.", 0, 1, outerPackaging);
145          case 721147602: /*immediatePackaging*/  return new Property("immediatePackaging", "Identifier", "A number appearing on the immediate packaging (and not the outer packaging).", 0, 1, immediatePackaging);
146          default: return super.getNamedProperty(_hash, _name, _checkValid);
147          }
148
149        }
150
151      @Override
152      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
153        switch (hash) {
154        case -682249912: /*outerPackaging*/ return this.outerPackaging == null ? new Base[0] : new Base[] {this.outerPackaging}; // Identifier
155        case 721147602: /*immediatePackaging*/ return this.immediatePackaging == null ? new Base[0] : new Base[] {this.immediatePackaging}; // Identifier
156        default: return super.getProperty(hash, name, checkValid);
157        }
158
159      }
160
161      @Override
162      public Base setProperty(int hash, String name, Base value) throws FHIRException {
163        switch (hash) {
164        case -682249912: // outerPackaging
165          this.outerPackaging = castToIdentifier(value); // Identifier
166          return value;
167        case 721147602: // immediatePackaging
168          this.immediatePackaging = castToIdentifier(value); // Identifier
169          return value;
170        default: return super.setProperty(hash, name, value);
171        }
172
173      }
174
175      @Override
176      public Base setProperty(String name, Base value) throws FHIRException {
177        if (name.equals("outerPackaging")) {
178          this.outerPackaging = castToIdentifier(value); // Identifier
179        } else if (name.equals("immediatePackaging")) {
180          this.immediatePackaging = castToIdentifier(value); // Identifier
181        } else
182          return super.setProperty(name, value);
183        return value;
184      }
185
186      @Override
187      public Base makeProperty(int hash, String name) throws FHIRException {
188        switch (hash) {
189        case -682249912:  return getOuterPackaging(); 
190        case 721147602:  return getImmediatePackaging(); 
191        default: return super.makeProperty(hash, name);
192        }
193
194      }
195
196      @Override
197      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
198        switch (hash) {
199        case -682249912: /*outerPackaging*/ return new String[] {"Identifier"};
200        case 721147602: /*immediatePackaging*/ return new String[] {"Identifier"};
201        default: return super.getTypesForProperty(hash, name);
202        }
203
204      }
205
206      @Override
207      public Base addChild(String name) throws FHIRException {
208        if (name.equals("outerPackaging")) {
209          this.outerPackaging = new Identifier();
210          return this.outerPackaging;
211        }
212        else if (name.equals("immediatePackaging")) {
213          this.immediatePackaging = new Identifier();
214          return this.immediatePackaging;
215        }
216        else
217          return super.addChild(name);
218      }
219
220      public MedicinalProductPackagedBatchIdentifierComponent copy() {
221        MedicinalProductPackagedBatchIdentifierComponent dst = new MedicinalProductPackagedBatchIdentifierComponent();
222        copyValues(dst);
223        return dst;
224      }
225
226      public void copyValues(MedicinalProductPackagedBatchIdentifierComponent dst) {
227        super.copyValues(dst);
228        dst.outerPackaging = outerPackaging == null ? null : outerPackaging.copy();
229        dst.immediatePackaging = immediatePackaging == null ? null : immediatePackaging.copy();
230      }
231
232      @Override
233      public boolean equalsDeep(Base other_) {
234        if (!super.equalsDeep(other_))
235          return false;
236        if (!(other_ instanceof MedicinalProductPackagedBatchIdentifierComponent))
237          return false;
238        MedicinalProductPackagedBatchIdentifierComponent o = (MedicinalProductPackagedBatchIdentifierComponent) other_;
239        return compareDeep(outerPackaging, o.outerPackaging, true) && compareDeep(immediatePackaging, o.immediatePackaging, true)
240          ;
241      }
242
243      @Override
244      public boolean equalsShallow(Base other_) {
245        if (!super.equalsShallow(other_))
246          return false;
247        if (!(other_ instanceof MedicinalProductPackagedBatchIdentifierComponent))
248          return false;
249        MedicinalProductPackagedBatchIdentifierComponent o = (MedicinalProductPackagedBatchIdentifierComponent) other_;
250        return true;
251      }
252
253      public boolean isEmpty() {
254        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(outerPackaging, immediatePackaging
255          );
256      }
257
258  public String fhirType() {
259    return "MedicinalProductPackaged.batchIdentifier";
260
261  }
262
263  }
264
265    @Block()
266    public static class MedicinalProductPackagedPackageItemComponent extends BackboneElement implements IBaseBackboneElement {
267        /**
268         * Including possibly Data Carrier Identifier.
269         */
270        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
271        @Description(shortDefinition="Including possibly Data Carrier Identifier", formalDefinition="Including possibly Data Carrier Identifier." )
272        protected List<Identifier> identifier;
273
274        /**
275         * The physical type of the container of the medicine.
276         */
277        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
278        @Description(shortDefinition="The physical type of the container of the medicine", formalDefinition="The physical type of the container of the medicine." )
279        protected CodeableConcept type;
280
281        /**
282         * The quantity of this package in the medicinal product, at the current level of packaging. The outermost is always 1.
283         */
284        @Child(name = "quantity", type = {Quantity.class}, order=3, min=1, max=1, modifier=false, summary=true)
285        @Description(shortDefinition="The quantity of this package in the medicinal product, at the current level of packaging. The outermost is always 1", formalDefinition="The quantity of this package in the medicinal product, at the current level of packaging. The outermost is always 1." )
286        protected Quantity quantity;
287
288        /**
289         * Material type of the package item.
290         */
291        @Child(name = "material", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
292        @Description(shortDefinition="Material type of the package item", formalDefinition="Material type of the package item." )
293        protected List<CodeableConcept> material;
294
295        /**
296         * A possible alternate material for the packaging.
297         */
298        @Child(name = "alternateMaterial", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
299        @Description(shortDefinition="A possible alternate material for the packaging", formalDefinition="A possible alternate material for the packaging." )
300        protected List<CodeableConcept> alternateMaterial;
301
302        /**
303         * A device accompanying a medicinal product.
304         */
305        @Child(name = "device", type = {DeviceDefinition.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
306        @Description(shortDefinition="A device accompanying a medicinal product", formalDefinition="A device accompanying a medicinal product." )
307        protected List<Reference> device;
308        /**
309         * The actual objects that are the target of the reference (A device accompanying a medicinal product.)
310         */
311        protected List<DeviceDefinition> deviceTarget;
312
313
314        /**
315         * The manufactured item as contained in the packaged medicinal product.
316         */
317        @Child(name = "manufacturedItem", type = {MedicinalProductManufactured.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
318        @Description(shortDefinition="The manufactured item as contained in the packaged medicinal product", formalDefinition="The manufactured item as contained in the packaged medicinal product." )
319        protected List<Reference> manufacturedItem;
320        /**
321         * The actual objects that are the target of the reference (The manufactured item as contained in the packaged medicinal product.)
322         */
323        protected List<MedicinalProductManufactured> manufacturedItemTarget;
324
325
326        /**
327         * Allows containers within containers.
328         */
329        @Child(name = "packageItem", type = {MedicinalProductPackagedPackageItemComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
330        @Description(shortDefinition="Allows containers within containers", formalDefinition="Allows containers within containers." )
331        protected List<MedicinalProductPackagedPackageItemComponent> packageItem;
332
333        /**
334         * Dimensions, color etc.
335         */
336        @Child(name = "physicalCharacteristics", type = {ProdCharacteristic.class}, order=9, min=0, max=1, modifier=false, summary=true)
337        @Description(shortDefinition="Dimensions, color etc.", formalDefinition="Dimensions, color etc." )
338        protected ProdCharacteristic physicalCharacteristics;
339
340        /**
341         * Other codeable characteristics.
342         */
343        @Child(name = "otherCharacteristics", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
344        @Description(shortDefinition="Other codeable characteristics", formalDefinition="Other codeable characteristics." )
345        protected List<CodeableConcept> otherCharacteristics;
346
347        /**
348         * Shelf Life and storage information.
349         */
350        @Child(name = "shelfLifeStorage", type = {ProductShelfLife.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
351        @Description(shortDefinition="Shelf Life and storage information", formalDefinition="Shelf Life and storage information." )
352        protected List<ProductShelfLife> shelfLifeStorage;
353
354        /**
355         * Manufacturer of this Package Item.
356         */
357        @Child(name = "manufacturer", type = {Organization.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
358        @Description(shortDefinition="Manufacturer of this Package Item", formalDefinition="Manufacturer of this Package Item." )
359        protected List<Reference> manufacturer;
360        /**
361         * The actual objects that are the target of the reference (Manufacturer of this Package Item.)
362         */
363        protected List<Organization> manufacturerTarget;
364
365
366        private static final long serialVersionUID = 1454286533L;
367
368    /**
369     * Constructor
370     */
371      public MedicinalProductPackagedPackageItemComponent() {
372        super();
373      }
374
375    /**
376     * Constructor
377     */
378      public MedicinalProductPackagedPackageItemComponent(CodeableConcept type, Quantity quantity) {
379        super();
380        this.type = type;
381        this.quantity = quantity;
382      }
383
384        /**
385         * @return {@link #identifier} (Including possibly Data Carrier Identifier.)
386         */
387        public List<Identifier> getIdentifier() { 
388          if (this.identifier == null)
389            this.identifier = new ArrayList<Identifier>();
390          return this.identifier;
391        }
392
393        /**
394         * @return Returns a reference to <code>this</code> for easy method chaining
395         */
396        public MedicinalProductPackagedPackageItemComponent setIdentifier(List<Identifier> theIdentifier) { 
397          this.identifier = theIdentifier;
398          return this;
399        }
400
401        public boolean hasIdentifier() { 
402          if (this.identifier == null)
403            return false;
404          for (Identifier item : this.identifier)
405            if (!item.isEmpty())
406              return true;
407          return false;
408        }
409
410        public Identifier addIdentifier() { //3
411          Identifier t = new Identifier();
412          if (this.identifier == null)
413            this.identifier = new ArrayList<Identifier>();
414          this.identifier.add(t);
415          return t;
416        }
417
418        public MedicinalProductPackagedPackageItemComponent addIdentifier(Identifier t) { //3
419          if (t == null)
420            return this;
421          if (this.identifier == null)
422            this.identifier = new ArrayList<Identifier>();
423          this.identifier.add(t);
424          return this;
425        }
426
427        /**
428         * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
429         */
430        public Identifier getIdentifierFirstRep() { 
431          if (getIdentifier().isEmpty()) {
432            addIdentifier();
433          }
434          return getIdentifier().get(0);
435        }
436
437        /**
438         * @return {@link #type} (The physical type of the container of the medicine.)
439         */
440        public CodeableConcept getType() { 
441          if (this.type == null)
442            if (Configuration.errorOnAutoCreate())
443              throw new Error("Attempt to auto-create MedicinalProductPackagedPackageItemComponent.type");
444            else if (Configuration.doAutoCreate())
445              this.type = new CodeableConcept(); // cc
446          return this.type;
447        }
448
449        public boolean hasType() { 
450          return this.type != null && !this.type.isEmpty();
451        }
452
453        /**
454         * @param value {@link #type} (The physical type of the container of the medicine.)
455         */
456        public MedicinalProductPackagedPackageItemComponent setType(CodeableConcept value) { 
457          this.type = value;
458          return this;
459        }
460
461        /**
462         * @return {@link #quantity} (The quantity of this package in the medicinal product, at the current level of packaging. The outermost is always 1.)
463         */
464        public Quantity getQuantity() { 
465          if (this.quantity == null)
466            if (Configuration.errorOnAutoCreate())
467              throw new Error("Attempt to auto-create MedicinalProductPackagedPackageItemComponent.quantity");
468            else if (Configuration.doAutoCreate())
469              this.quantity = new Quantity(); // cc
470          return this.quantity;
471        }
472
473        public boolean hasQuantity() { 
474          return this.quantity != null && !this.quantity.isEmpty();
475        }
476
477        /**
478         * @param value {@link #quantity} (The quantity of this package in the medicinal product, at the current level of packaging. The outermost is always 1.)
479         */
480        public MedicinalProductPackagedPackageItemComponent setQuantity(Quantity value) { 
481          this.quantity = value;
482          return this;
483        }
484
485        /**
486         * @return {@link #material} (Material type of the package item.)
487         */
488        public List<CodeableConcept> getMaterial() { 
489          if (this.material == null)
490            this.material = new ArrayList<CodeableConcept>();
491          return this.material;
492        }
493
494        /**
495         * @return Returns a reference to <code>this</code> for easy method chaining
496         */
497        public MedicinalProductPackagedPackageItemComponent setMaterial(List<CodeableConcept> theMaterial) { 
498          this.material = theMaterial;
499          return this;
500        }
501
502        public boolean hasMaterial() { 
503          if (this.material == null)
504            return false;
505          for (CodeableConcept item : this.material)
506            if (!item.isEmpty())
507              return true;
508          return false;
509        }
510
511        public CodeableConcept addMaterial() { //3
512          CodeableConcept t = new CodeableConcept();
513          if (this.material == null)
514            this.material = new ArrayList<CodeableConcept>();
515          this.material.add(t);
516          return t;
517        }
518
519        public MedicinalProductPackagedPackageItemComponent addMaterial(CodeableConcept t) { //3
520          if (t == null)
521            return this;
522          if (this.material == null)
523            this.material = new ArrayList<CodeableConcept>();
524          this.material.add(t);
525          return this;
526        }
527
528        /**
529         * @return The first repetition of repeating field {@link #material}, creating it if it does not already exist
530         */
531        public CodeableConcept getMaterialFirstRep() { 
532          if (getMaterial().isEmpty()) {
533            addMaterial();
534          }
535          return getMaterial().get(0);
536        }
537
538        /**
539         * @return {@link #alternateMaterial} (A possible alternate material for the packaging.)
540         */
541        public List<CodeableConcept> getAlternateMaterial() { 
542          if (this.alternateMaterial == null)
543            this.alternateMaterial = new ArrayList<CodeableConcept>();
544          return this.alternateMaterial;
545        }
546
547        /**
548         * @return Returns a reference to <code>this</code> for easy method chaining
549         */
550        public MedicinalProductPackagedPackageItemComponent setAlternateMaterial(List<CodeableConcept> theAlternateMaterial) { 
551          this.alternateMaterial = theAlternateMaterial;
552          return this;
553        }
554
555        public boolean hasAlternateMaterial() { 
556          if (this.alternateMaterial == null)
557            return false;
558          for (CodeableConcept item : this.alternateMaterial)
559            if (!item.isEmpty())
560              return true;
561          return false;
562        }
563
564        public CodeableConcept addAlternateMaterial() { //3
565          CodeableConcept t = new CodeableConcept();
566          if (this.alternateMaterial == null)
567            this.alternateMaterial = new ArrayList<CodeableConcept>();
568          this.alternateMaterial.add(t);
569          return t;
570        }
571
572        public MedicinalProductPackagedPackageItemComponent addAlternateMaterial(CodeableConcept t) { //3
573          if (t == null)
574            return this;
575          if (this.alternateMaterial == null)
576            this.alternateMaterial = new ArrayList<CodeableConcept>();
577          this.alternateMaterial.add(t);
578          return this;
579        }
580
581        /**
582         * @return The first repetition of repeating field {@link #alternateMaterial}, creating it if it does not already exist
583         */
584        public CodeableConcept getAlternateMaterialFirstRep() { 
585          if (getAlternateMaterial().isEmpty()) {
586            addAlternateMaterial();
587          }
588          return getAlternateMaterial().get(0);
589        }
590
591        /**
592         * @return {@link #device} (A device accompanying a medicinal product.)
593         */
594        public List<Reference> getDevice() { 
595          if (this.device == null)
596            this.device = new ArrayList<Reference>();
597          return this.device;
598        }
599
600        /**
601         * @return Returns a reference to <code>this</code> for easy method chaining
602         */
603        public MedicinalProductPackagedPackageItemComponent setDevice(List<Reference> theDevice) { 
604          this.device = theDevice;
605          return this;
606        }
607
608        public boolean hasDevice() { 
609          if (this.device == null)
610            return false;
611          for (Reference item : this.device)
612            if (!item.isEmpty())
613              return true;
614          return false;
615        }
616
617        public Reference addDevice() { //3
618          Reference t = new Reference();
619          if (this.device == null)
620            this.device = new ArrayList<Reference>();
621          this.device.add(t);
622          return t;
623        }
624
625        public MedicinalProductPackagedPackageItemComponent addDevice(Reference t) { //3
626          if (t == null)
627            return this;
628          if (this.device == null)
629            this.device = new ArrayList<Reference>();
630          this.device.add(t);
631          return this;
632        }
633
634        /**
635         * @return The first repetition of repeating field {@link #device}, creating it if it does not already exist
636         */
637        public Reference getDeviceFirstRep() { 
638          if (getDevice().isEmpty()) {
639            addDevice();
640          }
641          return getDevice().get(0);
642        }
643
644        /**
645         * @deprecated Use Reference#setResource(IBaseResource) instead
646         */
647        @Deprecated
648        public List<DeviceDefinition> getDeviceTarget() { 
649          if (this.deviceTarget == null)
650            this.deviceTarget = new ArrayList<DeviceDefinition>();
651          return this.deviceTarget;
652        }
653
654        /**
655         * @deprecated Use Reference#setResource(IBaseResource) instead
656         */
657        @Deprecated
658        public DeviceDefinition addDeviceTarget() { 
659          DeviceDefinition r = new DeviceDefinition();
660          if (this.deviceTarget == null)
661            this.deviceTarget = new ArrayList<DeviceDefinition>();
662          this.deviceTarget.add(r);
663          return r;
664        }
665
666        /**
667         * @return {@link #manufacturedItem} (The manufactured item as contained in the packaged medicinal product.)
668         */
669        public List<Reference> getManufacturedItem() { 
670          if (this.manufacturedItem == null)
671            this.manufacturedItem = new ArrayList<Reference>();
672          return this.manufacturedItem;
673        }
674
675        /**
676         * @return Returns a reference to <code>this</code> for easy method chaining
677         */
678        public MedicinalProductPackagedPackageItemComponent setManufacturedItem(List<Reference> theManufacturedItem) { 
679          this.manufacturedItem = theManufacturedItem;
680          return this;
681        }
682
683        public boolean hasManufacturedItem() { 
684          if (this.manufacturedItem == null)
685            return false;
686          for (Reference item : this.manufacturedItem)
687            if (!item.isEmpty())
688              return true;
689          return false;
690        }
691
692        public Reference addManufacturedItem() { //3
693          Reference t = new Reference();
694          if (this.manufacturedItem == null)
695            this.manufacturedItem = new ArrayList<Reference>();
696          this.manufacturedItem.add(t);
697          return t;
698        }
699
700        public MedicinalProductPackagedPackageItemComponent addManufacturedItem(Reference t) { //3
701          if (t == null)
702            return this;
703          if (this.manufacturedItem == null)
704            this.manufacturedItem = new ArrayList<Reference>();
705          this.manufacturedItem.add(t);
706          return this;
707        }
708
709        /**
710         * @return The first repetition of repeating field {@link #manufacturedItem}, creating it if it does not already exist
711         */
712        public Reference getManufacturedItemFirstRep() { 
713          if (getManufacturedItem().isEmpty()) {
714            addManufacturedItem();
715          }
716          return getManufacturedItem().get(0);
717        }
718
719        /**
720         * @deprecated Use Reference#setResource(IBaseResource) instead
721         */
722        @Deprecated
723        public List<MedicinalProductManufactured> getManufacturedItemTarget() { 
724          if (this.manufacturedItemTarget == null)
725            this.manufacturedItemTarget = new ArrayList<MedicinalProductManufactured>();
726          return this.manufacturedItemTarget;
727        }
728
729        /**
730         * @deprecated Use Reference#setResource(IBaseResource) instead
731         */
732        @Deprecated
733        public MedicinalProductManufactured addManufacturedItemTarget() { 
734          MedicinalProductManufactured r = new MedicinalProductManufactured();
735          if (this.manufacturedItemTarget == null)
736            this.manufacturedItemTarget = new ArrayList<MedicinalProductManufactured>();
737          this.manufacturedItemTarget.add(r);
738          return r;
739        }
740
741        /**
742         * @return {@link #packageItem} (Allows containers within containers.)
743         */
744        public List<MedicinalProductPackagedPackageItemComponent> getPackageItem() { 
745          if (this.packageItem == null)
746            this.packageItem = new ArrayList<MedicinalProductPackagedPackageItemComponent>();
747          return this.packageItem;
748        }
749
750        /**
751         * @return Returns a reference to <code>this</code> for easy method chaining
752         */
753        public MedicinalProductPackagedPackageItemComponent setPackageItem(List<MedicinalProductPackagedPackageItemComponent> thePackageItem) { 
754          this.packageItem = thePackageItem;
755          return this;
756        }
757
758        public boolean hasPackageItem() { 
759          if (this.packageItem == null)
760            return false;
761          for (MedicinalProductPackagedPackageItemComponent item : this.packageItem)
762            if (!item.isEmpty())
763              return true;
764          return false;
765        }
766
767        public MedicinalProductPackagedPackageItemComponent addPackageItem() { //3
768          MedicinalProductPackagedPackageItemComponent t = new MedicinalProductPackagedPackageItemComponent();
769          if (this.packageItem == null)
770            this.packageItem = new ArrayList<MedicinalProductPackagedPackageItemComponent>();
771          this.packageItem.add(t);
772          return t;
773        }
774
775        public MedicinalProductPackagedPackageItemComponent addPackageItem(MedicinalProductPackagedPackageItemComponent t) { //3
776          if (t == null)
777            return this;
778          if (this.packageItem == null)
779            this.packageItem = new ArrayList<MedicinalProductPackagedPackageItemComponent>();
780          this.packageItem.add(t);
781          return this;
782        }
783
784        /**
785         * @return The first repetition of repeating field {@link #packageItem}, creating it if it does not already exist
786         */
787        public MedicinalProductPackagedPackageItemComponent getPackageItemFirstRep() { 
788          if (getPackageItem().isEmpty()) {
789            addPackageItem();
790          }
791          return getPackageItem().get(0);
792        }
793
794        /**
795         * @return {@link #physicalCharacteristics} (Dimensions, color etc.)
796         */
797        public ProdCharacteristic getPhysicalCharacteristics() { 
798          if (this.physicalCharacteristics == null)
799            if (Configuration.errorOnAutoCreate())
800              throw new Error("Attempt to auto-create MedicinalProductPackagedPackageItemComponent.physicalCharacteristics");
801            else if (Configuration.doAutoCreate())
802              this.physicalCharacteristics = new ProdCharacteristic(); // cc
803          return this.physicalCharacteristics;
804        }
805
806        public boolean hasPhysicalCharacteristics() { 
807          return this.physicalCharacteristics != null && !this.physicalCharacteristics.isEmpty();
808        }
809
810        /**
811         * @param value {@link #physicalCharacteristics} (Dimensions, color etc.)
812         */
813        public MedicinalProductPackagedPackageItemComponent setPhysicalCharacteristics(ProdCharacteristic value) { 
814          this.physicalCharacteristics = value;
815          return this;
816        }
817
818        /**
819         * @return {@link #otherCharacteristics} (Other codeable characteristics.)
820         */
821        public List<CodeableConcept> getOtherCharacteristics() { 
822          if (this.otherCharacteristics == null)
823            this.otherCharacteristics = new ArrayList<CodeableConcept>();
824          return this.otherCharacteristics;
825        }
826
827        /**
828         * @return Returns a reference to <code>this</code> for easy method chaining
829         */
830        public MedicinalProductPackagedPackageItemComponent setOtherCharacteristics(List<CodeableConcept> theOtherCharacteristics) { 
831          this.otherCharacteristics = theOtherCharacteristics;
832          return this;
833        }
834
835        public boolean hasOtherCharacteristics() { 
836          if (this.otherCharacteristics == null)
837            return false;
838          for (CodeableConcept item : this.otherCharacteristics)
839            if (!item.isEmpty())
840              return true;
841          return false;
842        }
843
844        public CodeableConcept addOtherCharacteristics() { //3
845          CodeableConcept t = new CodeableConcept();
846          if (this.otherCharacteristics == null)
847            this.otherCharacteristics = new ArrayList<CodeableConcept>();
848          this.otherCharacteristics.add(t);
849          return t;
850        }
851
852        public MedicinalProductPackagedPackageItemComponent addOtherCharacteristics(CodeableConcept t) { //3
853          if (t == null)
854            return this;
855          if (this.otherCharacteristics == null)
856            this.otherCharacteristics = new ArrayList<CodeableConcept>();
857          this.otherCharacteristics.add(t);
858          return this;
859        }
860
861        /**
862         * @return The first repetition of repeating field {@link #otherCharacteristics}, creating it if it does not already exist
863         */
864        public CodeableConcept getOtherCharacteristicsFirstRep() { 
865          if (getOtherCharacteristics().isEmpty()) {
866            addOtherCharacteristics();
867          }
868          return getOtherCharacteristics().get(0);
869        }
870
871        /**
872         * @return {@link #shelfLifeStorage} (Shelf Life and storage information.)
873         */
874        public List<ProductShelfLife> getShelfLifeStorage() { 
875          if (this.shelfLifeStorage == null)
876            this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
877          return this.shelfLifeStorage;
878        }
879
880        /**
881         * @return Returns a reference to <code>this</code> for easy method chaining
882         */
883        public MedicinalProductPackagedPackageItemComponent setShelfLifeStorage(List<ProductShelfLife> theShelfLifeStorage) { 
884          this.shelfLifeStorage = theShelfLifeStorage;
885          return this;
886        }
887
888        public boolean hasShelfLifeStorage() { 
889          if (this.shelfLifeStorage == null)
890            return false;
891          for (ProductShelfLife item : this.shelfLifeStorage)
892            if (!item.isEmpty())
893              return true;
894          return false;
895        }
896
897        public ProductShelfLife addShelfLifeStorage() { //3
898          ProductShelfLife t = new ProductShelfLife();
899          if (this.shelfLifeStorage == null)
900            this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
901          this.shelfLifeStorage.add(t);
902          return t;
903        }
904
905        public MedicinalProductPackagedPackageItemComponent addShelfLifeStorage(ProductShelfLife t) { //3
906          if (t == null)
907            return this;
908          if (this.shelfLifeStorage == null)
909            this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
910          this.shelfLifeStorage.add(t);
911          return this;
912        }
913
914        /**
915         * @return The first repetition of repeating field {@link #shelfLifeStorage}, creating it if it does not already exist
916         */
917        public ProductShelfLife getShelfLifeStorageFirstRep() { 
918          if (getShelfLifeStorage().isEmpty()) {
919            addShelfLifeStorage();
920          }
921          return getShelfLifeStorage().get(0);
922        }
923
924        /**
925         * @return {@link #manufacturer} (Manufacturer of this Package Item.)
926         */
927        public List<Reference> getManufacturer() { 
928          if (this.manufacturer == null)
929            this.manufacturer = new ArrayList<Reference>();
930          return this.manufacturer;
931        }
932
933        /**
934         * @return Returns a reference to <code>this</code> for easy method chaining
935         */
936        public MedicinalProductPackagedPackageItemComponent setManufacturer(List<Reference> theManufacturer) { 
937          this.manufacturer = theManufacturer;
938          return this;
939        }
940
941        public boolean hasManufacturer() { 
942          if (this.manufacturer == null)
943            return false;
944          for (Reference item : this.manufacturer)
945            if (!item.isEmpty())
946              return true;
947          return false;
948        }
949
950        public Reference addManufacturer() { //3
951          Reference t = new Reference();
952          if (this.manufacturer == null)
953            this.manufacturer = new ArrayList<Reference>();
954          this.manufacturer.add(t);
955          return t;
956        }
957
958        public MedicinalProductPackagedPackageItemComponent addManufacturer(Reference t) { //3
959          if (t == null)
960            return this;
961          if (this.manufacturer == null)
962            this.manufacturer = new ArrayList<Reference>();
963          this.manufacturer.add(t);
964          return this;
965        }
966
967        /**
968         * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist
969         */
970        public Reference getManufacturerFirstRep() { 
971          if (getManufacturer().isEmpty()) {
972            addManufacturer();
973          }
974          return getManufacturer().get(0);
975        }
976
977        /**
978         * @deprecated Use Reference#setResource(IBaseResource) instead
979         */
980        @Deprecated
981        public List<Organization> getManufacturerTarget() { 
982          if (this.manufacturerTarget == null)
983            this.manufacturerTarget = new ArrayList<Organization>();
984          return this.manufacturerTarget;
985        }
986
987        /**
988         * @deprecated Use Reference#setResource(IBaseResource) instead
989         */
990        @Deprecated
991        public Organization addManufacturerTarget() { 
992          Organization r = new Organization();
993          if (this.manufacturerTarget == null)
994            this.manufacturerTarget = new ArrayList<Organization>();
995          this.manufacturerTarget.add(r);
996          return r;
997        }
998
999        protected void listChildren(List<Property> children) {
1000          super.listChildren(children);
1001          children.add(new Property("identifier", "Identifier", "Including possibly Data Carrier Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
1002          children.add(new Property("type", "CodeableConcept", "The physical type of the container of the medicine.", 0, 1, type));
1003          children.add(new Property("quantity", "Quantity", "The quantity of this package in the medicinal product, at the current level of packaging. The outermost is always 1.", 0, 1, quantity));
1004          children.add(new Property("material", "CodeableConcept", "Material type of the package item.", 0, java.lang.Integer.MAX_VALUE, material));
1005          children.add(new Property("alternateMaterial", "CodeableConcept", "A possible alternate material for the packaging.", 0, java.lang.Integer.MAX_VALUE, alternateMaterial));
1006          children.add(new Property("device", "Reference(DeviceDefinition)", "A device accompanying a medicinal product.", 0, java.lang.Integer.MAX_VALUE, device));
1007          children.add(new Property("manufacturedItem", "Reference(MedicinalProductManufactured)", "The manufactured item as contained in the packaged medicinal product.", 0, java.lang.Integer.MAX_VALUE, manufacturedItem));
1008          children.add(new Property("packageItem", "@MedicinalProductPackaged.packageItem", "Allows containers within containers.", 0, java.lang.Integer.MAX_VALUE, packageItem));
1009          children.add(new Property("physicalCharacteristics", "ProdCharacteristic", "Dimensions, color etc.", 0, 1, physicalCharacteristics));
1010          children.add(new Property("otherCharacteristics", "CodeableConcept", "Other codeable characteristics.", 0, java.lang.Integer.MAX_VALUE, otherCharacteristics));
1011          children.add(new Property("shelfLifeStorage", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLifeStorage));
1012          children.add(new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Package Item.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
1013        }
1014
1015        @Override
1016        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1017          switch (_hash) {
1018          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Including possibly Data Carrier Identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
1019          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The physical type of the container of the medicine.", 0, 1, type);
1020          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The quantity of this package in the medicinal product, at the current level of packaging. The outermost is always 1.", 0, 1, quantity);
1021          case 299066663: /*material*/  return new Property("material", "CodeableConcept", "Material type of the package item.", 0, java.lang.Integer.MAX_VALUE, material);
1022          case -1021448255: /*alternateMaterial*/  return new Property("alternateMaterial", "CodeableConcept", "A possible alternate material for the packaging.", 0, java.lang.Integer.MAX_VALUE, alternateMaterial);
1023          case -1335157162: /*device*/  return new Property("device", "Reference(DeviceDefinition)", "A device accompanying a medicinal product.", 0, java.lang.Integer.MAX_VALUE, device);
1024          case 62093686: /*manufacturedItem*/  return new Property("manufacturedItem", "Reference(MedicinalProductManufactured)", "The manufactured item as contained in the packaged medicinal product.", 0, java.lang.Integer.MAX_VALUE, manufacturedItem);
1025          case 908628089: /*packageItem*/  return new Property("packageItem", "@MedicinalProductPackaged.packageItem", "Allows containers within containers.", 0, java.lang.Integer.MAX_VALUE, packageItem);
1026          case -1599676319: /*physicalCharacteristics*/  return new Property("physicalCharacteristics", "ProdCharacteristic", "Dimensions, color etc.", 0, 1, physicalCharacteristics);
1027          case 722135304: /*otherCharacteristics*/  return new Property("otherCharacteristics", "CodeableConcept", "Other codeable characteristics.", 0, java.lang.Integer.MAX_VALUE, otherCharacteristics);
1028          case 172049237: /*shelfLifeStorage*/  return new Property("shelfLifeStorage", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLifeStorage);
1029          case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Package Item.", 0, java.lang.Integer.MAX_VALUE, manufacturer);
1030          default: return super.getNamedProperty(_hash, _name, _checkValid);
1031          }
1032
1033        }
1034
1035      @Override
1036      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1037        switch (hash) {
1038        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1039        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1040        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1041        case 299066663: /*material*/ return this.material == null ? new Base[0] : this.material.toArray(new Base[this.material.size()]); // CodeableConcept
1042        case -1021448255: /*alternateMaterial*/ return this.alternateMaterial == null ? new Base[0] : this.alternateMaterial.toArray(new Base[this.alternateMaterial.size()]); // CodeableConcept
1043        case -1335157162: /*device*/ return this.device == null ? new Base[0] : this.device.toArray(new Base[this.device.size()]); // Reference
1044        case 62093686: /*manufacturedItem*/ return this.manufacturedItem == null ? new Base[0] : this.manufacturedItem.toArray(new Base[this.manufacturedItem.size()]); // Reference
1045        case 908628089: /*packageItem*/ return this.packageItem == null ? new Base[0] : this.packageItem.toArray(new Base[this.packageItem.size()]); // MedicinalProductPackagedPackageItemComponent
1046        case -1599676319: /*physicalCharacteristics*/ return this.physicalCharacteristics == null ? new Base[0] : new Base[] {this.physicalCharacteristics}; // ProdCharacteristic
1047        case 722135304: /*otherCharacteristics*/ return this.otherCharacteristics == null ? new Base[0] : this.otherCharacteristics.toArray(new Base[this.otherCharacteristics.size()]); // CodeableConcept
1048        case 172049237: /*shelfLifeStorage*/ return this.shelfLifeStorage == null ? new Base[0] : this.shelfLifeStorage.toArray(new Base[this.shelfLifeStorage.size()]); // ProductShelfLife
1049        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
1050        default: return super.getProperty(hash, name, checkValid);
1051        }
1052
1053      }
1054
1055      @Override
1056      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1057        switch (hash) {
1058        case -1618432855: // identifier
1059          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1060          return value;
1061        case 3575610: // type
1062          this.type = castToCodeableConcept(value); // CodeableConcept
1063          return value;
1064        case -1285004149: // quantity
1065          this.quantity = castToQuantity(value); // Quantity
1066          return value;
1067        case 299066663: // material
1068          this.getMaterial().add(castToCodeableConcept(value)); // CodeableConcept
1069          return value;
1070        case -1021448255: // alternateMaterial
1071          this.getAlternateMaterial().add(castToCodeableConcept(value)); // CodeableConcept
1072          return value;
1073        case -1335157162: // device
1074          this.getDevice().add(castToReference(value)); // Reference
1075          return value;
1076        case 62093686: // manufacturedItem
1077          this.getManufacturedItem().add(castToReference(value)); // Reference
1078          return value;
1079        case 908628089: // packageItem
1080          this.getPackageItem().add((MedicinalProductPackagedPackageItemComponent) value); // MedicinalProductPackagedPackageItemComponent
1081          return value;
1082        case -1599676319: // physicalCharacteristics
1083          this.physicalCharacteristics = castToProdCharacteristic(value); // ProdCharacteristic
1084          return value;
1085        case 722135304: // otherCharacteristics
1086          this.getOtherCharacteristics().add(castToCodeableConcept(value)); // CodeableConcept
1087          return value;
1088        case 172049237: // shelfLifeStorage
1089          this.getShelfLifeStorage().add(castToProductShelfLife(value)); // ProductShelfLife
1090          return value;
1091        case -1969347631: // manufacturer
1092          this.getManufacturer().add(castToReference(value)); // Reference
1093          return value;
1094        default: return super.setProperty(hash, name, value);
1095        }
1096
1097      }
1098
1099      @Override
1100      public Base setProperty(String name, Base value) throws FHIRException {
1101        if (name.equals("identifier")) {
1102          this.getIdentifier().add(castToIdentifier(value));
1103        } else if (name.equals("type")) {
1104          this.type = castToCodeableConcept(value); // CodeableConcept
1105        } else if (name.equals("quantity")) {
1106          this.quantity = castToQuantity(value); // Quantity
1107        } else if (name.equals("material")) {
1108          this.getMaterial().add(castToCodeableConcept(value));
1109        } else if (name.equals("alternateMaterial")) {
1110          this.getAlternateMaterial().add(castToCodeableConcept(value));
1111        } else if (name.equals("device")) {
1112          this.getDevice().add(castToReference(value));
1113        } else if (name.equals("manufacturedItem")) {
1114          this.getManufacturedItem().add(castToReference(value));
1115        } else if (name.equals("packageItem")) {
1116          this.getPackageItem().add((MedicinalProductPackagedPackageItemComponent) value);
1117        } else if (name.equals("physicalCharacteristics")) {
1118          this.physicalCharacteristics = castToProdCharacteristic(value); // ProdCharacteristic
1119        } else if (name.equals("otherCharacteristics")) {
1120          this.getOtherCharacteristics().add(castToCodeableConcept(value));
1121        } else if (name.equals("shelfLifeStorage")) {
1122          this.getShelfLifeStorage().add(castToProductShelfLife(value));
1123        } else if (name.equals("manufacturer")) {
1124          this.getManufacturer().add(castToReference(value));
1125        } else
1126          return super.setProperty(name, value);
1127        return value;
1128      }
1129
1130      @Override
1131      public Base makeProperty(int hash, String name) throws FHIRException {
1132        switch (hash) {
1133        case -1618432855:  return addIdentifier(); 
1134        case 3575610:  return getType(); 
1135        case -1285004149:  return getQuantity(); 
1136        case 299066663:  return addMaterial(); 
1137        case -1021448255:  return addAlternateMaterial(); 
1138        case -1335157162:  return addDevice(); 
1139        case 62093686:  return addManufacturedItem(); 
1140        case 908628089:  return addPackageItem(); 
1141        case -1599676319:  return getPhysicalCharacteristics(); 
1142        case 722135304:  return addOtherCharacteristics(); 
1143        case 172049237:  return addShelfLifeStorage(); 
1144        case -1969347631:  return addManufacturer(); 
1145        default: return super.makeProperty(hash, name);
1146        }
1147
1148      }
1149
1150      @Override
1151      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1152        switch (hash) {
1153        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1154        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1155        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1156        case 299066663: /*material*/ return new String[] {"CodeableConcept"};
1157        case -1021448255: /*alternateMaterial*/ return new String[] {"CodeableConcept"};
1158        case -1335157162: /*device*/ return new String[] {"Reference"};
1159        case 62093686: /*manufacturedItem*/ return new String[] {"Reference"};
1160        case 908628089: /*packageItem*/ return new String[] {"@MedicinalProductPackaged.packageItem"};
1161        case -1599676319: /*physicalCharacteristics*/ return new String[] {"ProdCharacteristic"};
1162        case 722135304: /*otherCharacteristics*/ return new String[] {"CodeableConcept"};
1163        case 172049237: /*shelfLifeStorage*/ return new String[] {"ProductShelfLife"};
1164        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
1165        default: return super.getTypesForProperty(hash, name);
1166        }
1167
1168      }
1169
1170      @Override
1171      public Base addChild(String name) throws FHIRException {
1172        if (name.equals("identifier")) {
1173          return addIdentifier();
1174        }
1175        else if (name.equals("type")) {
1176          this.type = new CodeableConcept();
1177          return this.type;
1178        }
1179        else if (name.equals("quantity")) {
1180          this.quantity = new Quantity();
1181          return this.quantity;
1182        }
1183        else if (name.equals("material")) {
1184          return addMaterial();
1185        }
1186        else if (name.equals("alternateMaterial")) {
1187          return addAlternateMaterial();
1188        }
1189        else if (name.equals("device")) {
1190          return addDevice();
1191        }
1192        else if (name.equals("manufacturedItem")) {
1193          return addManufacturedItem();
1194        }
1195        else if (name.equals("packageItem")) {
1196          return addPackageItem();
1197        }
1198        else if (name.equals("physicalCharacteristics")) {
1199          this.physicalCharacteristics = new ProdCharacteristic();
1200          return this.physicalCharacteristics;
1201        }
1202        else if (name.equals("otherCharacteristics")) {
1203          return addOtherCharacteristics();
1204        }
1205        else if (name.equals("shelfLifeStorage")) {
1206          return addShelfLifeStorage();
1207        }
1208        else if (name.equals("manufacturer")) {
1209          return addManufacturer();
1210        }
1211        else
1212          return super.addChild(name);
1213      }
1214
1215      public MedicinalProductPackagedPackageItemComponent copy() {
1216        MedicinalProductPackagedPackageItemComponent dst = new MedicinalProductPackagedPackageItemComponent();
1217        copyValues(dst);
1218        return dst;
1219      }
1220
1221      public void copyValues(MedicinalProductPackagedPackageItemComponent dst) {
1222        super.copyValues(dst);
1223        if (identifier != null) {
1224          dst.identifier = new ArrayList<Identifier>();
1225          for (Identifier i : identifier)
1226            dst.identifier.add(i.copy());
1227        };
1228        dst.type = type == null ? null : type.copy();
1229        dst.quantity = quantity == null ? null : quantity.copy();
1230        if (material != null) {
1231          dst.material = new ArrayList<CodeableConcept>();
1232          for (CodeableConcept i : material)
1233            dst.material.add(i.copy());
1234        };
1235        if (alternateMaterial != null) {
1236          dst.alternateMaterial = new ArrayList<CodeableConcept>();
1237          for (CodeableConcept i : alternateMaterial)
1238            dst.alternateMaterial.add(i.copy());
1239        };
1240        if (device != null) {
1241          dst.device = new ArrayList<Reference>();
1242          for (Reference i : device)
1243            dst.device.add(i.copy());
1244        };
1245        if (manufacturedItem != null) {
1246          dst.manufacturedItem = new ArrayList<Reference>();
1247          for (Reference i : manufacturedItem)
1248            dst.manufacturedItem.add(i.copy());
1249        };
1250        if (packageItem != null) {
1251          dst.packageItem = new ArrayList<MedicinalProductPackagedPackageItemComponent>();
1252          for (MedicinalProductPackagedPackageItemComponent i : packageItem)
1253            dst.packageItem.add(i.copy());
1254        };
1255        dst.physicalCharacteristics = physicalCharacteristics == null ? null : physicalCharacteristics.copy();
1256        if (otherCharacteristics != null) {
1257          dst.otherCharacteristics = new ArrayList<CodeableConcept>();
1258          for (CodeableConcept i : otherCharacteristics)
1259            dst.otherCharacteristics.add(i.copy());
1260        };
1261        if (shelfLifeStorage != null) {
1262          dst.shelfLifeStorage = new ArrayList<ProductShelfLife>();
1263          for (ProductShelfLife i : shelfLifeStorage)
1264            dst.shelfLifeStorage.add(i.copy());
1265        };
1266        if (manufacturer != null) {
1267          dst.manufacturer = new ArrayList<Reference>();
1268          for (Reference i : manufacturer)
1269            dst.manufacturer.add(i.copy());
1270        };
1271      }
1272
1273      @Override
1274      public boolean equalsDeep(Base other_) {
1275        if (!super.equalsDeep(other_))
1276          return false;
1277        if (!(other_ instanceof MedicinalProductPackagedPackageItemComponent))
1278          return false;
1279        MedicinalProductPackagedPackageItemComponent o = (MedicinalProductPackagedPackageItemComponent) other_;
1280        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(quantity, o.quantity, true)
1281           && compareDeep(material, o.material, true) && compareDeep(alternateMaterial, o.alternateMaterial, true)
1282           && compareDeep(device, o.device, true) && compareDeep(manufacturedItem, o.manufacturedItem, true)
1283           && compareDeep(packageItem, o.packageItem, true) && compareDeep(physicalCharacteristics, o.physicalCharacteristics, true)
1284           && compareDeep(otherCharacteristics, o.otherCharacteristics, true) && compareDeep(shelfLifeStorage, o.shelfLifeStorage, true)
1285           && compareDeep(manufacturer, o.manufacturer, true);
1286      }
1287
1288      @Override
1289      public boolean equalsShallow(Base other_) {
1290        if (!super.equalsShallow(other_))
1291          return false;
1292        if (!(other_ instanceof MedicinalProductPackagedPackageItemComponent))
1293          return false;
1294        MedicinalProductPackagedPackageItemComponent o = (MedicinalProductPackagedPackageItemComponent) other_;
1295        return true;
1296      }
1297
1298      public boolean isEmpty() {
1299        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, quantity
1300          , material, alternateMaterial, device, manufacturedItem, packageItem, physicalCharacteristics
1301          , otherCharacteristics, shelfLifeStorage, manufacturer);
1302      }
1303
1304  public String fhirType() {
1305    return "MedicinalProductPackaged.packageItem";
1306
1307  }
1308
1309  }
1310
1311    /**
1312     * Unique identifier.
1313     */
1314    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1315    @Description(shortDefinition="Unique identifier", formalDefinition="Unique identifier." )
1316    protected List<Identifier> identifier;
1317
1318    /**
1319     * The product with this is a pack for.
1320     */
1321    @Child(name = "subject", type = {MedicinalProduct.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1322    @Description(shortDefinition="The product with this is a pack for", formalDefinition="The product with this is a pack for." )
1323    protected List<Reference> subject;
1324    /**
1325     * The actual objects that are the target of the reference (The product with this is a pack for.)
1326     */
1327    protected List<MedicinalProduct> subjectTarget;
1328
1329
1330    /**
1331     * Textual description.
1332     */
1333    @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1334    @Description(shortDefinition="Textual description", formalDefinition="Textual description." )
1335    protected StringType description;
1336
1337    /**
1338     * The legal status of supply of the medicinal product as classified by the regulator.
1339     */
1340    @Child(name = "legalStatusOfSupply", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1341    @Description(shortDefinition="The legal status of supply of the medicinal product as classified by the regulator", formalDefinition="The legal status of supply of the medicinal product as classified by the regulator." )
1342    protected CodeableConcept legalStatusOfSupply;
1343
1344    /**
1345     * Marketing information.
1346     */
1347    @Child(name = "marketingStatus", type = {MarketingStatus.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1348    @Description(shortDefinition="Marketing information", formalDefinition="Marketing information." )
1349    protected List<MarketingStatus> marketingStatus;
1350
1351    /**
1352     * Manufacturer of this Package Item.
1353     */
1354    @Child(name = "marketingAuthorization", type = {MedicinalProductAuthorization.class}, order=5, min=0, max=1, modifier=false, summary=true)
1355    @Description(shortDefinition="Manufacturer of this Package Item", formalDefinition="Manufacturer of this Package Item." )
1356    protected Reference marketingAuthorization;
1357
1358    /**
1359     * The actual object that is the target of the reference (Manufacturer of this Package Item.)
1360     */
1361    protected MedicinalProductAuthorization marketingAuthorizationTarget;
1362
1363    /**
1364     * Manufacturer of this Package Item.
1365     */
1366    @Child(name = "manufacturer", type = {Organization.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1367    @Description(shortDefinition="Manufacturer of this Package Item", formalDefinition="Manufacturer of this Package Item." )
1368    protected List<Reference> manufacturer;
1369    /**
1370     * The actual objects that are the target of the reference (Manufacturer of this Package Item.)
1371     */
1372    protected List<Organization> manufacturerTarget;
1373
1374
1375    /**
1376     * Batch numbering.
1377     */
1378    @Child(name = "batchIdentifier", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1379    @Description(shortDefinition="Batch numbering", formalDefinition="Batch numbering." )
1380    protected List<MedicinalProductPackagedBatchIdentifierComponent> batchIdentifier;
1381
1382    /**
1383     * A packaging item, as a contained for medicine, possibly with other packaging items within.
1384     */
1385    @Child(name = "packageItem", type = {}, order=8, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1386    @Description(shortDefinition="A packaging item, as a contained for medicine, possibly with other packaging items within", formalDefinition="A packaging item, as a contained for medicine, possibly with other packaging items within." )
1387    protected List<MedicinalProductPackagedPackageItemComponent> packageItem;
1388
1389    private static final long serialVersionUID = -1530863773L;
1390
1391  /**
1392   * Constructor
1393   */
1394    public MedicinalProductPackaged() {
1395      super();
1396    }
1397
1398    /**
1399     * @return {@link #identifier} (Unique identifier.)
1400     */
1401    public List<Identifier> getIdentifier() { 
1402      if (this.identifier == null)
1403        this.identifier = new ArrayList<Identifier>();
1404      return this.identifier;
1405    }
1406
1407    /**
1408     * @return Returns a reference to <code>this</code> for easy method chaining
1409     */
1410    public MedicinalProductPackaged setIdentifier(List<Identifier> theIdentifier) { 
1411      this.identifier = theIdentifier;
1412      return this;
1413    }
1414
1415    public boolean hasIdentifier() { 
1416      if (this.identifier == null)
1417        return false;
1418      for (Identifier item : this.identifier)
1419        if (!item.isEmpty())
1420          return true;
1421      return false;
1422    }
1423
1424    public Identifier addIdentifier() { //3
1425      Identifier t = new Identifier();
1426      if (this.identifier == null)
1427        this.identifier = new ArrayList<Identifier>();
1428      this.identifier.add(t);
1429      return t;
1430    }
1431
1432    public MedicinalProductPackaged addIdentifier(Identifier t) { //3
1433      if (t == null)
1434        return this;
1435      if (this.identifier == null)
1436        this.identifier = new ArrayList<Identifier>();
1437      this.identifier.add(t);
1438      return this;
1439    }
1440
1441    /**
1442     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1443     */
1444    public Identifier getIdentifierFirstRep() { 
1445      if (getIdentifier().isEmpty()) {
1446        addIdentifier();
1447      }
1448      return getIdentifier().get(0);
1449    }
1450
1451    /**
1452     * @return {@link #subject} (The product with this is a pack for.)
1453     */
1454    public List<Reference> getSubject() { 
1455      if (this.subject == null)
1456        this.subject = new ArrayList<Reference>();
1457      return this.subject;
1458    }
1459
1460    /**
1461     * @return Returns a reference to <code>this</code> for easy method chaining
1462     */
1463    public MedicinalProductPackaged setSubject(List<Reference> theSubject) { 
1464      this.subject = theSubject;
1465      return this;
1466    }
1467
1468    public boolean hasSubject() { 
1469      if (this.subject == null)
1470        return false;
1471      for (Reference item : this.subject)
1472        if (!item.isEmpty())
1473          return true;
1474      return false;
1475    }
1476
1477    public Reference addSubject() { //3
1478      Reference t = new Reference();
1479      if (this.subject == null)
1480        this.subject = new ArrayList<Reference>();
1481      this.subject.add(t);
1482      return t;
1483    }
1484
1485    public MedicinalProductPackaged addSubject(Reference t) { //3
1486      if (t == null)
1487        return this;
1488      if (this.subject == null)
1489        this.subject = new ArrayList<Reference>();
1490      this.subject.add(t);
1491      return this;
1492    }
1493
1494    /**
1495     * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist
1496     */
1497    public Reference getSubjectFirstRep() { 
1498      if (getSubject().isEmpty()) {
1499        addSubject();
1500      }
1501      return getSubject().get(0);
1502    }
1503
1504    /**
1505     * @deprecated Use Reference#setResource(IBaseResource) instead
1506     */
1507    @Deprecated
1508    public List<MedicinalProduct> getSubjectTarget() { 
1509      if (this.subjectTarget == null)
1510        this.subjectTarget = new ArrayList<MedicinalProduct>();
1511      return this.subjectTarget;
1512    }
1513
1514    /**
1515     * @deprecated Use Reference#setResource(IBaseResource) instead
1516     */
1517    @Deprecated
1518    public MedicinalProduct addSubjectTarget() { 
1519      MedicinalProduct r = new MedicinalProduct();
1520      if (this.subjectTarget == null)
1521        this.subjectTarget = new ArrayList<MedicinalProduct>();
1522      this.subjectTarget.add(r);
1523      return r;
1524    }
1525
1526    /**
1527     * @return {@link #description} (Textual description.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1528     */
1529    public StringType getDescriptionElement() { 
1530      if (this.description == null)
1531        if (Configuration.errorOnAutoCreate())
1532          throw new Error("Attempt to auto-create MedicinalProductPackaged.description");
1533        else if (Configuration.doAutoCreate())
1534          this.description = new StringType(); // bb
1535      return this.description;
1536    }
1537
1538    public boolean hasDescriptionElement() { 
1539      return this.description != null && !this.description.isEmpty();
1540    }
1541
1542    public boolean hasDescription() { 
1543      return this.description != null && !this.description.isEmpty();
1544    }
1545
1546    /**
1547     * @param value {@link #description} (Textual description.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1548     */
1549    public MedicinalProductPackaged setDescriptionElement(StringType value) { 
1550      this.description = value;
1551      return this;
1552    }
1553
1554    /**
1555     * @return Textual description.
1556     */
1557    public String getDescription() { 
1558      return this.description == null ? null : this.description.getValue();
1559    }
1560
1561    /**
1562     * @param value Textual description.
1563     */
1564    public MedicinalProductPackaged setDescription(String value) { 
1565      if (Utilities.noString(value))
1566        this.description = null;
1567      else {
1568        if (this.description == null)
1569          this.description = new StringType();
1570        this.description.setValue(value);
1571      }
1572      return this;
1573    }
1574
1575    /**
1576     * @return {@link #legalStatusOfSupply} (The legal status of supply of the medicinal product as classified by the regulator.)
1577     */
1578    public CodeableConcept getLegalStatusOfSupply() { 
1579      if (this.legalStatusOfSupply == null)
1580        if (Configuration.errorOnAutoCreate())
1581          throw new Error("Attempt to auto-create MedicinalProductPackaged.legalStatusOfSupply");
1582        else if (Configuration.doAutoCreate())
1583          this.legalStatusOfSupply = new CodeableConcept(); // cc
1584      return this.legalStatusOfSupply;
1585    }
1586
1587    public boolean hasLegalStatusOfSupply() { 
1588      return this.legalStatusOfSupply != null && !this.legalStatusOfSupply.isEmpty();
1589    }
1590
1591    /**
1592     * @param value {@link #legalStatusOfSupply} (The legal status of supply of the medicinal product as classified by the regulator.)
1593     */
1594    public MedicinalProductPackaged setLegalStatusOfSupply(CodeableConcept value) { 
1595      this.legalStatusOfSupply = value;
1596      return this;
1597    }
1598
1599    /**
1600     * @return {@link #marketingStatus} (Marketing information.)
1601     */
1602    public List<MarketingStatus> getMarketingStatus() { 
1603      if (this.marketingStatus == null)
1604        this.marketingStatus = new ArrayList<MarketingStatus>();
1605      return this.marketingStatus;
1606    }
1607
1608    /**
1609     * @return Returns a reference to <code>this</code> for easy method chaining
1610     */
1611    public MedicinalProductPackaged setMarketingStatus(List<MarketingStatus> theMarketingStatus) { 
1612      this.marketingStatus = theMarketingStatus;
1613      return this;
1614    }
1615
1616    public boolean hasMarketingStatus() { 
1617      if (this.marketingStatus == null)
1618        return false;
1619      for (MarketingStatus item : this.marketingStatus)
1620        if (!item.isEmpty())
1621          return true;
1622      return false;
1623    }
1624
1625    public MarketingStatus addMarketingStatus() { //3
1626      MarketingStatus t = new MarketingStatus();
1627      if (this.marketingStatus == null)
1628        this.marketingStatus = new ArrayList<MarketingStatus>();
1629      this.marketingStatus.add(t);
1630      return t;
1631    }
1632
1633    public MedicinalProductPackaged addMarketingStatus(MarketingStatus t) { //3
1634      if (t == null)
1635        return this;
1636      if (this.marketingStatus == null)
1637        this.marketingStatus = new ArrayList<MarketingStatus>();
1638      this.marketingStatus.add(t);
1639      return this;
1640    }
1641
1642    /**
1643     * @return The first repetition of repeating field {@link #marketingStatus}, creating it if it does not already exist
1644     */
1645    public MarketingStatus getMarketingStatusFirstRep() { 
1646      if (getMarketingStatus().isEmpty()) {
1647        addMarketingStatus();
1648      }
1649      return getMarketingStatus().get(0);
1650    }
1651
1652    /**
1653     * @return {@link #marketingAuthorization} (Manufacturer of this Package Item.)
1654     */
1655    public Reference getMarketingAuthorization() { 
1656      if (this.marketingAuthorization == null)
1657        if (Configuration.errorOnAutoCreate())
1658          throw new Error("Attempt to auto-create MedicinalProductPackaged.marketingAuthorization");
1659        else if (Configuration.doAutoCreate())
1660          this.marketingAuthorization = new Reference(); // cc
1661      return this.marketingAuthorization;
1662    }
1663
1664    public boolean hasMarketingAuthorization() { 
1665      return this.marketingAuthorization != null && !this.marketingAuthorization.isEmpty();
1666    }
1667
1668    /**
1669     * @param value {@link #marketingAuthorization} (Manufacturer of this Package Item.)
1670     */
1671    public MedicinalProductPackaged setMarketingAuthorization(Reference value) { 
1672      this.marketingAuthorization = value;
1673      return this;
1674    }
1675
1676    /**
1677     * @return {@link #marketingAuthorization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Manufacturer of this Package Item.)
1678     */
1679    public MedicinalProductAuthorization getMarketingAuthorizationTarget() { 
1680      if (this.marketingAuthorizationTarget == null)
1681        if (Configuration.errorOnAutoCreate())
1682          throw new Error("Attempt to auto-create MedicinalProductPackaged.marketingAuthorization");
1683        else if (Configuration.doAutoCreate())
1684          this.marketingAuthorizationTarget = new MedicinalProductAuthorization(); // aa
1685      return this.marketingAuthorizationTarget;
1686    }
1687
1688    /**
1689     * @param value {@link #marketingAuthorization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Manufacturer of this Package Item.)
1690     */
1691    public MedicinalProductPackaged setMarketingAuthorizationTarget(MedicinalProductAuthorization value) { 
1692      this.marketingAuthorizationTarget = value;
1693      return this;
1694    }
1695
1696    /**
1697     * @return {@link #manufacturer} (Manufacturer of this Package Item.)
1698     */
1699    public List<Reference> getManufacturer() { 
1700      if (this.manufacturer == null)
1701        this.manufacturer = new ArrayList<Reference>();
1702      return this.manufacturer;
1703    }
1704
1705    /**
1706     * @return Returns a reference to <code>this</code> for easy method chaining
1707     */
1708    public MedicinalProductPackaged setManufacturer(List<Reference> theManufacturer) { 
1709      this.manufacturer = theManufacturer;
1710      return this;
1711    }
1712
1713    public boolean hasManufacturer() { 
1714      if (this.manufacturer == null)
1715        return false;
1716      for (Reference item : this.manufacturer)
1717        if (!item.isEmpty())
1718          return true;
1719      return false;
1720    }
1721
1722    public Reference addManufacturer() { //3
1723      Reference t = new Reference();
1724      if (this.manufacturer == null)
1725        this.manufacturer = new ArrayList<Reference>();
1726      this.manufacturer.add(t);
1727      return t;
1728    }
1729
1730    public MedicinalProductPackaged addManufacturer(Reference t) { //3
1731      if (t == null)
1732        return this;
1733      if (this.manufacturer == null)
1734        this.manufacturer = new ArrayList<Reference>();
1735      this.manufacturer.add(t);
1736      return this;
1737    }
1738
1739    /**
1740     * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist
1741     */
1742    public Reference getManufacturerFirstRep() { 
1743      if (getManufacturer().isEmpty()) {
1744        addManufacturer();
1745      }
1746      return getManufacturer().get(0);
1747    }
1748
1749    /**
1750     * @deprecated Use Reference#setResource(IBaseResource) instead
1751     */
1752    @Deprecated
1753    public List<Organization> getManufacturerTarget() { 
1754      if (this.manufacturerTarget == null)
1755        this.manufacturerTarget = new ArrayList<Organization>();
1756      return this.manufacturerTarget;
1757    }
1758
1759    /**
1760     * @deprecated Use Reference#setResource(IBaseResource) instead
1761     */
1762    @Deprecated
1763    public Organization addManufacturerTarget() { 
1764      Organization r = new Organization();
1765      if (this.manufacturerTarget == null)
1766        this.manufacturerTarget = new ArrayList<Organization>();
1767      this.manufacturerTarget.add(r);
1768      return r;
1769    }
1770
1771    /**
1772     * @return {@link #batchIdentifier} (Batch numbering.)
1773     */
1774    public List<MedicinalProductPackagedBatchIdentifierComponent> getBatchIdentifier() { 
1775      if (this.batchIdentifier == null)
1776        this.batchIdentifier = new ArrayList<MedicinalProductPackagedBatchIdentifierComponent>();
1777      return this.batchIdentifier;
1778    }
1779
1780    /**
1781     * @return Returns a reference to <code>this</code> for easy method chaining
1782     */
1783    public MedicinalProductPackaged setBatchIdentifier(List<MedicinalProductPackagedBatchIdentifierComponent> theBatchIdentifier) { 
1784      this.batchIdentifier = theBatchIdentifier;
1785      return this;
1786    }
1787
1788    public boolean hasBatchIdentifier() { 
1789      if (this.batchIdentifier == null)
1790        return false;
1791      for (MedicinalProductPackagedBatchIdentifierComponent item : this.batchIdentifier)
1792        if (!item.isEmpty())
1793          return true;
1794      return false;
1795    }
1796
1797    public MedicinalProductPackagedBatchIdentifierComponent addBatchIdentifier() { //3
1798      MedicinalProductPackagedBatchIdentifierComponent t = new MedicinalProductPackagedBatchIdentifierComponent();
1799      if (this.batchIdentifier == null)
1800        this.batchIdentifier = new ArrayList<MedicinalProductPackagedBatchIdentifierComponent>();
1801      this.batchIdentifier.add(t);
1802      return t;
1803    }
1804
1805    public MedicinalProductPackaged addBatchIdentifier(MedicinalProductPackagedBatchIdentifierComponent t) { //3
1806      if (t == null)
1807        return this;
1808      if (this.batchIdentifier == null)
1809        this.batchIdentifier = new ArrayList<MedicinalProductPackagedBatchIdentifierComponent>();
1810      this.batchIdentifier.add(t);
1811      return this;
1812    }
1813
1814    /**
1815     * @return The first repetition of repeating field {@link #batchIdentifier}, creating it if it does not already exist
1816     */
1817    public MedicinalProductPackagedBatchIdentifierComponent getBatchIdentifierFirstRep() { 
1818      if (getBatchIdentifier().isEmpty()) {
1819        addBatchIdentifier();
1820      }
1821      return getBatchIdentifier().get(0);
1822    }
1823
1824    /**
1825     * @return {@link #packageItem} (A packaging item, as a contained for medicine, possibly with other packaging items within.)
1826     */
1827    public List<MedicinalProductPackagedPackageItemComponent> getPackageItem() { 
1828      if (this.packageItem == null)
1829        this.packageItem = new ArrayList<MedicinalProductPackagedPackageItemComponent>();
1830      return this.packageItem;
1831    }
1832
1833    /**
1834     * @return Returns a reference to <code>this</code> for easy method chaining
1835     */
1836    public MedicinalProductPackaged setPackageItem(List<MedicinalProductPackagedPackageItemComponent> thePackageItem) { 
1837      this.packageItem = thePackageItem;
1838      return this;
1839    }
1840
1841    public boolean hasPackageItem() { 
1842      if (this.packageItem == null)
1843        return false;
1844      for (MedicinalProductPackagedPackageItemComponent item : this.packageItem)
1845        if (!item.isEmpty())
1846          return true;
1847      return false;
1848    }
1849
1850    public MedicinalProductPackagedPackageItemComponent addPackageItem() { //3
1851      MedicinalProductPackagedPackageItemComponent t = new MedicinalProductPackagedPackageItemComponent();
1852      if (this.packageItem == null)
1853        this.packageItem = new ArrayList<MedicinalProductPackagedPackageItemComponent>();
1854      this.packageItem.add(t);
1855      return t;
1856    }
1857
1858    public MedicinalProductPackaged addPackageItem(MedicinalProductPackagedPackageItemComponent t) { //3
1859      if (t == null)
1860        return this;
1861      if (this.packageItem == null)
1862        this.packageItem = new ArrayList<MedicinalProductPackagedPackageItemComponent>();
1863      this.packageItem.add(t);
1864      return this;
1865    }
1866
1867    /**
1868     * @return The first repetition of repeating field {@link #packageItem}, creating it if it does not already exist
1869     */
1870    public MedicinalProductPackagedPackageItemComponent getPackageItemFirstRep() { 
1871      if (getPackageItem().isEmpty()) {
1872        addPackageItem();
1873      }
1874      return getPackageItem().get(0);
1875    }
1876
1877      protected void listChildren(List<Property> children) {
1878        super.listChildren(children);
1879        children.add(new Property("identifier", "Identifier", "Unique identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
1880        children.add(new Property("subject", "Reference(MedicinalProduct)", "The product with this is a pack for.", 0, java.lang.Integer.MAX_VALUE, subject));
1881        children.add(new Property("description", "string", "Textual description.", 0, 1, description));
1882        children.add(new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1, legalStatusOfSupply));
1883        children.add(new Property("marketingStatus", "MarketingStatus", "Marketing information.", 0, java.lang.Integer.MAX_VALUE, marketingStatus));
1884        children.add(new Property("marketingAuthorization", "Reference(MedicinalProductAuthorization)", "Manufacturer of this Package Item.", 0, 1, marketingAuthorization));
1885        children.add(new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Package Item.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
1886        children.add(new Property("batchIdentifier", "", "Batch numbering.", 0, java.lang.Integer.MAX_VALUE, batchIdentifier));
1887        children.add(new Property("packageItem", "", "A packaging item, as a contained for medicine, possibly with other packaging items within.", 0, java.lang.Integer.MAX_VALUE, packageItem));
1888      }
1889
1890      @Override
1891      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1892        switch (_hash) {
1893        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
1894        case -1867885268: /*subject*/  return new Property("subject", "Reference(MedicinalProduct)", "The product with this is a pack for.", 0, java.lang.Integer.MAX_VALUE, subject);
1895        case -1724546052: /*description*/  return new Property("description", "string", "Textual description.", 0, 1, description);
1896        case -844874031: /*legalStatusOfSupply*/  return new Property("legalStatusOfSupply", "CodeableConcept", "The legal status of supply of the medicinal product as classified by the regulator.", 0, 1, legalStatusOfSupply);
1897        case 70767032: /*marketingStatus*/  return new Property("marketingStatus", "MarketingStatus", "Marketing information.", 0, java.lang.Integer.MAX_VALUE, marketingStatus);
1898        case 571831283: /*marketingAuthorization*/  return new Property("marketingAuthorization", "Reference(MedicinalProductAuthorization)", "Manufacturer of this Package Item.", 0, 1, marketingAuthorization);
1899        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Package Item.", 0, java.lang.Integer.MAX_VALUE, manufacturer);
1900        case -1688395901: /*batchIdentifier*/  return new Property("batchIdentifier", "", "Batch numbering.", 0, java.lang.Integer.MAX_VALUE, batchIdentifier);
1901        case 908628089: /*packageItem*/  return new Property("packageItem", "", "A packaging item, as a contained for medicine, possibly with other packaging items within.", 0, java.lang.Integer.MAX_VALUE, packageItem);
1902        default: return super.getNamedProperty(_hash, _name, _checkValid);
1903        }
1904
1905      }
1906
1907      @Override
1908      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1909        switch (hash) {
1910        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1911        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference
1912        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1913        case -844874031: /*legalStatusOfSupply*/ return this.legalStatusOfSupply == null ? new Base[0] : new Base[] {this.legalStatusOfSupply}; // CodeableConcept
1914        case 70767032: /*marketingStatus*/ return this.marketingStatus == null ? new Base[0] : this.marketingStatus.toArray(new Base[this.marketingStatus.size()]); // MarketingStatus
1915        case 571831283: /*marketingAuthorization*/ return this.marketingAuthorization == null ? new Base[0] : new Base[] {this.marketingAuthorization}; // Reference
1916        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
1917        case -1688395901: /*batchIdentifier*/ return this.batchIdentifier == null ? new Base[0] : this.batchIdentifier.toArray(new Base[this.batchIdentifier.size()]); // MedicinalProductPackagedBatchIdentifierComponent
1918        case 908628089: /*packageItem*/ return this.packageItem == null ? new Base[0] : this.packageItem.toArray(new Base[this.packageItem.size()]); // MedicinalProductPackagedPackageItemComponent
1919        default: return super.getProperty(hash, name, checkValid);
1920        }
1921
1922      }
1923
1924      @Override
1925      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1926        switch (hash) {
1927        case -1618432855: // identifier
1928          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1929          return value;
1930        case -1867885268: // subject
1931          this.getSubject().add(castToReference(value)); // Reference
1932          return value;
1933        case -1724546052: // description
1934          this.description = castToString(value); // StringType
1935          return value;
1936        case -844874031: // legalStatusOfSupply
1937          this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
1938          return value;
1939        case 70767032: // marketingStatus
1940          this.getMarketingStatus().add(castToMarketingStatus(value)); // MarketingStatus
1941          return value;
1942        case 571831283: // marketingAuthorization
1943          this.marketingAuthorization = castToReference(value); // Reference
1944          return value;
1945        case -1969347631: // manufacturer
1946          this.getManufacturer().add(castToReference(value)); // Reference
1947          return value;
1948        case -1688395901: // batchIdentifier
1949          this.getBatchIdentifier().add((MedicinalProductPackagedBatchIdentifierComponent) value); // MedicinalProductPackagedBatchIdentifierComponent
1950          return value;
1951        case 908628089: // packageItem
1952          this.getPackageItem().add((MedicinalProductPackagedPackageItemComponent) value); // MedicinalProductPackagedPackageItemComponent
1953          return value;
1954        default: return super.setProperty(hash, name, value);
1955        }
1956
1957      }
1958
1959      @Override
1960      public Base setProperty(String name, Base value) throws FHIRException {
1961        if (name.equals("identifier")) {
1962          this.getIdentifier().add(castToIdentifier(value));
1963        } else if (name.equals("subject")) {
1964          this.getSubject().add(castToReference(value));
1965        } else if (name.equals("description")) {
1966          this.description = castToString(value); // StringType
1967        } else if (name.equals("legalStatusOfSupply")) {
1968          this.legalStatusOfSupply = castToCodeableConcept(value); // CodeableConcept
1969        } else if (name.equals("marketingStatus")) {
1970          this.getMarketingStatus().add(castToMarketingStatus(value));
1971        } else if (name.equals("marketingAuthorization")) {
1972          this.marketingAuthorization = castToReference(value); // Reference
1973        } else if (name.equals("manufacturer")) {
1974          this.getManufacturer().add(castToReference(value));
1975        } else if (name.equals("batchIdentifier")) {
1976          this.getBatchIdentifier().add((MedicinalProductPackagedBatchIdentifierComponent) value);
1977        } else if (name.equals("packageItem")) {
1978          this.getPackageItem().add((MedicinalProductPackagedPackageItemComponent) value);
1979        } else
1980          return super.setProperty(name, value);
1981        return value;
1982      }
1983
1984      @Override
1985      public Base makeProperty(int hash, String name) throws FHIRException {
1986        switch (hash) {
1987        case -1618432855:  return addIdentifier(); 
1988        case -1867885268:  return addSubject(); 
1989        case -1724546052:  return getDescriptionElement();
1990        case -844874031:  return getLegalStatusOfSupply(); 
1991        case 70767032:  return addMarketingStatus(); 
1992        case 571831283:  return getMarketingAuthorization(); 
1993        case -1969347631:  return addManufacturer(); 
1994        case -1688395901:  return addBatchIdentifier(); 
1995        case 908628089:  return addPackageItem(); 
1996        default: return super.makeProperty(hash, name);
1997        }
1998
1999      }
2000
2001      @Override
2002      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2003        switch (hash) {
2004        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2005        case -1867885268: /*subject*/ return new String[] {"Reference"};
2006        case -1724546052: /*description*/ return new String[] {"string"};
2007        case -844874031: /*legalStatusOfSupply*/ return new String[] {"CodeableConcept"};
2008        case 70767032: /*marketingStatus*/ return new String[] {"MarketingStatus"};
2009        case 571831283: /*marketingAuthorization*/ return new String[] {"Reference"};
2010        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
2011        case -1688395901: /*batchIdentifier*/ return new String[] {};
2012        case 908628089: /*packageItem*/ return new String[] {};
2013        default: return super.getTypesForProperty(hash, name);
2014        }
2015
2016      }
2017
2018      @Override
2019      public Base addChild(String name) throws FHIRException {
2020        if (name.equals("identifier")) {
2021          return addIdentifier();
2022        }
2023        else if (name.equals("subject")) {
2024          return addSubject();
2025        }
2026        else if (name.equals("description")) {
2027          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductPackaged.description");
2028        }
2029        else if (name.equals("legalStatusOfSupply")) {
2030          this.legalStatusOfSupply = new CodeableConcept();
2031          return this.legalStatusOfSupply;
2032        }
2033        else if (name.equals("marketingStatus")) {
2034          return addMarketingStatus();
2035        }
2036        else if (name.equals("marketingAuthorization")) {
2037          this.marketingAuthorization = new Reference();
2038          return this.marketingAuthorization;
2039        }
2040        else if (name.equals("manufacturer")) {
2041          return addManufacturer();
2042        }
2043        else if (name.equals("batchIdentifier")) {
2044          return addBatchIdentifier();
2045        }
2046        else if (name.equals("packageItem")) {
2047          return addPackageItem();
2048        }
2049        else
2050          return super.addChild(name);
2051      }
2052
2053  public String fhirType() {
2054    return "MedicinalProductPackaged";
2055
2056  }
2057
2058      public MedicinalProductPackaged copy() {
2059        MedicinalProductPackaged dst = new MedicinalProductPackaged();
2060        copyValues(dst);
2061        return dst;
2062      }
2063
2064      public void copyValues(MedicinalProductPackaged dst) {
2065        super.copyValues(dst);
2066        if (identifier != null) {
2067          dst.identifier = new ArrayList<Identifier>();
2068          for (Identifier i : identifier)
2069            dst.identifier.add(i.copy());
2070        };
2071        if (subject != null) {
2072          dst.subject = new ArrayList<Reference>();
2073          for (Reference i : subject)
2074            dst.subject.add(i.copy());
2075        };
2076        dst.description = description == null ? null : description.copy();
2077        dst.legalStatusOfSupply = legalStatusOfSupply == null ? null : legalStatusOfSupply.copy();
2078        if (marketingStatus != null) {
2079          dst.marketingStatus = new ArrayList<MarketingStatus>();
2080          for (MarketingStatus i : marketingStatus)
2081            dst.marketingStatus.add(i.copy());
2082        };
2083        dst.marketingAuthorization = marketingAuthorization == null ? null : marketingAuthorization.copy();
2084        if (manufacturer != null) {
2085          dst.manufacturer = new ArrayList<Reference>();
2086          for (Reference i : manufacturer)
2087            dst.manufacturer.add(i.copy());
2088        };
2089        if (batchIdentifier != null) {
2090          dst.batchIdentifier = new ArrayList<MedicinalProductPackagedBatchIdentifierComponent>();
2091          for (MedicinalProductPackagedBatchIdentifierComponent i : batchIdentifier)
2092            dst.batchIdentifier.add(i.copy());
2093        };
2094        if (packageItem != null) {
2095          dst.packageItem = new ArrayList<MedicinalProductPackagedPackageItemComponent>();
2096          for (MedicinalProductPackagedPackageItemComponent i : packageItem)
2097            dst.packageItem.add(i.copy());
2098        };
2099      }
2100
2101      protected MedicinalProductPackaged typedCopy() {
2102        return copy();
2103      }
2104
2105      @Override
2106      public boolean equalsDeep(Base other_) {
2107        if (!super.equalsDeep(other_))
2108          return false;
2109        if (!(other_ instanceof MedicinalProductPackaged))
2110          return false;
2111        MedicinalProductPackaged o = (MedicinalProductPackaged) other_;
2112        return compareDeep(identifier, o.identifier, true) && compareDeep(subject, o.subject, true) && compareDeep(description, o.description, true)
2113           && compareDeep(legalStatusOfSupply, o.legalStatusOfSupply, true) && compareDeep(marketingStatus, o.marketingStatus, true)
2114           && compareDeep(marketingAuthorization, o.marketingAuthorization, true) && compareDeep(manufacturer, o.manufacturer, true)
2115           && compareDeep(batchIdentifier, o.batchIdentifier, true) && compareDeep(packageItem, o.packageItem, true)
2116          ;
2117      }
2118
2119      @Override
2120      public boolean equalsShallow(Base other_) {
2121        if (!super.equalsShallow(other_))
2122          return false;
2123        if (!(other_ instanceof MedicinalProductPackaged))
2124          return false;
2125        MedicinalProductPackaged o = (MedicinalProductPackaged) other_;
2126        return compareValues(description, o.description, true);
2127      }
2128
2129      public boolean isEmpty() {
2130        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, subject, description
2131          , legalStatusOfSupply, marketingStatus, marketingAuthorization, manufacturer, batchIdentifier
2132          , packageItem);
2133      }
2134
2135  @Override
2136  public ResourceType getResourceType() {
2137    return ResourceType.MedicinalProductPackaged;
2138   }
2139
2140 /**
2141   * Search parameter: <b>identifier</b>
2142   * <p>
2143   * Description: <b>Unique identifier</b><br>
2144   * Type: <b>token</b><br>
2145   * Path: <b>MedicinalProductPackaged.identifier</b><br>
2146   * </p>
2147   */
2148  @SearchParamDefinition(name="identifier", path="MedicinalProductPackaged.identifier", description="Unique identifier", type="token" )
2149  public static final String SP_IDENTIFIER = "identifier";
2150 /**
2151   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2152   * <p>
2153   * Description: <b>Unique identifier</b><br>
2154   * Type: <b>token</b><br>
2155   * Path: <b>MedicinalProductPackaged.identifier</b><br>
2156   * </p>
2157   */
2158  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2159
2160 /**
2161   * Search parameter: <b>subject</b>
2162   * <p>
2163   * Description: <b>The product with this is a pack for</b><br>
2164   * Type: <b>reference</b><br>
2165   * Path: <b>MedicinalProductPackaged.subject</b><br>
2166   * </p>
2167   */
2168  @SearchParamDefinition(name="subject", path="MedicinalProductPackaged.subject", description="The product with this is a pack for", type="reference", target={MedicinalProduct.class } )
2169  public static final String SP_SUBJECT = "subject";
2170 /**
2171   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
2172   * <p>
2173   * Description: <b>The product with this is a pack for</b><br>
2174   * Type: <b>reference</b><br>
2175   * Path: <b>MedicinalProductPackaged.subject</b><br>
2176   * </p>
2177   */
2178  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
2179
2180/**
2181   * Constant for fluent queries to be used to add include statements. Specifies
2182   * the path value of "<b>MedicinalProductPackaged:subject</b>".
2183   */
2184  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductPackaged:subject").toLocked();
2185
2186
2187}