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