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 java.math.*;
040import org.hl7.fhir.utilities.Utilities;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.ChildOrder;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047import org.hl7.fhir.instance.model.api.*;
048import org.hl7.fhir.exceptions.FHIRException;
049/**
050 * A material substance originating from a biological entity intended to be transplanted or infused
051into another (possibly the same) biological entity.
052 */
053@ResourceDef(name="BiologicallyDerivedProduct", profile="http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct")
054public class BiologicallyDerivedProduct extends DomainResource {
055
056    public enum BiologicallyDerivedProductCategory {
057        /**
058         * A collection of tissues joined in a structural unit to serve a common function.
059         */
060        ORGAN, 
061        /**
062         * An ensemble of similar cells and their extracellular matrix from the same origin that together carry out a specific function.
063         */
064        TISSUE, 
065        /**
066         * Body fluid.
067         */
068        FLUID, 
069        /**
070         * Collection of cells.
071         */
072        CELLS, 
073        /**
074         * Biological agent of unspecified type.
075         */
076        BIOLOGICALAGENT, 
077        /**
078         * added to help the parsers with the generic types
079         */
080        NULL;
081        public static BiologicallyDerivedProductCategory fromCode(String codeString) throws FHIRException {
082            if (codeString == null || "".equals(codeString))
083                return null;
084        if ("organ".equals(codeString))
085          return ORGAN;
086        if ("tissue".equals(codeString))
087          return TISSUE;
088        if ("fluid".equals(codeString))
089          return FLUID;
090        if ("cells".equals(codeString))
091          return CELLS;
092        if ("biologicalAgent".equals(codeString))
093          return BIOLOGICALAGENT;
094        if (Configuration.isAcceptInvalidEnums())
095          return null;
096        else
097          throw new FHIRException("Unknown BiologicallyDerivedProductCategory code '"+codeString+"'");
098        }
099        public String toCode() {
100          switch (this) {
101            case ORGAN: return "organ";
102            case TISSUE: return "tissue";
103            case FLUID: return "fluid";
104            case CELLS: return "cells";
105            case BIOLOGICALAGENT: return "biologicalAgent";
106            default: return "?";
107          }
108        }
109        public String getSystem() {
110          switch (this) {
111            case ORGAN: return "http://hl7.org/fhir/product-category";
112            case TISSUE: return "http://hl7.org/fhir/product-category";
113            case FLUID: return "http://hl7.org/fhir/product-category";
114            case CELLS: return "http://hl7.org/fhir/product-category";
115            case BIOLOGICALAGENT: return "http://hl7.org/fhir/product-category";
116            default: return "?";
117          }
118        }
119        public String getDefinition() {
120          switch (this) {
121            case ORGAN: return "A collection of tissues joined in a structural unit to serve a common function.";
122            case TISSUE: return "An ensemble of similar cells and their extracellular matrix from the same origin that together carry out a specific function.";
123            case FLUID: return "Body fluid.";
124            case CELLS: return "Collection of cells.";
125            case BIOLOGICALAGENT: return "Biological agent of unspecified type.";
126            default: return "?";
127          }
128        }
129        public String getDisplay() {
130          switch (this) {
131            case ORGAN: return "Organ";
132            case TISSUE: return "Tissue";
133            case FLUID: return "Fluid";
134            case CELLS: return "Cells";
135            case BIOLOGICALAGENT: return "BiologicalAgent";
136            default: return "?";
137          }
138        }
139    }
140
141  public static class BiologicallyDerivedProductCategoryEnumFactory implements EnumFactory<BiologicallyDerivedProductCategory> {
142    public BiologicallyDerivedProductCategory fromCode(String codeString) throws IllegalArgumentException {
143      if (codeString == null || "".equals(codeString))
144            if (codeString == null || "".equals(codeString))
145                return null;
146        if ("organ".equals(codeString))
147          return BiologicallyDerivedProductCategory.ORGAN;
148        if ("tissue".equals(codeString))
149          return BiologicallyDerivedProductCategory.TISSUE;
150        if ("fluid".equals(codeString))
151          return BiologicallyDerivedProductCategory.FLUID;
152        if ("cells".equals(codeString))
153          return BiologicallyDerivedProductCategory.CELLS;
154        if ("biologicalAgent".equals(codeString))
155          return BiologicallyDerivedProductCategory.BIOLOGICALAGENT;
156        throw new IllegalArgumentException("Unknown BiologicallyDerivedProductCategory code '"+codeString+"'");
157        }
158        public Enumeration<BiologicallyDerivedProductCategory> fromType(Base code) throws FHIRException {
159          if (code == null)
160            return null;
161          if (code.isEmpty())
162            return new Enumeration<BiologicallyDerivedProductCategory>(this);
163          String codeString = ((PrimitiveType) code).asStringValue();
164          if (codeString == null || "".equals(codeString))
165            return null;
166        if ("organ".equals(codeString))
167          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.ORGAN);
168        if ("tissue".equals(codeString))
169          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.TISSUE);
170        if ("fluid".equals(codeString))
171          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.FLUID);
172        if ("cells".equals(codeString))
173          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.CELLS);
174        if ("biologicalAgent".equals(codeString))
175          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.BIOLOGICALAGENT);
176        throw new FHIRException("Unknown BiologicallyDerivedProductCategory code '"+codeString+"'");
177        }
178    public String toCode(BiologicallyDerivedProductCategory code) {
179      if (code == BiologicallyDerivedProductCategory.ORGAN)
180        return "organ";
181      if (code == BiologicallyDerivedProductCategory.TISSUE)
182        return "tissue";
183      if (code == BiologicallyDerivedProductCategory.FLUID)
184        return "fluid";
185      if (code == BiologicallyDerivedProductCategory.CELLS)
186        return "cells";
187      if (code == BiologicallyDerivedProductCategory.BIOLOGICALAGENT)
188        return "biologicalAgent";
189      return "?";
190      }
191    public String toSystem(BiologicallyDerivedProductCategory code) {
192      return code.getSystem();
193      }
194    }
195
196    public enum BiologicallyDerivedProductStatus {
197        /**
198         * Product is currently available for use.
199         */
200        AVAILABLE, 
201        /**
202         * Product is not currently available for use.
203         */
204        UNAVAILABLE, 
205        /**
206         * added to help the parsers with the generic types
207         */
208        NULL;
209        public static BiologicallyDerivedProductStatus fromCode(String codeString) throws FHIRException {
210            if (codeString == null || "".equals(codeString))
211                return null;
212        if ("available".equals(codeString))
213          return AVAILABLE;
214        if ("unavailable".equals(codeString))
215          return UNAVAILABLE;
216        if (Configuration.isAcceptInvalidEnums())
217          return null;
218        else
219          throw new FHIRException("Unknown BiologicallyDerivedProductStatus code '"+codeString+"'");
220        }
221        public String toCode() {
222          switch (this) {
223            case AVAILABLE: return "available";
224            case UNAVAILABLE: return "unavailable";
225            default: return "?";
226          }
227        }
228        public String getSystem() {
229          switch (this) {
230            case AVAILABLE: return "http://hl7.org/fhir/product-status";
231            case UNAVAILABLE: return "http://hl7.org/fhir/product-status";
232            default: return "?";
233          }
234        }
235        public String getDefinition() {
236          switch (this) {
237            case AVAILABLE: return "Product is currently available for use.";
238            case UNAVAILABLE: return "Product is not currently available for use.";
239            default: return "?";
240          }
241        }
242        public String getDisplay() {
243          switch (this) {
244            case AVAILABLE: return "Available";
245            case UNAVAILABLE: return "Unavailable";
246            default: return "?";
247          }
248        }
249    }
250
251  public static class BiologicallyDerivedProductStatusEnumFactory implements EnumFactory<BiologicallyDerivedProductStatus> {
252    public BiologicallyDerivedProductStatus fromCode(String codeString) throws IllegalArgumentException {
253      if (codeString == null || "".equals(codeString))
254            if (codeString == null || "".equals(codeString))
255                return null;
256        if ("available".equals(codeString))
257          return BiologicallyDerivedProductStatus.AVAILABLE;
258        if ("unavailable".equals(codeString))
259          return BiologicallyDerivedProductStatus.UNAVAILABLE;
260        throw new IllegalArgumentException("Unknown BiologicallyDerivedProductStatus code '"+codeString+"'");
261        }
262        public Enumeration<BiologicallyDerivedProductStatus> fromType(Base code) throws FHIRException {
263          if (code == null)
264            return null;
265          if (code.isEmpty())
266            return new Enumeration<BiologicallyDerivedProductStatus>(this);
267          String codeString = ((PrimitiveType) code).asStringValue();
268          if (codeString == null || "".equals(codeString))
269            return null;
270        if ("available".equals(codeString))
271          return new Enumeration<BiologicallyDerivedProductStatus>(this, BiologicallyDerivedProductStatus.AVAILABLE);
272        if ("unavailable".equals(codeString))
273          return new Enumeration<BiologicallyDerivedProductStatus>(this, BiologicallyDerivedProductStatus.UNAVAILABLE);
274        throw new FHIRException("Unknown BiologicallyDerivedProductStatus code '"+codeString+"'");
275        }
276    public String toCode(BiologicallyDerivedProductStatus code) {
277      if (code == BiologicallyDerivedProductStatus.AVAILABLE)
278        return "available";
279      if (code == BiologicallyDerivedProductStatus.UNAVAILABLE)
280        return "unavailable";
281      return "?";
282      }
283    public String toSystem(BiologicallyDerivedProductStatus code) {
284      return code.getSystem();
285      }
286    }
287
288    public enum BiologicallyDerivedProductStorageScale {
289        /**
290         * Fahrenheit temperature scale.
291         */
292        FARENHEIT, 
293        /**
294         * Celsius or centigrade temperature scale.
295         */
296        CELSIUS, 
297        /**
298         * Kelvin absolute thermodynamic temperature scale.
299         */
300        KELVIN, 
301        /**
302         * added to help the parsers with the generic types
303         */
304        NULL;
305        public static BiologicallyDerivedProductStorageScale fromCode(String codeString) throws FHIRException {
306            if (codeString == null || "".equals(codeString))
307                return null;
308        if ("farenheit".equals(codeString))
309          return FARENHEIT;
310        if ("celsius".equals(codeString))
311          return CELSIUS;
312        if ("kelvin".equals(codeString))
313          return KELVIN;
314        if (Configuration.isAcceptInvalidEnums())
315          return null;
316        else
317          throw new FHIRException("Unknown BiologicallyDerivedProductStorageScale code '"+codeString+"'");
318        }
319        public String toCode() {
320          switch (this) {
321            case FARENHEIT: return "farenheit";
322            case CELSIUS: return "celsius";
323            case KELVIN: return "kelvin";
324            default: return "?";
325          }
326        }
327        public String getSystem() {
328          switch (this) {
329            case FARENHEIT: return "http://hl7.org/fhir/product-storage-scale";
330            case CELSIUS: return "http://hl7.org/fhir/product-storage-scale";
331            case KELVIN: return "http://hl7.org/fhir/product-storage-scale";
332            default: return "?";
333          }
334        }
335        public String getDefinition() {
336          switch (this) {
337            case FARENHEIT: return "Fahrenheit temperature scale.";
338            case CELSIUS: return "Celsius or centigrade temperature scale.";
339            case KELVIN: return "Kelvin absolute thermodynamic temperature scale.";
340            default: return "?";
341          }
342        }
343        public String getDisplay() {
344          switch (this) {
345            case FARENHEIT: return "Fahrenheit";
346            case CELSIUS: return "Celsius";
347            case KELVIN: return "Kelvin";
348            default: return "?";
349          }
350        }
351    }
352
353  public static class BiologicallyDerivedProductStorageScaleEnumFactory implements EnumFactory<BiologicallyDerivedProductStorageScale> {
354    public BiologicallyDerivedProductStorageScale fromCode(String codeString) throws IllegalArgumentException {
355      if (codeString == null || "".equals(codeString))
356            if (codeString == null || "".equals(codeString))
357                return null;
358        if ("farenheit".equals(codeString))
359          return BiologicallyDerivedProductStorageScale.FARENHEIT;
360        if ("celsius".equals(codeString))
361          return BiologicallyDerivedProductStorageScale.CELSIUS;
362        if ("kelvin".equals(codeString))
363          return BiologicallyDerivedProductStorageScale.KELVIN;
364        throw new IllegalArgumentException("Unknown BiologicallyDerivedProductStorageScale code '"+codeString+"'");
365        }
366        public Enumeration<BiologicallyDerivedProductStorageScale> fromType(Base code) throws FHIRException {
367          if (code == null)
368            return null;
369          if (code.isEmpty())
370            return new Enumeration<BiologicallyDerivedProductStorageScale>(this);
371          String codeString = ((PrimitiveType) code).asStringValue();
372          if (codeString == null || "".equals(codeString))
373            return null;
374        if ("farenheit".equals(codeString))
375          return new Enumeration<BiologicallyDerivedProductStorageScale>(this, BiologicallyDerivedProductStorageScale.FARENHEIT);
376        if ("celsius".equals(codeString))
377          return new Enumeration<BiologicallyDerivedProductStorageScale>(this, BiologicallyDerivedProductStorageScale.CELSIUS);
378        if ("kelvin".equals(codeString))
379          return new Enumeration<BiologicallyDerivedProductStorageScale>(this, BiologicallyDerivedProductStorageScale.KELVIN);
380        throw new FHIRException("Unknown BiologicallyDerivedProductStorageScale code '"+codeString+"'");
381        }
382    public String toCode(BiologicallyDerivedProductStorageScale code) {
383      if (code == BiologicallyDerivedProductStorageScale.FARENHEIT)
384        return "farenheit";
385      if (code == BiologicallyDerivedProductStorageScale.CELSIUS)
386        return "celsius";
387      if (code == BiologicallyDerivedProductStorageScale.KELVIN)
388        return "kelvin";
389      return "?";
390      }
391    public String toSystem(BiologicallyDerivedProductStorageScale code) {
392      return code.getSystem();
393      }
394    }
395
396    @Block()
397    public static class BiologicallyDerivedProductCollectionComponent extends BackboneElement implements IBaseBackboneElement {
398        /**
399         * Healthcare professional who is performing the collection.
400         */
401        @Child(name = "collector", type = {Practitioner.class, PractitionerRole.class}, order=1, min=0, max=1, modifier=false, summary=false)
402        @Description(shortDefinition="Individual performing collection", formalDefinition="Healthcare professional who is performing the collection." )
403        protected Reference collector;
404
405        /**
406         * The actual object that is the target of the reference (Healthcare professional who is performing the collection.)
407         */
408        protected Resource collectorTarget;
409
410        /**
411         * The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.
412         */
413        @Child(name = "source", type = {Patient.class, Organization.class}, order=2, min=0, max=1, modifier=false, summary=false)
414        @Description(shortDefinition="Who is product from", formalDefinition="The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product." )
415        protected Reference source;
416
417        /**
418         * The actual object that is the target of the reference (The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.)
419         */
420        protected Resource sourceTarget;
421
422        /**
423         * Time of product collection.
424         */
425        @Child(name = "collected", type = {DateTimeType.class, Period.class}, order=3, min=0, max=1, modifier=false, summary=false)
426        @Description(shortDefinition="Time of product collection", formalDefinition="Time of product collection." )
427        protected Type collected;
428
429        private static final long serialVersionUID = 892130089L;
430
431    /**
432     * Constructor
433     */
434      public BiologicallyDerivedProductCollectionComponent() {
435        super();
436      }
437
438        /**
439         * @return {@link #collector} (Healthcare professional who is performing the collection.)
440         */
441        public Reference getCollector() { 
442          if (this.collector == null)
443            if (Configuration.errorOnAutoCreate())
444              throw new Error("Attempt to auto-create BiologicallyDerivedProductCollectionComponent.collector");
445            else if (Configuration.doAutoCreate())
446              this.collector = new Reference(); // cc
447          return this.collector;
448        }
449
450        public boolean hasCollector() { 
451          return this.collector != null && !this.collector.isEmpty();
452        }
453
454        /**
455         * @param value {@link #collector} (Healthcare professional who is performing the collection.)
456         */
457        public BiologicallyDerivedProductCollectionComponent setCollector(Reference value) { 
458          this.collector = value;
459          return this;
460        }
461
462        /**
463         * @return {@link #collector} 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. (Healthcare professional who is performing the collection.)
464         */
465        public Resource getCollectorTarget() { 
466          return this.collectorTarget;
467        }
468
469        /**
470         * @param value {@link #collector} 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. (Healthcare professional who is performing the collection.)
471         */
472        public BiologicallyDerivedProductCollectionComponent setCollectorTarget(Resource value) { 
473          this.collectorTarget = value;
474          return this;
475        }
476
477        /**
478         * @return {@link #source} (The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.)
479         */
480        public Reference getSource() { 
481          if (this.source == null)
482            if (Configuration.errorOnAutoCreate())
483              throw new Error("Attempt to auto-create BiologicallyDerivedProductCollectionComponent.source");
484            else if (Configuration.doAutoCreate())
485              this.source = new Reference(); // cc
486          return this.source;
487        }
488
489        public boolean hasSource() { 
490          return this.source != null && !this.source.isEmpty();
491        }
492
493        /**
494         * @param value {@link #source} (The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.)
495         */
496        public BiologicallyDerivedProductCollectionComponent setSource(Reference value) { 
497          this.source = value;
498          return this;
499        }
500
501        /**
502         * @return {@link #source} 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. (The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.)
503         */
504        public Resource getSourceTarget() { 
505          return this.sourceTarget;
506        }
507
508        /**
509         * @param value {@link #source} 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. (The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.)
510         */
511        public BiologicallyDerivedProductCollectionComponent setSourceTarget(Resource value) { 
512          this.sourceTarget = value;
513          return this;
514        }
515
516        /**
517         * @return {@link #collected} (Time of product collection.)
518         */
519        public Type getCollected() { 
520          return this.collected;
521        }
522
523        /**
524         * @return {@link #collected} (Time of product collection.)
525         */
526        public DateTimeType getCollectedDateTimeType() throws FHIRException { 
527          if (this.collected == null)
528            this.collected = new DateTimeType();
529          if (!(this.collected instanceof DateTimeType))
530            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.collected.getClass().getName()+" was encountered");
531          return (DateTimeType) this.collected;
532        }
533
534        public boolean hasCollectedDateTimeType() { 
535          return this != null && this.collected instanceof DateTimeType;
536        }
537
538        /**
539         * @return {@link #collected} (Time of product collection.)
540         */
541        public Period getCollectedPeriod() throws FHIRException { 
542          if (this.collected == null)
543            this.collected = new Period();
544          if (!(this.collected instanceof Period))
545            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.collected.getClass().getName()+" was encountered");
546          return (Period) this.collected;
547        }
548
549        public boolean hasCollectedPeriod() { 
550          return this != null && this.collected instanceof Period;
551        }
552
553        public boolean hasCollected() { 
554          return this.collected != null && !this.collected.isEmpty();
555        }
556
557        /**
558         * @param value {@link #collected} (Time of product collection.)
559         */
560        public BiologicallyDerivedProductCollectionComponent setCollected(Type value) { 
561          if (value != null && !(value instanceof DateTimeType || value instanceof Period))
562            throw new Error("Not the right type for BiologicallyDerivedProduct.collection.collected[x]: "+value.fhirType());
563          this.collected = value;
564          return this;
565        }
566
567        protected void listChildren(List<Property> children) {
568          super.listChildren(children);
569          children.add(new Property("collector", "Reference(Practitioner|PractitionerRole)", "Healthcare professional who is performing the collection.", 0, 1, collector));
570          children.add(new Property("source", "Reference(Patient|Organization)", "The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.", 0, 1, source));
571          children.add(new Property("collected[x]", "dateTime|Period", "Time of product collection.", 0, 1, collected));
572        }
573
574        @Override
575        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
576          switch (_hash) {
577          case 1883491469: /*collector*/  return new Property("collector", "Reference(Practitioner|PractitionerRole)", "Healthcare professional who is performing the collection.", 0, 1, collector);
578          case -896505829: /*source*/  return new Property("source", "Reference(Patient|Organization)", "The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.", 0, 1, source);
579          case 1632037015: /*collected[x]*/  return new Property("collected[x]", "dateTime|Period", "Time of product collection.", 0, 1, collected);
580          case 1883491145: /*collected*/  return new Property("collected[x]", "dateTime|Period", "Time of product collection.", 0, 1, collected);
581          case 2005009924: /*collectedDateTime*/  return new Property("collected[x]", "dateTime|Period", "Time of product collection.", 0, 1, collected);
582          case 653185642: /*collectedPeriod*/  return new Property("collected[x]", "dateTime|Period", "Time of product collection.", 0, 1, collected);
583          default: return super.getNamedProperty(_hash, _name, _checkValid);
584          }
585
586        }
587
588      @Override
589      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
590        switch (hash) {
591        case 1883491469: /*collector*/ return this.collector == null ? new Base[0] : new Base[] {this.collector}; // Reference
592        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Reference
593        case 1883491145: /*collected*/ return this.collected == null ? new Base[0] : new Base[] {this.collected}; // Type
594        default: return super.getProperty(hash, name, checkValid);
595        }
596
597      }
598
599      @Override
600      public Base setProperty(int hash, String name, Base value) throws FHIRException {
601        switch (hash) {
602        case 1883491469: // collector
603          this.collector = castToReference(value); // Reference
604          return value;
605        case -896505829: // source
606          this.source = castToReference(value); // Reference
607          return value;
608        case 1883491145: // collected
609          this.collected = castToType(value); // Type
610          return value;
611        default: return super.setProperty(hash, name, value);
612        }
613
614      }
615
616      @Override
617      public Base setProperty(String name, Base value) throws FHIRException {
618        if (name.equals("collector")) {
619          this.collector = castToReference(value); // Reference
620        } else if (name.equals("source")) {
621          this.source = castToReference(value); // Reference
622        } else if (name.equals("collected[x]")) {
623          this.collected = castToType(value); // Type
624        } else
625          return super.setProperty(name, value);
626        return value;
627      }
628
629      @Override
630      public Base makeProperty(int hash, String name) throws FHIRException {
631        switch (hash) {
632        case 1883491469:  return getCollector(); 
633        case -896505829:  return getSource(); 
634        case 1632037015:  return getCollected(); 
635        case 1883491145:  return getCollected(); 
636        default: return super.makeProperty(hash, name);
637        }
638
639      }
640
641      @Override
642      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
643        switch (hash) {
644        case 1883491469: /*collector*/ return new String[] {"Reference"};
645        case -896505829: /*source*/ return new String[] {"Reference"};
646        case 1883491145: /*collected*/ return new String[] {"dateTime", "Period"};
647        default: return super.getTypesForProperty(hash, name);
648        }
649
650      }
651
652      @Override
653      public Base addChild(String name) throws FHIRException {
654        if (name.equals("collector")) {
655          this.collector = new Reference();
656          return this.collector;
657        }
658        else if (name.equals("source")) {
659          this.source = new Reference();
660          return this.source;
661        }
662        else if (name.equals("collectedDateTime")) {
663          this.collected = new DateTimeType();
664          return this.collected;
665        }
666        else if (name.equals("collectedPeriod")) {
667          this.collected = new Period();
668          return this.collected;
669        }
670        else
671          return super.addChild(name);
672      }
673
674      public BiologicallyDerivedProductCollectionComponent copy() {
675        BiologicallyDerivedProductCollectionComponent dst = new BiologicallyDerivedProductCollectionComponent();
676        copyValues(dst);
677        return dst;
678      }
679
680      public void copyValues(BiologicallyDerivedProductCollectionComponent dst) {
681        super.copyValues(dst);
682        dst.collector = collector == null ? null : collector.copy();
683        dst.source = source == null ? null : source.copy();
684        dst.collected = collected == null ? null : collected.copy();
685      }
686
687      @Override
688      public boolean equalsDeep(Base other_) {
689        if (!super.equalsDeep(other_))
690          return false;
691        if (!(other_ instanceof BiologicallyDerivedProductCollectionComponent))
692          return false;
693        BiologicallyDerivedProductCollectionComponent o = (BiologicallyDerivedProductCollectionComponent) other_;
694        return compareDeep(collector, o.collector, true) && compareDeep(source, o.source, true) && compareDeep(collected, o.collected, true)
695          ;
696      }
697
698      @Override
699      public boolean equalsShallow(Base other_) {
700        if (!super.equalsShallow(other_))
701          return false;
702        if (!(other_ instanceof BiologicallyDerivedProductCollectionComponent))
703          return false;
704        BiologicallyDerivedProductCollectionComponent o = (BiologicallyDerivedProductCollectionComponent) other_;
705        return true;
706      }
707
708      public boolean isEmpty() {
709        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(collector, source, collected
710          );
711      }
712
713  public String fhirType() {
714    return "BiologicallyDerivedProduct.collection";
715
716  }
717
718  }
719
720    @Block()
721    public static class BiologicallyDerivedProductProcessingComponent extends BackboneElement implements IBaseBackboneElement {
722        /**
723         * Description of of processing.
724         */
725        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
726        @Description(shortDefinition="Description of of processing", formalDefinition="Description of of processing." )
727        protected StringType description;
728
729        /**
730         * Procesing code.
731         */
732        @Child(name = "procedure", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
733        @Description(shortDefinition="Procesing code", formalDefinition="Procesing code." )
734        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/procedure-code")
735        protected CodeableConcept procedure;
736
737        /**
738         * Substance added during processing.
739         */
740        @Child(name = "additive", type = {Substance.class}, order=3, min=0, max=1, modifier=false, summary=false)
741        @Description(shortDefinition="Substance added during processing", formalDefinition="Substance added during processing." )
742        protected Reference additive;
743
744        /**
745         * The actual object that is the target of the reference (Substance added during processing.)
746         */
747        protected Substance additiveTarget;
748
749        /**
750         * Time of processing.
751         */
752        @Child(name = "time", type = {DateTimeType.class, Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
753        @Description(shortDefinition="Time of processing", formalDefinition="Time of processing." )
754        protected Type time;
755
756        private static final long serialVersionUID = -1007041216L;
757
758    /**
759     * Constructor
760     */
761      public BiologicallyDerivedProductProcessingComponent() {
762        super();
763      }
764
765        /**
766         * @return {@link #description} (Description of of processing.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
767         */
768        public StringType getDescriptionElement() { 
769          if (this.description == null)
770            if (Configuration.errorOnAutoCreate())
771              throw new Error("Attempt to auto-create BiologicallyDerivedProductProcessingComponent.description");
772            else if (Configuration.doAutoCreate())
773              this.description = new StringType(); // bb
774          return this.description;
775        }
776
777        public boolean hasDescriptionElement() { 
778          return this.description != null && !this.description.isEmpty();
779        }
780
781        public boolean hasDescription() { 
782          return this.description != null && !this.description.isEmpty();
783        }
784
785        /**
786         * @param value {@link #description} (Description of of processing.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
787         */
788        public BiologicallyDerivedProductProcessingComponent setDescriptionElement(StringType value) { 
789          this.description = value;
790          return this;
791        }
792
793        /**
794         * @return Description of of processing.
795         */
796        public String getDescription() { 
797          return this.description == null ? null : this.description.getValue();
798        }
799
800        /**
801         * @param value Description of of processing.
802         */
803        public BiologicallyDerivedProductProcessingComponent setDescription(String value) { 
804          if (Utilities.noString(value))
805            this.description = null;
806          else {
807            if (this.description == null)
808              this.description = new StringType();
809            this.description.setValue(value);
810          }
811          return this;
812        }
813
814        /**
815         * @return {@link #procedure} (Procesing code.)
816         */
817        public CodeableConcept getProcedure() { 
818          if (this.procedure == null)
819            if (Configuration.errorOnAutoCreate())
820              throw new Error("Attempt to auto-create BiologicallyDerivedProductProcessingComponent.procedure");
821            else if (Configuration.doAutoCreate())
822              this.procedure = new CodeableConcept(); // cc
823          return this.procedure;
824        }
825
826        public boolean hasProcedure() { 
827          return this.procedure != null && !this.procedure.isEmpty();
828        }
829
830        /**
831         * @param value {@link #procedure} (Procesing code.)
832         */
833        public BiologicallyDerivedProductProcessingComponent setProcedure(CodeableConcept value) { 
834          this.procedure = value;
835          return this;
836        }
837
838        /**
839         * @return {@link #additive} (Substance added during processing.)
840         */
841        public Reference getAdditive() { 
842          if (this.additive == null)
843            if (Configuration.errorOnAutoCreate())
844              throw new Error("Attempt to auto-create BiologicallyDerivedProductProcessingComponent.additive");
845            else if (Configuration.doAutoCreate())
846              this.additive = new Reference(); // cc
847          return this.additive;
848        }
849
850        public boolean hasAdditive() { 
851          return this.additive != null && !this.additive.isEmpty();
852        }
853
854        /**
855         * @param value {@link #additive} (Substance added during processing.)
856         */
857        public BiologicallyDerivedProductProcessingComponent setAdditive(Reference value) { 
858          this.additive = value;
859          return this;
860        }
861
862        /**
863         * @return {@link #additive} 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. (Substance added during processing.)
864         */
865        public Substance getAdditiveTarget() { 
866          if (this.additiveTarget == null)
867            if (Configuration.errorOnAutoCreate())
868              throw new Error("Attempt to auto-create BiologicallyDerivedProductProcessingComponent.additive");
869            else if (Configuration.doAutoCreate())
870              this.additiveTarget = new Substance(); // aa
871          return this.additiveTarget;
872        }
873
874        /**
875         * @param value {@link #additive} 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. (Substance added during processing.)
876         */
877        public BiologicallyDerivedProductProcessingComponent setAdditiveTarget(Substance value) { 
878          this.additiveTarget = value;
879          return this;
880        }
881
882        /**
883         * @return {@link #time} (Time of processing.)
884         */
885        public Type getTime() { 
886          return this.time;
887        }
888
889        /**
890         * @return {@link #time} (Time of processing.)
891         */
892        public DateTimeType getTimeDateTimeType() throws FHIRException { 
893          if (this.time == null)
894            this.time = new DateTimeType();
895          if (!(this.time instanceof DateTimeType))
896            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.time.getClass().getName()+" was encountered");
897          return (DateTimeType) this.time;
898        }
899
900        public boolean hasTimeDateTimeType() { 
901          return this != null && this.time instanceof DateTimeType;
902        }
903
904        /**
905         * @return {@link #time} (Time of processing.)
906         */
907        public Period getTimePeriod() throws FHIRException { 
908          if (this.time == null)
909            this.time = new Period();
910          if (!(this.time instanceof Period))
911            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.time.getClass().getName()+" was encountered");
912          return (Period) this.time;
913        }
914
915        public boolean hasTimePeriod() { 
916          return this != null && this.time instanceof Period;
917        }
918
919        public boolean hasTime() { 
920          return this.time != null && !this.time.isEmpty();
921        }
922
923        /**
924         * @param value {@link #time} (Time of processing.)
925         */
926        public BiologicallyDerivedProductProcessingComponent setTime(Type value) { 
927          if (value != null && !(value instanceof DateTimeType || value instanceof Period))
928            throw new Error("Not the right type for BiologicallyDerivedProduct.processing.time[x]: "+value.fhirType());
929          this.time = value;
930          return this;
931        }
932
933        protected void listChildren(List<Property> children) {
934          super.listChildren(children);
935          children.add(new Property("description", "string", "Description of of processing.", 0, 1, description));
936          children.add(new Property("procedure", "CodeableConcept", "Procesing code.", 0, 1, procedure));
937          children.add(new Property("additive", "Reference(Substance)", "Substance added during processing.", 0, 1, additive));
938          children.add(new Property("time[x]", "dateTime|Period", "Time of processing.", 0, 1, time));
939        }
940
941        @Override
942        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
943          switch (_hash) {
944          case -1724546052: /*description*/  return new Property("description", "string", "Description of of processing.", 0, 1, description);
945          case -1095204141: /*procedure*/  return new Property("procedure", "CodeableConcept", "Procesing code.", 0, 1, procedure);
946          case -1226589236: /*additive*/  return new Property("additive", "Reference(Substance)", "Substance added during processing.", 0, 1, additive);
947          case -1313930605: /*time[x]*/  return new Property("time[x]", "dateTime|Period", "Time of processing.", 0, 1, time);
948          case 3560141: /*time*/  return new Property("time[x]", "dateTime|Period", "Time of processing.", 0, 1, time);
949          case 2135345544: /*timeDateTime*/  return new Property("time[x]", "dateTime|Period", "Time of processing.", 0, 1, time);
950          case 693544686: /*timePeriod*/  return new Property("time[x]", "dateTime|Period", "Time of processing.", 0, 1, time);
951          default: return super.getNamedProperty(_hash, _name, _checkValid);
952          }
953
954        }
955
956      @Override
957      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
958        switch (hash) {
959        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
960        case -1095204141: /*procedure*/ return this.procedure == null ? new Base[0] : new Base[] {this.procedure}; // CodeableConcept
961        case -1226589236: /*additive*/ return this.additive == null ? new Base[0] : new Base[] {this.additive}; // Reference
962        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // Type
963        default: return super.getProperty(hash, name, checkValid);
964        }
965
966      }
967
968      @Override
969      public Base setProperty(int hash, String name, Base value) throws FHIRException {
970        switch (hash) {
971        case -1724546052: // description
972          this.description = castToString(value); // StringType
973          return value;
974        case -1095204141: // procedure
975          this.procedure = castToCodeableConcept(value); // CodeableConcept
976          return value;
977        case -1226589236: // additive
978          this.additive = castToReference(value); // Reference
979          return value;
980        case 3560141: // time
981          this.time = castToType(value); // Type
982          return value;
983        default: return super.setProperty(hash, name, value);
984        }
985
986      }
987
988      @Override
989      public Base setProperty(String name, Base value) throws FHIRException {
990        if (name.equals("description")) {
991          this.description = castToString(value); // StringType
992        } else if (name.equals("procedure")) {
993          this.procedure = castToCodeableConcept(value); // CodeableConcept
994        } else if (name.equals("additive")) {
995          this.additive = castToReference(value); // Reference
996        } else if (name.equals("time[x]")) {
997          this.time = castToType(value); // Type
998        } else
999          return super.setProperty(name, value);
1000        return value;
1001      }
1002
1003      @Override
1004      public Base makeProperty(int hash, String name) throws FHIRException {
1005        switch (hash) {
1006        case -1724546052:  return getDescriptionElement();
1007        case -1095204141:  return getProcedure(); 
1008        case -1226589236:  return getAdditive(); 
1009        case -1313930605:  return getTime(); 
1010        case 3560141:  return getTime(); 
1011        default: return super.makeProperty(hash, name);
1012        }
1013
1014      }
1015
1016      @Override
1017      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1018        switch (hash) {
1019        case -1724546052: /*description*/ return new String[] {"string"};
1020        case -1095204141: /*procedure*/ return new String[] {"CodeableConcept"};
1021        case -1226589236: /*additive*/ return new String[] {"Reference"};
1022        case 3560141: /*time*/ return new String[] {"dateTime", "Period"};
1023        default: return super.getTypesForProperty(hash, name);
1024        }
1025
1026      }
1027
1028      @Override
1029      public Base addChild(String name) throws FHIRException {
1030        if (name.equals("description")) {
1031          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.description");
1032        }
1033        else if (name.equals("procedure")) {
1034          this.procedure = new CodeableConcept();
1035          return this.procedure;
1036        }
1037        else if (name.equals("additive")) {
1038          this.additive = new Reference();
1039          return this.additive;
1040        }
1041        else if (name.equals("timeDateTime")) {
1042          this.time = new DateTimeType();
1043          return this.time;
1044        }
1045        else if (name.equals("timePeriod")) {
1046          this.time = new Period();
1047          return this.time;
1048        }
1049        else
1050          return super.addChild(name);
1051      }
1052
1053      public BiologicallyDerivedProductProcessingComponent copy() {
1054        BiologicallyDerivedProductProcessingComponent dst = new BiologicallyDerivedProductProcessingComponent();
1055        copyValues(dst);
1056        return dst;
1057      }
1058
1059      public void copyValues(BiologicallyDerivedProductProcessingComponent dst) {
1060        super.copyValues(dst);
1061        dst.description = description == null ? null : description.copy();
1062        dst.procedure = procedure == null ? null : procedure.copy();
1063        dst.additive = additive == null ? null : additive.copy();
1064        dst.time = time == null ? null : time.copy();
1065      }
1066
1067      @Override
1068      public boolean equalsDeep(Base other_) {
1069        if (!super.equalsDeep(other_))
1070          return false;
1071        if (!(other_ instanceof BiologicallyDerivedProductProcessingComponent))
1072          return false;
1073        BiologicallyDerivedProductProcessingComponent o = (BiologicallyDerivedProductProcessingComponent) other_;
1074        return compareDeep(description, o.description, true) && compareDeep(procedure, o.procedure, true)
1075           && compareDeep(additive, o.additive, true) && compareDeep(time, o.time, true);
1076      }
1077
1078      @Override
1079      public boolean equalsShallow(Base other_) {
1080        if (!super.equalsShallow(other_))
1081          return false;
1082        if (!(other_ instanceof BiologicallyDerivedProductProcessingComponent))
1083          return false;
1084        BiologicallyDerivedProductProcessingComponent o = (BiologicallyDerivedProductProcessingComponent) other_;
1085        return compareValues(description, o.description, true);
1086      }
1087
1088      public boolean isEmpty() {
1089        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, procedure, additive
1090          , time);
1091      }
1092
1093  public String fhirType() {
1094    return "BiologicallyDerivedProduct.processing";
1095
1096  }
1097
1098  }
1099
1100    @Block()
1101    public static class BiologicallyDerivedProductManipulationComponent extends BackboneElement implements IBaseBackboneElement {
1102        /**
1103         * Description of manipulation.
1104         */
1105        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1106        @Description(shortDefinition="Description of manipulation", formalDefinition="Description of manipulation." )
1107        protected StringType description;
1108
1109        /**
1110         * Time of manipulation.
1111         */
1112        @Child(name = "time", type = {DateTimeType.class, Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
1113        @Description(shortDefinition="Time of manipulation", formalDefinition="Time of manipulation." )
1114        protected Type time;
1115
1116        private static final long serialVersionUID = 717201078L;
1117
1118    /**
1119     * Constructor
1120     */
1121      public BiologicallyDerivedProductManipulationComponent() {
1122        super();
1123      }
1124
1125        /**
1126         * @return {@link #description} (Description of manipulation.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1127         */
1128        public StringType getDescriptionElement() { 
1129          if (this.description == null)
1130            if (Configuration.errorOnAutoCreate())
1131              throw new Error("Attempt to auto-create BiologicallyDerivedProductManipulationComponent.description");
1132            else if (Configuration.doAutoCreate())
1133              this.description = new StringType(); // bb
1134          return this.description;
1135        }
1136
1137        public boolean hasDescriptionElement() { 
1138          return this.description != null && !this.description.isEmpty();
1139        }
1140
1141        public boolean hasDescription() { 
1142          return this.description != null && !this.description.isEmpty();
1143        }
1144
1145        /**
1146         * @param value {@link #description} (Description of manipulation.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1147         */
1148        public BiologicallyDerivedProductManipulationComponent setDescriptionElement(StringType value) { 
1149          this.description = value;
1150          return this;
1151        }
1152
1153        /**
1154         * @return Description of manipulation.
1155         */
1156        public String getDescription() { 
1157          return this.description == null ? null : this.description.getValue();
1158        }
1159
1160        /**
1161         * @param value Description of manipulation.
1162         */
1163        public BiologicallyDerivedProductManipulationComponent setDescription(String value) { 
1164          if (Utilities.noString(value))
1165            this.description = null;
1166          else {
1167            if (this.description == null)
1168              this.description = new StringType();
1169            this.description.setValue(value);
1170          }
1171          return this;
1172        }
1173
1174        /**
1175         * @return {@link #time} (Time of manipulation.)
1176         */
1177        public Type getTime() { 
1178          return this.time;
1179        }
1180
1181        /**
1182         * @return {@link #time} (Time of manipulation.)
1183         */
1184        public DateTimeType getTimeDateTimeType() throws FHIRException { 
1185          if (this.time == null)
1186            this.time = new DateTimeType();
1187          if (!(this.time instanceof DateTimeType))
1188            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.time.getClass().getName()+" was encountered");
1189          return (DateTimeType) this.time;
1190        }
1191
1192        public boolean hasTimeDateTimeType() { 
1193          return this != null && this.time instanceof DateTimeType;
1194        }
1195
1196        /**
1197         * @return {@link #time} (Time of manipulation.)
1198         */
1199        public Period getTimePeriod() throws FHIRException { 
1200          if (this.time == null)
1201            this.time = new Period();
1202          if (!(this.time instanceof Period))
1203            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.time.getClass().getName()+" was encountered");
1204          return (Period) this.time;
1205        }
1206
1207        public boolean hasTimePeriod() { 
1208          return this != null && this.time instanceof Period;
1209        }
1210
1211        public boolean hasTime() { 
1212          return this.time != null && !this.time.isEmpty();
1213        }
1214
1215        /**
1216         * @param value {@link #time} (Time of manipulation.)
1217         */
1218        public BiologicallyDerivedProductManipulationComponent setTime(Type value) { 
1219          if (value != null && !(value instanceof DateTimeType || value instanceof Period))
1220            throw new Error("Not the right type for BiologicallyDerivedProduct.manipulation.time[x]: "+value.fhirType());
1221          this.time = value;
1222          return this;
1223        }
1224
1225        protected void listChildren(List<Property> children) {
1226          super.listChildren(children);
1227          children.add(new Property("description", "string", "Description of manipulation.", 0, 1, description));
1228          children.add(new Property("time[x]", "dateTime|Period", "Time of manipulation.", 0, 1, time));
1229        }
1230
1231        @Override
1232        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1233          switch (_hash) {
1234          case -1724546052: /*description*/  return new Property("description", "string", "Description of manipulation.", 0, 1, description);
1235          case -1313930605: /*time[x]*/  return new Property("time[x]", "dateTime|Period", "Time of manipulation.", 0, 1, time);
1236          case 3560141: /*time*/  return new Property("time[x]", "dateTime|Period", "Time of manipulation.", 0, 1, time);
1237          case 2135345544: /*timeDateTime*/  return new Property("time[x]", "dateTime|Period", "Time of manipulation.", 0, 1, time);
1238          case 693544686: /*timePeriod*/  return new Property("time[x]", "dateTime|Period", "Time of manipulation.", 0, 1, time);
1239          default: return super.getNamedProperty(_hash, _name, _checkValid);
1240          }
1241
1242        }
1243
1244      @Override
1245      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1246        switch (hash) {
1247        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1248        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // Type
1249        default: return super.getProperty(hash, name, checkValid);
1250        }
1251
1252      }
1253
1254      @Override
1255      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1256        switch (hash) {
1257        case -1724546052: // description
1258          this.description = castToString(value); // StringType
1259          return value;
1260        case 3560141: // time
1261          this.time = castToType(value); // Type
1262          return value;
1263        default: return super.setProperty(hash, name, value);
1264        }
1265
1266      }
1267
1268      @Override
1269      public Base setProperty(String name, Base value) throws FHIRException {
1270        if (name.equals("description")) {
1271          this.description = castToString(value); // StringType
1272        } else if (name.equals("time[x]")) {
1273          this.time = castToType(value); // Type
1274        } else
1275          return super.setProperty(name, value);
1276        return value;
1277      }
1278
1279      @Override
1280      public Base makeProperty(int hash, String name) throws FHIRException {
1281        switch (hash) {
1282        case -1724546052:  return getDescriptionElement();
1283        case -1313930605:  return getTime(); 
1284        case 3560141:  return getTime(); 
1285        default: return super.makeProperty(hash, name);
1286        }
1287
1288      }
1289
1290      @Override
1291      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1292        switch (hash) {
1293        case -1724546052: /*description*/ return new String[] {"string"};
1294        case 3560141: /*time*/ return new String[] {"dateTime", "Period"};
1295        default: return super.getTypesForProperty(hash, name);
1296        }
1297
1298      }
1299
1300      @Override
1301      public Base addChild(String name) throws FHIRException {
1302        if (name.equals("description")) {
1303          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.description");
1304        }
1305        else if (name.equals("timeDateTime")) {
1306          this.time = new DateTimeType();
1307          return this.time;
1308        }
1309        else if (name.equals("timePeriod")) {
1310          this.time = new Period();
1311          return this.time;
1312        }
1313        else
1314          return super.addChild(name);
1315      }
1316
1317      public BiologicallyDerivedProductManipulationComponent copy() {
1318        BiologicallyDerivedProductManipulationComponent dst = new BiologicallyDerivedProductManipulationComponent();
1319        copyValues(dst);
1320        return dst;
1321      }
1322
1323      public void copyValues(BiologicallyDerivedProductManipulationComponent dst) {
1324        super.copyValues(dst);
1325        dst.description = description == null ? null : description.copy();
1326        dst.time = time == null ? null : time.copy();
1327      }
1328
1329      @Override
1330      public boolean equalsDeep(Base other_) {
1331        if (!super.equalsDeep(other_))
1332          return false;
1333        if (!(other_ instanceof BiologicallyDerivedProductManipulationComponent))
1334          return false;
1335        BiologicallyDerivedProductManipulationComponent o = (BiologicallyDerivedProductManipulationComponent) other_;
1336        return compareDeep(description, o.description, true) && compareDeep(time, o.time, true);
1337      }
1338
1339      @Override
1340      public boolean equalsShallow(Base other_) {
1341        if (!super.equalsShallow(other_))
1342          return false;
1343        if (!(other_ instanceof BiologicallyDerivedProductManipulationComponent))
1344          return false;
1345        BiologicallyDerivedProductManipulationComponent o = (BiologicallyDerivedProductManipulationComponent) other_;
1346        return compareValues(description, o.description, true);
1347      }
1348
1349      public boolean isEmpty() {
1350        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, time);
1351      }
1352
1353  public String fhirType() {
1354    return "BiologicallyDerivedProduct.manipulation";
1355
1356  }
1357
1358  }
1359
1360    @Block()
1361    public static class BiologicallyDerivedProductStorageComponent extends BackboneElement implements IBaseBackboneElement {
1362        /**
1363         * Description of storage.
1364         */
1365        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1366        @Description(shortDefinition="Description of storage", formalDefinition="Description of storage." )
1367        protected StringType description;
1368
1369        /**
1370         * Storage temperature.
1371         */
1372        @Child(name = "temperature", type = {DecimalType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1373        @Description(shortDefinition="Storage temperature", formalDefinition="Storage temperature." )
1374        protected DecimalType temperature;
1375
1376        /**
1377         * Temperature scale used.
1378         */
1379        @Child(name = "scale", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1380        @Description(shortDefinition="farenheit | celsius | kelvin", formalDefinition="Temperature scale used." )
1381        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/product-storage-scale")
1382        protected Enumeration<BiologicallyDerivedProductStorageScale> scale;
1383
1384        /**
1385         * Storage timeperiod.
1386         */
1387        @Child(name = "duration", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=false)
1388        @Description(shortDefinition="Storage timeperiod", formalDefinition="Storage timeperiod." )
1389        protected Period duration;
1390
1391        private static final long serialVersionUID = 1509141319L;
1392
1393    /**
1394     * Constructor
1395     */
1396      public BiologicallyDerivedProductStorageComponent() {
1397        super();
1398      }
1399
1400        /**
1401         * @return {@link #description} (Description of storage.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1402         */
1403        public StringType getDescriptionElement() { 
1404          if (this.description == null)
1405            if (Configuration.errorOnAutoCreate())
1406              throw new Error("Attempt to auto-create BiologicallyDerivedProductStorageComponent.description");
1407            else if (Configuration.doAutoCreate())
1408              this.description = new StringType(); // bb
1409          return this.description;
1410        }
1411
1412        public boolean hasDescriptionElement() { 
1413          return this.description != null && !this.description.isEmpty();
1414        }
1415
1416        public boolean hasDescription() { 
1417          return this.description != null && !this.description.isEmpty();
1418        }
1419
1420        /**
1421         * @param value {@link #description} (Description of storage.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1422         */
1423        public BiologicallyDerivedProductStorageComponent setDescriptionElement(StringType value) { 
1424          this.description = value;
1425          return this;
1426        }
1427
1428        /**
1429         * @return Description of storage.
1430         */
1431        public String getDescription() { 
1432          return this.description == null ? null : this.description.getValue();
1433        }
1434
1435        /**
1436         * @param value Description of storage.
1437         */
1438        public BiologicallyDerivedProductStorageComponent setDescription(String value) { 
1439          if (Utilities.noString(value))
1440            this.description = null;
1441          else {
1442            if (this.description == null)
1443              this.description = new StringType();
1444            this.description.setValue(value);
1445          }
1446          return this;
1447        }
1448
1449        /**
1450         * @return {@link #temperature} (Storage temperature.). This is the underlying object with id, value and extensions. The accessor "getTemperature" gives direct access to the value
1451         */
1452        public DecimalType getTemperatureElement() { 
1453          if (this.temperature == null)
1454            if (Configuration.errorOnAutoCreate())
1455              throw new Error("Attempt to auto-create BiologicallyDerivedProductStorageComponent.temperature");
1456            else if (Configuration.doAutoCreate())
1457              this.temperature = new DecimalType(); // bb
1458          return this.temperature;
1459        }
1460
1461        public boolean hasTemperatureElement() { 
1462          return this.temperature != null && !this.temperature.isEmpty();
1463        }
1464
1465        public boolean hasTemperature() { 
1466          return this.temperature != null && !this.temperature.isEmpty();
1467        }
1468
1469        /**
1470         * @param value {@link #temperature} (Storage temperature.). This is the underlying object with id, value and extensions. The accessor "getTemperature" gives direct access to the value
1471         */
1472        public BiologicallyDerivedProductStorageComponent setTemperatureElement(DecimalType value) { 
1473          this.temperature = value;
1474          return this;
1475        }
1476
1477        /**
1478         * @return Storage temperature.
1479         */
1480        public BigDecimal getTemperature() { 
1481          return this.temperature == null ? null : this.temperature.getValue();
1482        }
1483
1484        /**
1485         * @param value Storage temperature.
1486         */
1487        public BiologicallyDerivedProductStorageComponent setTemperature(BigDecimal value) { 
1488          if (value == null)
1489            this.temperature = null;
1490          else {
1491            if (this.temperature == null)
1492              this.temperature = new DecimalType();
1493            this.temperature.setValue(value);
1494          }
1495          return this;
1496        }
1497
1498        /**
1499         * @param value Storage temperature.
1500         */
1501        public BiologicallyDerivedProductStorageComponent setTemperature(long value) { 
1502              this.temperature = new DecimalType();
1503            this.temperature.setValue(value);
1504          return this;
1505        }
1506
1507        /**
1508         * @param value Storage temperature.
1509         */
1510        public BiologicallyDerivedProductStorageComponent setTemperature(double value) { 
1511              this.temperature = new DecimalType();
1512            this.temperature.setValue(value);
1513          return this;
1514        }
1515
1516        /**
1517         * @return {@link #scale} (Temperature scale used.). This is the underlying object with id, value and extensions. The accessor "getScale" gives direct access to the value
1518         */
1519        public Enumeration<BiologicallyDerivedProductStorageScale> getScaleElement() { 
1520          if (this.scale == null)
1521            if (Configuration.errorOnAutoCreate())
1522              throw new Error("Attempt to auto-create BiologicallyDerivedProductStorageComponent.scale");
1523            else if (Configuration.doAutoCreate())
1524              this.scale = new Enumeration<BiologicallyDerivedProductStorageScale>(new BiologicallyDerivedProductStorageScaleEnumFactory()); // bb
1525          return this.scale;
1526        }
1527
1528        public boolean hasScaleElement() { 
1529          return this.scale != null && !this.scale.isEmpty();
1530        }
1531
1532        public boolean hasScale() { 
1533          return this.scale != null && !this.scale.isEmpty();
1534        }
1535
1536        /**
1537         * @param value {@link #scale} (Temperature scale used.). This is the underlying object with id, value and extensions. The accessor "getScale" gives direct access to the value
1538         */
1539        public BiologicallyDerivedProductStorageComponent setScaleElement(Enumeration<BiologicallyDerivedProductStorageScale> value) { 
1540          this.scale = value;
1541          return this;
1542        }
1543
1544        /**
1545         * @return Temperature scale used.
1546         */
1547        public BiologicallyDerivedProductStorageScale getScale() { 
1548          return this.scale == null ? null : this.scale.getValue();
1549        }
1550
1551        /**
1552         * @param value Temperature scale used.
1553         */
1554        public BiologicallyDerivedProductStorageComponent setScale(BiologicallyDerivedProductStorageScale value) { 
1555          if (value == null)
1556            this.scale = null;
1557          else {
1558            if (this.scale == null)
1559              this.scale = new Enumeration<BiologicallyDerivedProductStorageScale>(new BiologicallyDerivedProductStorageScaleEnumFactory());
1560            this.scale.setValue(value);
1561          }
1562          return this;
1563        }
1564
1565        /**
1566         * @return {@link #duration} (Storage timeperiod.)
1567         */
1568        public Period getDuration() { 
1569          if (this.duration == null)
1570            if (Configuration.errorOnAutoCreate())
1571              throw new Error("Attempt to auto-create BiologicallyDerivedProductStorageComponent.duration");
1572            else if (Configuration.doAutoCreate())
1573              this.duration = new Period(); // cc
1574          return this.duration;
1575        }
1576
1577        public boolean hasDuration() { 
1578          return this.duration != null && !this.duration.isEmpty();
1579        }
1580
1581        /**
1582         * @param value {@link #duration} (Storage timeperiod.)
1583         */
1584        public BiologicallyDerivedProductStorageComponent setDuration(Period value) { 
1585          this.duration = value;
1586          return this;
1587        }
1588
1589        protected void listChildren(List<Property> children) {
1590          super.listChildren(children);
1591          children.add(new Property("description", "string", "Description of storage.", 0, 1, description));
1592          children.add(new Property("temperature", "decimal", "Storage temperature.", 0, 1, temperature));
1593          children.add(new Property("scale", "code", "Temperature scale used.", 0, 1, scale));
1594          children.add(new Property("duration", "Period", "Storage timeperiod.", 0, 1, duration));
1595        }
1596
1597        @Override
1598        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1599          switch (_hash) {
1600          case -1724546052: /*description*/  return new Property("description", "string", "Description of storage.", 0, 1, description);
1601          case 321701236: /*temperature*/  return new Property("temperature", "decimal", "Storage temperature.", 0, 1, temperature);
1602          case 109250890: /*scale*/  return new Property("scale", "code", "Temperature scale used.", 0, 1, scale);
1603          case -1992012396: /*duration*/  return new Property("duration", "Period", "Storage timeperiod.", 0, 1, duration);
1604          default: return super.getNamedProperty(_hash, _name, _checkValid);
1605          }
1606
1607        }
1608
1609      @Override
1610      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1611        switch (hash) {
1612        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1613        case 321701236: /*temperature*/ return this.temperature == null ? new Base[0] : new Base[] {this.temperature}; // DecimalType
1614        case 109250890: /*scale*/ return this.scale == null ? new Base[0] : new Base[] {this.scale}; // Enumeration<BiologicallyDerivedProductStorageScale>
1615        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Period
1616        default: return super.getProperty(hash, name, checkValid);
1617        }
1618
1619      }
1620
1621      @Override
1622      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1623        switch (hash) {
1624        case -1724546052: // description
1625          this.description = castToString(value); // StringType
1626          return value;
1627        case 321701236: // temperature
1628          this.temperature = castToDecimal(value); // DecimalType
1629          return value;
1630        case 109250890: // scale
1631          value = new BiologicallyDerivedProductStorageScaleEnumFactory().fromType(castToCode(value));
1632          this.scale = (Enumeration) value; // Enumeration<BiologicallyDerivedProductStorageScale>
1633          return value;
1634        case -1992012396: // duration
1635          this.duration = castToPeriod(value); // Period
1636          return value;
1637        default: return super.setProperty(hash, name, value);
1638        }
1639
1640      }
1641
1642      @Override
1643      public Base setProperty(String name, Base value) throws FHIRException {
1644        if (name.equals("description")) {
1645          this.description = castToString(value); // StringType
1646        } else if (name.equals("temperature")) {
1647          this.temperature = castToDecimal(value); // DecimalType
1648        } else if (name.equals("scale")) {
1649          value = new BiologicallyDerivedProductStorageScaleEnumFactory().fromType(castToCode(value));
1650          this.scale = (Enumeration) value; // Enumeration<BiologicallyDerivedProductStorageScale>
1651        } else if (name.equals("duration")) {
1652          this.duration = castToPeriod(value); // Period
1653        } else
1654          return super.setProperty(name, value);
1655        return value;
1656      }
1657
1658      @Override
1659      public Base makeProperty(int hash, String name) throws FHIRException {
1660        switch (hash) {
1661        case -1724546052:  return getDescriptionElement();
1662        case 321701236:  return getTemperatureElement();
1663        case 109250890:  return getScaleElement();
1664        case -1992012396:  return getDuration(); 
1665        default: return super.makeProperty(hash, name);
1666        }
1667
1668      }
1669
1670      @Override
1671      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1672        switch (hash) {
1673        case -1724546052: /*description*/ return new String[] {"string"};
1674        case 321701236: /*temperature*/ return new String[] {"decimal"};
1675        case 109250890: /*scale*/ return new String[] {"code"};
1676        case -1992012396: /*duration*/ return new String[] {"Period"};
1677        default: return super.getTypesForProperty(hash, name);
1678        }
1679
1680      }
1681
1682      @Override
1683      public Base addChild(String name) throws FHIRException {
1684        if (name.equals("description")) {
1685          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.description");
1686        }
1687        else if (name.equals("temperature")) {
1688          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.temperature");
1689        }
1690        else if (name.equals("scale")) {
1691          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.scale");
1692        }
1693        else if (name.equals("duration")) {
1694          this.duration = new Period();
1695          return this.duration;
1696        }
1697        else
1698          return super.addChild(name);
1699      }
1700
1701      public BiologicallyDerivedProductStorageComponent copy() {
1702        BiologicallyDerivedProductStorageComponent dst = new BiologicallyDerivedProductStorageComponent();
1703        copyValues(dst);
1704        return dst;
1705      }
1706
1707      public void copyValues(BiologicallyDerivedProductStorageComponent dst) {
1708        super.copyValues(dst);
1709        dst.description = description == null ? null : description.copy();
1710        dst.temperature = temperature == null ? null : temperature.copy();
1711        dst.scale = scale == null ? null : scale.copy();
1712        dst.duration = duration == null ? null : duration.copy();
1713      }
1714
1715      @Override
1716      public boolean equalsDeep(Base other_) {
1717        if (!super.equalsDeep(other_))
1718          return false;
1719        if (!(other_ instanceof BiologicallyDerivedProductStorageComponent))
1720          return false;
1721        BiologicallyDerivedProductStorageComponent o = (BiologicallyDerivedProductStorageComponent) other_;
1722        return compareDeep(description, o.description, true) && compareDeep(temperature, o.temperature, true)
1723           && compareDeep(scale, o.scale, true) && compareDeep(duration, o.duration, true);
1724      }
1725
1726      @Override
1727      public boolean equalsShallow(Base other_) {
1728        if (!super.equalsShallow(other_))
1729          return false;
1730        if (!(other_ instanceof BiologicallyDerivedProductStorageComponent))
1731          return false;
1732        BiologicallyDerivedProductStorageComponent o = (BiologicallyDerivedProductStorageComponent) other_;
1733        return compareValues(description, o.description, true) && compareValues(temperature, o.temperature, true)
1734           && compareValues(scale, o.scale, true);
1735      }
1736
1737      public boolean isEmpty() {
1738        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, temperature, scale
1739          , duration);
1740      }
1741
1742  public String fhirType() {
1743    return "BiologicallyDerivedProduct.storage";
1744
1745  }
1746
1747  }
1748
1749    /**
1750     * This records identifiers associated with this biologically derived product instance that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).
1751     */
1752    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1753    @Description(shortDefinition="External ids for this item", formalDefinition="This records identifiers associated with this biologically derived product instance that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation)." )
1754    protected List<Identifier> identifier;
1755
1756    /**
1757     * Broad category of this product.
1758     */
1759    @Child(name = "productCategory", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1760    @Description(shortDefinition="organ | tissue | fluid | cells | biologicalAgent", formalDefinition="Broad category of this product." )
1761    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/product-category")
1762    protected Enumeration<BiologicallyDerivedProductCategory> productCategory;
1763
1764    /**
1765     * A code that identifies the kind of this biologically derived product (SNOMED Ctcode).
1766     */
1767    @Child(name = "productCode", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1768    @Description(shortDefinition="What this biologically derived product is", formalDefinition="A code that identifies the kind of this biologically derived product (SNOMED Ctcode)." )
1769    protected CodeableConcept productCode;
1770
1771    /**
1772     * Whether the product is currently available.
1773     */
1774    @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1775    @Description(shortDefinition="available | unavailable", formalDefinition="Whether the product is currently available." )
1776    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/product-status")
1777    protected Enumeration<BiologicallyDerivedProductStatus> status;
1778
1779    /**
1780     * Procedure request to obtain this biologically derived product.
1781     */
1782    @Child(name = "request", type = {ServiceRequest.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1783    @Description(shortDefinition="Procedure request", formalDefinition="Procedure request to obtain this biologically derived product." )
1784    protected List<Reference> request;
1785    /**
1786     * The actual objects that are the target of the reference (Procedure request to obtain this biologically derived product.)
1787     */
1788    protected List<ServiceRequest> requestTarget;
1789
1790
1791    /**
1792     * Number of discrete units within this product.
1793     */
1794    @Child(name = "quantity", type = {IntegerType.class}, order=5, min=0, max=1, modifier=false, summary=false)
1795    @Description(shortDefinition="The amount of this biologically derived product", formalDefinition="Number of discrete units within this product." )
1796    protected IntegerType quantity;
1797
1798    /**
1799     * Parent product (if any).
1800     */
1801    @Child(name = "parent", type = {BiologicallyDerivedProduct.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1802    @Description(shortDefinition="BiologicallyDerivedProduct parent", formalDefinition="Parent product (if any)." )
1803    protected List<Reference> parent;
1804    /**
1805     * The actual objects that are the target of the reference (Parent product (if any).)
1806     */
1807    protected List<BiologicallyDerivedProduct> parentTarget;
1808
1809
1810    /**
1811     * How this product was collected.
1812     */
1813    @Child(name = "collection", type = {}, order=7, min=0, max=1, modifier=false, summary=false)
1814    @Description(shortDefinition="How this product was collected", formalDefinition="How this product was collected." )
1815    protected BiologicallyDerivedProductCollectionComponent collection;
1816
1817    /**
1818     * Any processing of the product during collection that does not change the fundamental nature of the product. For example adding anti-coagulants during the collection of Peripheral Blood Stem Cells.
1819     */
1820    @Child(name = "processing", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1821    @Description(shortDefinition="Any processing of the product during collection", formalDefinition="Any processing of the product during collection that does not change the fundamental nature of the product. For example adding anti-coagulants during the collection of Peripheral Blood Stem Cells." )
1822    protected List<BiologicallyDerivedProductProcessingComponent> processing;
1823
1824    /**
1825     * Any manipulation of product post-collection that is intended to alter the product.  For example a buffy-coat enrichment or CD8 reduction of Peripheral Blood Stem Cells to make it more suitable for infusion.
1826     */
1827    @Child(name = "manipulation", type = {}, order=9, min=0, max=1, modifier=false, summary=false)
1828    @Description(shortDefinition="Any manipulation of product post-collection", formalDefinition="Any manipulation of product post-collection that is intended to alter the product.  For example a buffy-coat enrichment or CD8 reduction of Peripheral Blood Stem Cells to make it more suitable for infusion." )
1829    protected BiologicallyDerivedProductManipulationComponent manipulation;
1830
1831    /**
1832     * Product storage.
1833     */
1834    @Child(name = "storage", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1835    @Description(shortDefinition="Product storage", formalDefinition="Product storage." )
1836    protected List<BiologicallyDerivedProductStorageComponent> storage;
1837
1838    private static final long serialVersionUID = -1367034547L;
1839
1840  /**
1841   * Constructor
1842   */
1843    public BiologicallyDerivedProduct() {
1844      super();
1845    }
1846
1847    /**
1848     * @return {@link #identifier} (This records identifiers associated with this biologically derived product instance that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).)
1849     */
1850    public List<Identifier> getIdentifier() { 
1851      if (this.identifier == null)
1852        this.identifier = new ArrayList<Identifier>();
1853      return this.identifier;
1854    }
1855
1856    /**
1857     * @return Returns a reference to <code>this</code> for easy method chaining
1858     */
1859    public BiologicallyDerivedProduct setIdentifier(List<Identifier> theIdentifier) { 
1860      this.identifier = theIdentifier;
1861      return this;
1862    }
1863
1864    public boolean hasIdentifier() { 
1865      if (this.identifier == null)
1866        return false;
1867      for (Identifier item : this.identifier)
1868        if (!item.isEmpty())
1869          return true;
1870      return false;
1871    }
1872
1873    public Identifier addIdentifier() { //3
1874      Identifier t = new Identifier();
1875      if (this.identifier == null)
1876        this.identifier = new ArrayList<Identifier>();
1877      this.identifier.add(t);
1878      return t;
1879    }
1880
1881    public BiologicallyDerivedProduct addIdentifier(Identifier t) { //3
1882      if (t == null)
1883        return this;
1884      if (this.identifier == null)
1885        this.identifier = new ArrayList<Identifier>();
1886      this.identifier.add(t);
1887      return this;
1888    }
1889
1890    /**
1891     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1892     */
1893    public Identifier getIdentifierFirstRep() { 
1894      if (getIdentifier().isEmpty()) {
1895        addIdentifier();
1896      }
1897      return getIdentifier().get(0);
1898    }
1899
1900    /**
1901     * @return {@link #productCategory} (Broad category of this product.). This is the underlying object with id, value and extensions. The accessor "getProductCategory" gives direct access to the value
1902     */
1903    public Enumeration<BiologicallyDerivedProductCategory> getProductCategoryElement() { 
1904      if (this.productCategory == null)
1905        if (Configuration.errorOnAutoCreate())
1906          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.productCategory");
1907        else if (Configuration.doAutoCreate())
1908          this.productCategory = new Enumeration<BiologicallyDerivedProductCategory>(new BiologicallyDerivedProductCategoryEnumFactory()); // bb
1909      return this.productCategory;
1910    }
1911
1912    public boolean hasProductCategoryElement() { 
1913      return this.productCategory != null && !this.productCategory.isEmpty();
1914    }
1915
1916    public boolean hasProductCategory() { 
1917      return this.productCategory != null && !this.productCategory.isEmpty();
1918    }
1919
1920    /**
1921     * @param value {@link #productCategory} (Broad category of this product.). This is the underlying object with id, value and extensions. The accessor "getProductCategory" gives direct access to the value
1922     */
1923    public BiologicallyDerivedProduct setProductCategoryElement(Enumeration<BiologicallyDerivedProductCategory> value) { 
1924      this.productCategory = value;
1925      return this;
1926    }
1927
1928    /**
1929     * @return Broad category of this product.
1930     */
1931    public BiologicallyDerivedProductCategory getProductCategory() { 
1932      return this.productCategory == null ? null : this.productCategory.getValue();
1933    }
1934
1935    /**
1936     * @param value Broad category of this product.
1937     */
1938    public BiologicallyDerivedProduct setProductCategory(BiologicallyDerivedProductCategory value) { 
1939      if (value == null)
1940        this.productCategory = null;
1941      else {
1942        if (this.productCategory == null)
1943          this.productCategory = new Enumeration<BiologicallyDerivedProductCategory>(new BiologicallyDerivedProductCategoryEnumFactory());
1944        this.productCategory.setValue(value);
1945      }
1946      return this;
1947    }
1948
1949    /**
1950     * @return {@link #productCode} (A code that identifies the kind of this biologically derived product (SNOMED Ctcode).)
1951     */
1952    public CodeableConcept getProductCode() { 
1953      if (this.productCode == null)
1954        if (Configuration.errorOnAutoCreate())
1955          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.productCode");
1956        else if (Configuration.doAutoCreate())
1957          this.productCode = new CodeableConcept(); // cc
1958      return this.productCode;
1959    }
1960
1961    public boolean hasProductCode() { 
1962      return this.productCode != null && !this.productCode.isEmpty();
1963    }
1964
1965    /**
1966     * @param value {@link #productCode} (A code that identifies the kind of this biologically derived product (SNOMED Ctcode).)
1967     */
1968    public BiologicallyDerivedProduct setProductCode(CodeableConcept value) { 
1969      this.productCode = value;
1970      return this;
1971    }
1972
1973    /**
1974     * @return {@link #status} (Whether the product is currently available.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1975     */
1976    public Enumeration<BiologicallyDerivedProductStatus> getStatusElement() { 
1977      if (this.status == null)
1978        if (Configuration.errorOnAutoCreate())
1979          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.status");
1980        else if (Configuration.doAutoCreate())
1981          this.status = new Enumeration<BiologicallyDerivedProductStatus>(new BiologicallyDerivedProductStatusEnumFactory()); // bb
1982      return this.status;
1983    }
1984
1985    public boolean hasStatusElement() { 
1986      return this.status != null && !this.status.isEmpty();
1987    }
1988
1989    public boolean hasStatus() { 
1990      return this.status != null && !this.status.isEmpty();
1991    }
1992
1993    /**
1994     * @param value {@link #status} (Whether the product is currently available.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1995     */
1996    public BiologicallyDerivedProduct setStatusElement(Enumeration<BiologicallyDerivedProductStatus> value) { 
1997      this.status = value;
1998      return this;
1999    }
2000
2001    /**
2002     * @return Whether the product is currently available.
2003     */
2004    public BiologicallyDerivedProductStatus getStatus() { 
2005      return this.status == null ? null : this.status.getValue();
2006    }
2007
2008    /**
2009     * @param value Whether the product is currently available.
2010     */
2011    public BiologicallyDerivedProduct setStatus(BiologicallyDerivedProductStatus value) { 
2012      if (value == null)
2013        this.status = null;
2014      else {
2015        if (this.status == null)
2016          this.status = new Enumeration<BiologicallyDerivedProductStatus>(new BiologicallyDerivedProductStatusEnumFactory());
2017        this.status.setValue(value);
2018      }
2019      return this;
2020    }
2021
2022    /**
2023     * @return {@link #request} (Procedure request to obtain this biologically derived product.)
2024     */
2025    public List<Reference> getRequest() { 
2026      if (this.request == null)
2027        this.request = new ArrayList<Reference>();
2028      return this.request;
2029    }
2030
2031    /**
2032     * @return Returns a reference to <code>this</code> for easy method chaining
2033     */
2034    public BiologicallyDerivedProduct setRequest(List<Reference> theRequest) { 
2035      this.request = theRequest;
2036      return this;
2037    }
2038
2039    public boolean hasRequest() { 
2040      if (this.request == null)
2041        return false;
2042      for (Reference item : this.request)
2043        if (!item.isEmpty())
2044          return true;
2045      return false;
2046    }
2047
2048    public Reference addRequest() { //3
2049      Reference t = new Reference();
2050      if (this.request == null)
2051        this.request = new ArrayList<Reference>();
2052      this.request.add(t);
2053      return t;
2054    }
2055
2056    public BiologicallyDerivedProduct addRequest(Reference t) { //3
2057      if (t == null)
2058        return this;
2059      if (this.request == null)
2060        this.request = new ArrayList<Reference>();
2061      this.request.add(t);
2062      return this;
2063    }
2064
2065    /**
2066     * @return The first repetition of repeating field {@link #request}, creating it if it does not already exist
2067     */
2068    public Reference getRequestFirstRep() { 
2069      if (getRequest().isEmpty()) {
2070        addRequest();
2071      }
2072      return getRequest().get(0);
2073    }
2074
2075    /**
2076     * @deprecated Use Reference#setResource(IBaseResource) instead
2077     */
2078    @Deprecated
2079    public List<ServiceRequest> getRequestTarget() { 
2080      if (this.requestTarget == null)
2081        this.requestTarget = new ArrayList<ServiceRequest>();
2082      return this.requestTarget;
2083    }
2084
2085    /**
2086     * @deprecated Use Reference#setResource(IBaseResource) instead
2087     */
2088    @Deprecated
2089    public ServiceRequest addRequestTarget() { 
2090      ServiceRequest r = new ServiceRequest();
2091      if (this.requestTarget == null)
2092        this.requestTarget = new ArrayList<ServiceRequest>();
2093      this.requestTarget.add(r);
2094      return r;
2095    }
2096
2097    /**
2098     * @return {@link #quantity} (Number of discrete units within this product.). This is the underlying object with id, value and extensions. The accessor "getQuantity" gives direct access to the value
2099     */
2100    public IntegerType getQuantityElement() { 
2101      if (this.quantity == null)
2102        if (Configuration.errorOnAutoCreate())
2103          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.quantity");
2104        else if (Configuration.doAutoCreate())
2105          this.quantity = new IntegerType(); // bb
2106      return this.quantity;
2107    }
2108
2109    public boolean hasQuantityElement() { 
2110      return this.quantity != null && !this.quantity.isEmpty();
2111    }
2112
2113    public boolean hasQuantity() { 
2114      return this.quantity != null && !this.quantity.isEmpty();
2115    }
2116
2117    /**
2118     * @param value {@link #quantity} (Number of discrete units within this product.). This is the underlying object with id, value and extensions. The accessor "getQuantity" gives direct access to the value
2119     */
2120    public BiologicallyDerivedProduct setQuantityElement(IntegerType value) { 
2121      this.quantity = value;
2122      return this;
2123    }
2124
2125    /**
2126     * @return Number of discrete units within this product.
2127     */
2128    public int getQuantity() { 
2129      return this.quantity == null || this.quantity.isEmpty() ? 0 : this.quantity.getValue();
2130    }
2131
2132    /**
2133     * @param value Number of discrete units within this product.
2134     */
2135    public BiologicallyDerivedProduct setQuantity(int value) { 
2136        if (this.quantity == null)
2137          this.quantity = new IntegerType();
2138        this.quantity.setValue(value);
2139      return this;
2140    }
2141
2142    /**
2143     * @return {@link #parent} (Parent product (if any).)
2144     */
2145    public List<Reference> getParent() { 
2146      if (this.parent == null)
2147        this.parent = new ArrayList<Reference>();
2148      return this.parent;
2149    }
2150
2151    /**
2152     * @return Returns a reference to <code>this</code> for easy method chaining
2153     */
2154    public BiologicallyDerivedProduct setParent(List<Reference> theParent) { 
2155      this.parent = theParent;
2156      return this;
2157    }
2158
2159    public boolean hasParent() { 
2160      if (this.parent == null)
2161        return false;
2162      for (Reference item : this.parent)
2163        if (!item.isEmpty())
2164          return true;
2165      return false;
2166    }
2167
2168    public Reference addParent() { //3
2169      Reference t = new Reference();
2170      if (this.parent == null)
2171        this.parent = new ArrayList<Reference>();
2172      this.parent.add(t);
2173      return t;
2174    }
2175
2176    public BiologicallyDerivedProduct addParent(Reference t) { //3
2177      if (t == null)
2178        return this;
2179      if (this.parent == null)
2180        this.parent = new ArrayList<Reference>();
2181      this.parent.add(t);
2182      return this;
2183    }
2184
2185    /**
2186     * @return The first repetition of repeating field {@link #parent}, creating it if it does not already exist
2187     */
2188    public Reference getParentFirstRep() { 
2189      if (getParent().isEmpty()) {
2190        addParent();
2191      }
2192      return getParent().get(0);
2193    }
2194
2195    /**
2196     * @deprecated Use Reference#setResource(IBaseResource) instead
2197     */
2198    @Deprecated
2199    public List<BiologicallyDerivedProduct> getParentTarget() { 
2200      if (this.parentTarget == null)
2201        this.parentTarget = new ArrayList<BiologicallyDerivedProduct>();
2202      return this.parentTarget;
2203    }
2204
2205    /**
2206     * @deprecated Use Reference#setResource(IBaseResource) instead
2207     */
2208    @Deprecated
2209    public BiologicallyDerivedProduct addParentTarget() { 
2210      BiologicallyDerivedProduct r = new BiologicallyDerivedProduct();
2211      if (this.parentTarget == null)
2212        this.parentTarget = new ArrayList<BiologicallyDerivedProduct>();
2213      this.parentTarget.add(r);
2214      return r;
2215    }
2216
2217    /**
2218     * @return {@link #collection} (How this product was collected.)
2219     */
2220    public BiologicallyDerivedProductCollectionComponent getCollection() { 
2221      if (this.collection == null)
2222        if (Configuration.errorOnAutoCreate())
2223          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.collection");
2224        else if (Configuration.doAutoCreate())
2225          this.collection = new BiologicallyDerivedProductCollectionComponent(); // cc
2226      return this.collection;
2227    }
2228
2229    public boolean hasCollection() { 
2230      return this.collection != null && !this.collection.isEmpty();
2231    }
2232
2233    /**
2234     * @param value {@link #collection} (How this product was collected.)
2235     */
2236    public BiologicallyDerivedProduct setCollection(BiologicallyDerivedProductCollectionComponent value) { 
2237      this.collection = value;
2238      return this;
2239    }
2240
2241    /**
2242     * @return {@link #processing} (Any processing of the product during collection that does not change the fundamental nature of the product. For example adding anti-coagulants during the collection of Peripheral Blood Stem Cells.)
2243     */
2244    public List<BiologicallyDerivedProductProcessingComponent> getProcessing() { 
2245      if (this.processing == null)
2246        this.processing = new ArrayList<BiologicallyDerivedProductProcessingComponent>();
2247      return this.processing;
2248    }
2249
2250    /**
2251     * @return Returns a reference to <code>this</code> for easy method chaining
2252     */
2253    public BiologicallyDerivedProduct setProcessing(List<BiologicallyDerivedProductProcessingComponent> theProcessing) { 
2254      this.processing = theProcessing;
2255      return this;
2256    }
2257
2258    public boolean hasProcessing() { 
2259      if (this.processing == null)
2260        return false;
2261      for (BiologicallyDerivedProductProcessingComponent item : this.processing)
2262        if (!item.isEmpty())
2263          return true;
2264      return false;
2265    }
2266
2267    public BiologicallyDerivedProductProcessingComponent addProcessing() { //3
2268      BiologicallyDerivedProductProcessingComponent t = new BiologicallyDerivedProductProcessingComponent();
2269      if (this.processing == null)
2270        this.processing = new ArrayList<BiologicallyDerivedProductProcessingComponent>();
2271      this.processing.add(t);
2272      return t;
2273    }
2274
2275    public BiologicallyDerivedProduct addProcessing(BiologicallyDerivedProductProcessingComponent t) { //3
2276      if (t == null)
2277        return this;
2278      if (this.processing == null)
2279        this.processing = new ArrayList<BiologicallyDerivedProductProcessingComponent>();
2280      this.processing.add(t);
2281      return this;
2282    }
2283
2284    /**
2285     * @return The first repetition of repeating field {@link #processing}, creating it if it does not already exist
2286     */
2287    public BiologicallyDerivedProductProcessingComponent getProcessingFirstRep() { 
2288      if (getProcessing().isEmpty()) {
2289        addProcessing();
2290      }
2291      return getProcessing().get(0);
2292    }
2293
2294    /**
2295     * @return {@link #manipulation} (Any manipulation of product post-collection that is intended to alter the product.  For example a buffy-coat enrichment or CD8 reduction of Peripheral Blood Stem Cells to make it more suitable for infusion.)
2296     */
2297    public BiologicallyDerivedProductManipulationComponent getManipulation() { 
2298      if (this.manipulation == null)
2299        if (Configuration.errorOnAutoCreate())
2300          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.manipulation");
2301        else if (Configuration.doAutoCreate())
2302          this.manipulation = new BiologicallyDerivedProductManipulationComponent(); // cc
2303      return this.manipulation;
2304    }
2305
2306    public boolean hasManipulation() { 
2307      return this.manipulation != null && !this.manipulation.isEmpty();
2308    }
2309
2310    /**
2311     * @param value {@link #manipulation} (Any manipulation of product post-collection that is intended to alter the product.  For example a buffy-coat enrichment or CD8 reduction of Peripheral Blood Stem Cells to make it more suitable for infusion.)
2312     */
2313    public BiologicallyDerivedProduct setManipulation(BiologicallyDerivedProductManipulationComponent value) { 
2314      this.manipulation = value;
2315      return this;
2316    }
2317
2318    /**
2319     * @return {@link #storage} (Product storage.)
2320     */
2321    public List<BiologicallyDerivedProductStorageComponent> getStorage() { 
2322      if (this.storage == null)
2323        this.storage = new ArrayList<BiologicallyDerivedProductStorageComponent>();
2324      return this.storage;
2325    }
2326
2327    /**
2328     * @return Returns a reference to <code>this</code> for easy method chaining
2329     */
2330    public BiologicallyDerivedProduct setStorage(List<BiologicallyDerivedProductStorageComponent> theStorage) { 
2331      this.storage = theStorage;
2332      return this;
2333    }
2334
2335    public boolean hasStorage() { 
2336      if (this.storage == null)
2337        return false;
2338      for (BiologicallyDerivedProductStorageComponent item : this.storage)
2339        if (!item.isEmpty())
2340          return true;
2341      return false;
2342    }
2343
2344    public BiologicallyDerivedProductStorageComponent addStorage() { //3
2345      BiologicallyDerivedProductStorageComponent t = new BiologicallyDerivedProductStorageComponent();
2346      if (this.storage == null)
2347        this.storage = new ArrayList<BiologicallyDerivedProductStorageComponent>();
2348      this.storage.add(t);
2349      return t;
2350    }
2351
2352    public BiologicallyDerivedProduct addStorage(BiologicallyDerivedProductStorageComponent t) { //3
2353      if (t == null)
2354        return this;
2355      if (this.storage == null)
2356        this.storage = new ArrayList<BiologicallyDerivedProductStorageComponent>();
2357      this.storage.add(t);
2358      return this;
2359    }
2360
2361    /**
2362     * @return The first repetition of repeating field {@link #storage}, creating it if it does not already exist
2363     */
2364    public BiologicallyDerivedProductStorageComponent getStorageFirstRep() { 
2365      if (getStorage().isEmpty()) {
2366        addStorage();
2367      }
2368      return getStorage().get(0);
2369    }
2370
2371      protected void listChildren(List<Property> children) {
2372        super.listChildren(children);
2373        children.add(new Property("identifier", "Identifier", "This records identifiers associated with this biologically derived product instance that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier));
2374        children.add(new Property("productCategory", "code", "Broad category of this product.", 0, 1, productCategory));
2375        children.add(new Property("productCode", "CodeableConcept", "A code that identifies the kind of this biologically derived product (SNOMED Ctcode).", 0, 1, productCode));
2376        children.add(new Property("status", "code", "Whether the product is currently available.", 0, 1, status));
2377        children.add(new Property("request", "Reference(ServiceRequest)", "Procedure request to obtain this biologically derived product.", 0, java.lang.Integer.MAX_VALUE, request));
2378        children.add(new Property("quantity", "integer", "Number of discrete units within this product.", 0, 1, quantity));
2379        children.add(new Property("parent", "Reference(BiologicallyDerivedProduct)", "Parent product (if any).", 0, java.lang.Integer.MAX_VALUE, parent));
2380        children.add(new Property("collection", "", "How this product was collected.", 0, 1, collection));
2381        children.add(new Property("processing", "", "Any processing of the product during collection that does not change the fundamental nature of the product. For example adding anti-coagulants during the collection of Peripheral Blood Stem Cells.", 0, java.lang.Integer.MAX_VALUE, processing));
2382        children.add(new Property("manipulation", "", "Any manipulation of product post-collection that is intended to alter the product.  For example a buffy-coat enrichment or CD8 reduction of Peripheral Blood Stem Cells to make it more suitable for infusion.", 0, 1, manipulation));
2383        children.add(new Property("storage", "", "Product storage.", 0, java.lang.Integer.MAX_VALUE, storage));
2384      }
2385
2386      @Override
2387      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2388        switch (_hash) {
2389        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "This records identifiers associated with this biologically derived product instance that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).", 0, java.lang.Integer.MAX_VALUE, identifier);
2390        case 197299981: /*productCategory*/  return new Property("productCategory", "code", "Broad category of this product.", 0, 1, productCategory);
2391        case -1492131972: /*productCode*/  return new Property("productCode", "CodeableConcept", "A code that identifies the kind of this biologically derived product (SNOMED Ctcode).", 0, 1, productCode);
2392        case -892481550: /*status*/  return new Property("status", "code", "Whether the product is currently available.", 0, 1, status);
2393        case 1095692943: /*request*/  return new Property("request", "Reference(ServiceRequest)", "Procedure request to obtain this biologically derived product.", 0, java.lang.Integer.MAX_VALUE, request);
2394        case -1285004149: /*quantity*/  return new Property("quantity", "integer", "Number of discrete units within this product.", 0, 1, quantity);
2395        case -995424086: /*parent*/  return new Property("parent", "Reference(BiologicallyDerivedProduct)", "Parent product (if any).", 0, java.lang.Integer.MAX_VALUE, parent);
2396        case -1741312354: /*collection*/  return new Property("collection", "", "How this product was collected.", 0, 1, collection);
2397        case 422194963: /*processing*/  return new Property("processing", "", "Any processing of the product during collection that does not change the fundamental nature of the product. For example adding anti-coagulants during the collection of Peripheral Blood Stem Cells.", 0, java.lang.Integer.MAX_VALUE, processing);
2398        case -696214627: /*manipulation*/  return new Property("manipulation", "", "Any manipulation of product post-collection that is intended to alter the product.  For example a buffy-coat enrichment or CD8 reduction of Peripheral Blood Stem Cells to make it more suitable for infusion.", 0, 1, manipulation);
2399        case -1884274053: /*storage*/  return new Property("storage", "", "Product storage.", 0, java.lang.Integer.MAX_VALUE, storage);
2400        default: return super.getNamedProperty(_hash, _name, _checkValid);
2401        }
2402
2403      }
2404
2405      @Override
2406      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2407        switch (hash) {
2408        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2409        case 197299981: /*productCategory*/ return this.productCategory == null ? new Base[0] : new Base[] {this.productCategory}; // Enumeration<BiologicallyDerivedProductCategory>
2410        case -1492131972: /*productCode*/ return this.productCode == null ? new Base[0] : new Base[] {this.productCode}; // CodeableConcept
2411        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<BiologicallyDerivedProductStatus>
2412        case 1095692943: /*request*/ return this.request == null ? new Base[0] : this.request.toArray(new Base[this.request.size()]); // Reference
2413        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // IntegerType
2414        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : this.parent.toArray(new Base[this.parent.size()]); // Reference
2415        case -1741312354: /*collection*/ return this.collection == null ? new Base[0] : new Base[] {this.collection}; // BiologicallyDerivedProductCollectionComponent
2416        case 422194963: /*processing*/ return this.processing == null ? new Base[0] : this.processing.toArray(new Base[this.processing.size()]); // BiologicallyDerivedProductProcessingComponent
2417        case -696214627: /*manipulation*/ return this.manipulation == null ? new Base[0] : new Base[] {this.manipulation}; // BiologicallyDerivedProductManipulationComponent
2418        case -1884274053: /*storage*/ return this.storage == null ? new Base[0] : this.storage.toArray(new Base[this.storage.size()]); // BiologicallyDerivedProductStorageComponent
2419        default: return super.getProperty(hash, name, checkValid);
2420        }
2421
2422      }
2423
2424      @Override
2425      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2426        switch (hash) {
2427        case -1618432855: // identifier
2428          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2429          return value;
2430        case 197299981: // productCategory
2431          value = new BiologicallyDerivedProductCategoryEnumFactory().fromType(castToCode(value));
2432          this.productCategory = (Enumeration) value; // Enumeration<BiologicallyDerivedProductCategory>
2433          return value;
2434        case -1492131972: // productCode
2435          this.productCode = castToCodeableConcept(value); // CodeableConcept
2436          return value;
2437        case -892481550: // status
2438          value = new BiologicallyDerivedProductStatusEnumFactory().fromType(castToCode(value));
2439          this.status = (Enumeration) value; // Enumeration<BiologicallyDerivedProductStatus>
2440          return value;
2441        case 1095692943: // request
2442          this.getRequest().add(castToReference(value)); // Reference
2443          return value;
2444        case -1285004149: // quantity
2445          this.quantity = castToInteger(value); // IntegerType
2446          return value;
2447        case -995424086: // parent
2448          this.getParent().add(castToReference(value)); // Reference
2449          return value;
2450        case -1741312354: // collection
2451          this.collection = (BiologicallyDerivedProductCollectionComponent) value; // BiologicallyDerivedProductCollectionComponent
2452          return value;
2453        case 422194963: // processing
2454          this.getProcessing().add((BiologicallyDerivedProductProcessingComponent) value); // BiologicallyDerivedProductProcessingComponent
2455          return value;
2456        case -696214627: // manipulation
2457          this.manipulation = (BiologicallyDerivedProductManipulationComponent) value; // BiologicallyDerivedProductManipulationComponent
2458          return value;
2459        case -1884274053: // storage
2460          this.getStorage().add((BiologicallyDerivedProductStorageComponent) value); // BiologicallyDerivedProductStorageComponent
2461          return value;
2462        default: return super.setProperty(hash, name, value);
2463        }
2464
2465      }
2466
2467      @Override
2468      public Base setProperty(String name, Base value) throws FHIRException {
2469        if (name.equals("identifier")) {
2470          this.getIdentifier().add(castToIdentifier(value));
2471        } else if (name.equals("productCategory")) {
2472          value = new BiologicallyDerivedProductCategoryEnumFactory().fromType(castToCode(value));
2473          this.productCategory = (Enumeration) value; // Enumeration<BiologicallyDerivedProductCategory>
2474        } else if (name.equals("productCode")) {
2475          this.productCode = castToCodeableConcept(value); // CodeableConcept
2476        } else if (name.equals("status")) {
2477          value = new BiologicallyDerivedProductStatusEnumFactory().fromType(castToCode(value));
2478          this.status = (Enumeration) value; // Enumeration<BiologicallyDerivedProductStatus>
2479        } else if (name.equals("request")) {
2480          this.getRequest().add(castToReference(value));
2481        } else if (name.equals("quantity")) {
2482          this.quantity = castToInteger(value); // IntegerType
2483        } else if (name.equals("parent")) {
2484          this.getParent().add(castToReference(value));
2485        } else if (name.equals("collection")) {
2486          this.collection = (BiologicallyDerivedProductCollectionComponent) value; // BiologicallyDerivedProductCollectionComponent
2487        } else if (name.equals("processing")) {
2488          this.getProcessing().add((BiologicallyDerivedProductProcessingComponent) value);
2489        } else if (name.equals("manipulation")) {
2490          this.manipulation = (BiologicallyDerivedProductManipulationComponent) value; // BiologicallyDerivedProductManipulationComponent
2491        } else if (name.equals("storage")) {
2492          this.getStorage().add((BiologicallyDerivedProductStorageComponent) value);
2493        } else
2494          return super.setProperty(name, value);
2495        return value;
2496      }
2497
2498      @Override
2499      public Base makeProperty(int hash, String name) throws FHIRException {
2500        switch (hash) {
2501        case -1618432855:  return addIdentifier(); 
2502        case 197299981:  return getProductCategoryElement();
2503        case -1492131972:  return getProductCode(); 
2504        case -892481550:  return getStatusElement();
2505        case 1095692943:  return addRequest(); 
2506        case -1285004149:  return getQuantityElement();
2507        case -995424086:  return addParent(); 
2508        case -1741312354:  return getCollection(); 
2509        case 422194963:  return addProcessing(); 
2510        case -696214627:  return getManipulation(); 
2511        case -1884274053:  return addStorage(); 
2512        default: return super.makeProperty(hash, name);
2513        }
2514
2515      }
2516
2517      @Override
2518      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2519        switch (hash) {
2520        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2521        case 197299981: /*productCategory*/ return new String[] {"code"};
2522        case -1492131972: /*productCode*/ return new String[] {"CodeableConcept"};
2523        case -892481550: /*status*/ return new String[] {"code"};
2524        case 1095692943: /*request*/ return new String[] {"Reference"};
2525        case -1285004149: /*quantity*/ return new String[] {"integer"};
2526        case -995424086: /*parent*/ return new String[] {"Reference"};
2527        case -1741312354: /*collection*/ return new String[] {};
2528        case 422194963: /*processing*/ return new String[] {};
2529        case -696214627: /*manipulation*/ return new String[] {};
2530        case -1884274053: /*storage*/ return new String[] {};
2531        default: return super.getTypesForProperty(hash, name);
2532        }
2533
2534      }
2535
2536      @Override
2537      public Base addChild(String name) throws FHIRException {
2538        if (name.equals("identifier")) {
2539          return addIdentifier();
2540        }
2541        else if (name.equals("productCategory")) {
2542          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.productCategory");
2543        }
2544        else if (name.equals("productCode")) {
2545          this.productCode = new CodeableConcept();
2546          return this.productCode;
2547        }
2548        else if (name.equals("status")) {
2549          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.status");
2550        }
2551        else if (name.equals("request")) {
2552          return addRequest();
2553        }
2554        else if (name.equals("quantity")) {
2555          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.quantity");
2556        }
2557        else if (name.equals("parent")) {
2558          return addParent();
2559        }
2560        else if (name.equals("collection")) {
2561          this.collection = new BiologicallyDerivedProductCollectionComponent();
2562          return this.collection;
2563        }
2564        else if (name.equals("processing")) {
2565          return addProcessing();
2566        }
2567        else if (name.equals("manipulation")) {
2568          this.manipulation = new BiologicallyDerivedProductManipulationComponent();
2569          return this.manipulation;
2570        }
2571        else if (name.equals("storage")) {
2572          return addStorage();
2573        }
2574        else
2575          return super.addChild(name);
2576      }
2577
2578  public String fhirType() {
2579    return "BiologicallyDerivedProduct";
2580
2581  }
2582
2583      public BiologicallyDerivedProduct copy() {
2584        BiologicallyDerivedProduct dst = new BiologicallyDerivedProduct();
2585        copyValues(dst);
2586        return dst;
2587      }
2588
2589      public void copyValues(BiologicallyDerivedProduct dst) {
2590        super.copyValues(dst);
2591        if (identifier != null) {
2592          dst.identifier = new ArrayList<Identifier>();
2593          for (Identifier i : identifier)
2594            dst.identifier.add(i.copy());
2595        };
2596        dst.productCategory = productCategory == null ? null : productCategory.copy();
2597        dst.productCode = productCode == null ? null : productCode.copy();
2598        dst.status = status == null ? null : status.copy();
2599        if (request != null) {
2600          dst.request = new ArrayList<Reference>();
2601          for (Reference i : request)
2602            dst.request.add(i.copy());
2603        };
2604        dst.quantity = quantity == null ? null : quantity.copy();
2605        if (parent != null) {
2606          dst.parent = new ArrayList<Reference>();
2607          for (Reference i : parent)
2608            dst.parent.add(i.copy());
2609        };
2610        dst.collection = collection == null ? null : collection.copy();
2611        if (processing != null) {
2612          dst.processing = new ArrayList<BiologicallyDerivedProductProcessingComponent>();
2613          for (BiologicallyDerivedProductProcessingComponent i : processing)
2614            dst.processing.add(i.copy());
2615        };
2616        dst.manipulation = manipulation == null ? null : manipulation.copy();
2617        if (storage != null) {
2618          dst.storage = new ArrayList<BiologicallyDerivedProductStorageComponent>();
2619          for (BiologicallyDerivedProductStorageComponent i : storage)
2620            dst.storage.add(i.copy());
2621        };
2622      }
2623
2624      protected BiologicallyDerivedProduct typedCopy() {
2625        return copy();
2626      }
2627
2628      @Override
2629      public boolean equalsDeep(Base other_) {
2630        if (!super.equalsDeep(other_))
2631          return false;
2632        if (!(other_ instanceof BiologicallyDerivedProduct))
2633          return false;
2634        BiologicallyDerivedProduct o = (BiologicallyDerivedProduct) other_;
2635        return compareDeep(identifier, o.identifier, true) && compareDeep(productCategory, o.productCategory, true)
2636           && compareDeep(productCode, o.productCode, true) && compareDeep(status, o.status, true) && compareDeep(request, o.request, true)
2637           && compareDeep(quantity, o.quantity, true) && compareDeep(parent, o.parent, true) && compareDeep(collection, o.collection, true)
2638           && compareDeep(processing, o.processing, true) && compareDeep(manipulation, o.manipulation, true)
2639           && compareDeep(storage, o.storage, true);
2640      }
2641
2642      @Override
2643      public boolean equalsShallow(Base other_) {
2644        if (!super.equalsShallow(other_))
2645          return false;
2646        if (!(other_ instanceof BiologicallyDerivedProduct))
2647          return false;
2648        BiologicallyDerivedProduct o = (BiologicallyDerivedProduct) other_;
2649        return compareValues(productCategory, o.productCategory, true) && compareValues(status, o.status, true)
2650           && compareValues(quantity, o.quantity, true);
2651      }
2652
2653      public boolean isEmpty() {
2654        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, productCategory
2655          , productCode, status, request, quantity, parent, collection, processing, manipulation
2656          , storage);
2657      }
2658
2659  @Override
2660  public ResourceType getResourceType() {
2661    return ResourceType.BiologicallyDerivedProduct;
2662   }
2663
2664
2665}