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