001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A biological material originating from a biological entity intended to be transplanted or infused into another (possibly the same) biological entity.
052 */
053@ResourceDef(name="BiologicallyDerivedProduct", profile="http://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProduct")
054public class BiologicallyDerivedProduct extends DomainResource {
055
056    public enum BiologicallyDerivedProductCategory {
057        /**
058         * A collection of tissues joined in a structural unit to serve a common function.
059         */
060        ORGAN, 
061        /**
062         * An ensemble of similar cells and their extracellular matrix from the same origin that together carry out a specific function.
063         */
064        TISSUE, 
065        /**
066         * Body fluid.
067         */
068        FLUID, 
069        /**
070         * Collection of cells.
071         */
072        CELLS, 
073        /**
074         * Biological agent of unspecified type.
075         */
076        BIOLOGICALAGENT, 
077        /**
078         * added to help the parsers with the generic types
079         */
080        NULL;
081        public static BiologicallyDerivedProductCategory fromCode(String codeString) throws FHIRException {
082            if (codeString == null || "".equals(codeString))
083                return null;
084        if ("organ".equals(codeString))
085          return ORGAN;
086        if ("tissue".equals(codeString))
087          return TISSUE;
088        if ("fluid".equals(codeString))
089          return FLUID;
090        if ("cells".equals(codeString))
091          return CELLS;
092        if ("biologicalAgent".equals(codeString))
093          return BIOLOGICALAGENT;
094        if (Configuration.isAcceptInvalidEnums())
095          return null;
096        else
097          throw new FHIRException("Unknown BiologicallyDerivedProductCategory code '"+codeString+"'");
098        }
099        public String toCode() {
100          switch (this) {
101            case ORGAN: return "organ";
102            case TISSUE: return "tissue";
103            case FLUID: return "fluid";
104            case CELLS: return "cells";
105            case BIOLOGICALAGENT: return "biologicalAgent";
106            default: return "?";
107          }
108        }
109        public String getSystem() {
110          switch (this) {
111            case ORGAN: return "http://hl7.org/fhir/product-category";
112            case TISSUE: return "http://hl7.org/fhir/product-category";
113            case FLUID: return "http://hl7.org/fhir/product-category";
114            case CELLS: return "http://hl7.org/fhir/product-category";
115            case BIOLOGICALAGENT: return "http://hl7.org/fhir/product-category";
116            default: return "?";
117          }
118        }
119        public String getDefinition() {
120          switch (this) {
121            case ORGAN: return "A collection of tissues joined in a structural unit to serve a common function.";
122            case TISSUE: return "An ensemble of similar cells and their extracellular matrix from the same origin that together carry out a specific function.";
123            case FLUID: return "Body fluid.";
124            case CELLS: return "Collection of cells.";
125            case BIOLOGICALAGENT: return "Biological agent of unspecified type.";
126            default: return "?";
127          }
128        }
129        public String getDisplay() {
130          switch (this) {
131            case ORGAN: return "Organ";
132            case TISSUE: return "Tissue";
133            case FLUID: return "Fluid";
134            case CELLS: return "Cells";
135            case BIOLOGICALAGENT: return "BiologicalAgent";
136            default: return "?";
137          }
138        }
139    }
140
141  public static class BiologicallyDerivedProductCategoryEnumFactory implements EnumFactory<BiologicallyDerivedProductCategory> {
142    public BiologicallyDerivedProductCategory fromCode(String codeString) throws IllegalArgumentException {
143      if (codeString == null || "".equals(codeString))
144            if (codeString == null || "".equals(codeString))
145                return null;
146        if ("organ".equals(codeString))
147          return BiologicallyDerivedProductCategory.ORGAN;
148        if ("tissue".equals(codeString))
149          return BiologicallyDerivedProductCategory.TISSUE;
150        if ("fluid".equals(codeString))
151          return BiologicallyDerivedProductCategory.FLUID;
152        if ("cells".equals(codeString))
153          return BiologicallyDerivedProductCategory.CELLS;
154        if ("biologicalAgent".equals(codeString))
155          return BiologicallyDerivedProductCategory.BIOLOGICALAGENT;
156        throw new IllegalArgumentException("Unknown BiologicallyDerivedProductCategory code '"+codeString+"'");
157        }
158        public Enumeration<BiologicallyDerivedProductCategory> fromType(Base code) throws FHIRException {
159          if (code == null)
160            return null;
161          if (code.isEmpty())
162            return new Enumeration<BiologicallyDerivedProductCategory>(this);
163          String codeString = ((PrimitiveType) code).asStringValue();
164          if (codeString == null || "".equals(codeString))
165            return null;
166        if ("organ".equals(codeString))
167          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.ORGAN);
168        if ("tissue".equals(codeString))
169          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.TISSUE);
170        if ("fluid".equals(codeString))
171          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.FLUID);
172        if ("cells".equals(codeString))
173          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.CELLS);
174        if ("biologicalAgent".equals(codeString))
175          return new Enumeration<BiologicallyDerivedProductCategory>(this, BiologicallyDerivedProductCategory.BIOLOGICALAGENT);
176        throw new FHIRException("Unknown BiologicallyDerivedProductCategory code '"+codeString+"'");
177        }
178    public String toCode(BiologicallyDerivedProductCategory code) {
179      if (code == BiologicallyDerivedProductCategory.ORGAN)
180        return "organ";
181      if (code == BiologicallyDerivedProductCategory.TISSUE)
182        return "tissue";
183      if (code == BiologicallyDerivedProductCategory.FLUID)
184        return "fluid";
185      if (code == BiologicallyDerivedProductCategory.CELLS)
186        return "cells";
187      if (code == BiologicallyDerivedProductCategory.BIOLOGICALAGENT)
188        return "biologicalAgent";
189      return "?";
190      }
191    public String toSystem(BiologicallyDerivedProductCategory code) {
192      return code.getSystem();
193      }
194    }
195
196    public enum BiologicallyDerivedProductStatus {
197        /**
198         * Product is currently available for use.
199         */
200        AVAILABLE, 
201        /**
202         * Product is not currently available for use.
203         */
204        UNAVAILABLE, 
205        /**
206         * added to help the parsers with the generic types
207         */
208        NULL;
209        public static BiologicallyDerivedProductStatus fromCode(String codeString) throws FHIRException {
210            if (codeString == null || "".equals(codeString))
211                return null;
212        if ("available".equals(codeString))
213          return AVAILABLE;
214        if ("unavailable".equals(codeString))
215          return UNAVAILABLE;
216        if (Configuration.isAcceptInvalidEnums())
217          return null;
218        else
219          throw new FHIRException("Unknown BiologicallyDerivedProductStatus code '"+codeString+"'");
220        }
221        public String toCode() {
222          switch (this) {
223            case AVAILABLE: return "available";
224            case UNAVAILABLE: return "unavailable";
225            default: return "?";
226          }
227        }
228        public String getSystem() {
229          switch (this) {
230            case AVAILABLE: return "http://hl7.org/fhir/biological-product-status";
231            case UNAVAILABLE: return "http://hl7.org/fhir/biological-product-status";
232            default: return "?";
233          }
234        }
235        public String getDefinition() {
236          switch (this) {
237            case AVAILABLE: return "Product is currently available for use.";
238            case UNAVAILABLE: return "Product is not currently available for use.";
239            default: return "?";
240          }
241        }
242        public String getDisplay() {
243          switch (this) {
244            case AVAILABLE: return "Available";
245            case UNAVAILABLE: return "Unavailable";
246            default: return "?";
247          }
248        }
249    }
250
251  public static class BiologicallyDerivedProductStatusEnumFactory implements EnumFactory<BiologicallyDerivedProductStatus> {
252    public BiologicallyDerivedProductStatus fromCode(String codeString) throws IllegalArgumentException {
253      if (codeString == null || "".equals(codeString))
254            if (codeString == null || "".equals(codeString))
255                return null;
256        if ("available".equals(codeString))
257          return BiologicallyDerivedProductStatus.AVAILABLE;
258        if ("unavailable".equals(codeString))
259          return BiologicallyDerivedProductStatus.UNAVAILABLE;
260        throw new IllegalArgumentException("Unknown BiologicallyDerivedProductStatus code '"+codeString+"'");
261        }
262        public Enumeration<BiologicallyDerivedProductStatus> fromType(Base code) throws FHIRException {
263          if (code == null)
264            return null;
265          if (code.isEmpty())
266            return new Enumeration<BiologicallyDerivedProductStatus>(this);
267          String codeString = ((PrimitiveType) code).asStringValue();
268          if (codeString == null || "".equals(codeString))
269            return null;
270        if ("available".equals(codeString))
271          return new Enumeration<BiologicallyDerivedProductStatus>(this, BiologicallyDerivedProductStatus.AVAILABLE);
272        if ("unavailable".equals(codeString))
273          return new Enumeration<BiologicallyDerivedProductStatus>(this, BiologicallyDerivedProductStatus.UNAVAILABLE);
274        throw new FHIRException("Unknown BiologicallyDerivedProductStatus code '"+codeString+"'");
275        }
276    public String toCode(BiologicallyDerivedProductStatus code) {
277      if (code == BiologicallyDerivedProductStatus.AVAILABLE)
278        return "available";
279      if (code == BiologicallyDerivedProductStatus.UNAVAILABLE)
280        return "unavailable";
281      return "?";
282      }
283    public String toSystem(BiologicallyDerivedProductStatus code) {
284      return code.getSystem();
285      }
286    }
287
288    @Block()
289    public static class BiologicallyDerivedProductCollectionComponent extends BackboneElement implements IBaseBackboneElement {
290        /**
291         * Healthcare professional who is performing the collection.
292         */
293        @Child(name = "collector", type = {Practitioner.class, PractitionerRole.class}, order=1, min=0, max=1, modifier=false, summary=false)
294        @Description(shortDefinition="Individual performing collection", formalDefinition="Healthcare professional who is performing the collection." )
295        protected Reference collector;
296
297        /**
298         * The patient or entity, such as a hospital or vendor in the case of a processed/manipulated/manufactured product, providing the product.
299         */
300        @Child(name = "source", type = {Patient.class, Organization.class}, order=2, min=0, max=1, modifier=false, summary=false)
301        @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." )
302        protected Reference source;
303
304        /**
305         * Time of product collection.
306         */
307        @Child(name = "collected", type = {DateTimeType.class, Period.class}, order=3, min=0, max=1, modifier=false, summary=false)
308        @Description(shortDefinition="Time of product collection", formalDefinition="Time of product collection." )
309        protected DataType collected;
310
311        private static final long serialVersionUID = 626956533L;
312
313    /**
314     * Constructor
315     */
316      public BiologicallyDerivedProductCollectionComponent() {
317        super();
318      }
319
320        /**
321         * @return {@link #collector} (Healthcare professional who is performing the collection.)
322         */
323        public Reference getCollector() { 
324          if (this.collector == null)
325            if (Configuration.errorOnAutoCreate())
326              throw new Error("Attempt to auto-create BiologicallyDerivedProductCollectionComponent.collector");
327            else if (Configuration.doAutoCreate())
328              this.collector = new Reference(); // cc
329          return this.collector;
330        }
331
332        public boolean hasCollector() { 
333          return this.collector != null && !this.collector.isEmpty();
334        }
335
336        /**
337         * @param value {@link #collector} (Healthcare professional who is performing the collection.)
338         */
339        public BiologicallyDerivedProductCollectionComponent setCollector(Reference value) { 
340          this.collector = value;
341          return this;
342        }
343
344        /**
345         * @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.)
346         */
347        public Reference getSource() { 
348          if (this.source == null)
349            if (Configuration.errorOnAutoCreate())
350              throw new Error("Attempt to auto-create BiologicallyDerivedProductCollectionComponent.source");
351            else if (Configuration.doAutoCreate())
352              this.source = new Reference(); // cc
353          return this.source;
354        }
355
356        public boolean hasSource() { 
357          return this.source != null && !this.source.isEmpty();
358        }
359
360        /**
361         * @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.)
362         */
363        public BiologicallyDerivedProductCollectionComponent setSource(Reference value) { 
364          this.source = value;
365          return this;
366        }
367
368        /**
369         * @return {@link #collected} (Time of product collection.)
370         */
371        public DataType getCollected() { 
372          return this.collected;
373        }
374
375        /**
376         * @return {@link #collected} (Time of product collection.)
377         */
378        public DateTimeType getCollectedDateTimeType() throws FHIRException { 
379          if (this.collected == null)
380            this.collected = new DateTimeType();
381          if (!(this.collected instanceof DateTimeType))
382            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.collected.getClass().getName()+" was encountered");
383          return (DateTimeType) this.collected;
384        }
385
386        public boolean hasCollectedDateTimeType() { 
387          return this != null && this.collected instanceof DateTimeType;
388        }
389
390        /**
391         * @return {@link #collected} (Time of product collection.)
392         */
393        public Period getCollectedPeriod() throws FHIRException { 
394          if (this.collected == null)
395            this.collected = new Period();
396          if (!(this.collected instanceof Period))
397            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.collected.getClass().getName()+" was encountered");
398          return (Period) this.collected;
399        }
400
401        public boolean hasCollectedPeriod() { 
402          return this != null && this.collected instanceof Period;
403        }
404
405        public boolean hasCollected() { 
406          return this.collected != null && !this.collected.isEmpty();
407        }
408
409        /**
410         * @param value {@link #collected} (Time of product collection.)
411         */
412        public BiologicallyDerivedProductCollectionComponent setCollected(DataType value) { 
413          if (value != null && !(value instanceof DateTimeType || value instanceof Period))
414            throw new Error("Not the right type for BiologicallyDerivedProduct.collection.collected[x]: "+value.fhirType());
415          this.collected = value;
416          return this;
417        }
418
419        protected void listChildren(List<Property> children) {
420          super.listChildren(children);
421          children.add(new Property("collector", "Reference(Practitioner|PractitionerRole)", "Healthcare professional who is performing the collection.", 0, 1, collector));
422          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));
423          children.add(new Property("collected[x]", "dateTime|Period", "Time of product collection.", 0, 1, collected));
424        }
425
426        @Override
427        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
428          switch (_hash) {
429          case 1883491469: /*collector*/  return new Property("collector", "Reference(Practitioner|PractitionerRole)", "Healthcare professional who is performing the collection.", 0, 1, collector);
430          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);
431          case 1632037015: /*collected[x]*/  return new Property("collected[x]", "dateTime|Period", "Time of product collection.", 0, 1, collected);
432          case 1883491145: /*collected*/  return new Property("collected[x]", "dateTime|Period", "Time of product collection.", 0, 1, collected);
433          case 2005009924: /*collectedDateTime*/  return new Property("collected[x]", "dateTime", "Time of product collection.", 0, 1, collected);
434          case 653185642: /*collectedPeriod*/  return new Property("collected[x]", "Period", "Time of product collection.", 0, 1, collected);
435          default: return super.getNamedProperty(_hash, _name, _checkValid);
436          }
437
438        }
439
440      @Override
441      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
442        switch (hash) {
443        case 1883491469: /*collector*/ return this.collector == null ? new Base[0] : new Base[] {this.collector}; // Reference
444        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Reference
445        case 1883491145: /*collected*/ return this.collected == null ? new Base[0] : new Base[] {this.collected}; // DataType
446        default: return super.getProperty(hash, name, checkValid);
447        }
448
449      }
450
451      @Override
452      public Base setProperty(int hash, String name, Base value) throws FHIRException {
453        switch (hash) {
454        case 1883491469: // collector
455          this.collector = TypeConvertor.castToReference(value); // Reference
456          return value;
457        case -896505829: // source
458          this.source = TypeConvertor.castToReference(value); // Reference
459          return value;
460        case 1883491145: // collected
461          this.collected = TypeConvertor.castToType(value); // DataType
462          return value;
463        default: return super.setProperty(hash, name, value);
464        }
465
466      }
467
468      @Override
469      public Base setProperty(String name, Base value) throws FHIRException {
470        if (name.equals("collector")) {
471          this.collector = TypeConvertor.castToReference(value); // Reference
472        } else if (name.equals("source")) {
473          this.source = TypeConvertor.castToReference(value); // Reference
474        } else if (name.equals("collected[x]")) {
475          this.collected = TypeConvertor.castToType(value); // DataType
476        } else
477          return super.setProperty(name, value);
478        return value;
479      }
480
481      @Override
482      public Base makeProperty(int hash, String name) throws FHIRException {
483        switch (hash) {
484        case 1883491469:  return getCollector();
485        case -896505829:  return getSource();
486        case 1632037015:  return getCollected();
487        case 1883491145:  return getCollected();
488        default: return super.makeProperty(hash, name);
489        }
490
491      }
492
493      @Override
494      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
495        switch (hash) {
496        case 1883491469: /*collector*/ return new String[] {"Reference"};
497        case -896505829: /*source*/ return new String[] {"Reference"};
498        case 1883491145: /*collected*/ return new String[] {"dateTime", "Period"};
499        default: return super.getTypesForProperty(hash, name);
500        }
501
502      }
503
504      @Override
505      public Base addChild(String name) throws FHIRException {
506        if (name.equals("collector")) {
507          this.collector = new Reference();
508          return this.collector;
509        }
510        else if (name.equals("source")) {
511          this.source = new Reference();
512          return this.source;
513        }
514        else if (name.equals("collectedDateTime")) {
515          this.collected = new DateTimeType();
516          return this.collected;
517        }
518        else if (name.equals("collectedPeriod")) {
519          this.collected = new Period();
520          return this.collected;
521        }
522        else
523          return super.addChild(name);
524      }
525
526      public BiologicallyDerivedProductCollectionComponent copy() {
527        BiologicallyDerivedProductCollectionComponent dst = new BiologicallyDerivedProductCollectionComponent();
528        copyValues(dst);
529        return dst;
530      }
531
532      public void copyValues(BiologicallyDerivedProductCollectionComponent dst) {
533        super.copyValues(dst);
534        dst.collector = collector == null ? null : collector.copy();
535        dst.source = source == null ? null : source.copy();
536        dst.collected = collected == null ? null : collected.copy();
537      }
538
539      @Override
540      public boolean equalsDeep(Base other_) {
541        if (!super.equalsDeep(other_))
542          return false;
543        if (!(other_ instanceof BiologicallyDerivedProductCollectionComponent))
544          return false;
545        BiologicallyDerivedProductCollectionComponent o = (BiologicallyDerivedProductCollectionComponent) other_;
546        return compareDeep(collector, o.collector, true) && compareDeep(source, o.source, true) && compareDeep(collected, o.collected, true)
547          ;
548      }
549
550      @Override
551      public boolean equalsShallow(Base other_) {
552        if (!super.equalsShallow(other_))
553          return false;
554        if (!(other_ instanceof BiologicallyDerivedProductCollectionComponent))
555          return false;
556        BiologicallyDerivedProductCollectionComponent o = (BiologicallyDerivedProductCollectionComponent) other_;
557        return true;
558      }
559
560      public boolean isEmpty() {
561        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(collector, source, collected
562          );
563      }
564
565  public String fhirType() {
566    return "BiologicallyDerivedProduct.collection";
567
568  }
569
570  }
571
572    @Block()
573    public static class BiologicallyDerivedProductPropertyComponent extends BackboneElement implements IBaseBackboneElement {
574        /**
575         * Code that specifies the property.
576         */
577        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
578        @Description(shortDefinition="Code that specifies the property", formalDefinition="Code that specifies the property." )
579        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/NamingSystem/ib")
580        protected CodeableConcept type;
581
582        /**
583         * Property values.
584         */
585        @Child(name = "value", type = {BooleanType.class, IntegerType.class, CodeableConcept.class, Quantity.class, Range.class, StringType.class, Attachment.class}, order=2, min=1, max=1, modifier=false, summary=false)
586        @Description(shortDefinition="Property values", formalDefinition="Property values." )
587        protected DataType value;
588
589        private static final long serialVersionUID = -1659186716L;
590
591    /**
592     * Constructor
593     */
594      public BiologicallyDerivedProductPropertyComponent() {
595        super();
596      }
597
598    /**
599     * Constructor
600     */
601      public BiologicallyDerivedProductPropertyComponent(CodeableConcept type, DataType value) {
602        super();
603        this.setType(type);
604        this.setValue(value);
605      }
606
607        /**
608         * @return {@link #type} (Code that specifies the property.)
609         */
610        public CodeableConcept getType() { 
611          if (this.type == null)
612            if (Configuration.errorOnAutoCreate())
613              throw new Error("Attempt to auto-create BiologicallyDerivedProductPropertyComponent.type");
614            else if (Configuration.doAutoCreate())
615              this.type = new CodeableConcept(); // cc
616          return this.type;
617        }
618
619        public boolean hasType() { 
620          return this.type != null && !this.type.isEmpty();
621        }
622
623        /**
624         * @param value {@link #type} (Code that specifies the property.)
625         */
626        public BiologicallyDerivedProductPropertyComponent setType(CodeableConcept value) { 
627          this.type = value;
628          return this;
629        }
630
631        /**
632         * @return {@link #value} (Property values.)
633         */
634        public DataType getValue() { 
635          return this.value;
636        }
637
638        /**
639         * @return {@link #value} (Property values.)
640         */
641        public BooleanType getValueBooleanType() throws FHIRException { 
642          if (this.value == null)
643            this.value = new BooleanType();
644          if (!(this.value instanceof BooleanType))
645            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
646          return (BooleanType) this.value;
647        }
648
649        public boolean hasValueBooleanType() { 
650          return this != null && this.value instanceof BooleanType;
651        }
652
653        /**
654         * @return {@link #value} (Property values.)
655         */
656        public IntegerType getValueIntegerType() throws FHIRException { 
657          if (this.value == null)
658            this.value = new IntegerType();
659          if (!(this.value instanceof IntegerType))
660            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
661          return (IntegerType) this.value;
662        }
663
664        public boolean hasValueIntegerType() { 
665          return this != null && this.value instanceof IntegerType;
666        }
667
668        /**
669         * @return {@link #value} (Property values.)
670         */
671        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
672          if (this.value == null)
673            this.value = new CodeableConcept();
674          if (!(this.value instanceof CodeableConcept))
675            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
676          return (CodeableConcept) this.value;
677        }
678
679        public boolean hasValueCodeableConcept() { 
680          return this != null && this.value instanceof CodeableConcept;
681        }
682
683        /**
684         * @return {@link #value} (Property values.)
685         */
686        public Quantity getValueQuantity() throws FHIRException { 
687          if (this.value == null)
688            this.value = new Quantity();
689          if (!(this.value instanceof Quantity))
690            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
691          return (Quantity) this.value;
692        }
693
694        public boolean hasValueQuantity() { 
695          return this != null && this.value instanceof Quantity;
696        }
697
698        /**
699         * @return {@link #value} (Property values.)
700         */
701        public Range getValueRange() throws FHIRException { 
702          if (this.value == null)
703            this.value = new Range();
704          if (!(this.value instanceof Range))
705            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
706          return (Range) this.value;
707        }
708
709        public boolean hasValueRange() { 
710          return this != null && this.value instanceof Range;
711        }
712
713        /**
714         * @return {@link #value} (Property values.)
715         */
716        public StringType getValueStringType() throws FHIRException { 
717          if (this.value == null)
718            this.value = new StringType();
719          if (!(this.value instanceof StringType))
720            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
721          return (StringType) this.value;
722        }
723
724        public boolean hasValueStringType() { 
725          return this != null && this.value instanceof StringType;
726        }
727
728        /**
729         * @return {@link #value} (Property values.)
730         */
731        public Attachment getValueAttachment() throws FHIRException { 
732          if (this.value == null)
733            this.value = new Attachment();
734          if (!(this.value instanceof Attachment))
735            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
736          return (Attachment) this.value;
737        }
738
739        public boolean hasValueAttachment() { 
740          return this != null && this.value instanceof Attachment;
741        }
742
743        public boolean hasValue() { 
744          return this.value != null && !this.value.isEmpty();
745        }
746
747        /**
748         * @param value {@link #value} (Property values.)
749         */
750        public BiologicallyDerivedProductPropertyComponent setValue(DataType value) { 
751          if (value != null && !(value instanceof BooleanType || value instanceof IntegerType || value instanceof CodeableConcept || value instanceof Quantity || value instanceof Range || value instanceof StringType || value instanceof Attachment))
752            throw new Error("Not the right type for BiologicallyDerivedProduct.property.value[x]: "+value.fhirType());
753          this.value = value;
754          return this;
755        }
756
757        protected void listChildren(List<Property> children) {
758          super.listChildren(children);
759          children.add(new Property("type", "CodeableConcept", "Code that specifies the property.", 0, 1, type));
760          children.add(new Property("value[x]", "boolean|integer|CodeableConcept|Quantity|Range|string|Attachment", "Property values.", 0, 1, value));
761        }
762
763        @Override
764        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
765          switch (_hash) {
766          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code that specifies the property.", 0, 1, type);
767          case -1410166417: /*value[x]*/  return new Property("value[x]", "boolean|integer|CodeableConcept|Quantity|Range|string|Attachment", "Property values.", 0, 1, value);
768          case 111972721: /*value*/  return new Property("value[x]", "boolean|integer|CodeableConcept|Quantity|Range|string|Attachment", "Property values.", 0, 1, value);
769          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "Property values.", 0, 1, value);
770          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "Property values.", 0, 1, value);
771          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "Property values.", 0, 1, value);
772          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "Property values.", 0, 1, value);
773          case 2030761548: /*valueRange*/  return new Property("value[x]", "Range", "Property values.", 0, 1, value);
774          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "Property values.", 0, 1, value);
775          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "Property values.", 0, 1, value);
776          default: return super.getNamedProperty(_hash, _name, _checkValid);
777          }
778
779        }
780
781      @Override
782      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
783        switch (hash) {
784        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
785        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
786        default: return super.getProperty(hash, name, checkValid);
787        }
788
789      }
790
791      @Override
792      public Base setProperty(int hash, String name, Base value) throws FHIRException {
793        switch (hash) {
794        case 3575610: // type
795          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
796          return value;
797        case 111972721: // value
798          this.value = TypeConvertor.castToType(value); // DataType
799          return value;
800        default: return super.setProperty(hash, name, value);
801        }
802
803      }
804
805      @Override
806      public Base setProperty(String name, Base value) throws FHIRException {
807        if (name.equals("type")) {
808          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
809        } else if (name.equals("value[x]")) {
810          this.value = TypeConvertor.castToType(value); // DataType
811        } else
812          return super.setProperty(name, value);
813        return value;
814      }
815
816      @Override
817      public Base makeProperty(int hash, String name) throws FHIRException {
818        switch (hash) {
819        case 3575610:  return getType();
820        case -1410166417:  return getValue();
821        case 111972721:  return getValue();
822        default: return super.makeProperty(hash, name);
823        }
824
825      }
826
827      @Override
828      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
829        switch (hash) {
830        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
831        case 111972721: /*value*/ return new String[] {"boolean", "integer", "CodeableConcept", "Quantity", "Range", "string", "Attachment"};
832        default: return super.getTypesForProperty(hash, name);
833        }
834
835      }
836
837      @Override
838      public Base addChild(String name) throws FHIRException {
839        if (name.equals("type")) {
840          this.type = new CodeableConcept();
841          return this.type;
842        }
843        else if (name.equals("valueBoolean")) {
844          this.value = new BooleanType();
845          return this.value;
846        }
847        else if (name.equals("valueInteger")) {
848          this.value = new IntegerType();
849          return this.value;
850        }
851        else if (name.equals("valueCodeableConcept")) {
852          this.value = new CodeableConcept();
853          return this.value;
854        }
855        else if (name.equals("valueQuantity")) {
856          this.value = new Quantity();
857          return this.value;
858        }
859        else if (name.equals("valueRange")) {
860          this.value = new Range();
861          return this.value;
862        }
863        else if (name.equals("valueString")) {
864          this.value = new StringType();
865          return this.value;
866        }
867        else if (name.equals("valueAttachment")) {
868          this.value = new Attachment();
869          return this.value;
870        }
871        else
872          return super.addChild(name);
873      }
874
875      public BiologicallyDerivedProductPropertyComponent copy() {
876        BiologicallyDerivedProductPropertyComponent dst = new BiologicallyDerivedProductPropertyComponent();
877        copyValues(dst);
878        return dst;
879      }
880
881      public void copyValues(BiologicallyDerivedProductPropertyComponent dst) {
882        super.copyValues(dst);
883        dst.type = type == null ? null : type.copy();
884        dst.value = value == null ? null : value.copy();
885      }
886
887      @Override
888      public boolean equalsDeep(Base other_) {
889        if (!super.equalsDeep(other_))
890          return false;
891        if (!(other_ instanceof BiologicallyDerivedProductPropertyComponent))
892          return false;
893        BiologicallyDerivedProductPropertyComponent o = (BiologicallyDerivedProductPropertyComponent) other_;
894        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
895      }
896
897      @Override
898      public boolean equalsShallow(Base other_) {
899        if (!super.equalsShallow(other_))
900          return false;
901        if (!(other_ instanceof BiologicallyDerivedProductPropertyComponent))
902          return false;
903        BiologicallyDerivedProductPropertyComponent o = (BiologicallyDerivedProductPropertyComponent) other_;
904        return true;
905      }
906
907      public boolean isEmpty() {
908        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
909      }
910
911  public String fhirType() {
912    return "BiologicallyDerivedProduct.property";
913
914  }
915
916  }
917
918    /**
919     * Broad category of this product.
920     */
921    @Child(name = "productCategory", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=false)
922    @Description(shortDefinition="organ | tissue | fluid | cells | biologicalAgent", formalDefinition="Broad category of this product." )
923    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/product-category")
924    protected Enumeration<BiologicallyDerivedProductCategory> productCategory;
925
926    /**
927     * A code that identifies the kind of this biologically derived product (SNOMED Ctcode).
928     */
929    @Child(name = "productCode", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
930    @Description(shortDefinition="What this biologically derived product is", formalDefinition="A code that identifies the kind of this biologically derived product (SNOMED Ctcode)." )
931    protected CodeableConcept productCode;
932
933    /**
934     * Parent product (if any).
935     */
936    @Child(name = "parent", type = {BiologicallyDerivedProduct.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
937    @Description(shortDefinition="BiologicallyDerivedProduct parent", formalDefinition="Parent product (if any)." )
938    protected List<Reference> parent;
939
940    /**
941     * Procedure request to obtain this biologically derived product.
942     */
943    @Child(name = "request", type = {ServiceRequest.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
944    @Description(shortDefinition="Procedure request", formalDefinition="Procedure request to obtain this biologically derived product." )
945    protected List<Reference> request;
946
947    /**
948     * 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).
949     */
950    @Child(name = "identifier", type = {Identifier.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
951    @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)." )
952    protected List<Identifier> identifier;
953
954    /**
955     * An identifier that supports traceability to the biological entity that is the source of biological material in the product.
956     */
957    @Child(name = "biologicalSource", type = {Identifier.class}, order=5, min=0, max=1, modifier=false, summary=true)
958    @Description(shortDefinition="An identifier that supports traceability to the biological entity that is the source of biological material in the product", formalDefinition="An identifier that supports traceability to the biological entity that is the source of biological material in the product." )
959    protected Identifier biologicalSource;
960
961    /**
962     * Processing facilities for this biologically derived product.
963     */
964    @Child(name = "processingFacility", type = {Organization.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
965    @Description(shortDefinition="Processing facility", formalDefinition="Processing facilities for this biologically derived product." )
966    protected List<Reference> processingFacility;
967
968    /**
969     * Description of division.
970     */
971    @Child(name = "division", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
972    @Description(shortDefinition="Description of division", formalDefinition="Description of division." )
973    protected StringType division;
974
975    /**
976     * Whether the product is currently available.
977     */
978    @Child(name = "status", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=false)
979    @Description(shortDefinition="available | unavailable", formalDefinition="Whether the product is currently available." )
980    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/biological-product-status")
981    protected Enumeration<BiologicallyDerivedProductStatus> status;
982
983    /**
984     * Date of expiration.
985     */
986    @Child(name = "expirationDate", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=false)
987    @Description(shortDefinition="Date of expiration", formalDefinition="Date of expiration." )
988    protected DateTimeType expirationDate;
989
990    /**
991     * How this product was collected.
992     */
993    @Child(name = "collection", type = {}, order=10, min=0, max=1, modifier=false, summary=false)
994    @Description(shortDefinition="How this product was collected", formalDefinition="How this product was collected." )
995    protected BiologicallyDerivedProductCollectionComponent collection;
996
997    /**
998     * Product storage temp requirements.
999     */
1000    @Child(name = "storageTempRequirements", type = {Range.class}, order=11, min=0, max=1, modifier=false, summary=false)
1001    @Description(shortDefinition="Product storage temp requirements", formalDefinition="Product storage temp requirements." )
1002    protected Range storageTempRequirements;
1003
1004    /**
1005     * A property that is specific to this BiologicallyDerviedProduct instance.
1006     */
1007    @Child(name = "property", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1008    @Description(shortDefinition="A property that is specific to this BiologicallyDerviedProduct instance", formalDefinition="A property that is specific to this BiologicallyDerviedProduct instance." )
1009    protected List<BiologicallyDerivedProductPropertyComponent> property;
1010
1011    private static final long serialVersionUID = -2109673989L;
1012
1013  /**
1014   * Constructor
1015   */
1016    public BiologicallyDerivedProduct() {
1017      super();
1018    }
1019
1020    /**
1021     * @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
1022     */
1023    public Enumeration<BiologicallyDerivedProductCategory> getProductCategoryElement() { 
1024      if (this.productCategory == null)
1025        if (Configuration.errorOnAutoCreate())
1026          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.productCategory");
1027        else if (Configuration.doAutoCreate())
1028          this.productCategory = new Enumeration<BiologicallyDerivedProductCategory>(new BiologicallyDerivedProductCategoryEnumFactory()); // bb
1029      return this.productCategory;
1030    }
1031
1032    public boolean hasProductCategoryElement() { 
1033      return this.productCategory != null && !this.productCategory.isEmpty();
1034    }
1035
1036    public boolean hasProductCategory() { 
1037      return this.productCategory != null && !this.productCategory.isEmpty();
1038    }
1039
1040    /**
1041     * @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
1042     */
1043    public BiologicallyDerivedProduct setProductCategoryElement(Enumeration<BiologicallyDerivedProductCategory> value) { 
1044      this.productCategory = value;
1045      return this;
1046    }
1047
1048    /**
1049     * @return Broad category of this product.
1050     */
1051    public BiologicallyDerivedProductCategory getProductCategory() { 
1052      return this.productCategory == null ? null : this.productCategory.getValue();
1053    }
1054
1055    /**
1056     * @param value Broad category of this product.
1057     */
1058    public BiologicallyDerivedProduct setProductCategory(BiologicallyDerivedProductCategory value) { 
1059      if (value == null)
1060        this.productCategory = null;
1061      else {
1062        if (this.productCategory == null)
1063          this.productCategory = new Enumeration<BiologicallyDerivedProductCategory>(new BiologicallyDerivedProductCategoryEnumFactory());
1064        this.productCategory.setValue(value);
1065      }
1066      return this;
1067    }
1068
1069    /**
1070     * @return {@link #productCode} (A code that identifies the kind of this biologically derived product (SNOMED Ctcode).)
1071     */
1072    public CodeableConcept getProductCode() { 
1073      if (this.productCode == null)
1074        if (Configuration.errorOnAutoCreate())
1075          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.productCode");
1076        else if (Configuration.doAutoCreate())
1077          this.productCode = new CodeableConcept(); // cc
1078      return this.productCode;
1079    }
1080
1081    public boolean hasProductCode() { 
1082      return this.productCode != null && !this.productCode.isEmpty();
1083    }
1084
1085    /**
1086     * @param value {@link #productCode} (A code that identifies the kind of this biologically derived product (SNOMED Ctcode).)
1087     */
1088    public BiologicallyDerivedProduct setProductCode(CodeableConcept value) { 
1089      this.productCode = value;
1090      return this;
1091    }
1092
1093    /**
1094     * @return {@link #parent} (Parent product (if any).)
1095     */
1096    public List<Reference> getParent() { 
1097      if (this.parent == null)
1098        this.parent = new ArrayList<Reference>();
1099      return this.parent;
1100    }
1101
1102    /**
1103     * @return Returns a reference to <code>this</code> for easy method chaining
1104     */
1105    public BiologicallyDerivedProduct setParent(List<Reference> theParent) { 
1106      this.parent = theParent;
1107      return this;
1108    }
1109
1110    public boolean hasParent() { 
1111      if (this.parent == null)
1112        return false;
1113      for (Reference item : this.parent)
1114        if (!item.isEmpty())
1115          return true;
1116      return false;
1117    }
1118
1119    public Reference addParent() { //3
1120      Reference t = new Reference();
1121      if (this.parent == null)
1122        this.parent = new ArrayList<Reference>();
1123      this.parent.add(t);
1124      return t;
1125    }
1126
1127    public BiologicallyDerivedProduct addParent(Reference t) { //3
1128      if (t == null)
1129        return this;
1130      if (this.parent == null)
1131        this.parent = new ArrayList<Reference>();
1132      this.parent.add(t);
1133      return this;
1134    }
1135
1136    /**
1137     * @return The first repetition of repeating field {@link #parent}, creating it if it does not already exist {3}
1138     */
1139    public Reference getParentFirstRep() { 
1140      if (getParent().isEmpty()) {
1141        addParent();
1142      }
1143      return getParent().get(0);
1144    }
1145
1146    /**
1147     * @return {@link #request} (Procedure request to obtain this biologically derived product.)
1148     */
1149    public List<Reference> getRequest() { 
1150      if (this.request == null)
1151        this.request = new ArrayList<Reference>();
1152      return this.request;
1153    }
1154
1155    /**
1156     * @return Returns a reference to <code>this</code> for easy method chaining
1157     */
1158    public BiologicallyDerivedProduct setRequest(List<Reference> theRequest) { 
1159      this.request = theRequest;
1160      return this;
1161    }
1162
1163    public boolean hasRequest() { 
1164      if (this.request == null)
1165        return false;
1166      for (Reference item : this.request)
1167        if (!item.isEmpty())
1168          return true;
1169      return false;
1170    }
1171
1172    public Reference addRequest() { //3
1173      Reference t = new Reference();
1174      if (this.request == null)
1175        this.request = new ArrayList<Reference>();
1176      this.request.add(t);
1177      return t;
1178    }
1179
1180    public BiologicallyDerivedProduct addRequest(Reference t) { //3
1181      if (t == null)
1182        return this;
1183      if (this.request == null)
1184        this.request = new ArrayList<Reference>();
1185      this.request.add(t);
1186      return this;
1187    }
1188
1189    /**
1190     * @return The first repetition of repeating field {@link #request}, creating it if it does not already exist {3}
1191     */
1192    public Reference getRequestFirstRep() { 
1193      if (getRequest().isEmpty()) {
1194        addRequest();
1195      }
1196      return getRequest().get(0);
1197    }
1198
1199    /**
1200     * @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).)
1201     */
1202    public List<Identifier> getIdentifier() { 
1203      if (this.identifier == null)
1204        this.identifier = new ArrayList<Identifier>();
1205      return this.identifier;
1206    }
1207
1208    /**
1209     * @return Returns a reference to <code>this</code> for easy method chaining
1210     */
1211    public BiologicallyDerivedProduct setIdentifier(List<Identifier> theIdentifier) { 
1212      this.identifier = theIdentifier;
1213      return this;
1214    }
1215
1216    public boolean hasIdentifier() { 
1217      if (this.identifier == null)
1218        return false;
1219      for (Identifier item : this.identifier)
1220        if (!item.isEmpty())
1221          return true;
1222      return false;
1223    }
1224
1225    public Identifier addIdentifier() { //3
1226      Identifier t = new Identifier();
1227      if (this.identifier == null)
1228        this.identifier = new ArrayList<Identifier>();
1229      this.identifier.add(t);
1230      return t;
1231    }
1232
1233    public BiologicallyDerivedProduct addIdentifier(Identifier t) { //3
1234      if (t == null)
1235        return this;
1236      if (this.identifier == null)
1237        this.identifier = new ArrayList<Identifier>();
1238      this.identifier.add(t);
1239      return this;
1240    }
1241
1242    /**
1243     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1244     */
1245    public Identifier getIdentifierFirstRep() { 
1246      if (getIdentifier().isEmpty()) {
1247        addIdentifier();
1248      }
1249      return getIdentifier().get(0);
1250    }
1251
1252    /**
1253     * @return {@link #biologicalSource} (An identifier that supports traceability to the biological entity that is the source of biological material in the product.)
1254     */
1255    public Identifier getBiologicalSource() { 
1256      if (this.biologicalSource == null)
1257        if (Configuration.errorOnAutoCreate())
1258          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.biologicalSource");
1259        else if (Configuration.doAutoCreate())
1260          this.biologicalSource = new Identifier(); // cc
1261      return this.biologicalSource;
1262    }
1263
1264    public boolean hasBiologicalSource() { 
1265      return this.biologicalSource != null && !this.biologicalSource.isEmpty();
1266    }
1267
1268    /**
1269     * @param value {@link #biologicalSource} (An identifier that supports traceability to the biological entity that is the source of biological material in the product.)
1270     */
1271    public BiologicallyDerivedProduct setBiologicalSource(Identifier value) { 
1272      this.biologicalSource = value;
1273      return this;
1274    }
1275
1276    /**
1277     * @return {@link #processingFacility} (Processing facilities for this biologically derived product.)
1278     */
1279    public List<Reference> getProcessingFacility() { 
1280      if (this.processingFacility == null)
1281        this.processingFacility = new ArrayList<Reference>();
1282      return this.processingFacility;
1283    }
1284
1285    /**
1286     * @return Returns a reference to <code>this</code> for easy method chaining
1287     */
1288    public BiologicallyDerivedProduct setProcessingFacility(List<Reference> theProcessingFacility) { 
1289      this.processingFacility = theProcessingFacility;
1290      return this;
1291    }
1292
1293    public boolean hasProcessingFacility() { 
1294      if (this.processingFacility == null)
1295        return false;
1296      for (Reference item : this.processingFacility)
1297        if (!item.isEmpty())
1298          return true;
1299      return false;
1300    }
1301
1302    public Reference addProcessingFacility() { //3
1303      Reference t = new Reference();
1304      if (this.processingFacility == null)
1305        this.processingFacility = new ArrayList<Reference>();
1306      this.processingFacility.add(t);
1307      return t;
1308    }
1309
1310    public BiologicallyDerivedProduct addProcessingFacility(Reference t) { //3
1311      if (t == null)
1312        return this;
1313      if (this.processingFacility == null)
1314        this.processingFacility = new ArrayList<Reference>();
1315      this.processingFacility.add(t);
1316      return this;
1317    }
1318
1319    /**
1320     * @return The first repetition of repeating field {@link #processingFacility}, creating it if it does not already exist {3}
1321     */
1322    public Reference getProcessingFacilityFirstRep() { 
1323      if (getProcessingFacility().isEmpty()) {
1324        addProcessingFacility();
1325      }
1326      return getProcessingFacility().get(0);
1327    }
1328
1329    /**
1330     * @return {@link #division} (Description of division.). This is the underlying object with id, value and extensions. The accessor "getDivision" gives direct access to the value
1331     */
1332    public StringType getDivisionElement() { 
1333      if (this.division == null)
1334        if (Configuration.errorOnAutoCreate())
1335          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.division");
1336        else if (Configuration.doAutoCreate())
1337          this.division = new StringType(); // bb
1338      return this.division;
1339    }
1340
1341    public boolean hasDivisionElement() { 
1342      return this.division != null && !this.division.isEmpty();
1343    }
1344
1345    public boolean hasDivision() { 
1346      return this.division != null && !this.division.isEmpty();
1347    }
1348
1349    /**
1350     * @param value {@link #division} (Description of division.). This is the underlying object with id, value and extensions. The accessor "getDivision" gives direct access to the value
1351     */
1352    public BiologicallyDerivedProduct setDivisionElement(StringType value) { 
1353      this.division = value;
1354      return this;
1355    }
1356
1357    /**
1358     * @return Description of division.
1359     */
1360    public String getDivision() { 
1361      return this.division == null ? null : this.division.getValue();
1362    }
1363
1364    /**
1365     * @param value Description of division.
1366     */
1367    public BiologicallyDerivedProduct setDivision(String value) { 
1368      if (Utilities.noString(value))
1369        this.division = null;
1370      else {
1371        if (this.division == null)
1372          this.division = new StringType();
1373        this.division.setValue(value);
1374      }
1375      return this;
1376    }
1377
1378    /**
1379     * @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
1380     */
1381    public Enumeration<BiologicallyDerivedProductStatus> getStatusElement() { 
1382      if (this.status == null)
1383        if (Configuration.errorOnAutoCreate())
1384          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.status");
1385        else if (Configuration.doAutoCreate())
1386          this.status = new Enumeration<BiologicallyDerivedProductStatus>(new BiologicallyDerivedProductStatusEnumFactory()); // bb
1387      return this.status;
1388    }
1389
1390    public boolean hasStatusElement() { 
1391      return this.status != null && !this.status.isEmpty();
1392    }
1393
1394    public boolean hasStatus() { 
1395      return this.status != null && !this.status.isEmpty();
1396    }
1397
1398    /**
1399     * @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
1400     */
1401    public BiologicallyDerivedProduct setStatusElement(Enumeration<BiologicallyDerivedProductStatus> value) { 
1402      this.status = value;
1403      return this;
1404    }
1405
1406    /**
1407     * @return Whether the product is currently available.
1408     */
1409    public BiologicallyDerivedProductStatus getStatus() { 
1410      return this.status == null ? null : this.status.getValue();
1411    }
1412
1413    /**
1414     * @param value Whether the product is currently available.
1415     */
1416    public BiologicallyDerivedProduct setStatus(BiologicallyDerivedProductStatus value) { 
1417      if (value == null)
1418        this.status = null;
1419      else {
1420        if (this.status == null)
1421          this.status = new Enumeration<BiologicallyDerivedProductStatus>(new BiologicallyDerivedProductStatusEnumFactory());
1422        this.status.setValue(value);
1423      }
1424      return this;
1425    }
1426
1427    /**
1428     * @return {@link #expirationDate} (Date of expiration.). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value
1429     */
1430    public DateTimeType getExpirationDateElement() { 
1431      if (this.expirationDate == null)
1432        if (Configuration.errorOnAutoCreate())
1433          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.expirationDate");
1434        else if (Configuration.doAutoCreate())
1435          this.expirationDate = new DateTimeType(); // bb
1436      return this.expirationDate;
1437    }
1438
1439    public boolean hasExpirationDateElement() { 
1440      return this.expirationDate != null && !this.expirationDate.isEmpty();
1441    }
1442
1443    public boolean hasExpirationDate() { 
1444      return this.expirationDate != null && !this.expirationDate.isEmpty();
1445    }
1446
1447    /**
1448     * @param value {@link #expirationDate} (Date of expiration.). This is the underlying object with id, value and extensions. The accessor "getExpirationDate" gives direct access to the value
1449     */
1450    public BiologicallyDerivedProduct setExpirationDateElement(DateTimeType value) { 
1451      this.expirationDate = value;
1452      return this;
1453    }
1454
1455    /**
1456     * @return Date of expiration.
1457     */
1458    public Date getExpirationDate() { 
1459      return this.expirationDate == null ? null : this.expirationDate.getValue();
1460    }
1461
1462    /**
1463     * @param value Date of expiration.
1464     */
1465    public BiologicallyDerivedProduct setExpirationDate(Date value) { 
1466      if (value == null)
1467        this.expirationDate = null;
1468      else {
1469        if (this.expirationDate == null)
1470          this.expirationDate = new DateTimeType();
1471        this.expirationDate.setValue(value);
1472      }
1473      return this;
1474    }
1475
1476    /**
1477     * @return {@link #collection} (How this product was collected.)
1478     */
1479    public BiologicallyDerivedProductCollectionComponent getCollection() { 
1480      if (this.collection == null)
1481        if (Configuration.errorOnAutoCreate())
1482          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.collection");
1483        else if (Configuration.doAutoCreate())
1484          this.collection = new BiologicallyDerivedProductCollectionComponent(); // cc
1485      return this.collection;
1486    }
1487
1488    public boolean hasCollection() { 
1489      return this.collection != null && !this.collection.isEmpty();
1490    }
1491
1492    /**
1493     * @param value {@link #collection} (How this product was collected.)
1494     */
1495    public BiologicallyDerivedProduct setCollection(BiologicallyDerivedProductCollectionComponent value) { 
1496      this.collection = value;
1497      return this;
1498    }
1499
1500    /**
1501     * @return {@link #storageTempRequirements} (Product storage temp requirements.)
1502     */
1503    public Range getStorageTempRequirements() { 
1504      if (this.storageTempRequirements == null)
1505        if (Configuration.errorOnAutoCreate())
1506          throw new Error("Attempt to auto-create BiologicallyDerivedProduct.storageTempRequirements");
1507        else if (Configuration.doAutoCreate())
1508          this.storageTempRequirements = new Range(); // cc
1509      return this.storageTempRequirements;
1510    }
1511
1512    public boolean hasStorageTempRequirements() { 
1513      return this.storageTempRequirements != null && !this.storageTempRequirements.isEmpty();
1514    }
1515
1516    /**
1517     * @param value {@link #storageTempRequirements} (Product storage temp requirements.)
1518     */
1519    public BiologicallyDerivedProduct setStorageTempRequirements(Range value) { 
1520      this.storageTempRequirements = value;
1521      return this;
1522    }
1523
1524    /**
1525     * @return {@link #property} (A property that is specific to this BiologicallyDerviedProduct instance.)
1526     */
1527    public List<BiologicallyDerivedProductPropertyComponent> getProperty() { 
1528      if (this.property == null)
1529        this.property = new ArrayList<BiologicallyDerivedProductPropertyComponent>();
1530      return this.property;
1531    }
1532
1533    /**
1534     * @return Returns a reference to <code>this</code> for easy method chaining
1535     */
1536    public BiologicallyDerivedProduct setProperty(List<BiologicallyDerivedProductPropertyComponent> theProperty) { 
1537      this.property = theProperty;
1538      return this;
1539    }
1540
1541    public boolean hasProperty() { 
1542      if (this.property == null)
1543        return false;
1544      for (BiologicallyDerivedProductPropertyComponent item : this.property)
1545        if (!item.isEmpty())
1546          return true;
1547      return false;
1548    }
1549
1550    public BiologicallyDerivedProductPropertyComponent addProperty() { //3
1551      BiologicallyDerivedProductPropertyComponent t = new BiologicallyDerivedProductPropertyComponent();
1552      if (this.property == null)
1553        this.property = new ArrayList<BiologicallyDerivedProductPropertyComponent>();
1554      this.property.add(t);
1555      return t;
1556    }
1557
1558    public BiologicallyDerivedProduct addProperty(BiologicallyDerivedProductPropertyComponent t) { //3
1559      if (t == null)
1560        return this;
1561      if (this.property == null)
1562        this.property = new ArrayList<BiologicallyDerivedProductPropertyComponent>();
1563      this.property.add(t);
1564      return this;
1565    }
1566
1567    /**
1568     * @return The first repetition of repeating field {@link #property}, creating it if it does not already exist {3}
1569     */
1570    public BiologicallyDerivedProductPropertyComponent getPropertyFirstRep() { 
1571      if (getProperty().isEmpty()) {
1572        addProperty();
1573      }
1574      return getProperty().get(0);
1575    }
1576
1577      protected void listChildren(List<Property> children) {
1578        super.listChildren(children);
1579        children.add(new Property("productCategory", "code", "Broad category of this product.", 0, 1, productCategory));
1580        children.add(new Property("productCode", "CodeableConcept", "A code that identifies the kind of this biologically derived product (SNOMED Ctcode).", 0, 1, productCode));
1581        children.add(new Property("parent", "Reference(BiologicallyDerivedProduct)", "Parent product (if any).", 0, java.lang.Integer.MAX_VALUE, parent));
1582        children.add(new Property("request", "Reference(ServiceRequest)", "Procedure request to obtain this biologically derived product.", 0, java.lang.Integer.MAX_VALUE, request));
1583        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));
1584        children.add(new Property("biologicalSource", "Identifier", "An identifier that supports traceability to the biological entity that is the source of biological material in the product.", 0, 1, biologicalSource));
1585        children.add(new Property("processingFacility", "Reference(Organization)", "Processing facilities for this biologically derived product.", 0, java.lang.Integer.MAX_VALUE, processingFacility));
1586        children.add(new Property("division", "string", "Description of division.", 0, 1, division));
1587        children.add(new Property("status", "code", "Whether the product is currently available.", 0, 1, status));
1588        children.add(new Property("expirationDate", "dateTime", "Date of expiration.", 0, 1, expirationDate));
1589        children.add(new Property("collection", "", "How this product was collected.", 0, 1, collection));
1590        children.add(new Property("storageTempRequirements", "Range", "Product storage temp requirements.", 0, 1, storageTempRequirements));
1591        children.add(new Property("property", "", "A property that is specific to this BiologicallyDerviedProduct instance.", 0, java.lang.Integer.MAX_VALUE, property));
1592      }
1593
1594      @Override
1595      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1596        switch (_hash) {
1597        case 197299981: /*productCategory*/  return new Property("productCategory", "code", "Broad category of this product.", 0, 1, productCategory);
1598        case -1492131972: /*productCode*/  return new Property("productCode", "CodeableConcept", "A code that identifies the kind of this biologically derived product (SNOMED Ctcode).", 0, 1, productCode);
1599        case -995424086: /*parent*/  return new Property("parent", "Reference(BiologicallyDerivedProduct)", "Parent product (if any).", 0, java.lang.Integer.MAX_VALUE, parent);
1600        case 1095692943: /*request*/  return new Property("request", "Reference(ServiceRequest)", "Procedure request to obtain this biologically derived product.", 0, java.lang.Integer.MAX_VALUE, request);
1601        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);
1602        case -883952260: /*biologicalSource*/  return new Property("biologicalSource", "Identifier", "An identifier that supports traceability to the biological entity that is the source of biological material in the product.", 0, 1, biologicalSource);
1603        case 39337686: /*processingFacility*/  return new Property("processingFacility", "Reference(Organization)", "Processing facilities for this biologically derived product.", 0, java.lang.Integer.MAX_VALUE, processingFacility);
1604        case 364720301: /*division*/  return new Property("division", "string", "Description of division.", 0, 1, division);
1605        case -892481550: /*status*/  return new Property("status", "code", "Whether the product is currently available.", 0, 1, status);
1606        case -668811523: /*expirationDate*/  return new Property("expirationDate", "dateTime", "Date of expiration.", 0, 1, expirationDate);
1607        case -1741312354: /*collection*/  return new Property("collection", "", "How this product was collected.", 0, 1, collection);
1608        case 1643599647: /*storageTempRequirements*/  return new Property("storageTempRequirements", "Range", "Product storage temp requirements.", 0, 1, storageTempRequirements);
1609        case -993141291: /*property*/  return new Property("property", "", "A property that is specific to this BiologicallyDerviedProduct instance.", 0, java.lang.Integer.MAX_VALUE, property);
1610        default: return super.getNamedProperty(_hash, _name, _checkValid);
1611        }
1612
1613      }
1614
1615      @Override
1616      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1617        switch (hash) {
1618        case 197299981: /*productCategory*/ return this.productCategory == null ? new Base[0] : new Base[] {this.productCategory}; // Enumeration<BiologicallyDerivedProductCategory>
1619        case -1492131972: /*productCode*/ return this.productCode == null ? new Base[0] : new Base[] {this.productCode}; // CodeableConcept
1620        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : this.parent.toArray(new Base[this.parent.size()]); // Reference
1621        case 1095692943: /*request*/ return this.request == null ? new Base[0] : this.request.toArray(new Base[this.request.size()]); // Reference
1622        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1623        case -883952260: /*biologicalSource*/ return this.biologicalSource == null ? new Base[0] : new Base[] {this.biologicalSource}; // Identifier
1624        case 39337686: /*processingFacility*/ return this.processingFacility == null ? new Base[0] : this.processingFacility.toArray(new Base[this.processingFacility.size()]); // Reference
1625        case 364720301: /*division*/ return this.division == null ? new Base[0] : new Base[] {this.division}; // StringType
1626        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<BiologicallyDerivedProductStatus>
1627        case -668811523: /*expirationDate*/ return this.expirationDate == null ? new Base[0] : new Base[] {this.expirationDate}; // DateTimeType
1628        case -1741312354: /*collection*/ return this.collection == null ? new Base[0] : new Base[] {this.collection}; // BiologicallyDerivedProductCollectionComponent
1629        case 1643599647: /*storageTempRequirements*/ return this.storageTempRequirements == null ? new Base[0] : new Base[] {this.storageTempRequirements}; // Range
1630        case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // BiologicallyDerivedProductPropertyComponent
1631        default: return super.getProperty(hash, name, checkValid);
1632        }
1633
1634      }
1635
1636      @Override
1637      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1638        switch (hash) {
1639        case 197299981: // productCategory
1640          value = new BiologicallyDerivedProductCategoryEnumFactory().fromType(TypeConvertor.castToCode(value));
1641          this.productCategory = (Enumeration) value; // Enumeration<BiologicallyDerivedProductCategory>
1642          return value;
1643        case -1492131972: // productCode
1644          this.productCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1645          return value;
1646        case -995424086: // parent
1647          this.getParent().add(TypeConvertor.castToReference(value)); // Reference
1648          return value;
1649        case 1095692943: // request
1650          this.getRequest().add(TypeConvertor.castToReference(value)); // Reference
1651          return value;
1652        case -1618432855: // identifier
1653          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1654          return value;
1655        case -883952260: // biologicalSource
1656          this.biologicalSource = TypeConvertor.castToIdentifier(value); // Identifier
1657          return value;
1658        case 39337686: // processingFacility
1659          this.getProcessingFacility().add(TypeConvertor.castToReference(value)); // Reference
1660          return value;
1661        case 364720301: // division
1662          this.division = TypeConvertor.castToString(value); // StringType
1663          return value;
1664        case -892481550: // status
1665          value = new BiologicallyDerivedProductStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1666          this.status = (Enumeration) value; // Enumeration<BiologicallyDerivedProductStatus>
1667          return value;
1668        case -668811523: // expirationDate
1669          this.expirationDate = TypeConvertor.castToDateTime(value); // DateTimeType
1670          return value;
1671        case -1741312354: // collection
1672          this.collection = (BiologicallyDerivedProductCollectionComponent) value; // BiologicallyDerivedProductCollectionComponent
1673          return value;
1674        case 1643599647: // storageTempRequirements
1675          this.storageTempRequirements = TypeConvertor.castToRange(value); // Range
1676          return value;
1677        case -993141291: // property
1678          this.getProperty().add((BiologicallyDerivedProductPropertyComponent) value); // BiologicallyDerivedProductPropertyComponent
1679          return value;
1680        default: return super.setProperty(hash, name, value);
1681        }
1682
1683      }
1684
1685      @Override
1686      public Base setProperty(String name, Base value) throws FHIRException {
1687        if (name.equals("productCategory")) {
1688          value = new BiologicallyDerivedProductCategoryEnumFactory().fromType(TypeConvertor.castToCode(value));
1689          this.productCategory = (Enumeration) value; // Enumeration<BiologicallyDerivedProductCategory>
1690        } else if (name.equals("productCode")) {
1691          this.productCode = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1692        } else if (name.equals("parent")) {
1693          this.getParent().add(TypeConvertor.castToReference(value));
1694        } else if (name.equals("request")) {
1695          this.getRequest().add(TypeConvertor.castToReference(value));
1696        } else if (name.equals("identifier")) {
1697          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1698        } else if (name.equals("biologicalSource")) {
1699          this.biologicalSource = TypeConvertor.castToIdentifier(value); // Identifier
1700        } else if (name.equals("processingFacility")) {
1701          this.getProcessingFacility().add(TypeConvertor.castToReference(value));
1702        } else if (name.equals("division")) {
1703          this.division = TypeConvertor.castToString(value); // StringType
1704        } else if (name.equals("status")) {
1705          value = new BiologicallyDerivedProductStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1706          this.status = (Enumeration) value; // Enumeration<BiologicallyDerivedProductStatus>
1707        } else if (name.equals("expirationDate")) {
1708          this.expirationDate = TypeConvertor.castToDateTime(value); // DateTimeType
1709        } else if (name.equals("collection")) {
1710          this.collection = (BiologicallyDerivedProductCollectionComponent) value; // BiologicallyDerivedProductCollectionComponent
1711        } else if (name.equals("storageTempRequirements")) {
1712          this.storageTempRequirements = TypeConvertor.castToRange(value); // Range
1713        } else if (name.equals("property")) {
1714          this.getProperty().add((BiologicallyDerivedProductPropertyComponent) value);
1715        } else
1716          return super.setProperty(name, value);
1717        return value;
1718      }
1719
1720      @Override
1721      public Base makeProperty(int hash, String name) throws FHIRException {
1722        switch (hash) {
1723        case 197299981:  return getProductCategoryElement();
1724        case -1492131972:  return getProductCode();
1725        case -995424086:  return addParent(); 
1726        case 1095692943:  return addRequest(); 
1727        case -1618432855:  return addIdentifier(); 
1728        case -883952260:  return getBiologicalSource();
1729        case 39337686:  return addProcessingFacility(); 
1730        case 364720301:  return getDivisionElement();
1731        case -892481550:  return getStatusElement();
1732        case -668811523:  return getExpirationDateElement();
1733        case -1741312354:  return getCollection();
1734        case 1643599647:  return getStorageTempRequirements();
1735        case -993141291:  return addProperty(); 
1736        default: return super.makeProperty(hash, name);
1737        }
1738
1739      }
1740
1741      @Override
1742      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1743        switch (hash) {
1744        case 197299981: /*productCategory*/ return new String[] {"code"};
1745        case -1492131972: /*productCode*/ return new String[] {"CodeableConcept"};
1746        case -995424086: /*parent*/ return new String[] {"Reference"};
1747        case 1095692943: /*request*/ return new String[] {"Reference"};
1748        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1749        case -883952260: /*biologicalSource*/ return new String[] {"Identifier"};
1750        case 39337686: /*processingFacility*/ return new String[] {"Reference"};
1751        case 364720301: /*division*/ return new String[] {"string"};
1752        case -892481550: /*status*/ return new String[] {"code"};
1753        case -668811523: /*expirationDate*/ return new String[] {"dateTime"};
1754        case -1741312354: /*collection*/ return new String[] {};
1755        case 1643599647: /*storageTempRequirements*/ return new String[] {"Range"};
1756        case -993141291: /*property*/ return new String[] {};
1757        default: return super.getTypesForProperty(hash, name);
1758        }
1759
1760      }
1761
1762      @Override
1763      public Base addChild(String name) throws FHIRException {
1764        if (name.equals("productCategory")) {
1765          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.productCategory");
1766        }
1767        else if (name.equals("productCode")) {
1768          this.productCode = new CodeableConcept();
1769          return this.productCode;
1770        }
1771        else if (name.equals("parent")) {
1772          return addParent();
1773        }
1774        else if (name.equals("request")) {
1775          return addRequest();
1776        }
1777        else if (name.equals("identifier")) {
1778          return addIdentifier();
1779        }
1780        else if (name.equals("biologicalSource")) {
1781          this.biologicalSource = new Identifier();
1782          return this.biologicalSource;
1783        }
1784        else if (name.equals("processingFacility")) {
1785          return addProcessingFacility();
1786        }
1787        else if (name.equals("division")) {
1788          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.division");
1789        }
1790        else if (name.equals("status")) {
1791          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.status");
1792        }
1793        else if (name.equals("expirationDate")) {
1794          throw new FHIRException("Cannot call addChild on a primitive type BiologicallyDerivedProduct.expirationDate");
1795        }
1796        else if (name.equals("collection")) {
1797          this.collection = new BiologicallyDerivedProductCollectionComponent();
1798          return this.collection;
1799        }
1800        else if (name.equals("storageTempRequirements")) {
1801          this.storageTempRequirements = new Range();
1802          return this.storageTempRequirements;
1803        }
1804        else if (name.equals("property")) {
1805          return addProperty();
1806        }
1807        else
1808          return super.addChild(name);
1809      }
1810
1811  public String fhirType() {
1812    return "BiologicallyDerivedProduct";
1813
1814  }
1815
1816      public BiologicallyDerivedProduct copy() {
1817        BiologicallyDerivedProduct dst = new BiologicallyDerivedProduct();
1818        copyValues(dst);
1819        return dst;
1820      }
1821
1822      public void copyValues(BiologicallyDerivedProduct dst) {
1823        super.copyValues(dst);
1824        dst.productCategory = productCategory == null ? null : productCategory.copy();
1825        dst.productCode = productCode == null ? null : productCode.copy();
1826        if (parent != null) {
1827          dst.parent = new ArrayList<Reference>();
1828          for (Reference i : parent)
1829            dst.parent.add(i.copy());
1830        };
1831        if (request != null) {
1832          dst.request = new ArrayList<Reference>();
1833          for (Reference i : request)
1834            dst.request.add(i.copy());
1835        };
1836        if (identifier != null) {
1837          dst.identifier = new ArrayList<Identifier>();
1838          for (Identifier i : identifier)
1839            dst.identifier.add(i.copy());
1840        };
1841        dst.biologicalSource = biologicalSource == null ? null : biologicalSource.copy();
1842        if (processingFacility != null) {
1843          dst.processingFacility = new ArrayList<Reference>();
1844          for (Reference i : processingFacility)
1845            dst.processingFacility.add(i.copy());
1846        };
1847        dst.division = division == null ? null : division.copy();
1848        dst.status = status == null ? null : status.copy();
1849        dst.expirationDate = expirationDate == null ? null : expirationDate.copy();
1850        dst.collection = collection == null ? null : collection.copy();
1851        dst.storageTempRequirements = storageTempRequirements == null ? null : storageTempRequirements.copy();
1852        if (property != null) {
1853          dst.property = new ArrayList<BiologicallyDerivedProductPropertyComponent>();
1854          for (BiologicallyDerivedProductPropertyComponent i : property)
1855            dst.property.add(i.copy());
1856        };
1857      }
1858
1859      protected BiologicallyDerivedProduct typedCopy() {
1860        return copy();
1861      }
1862
1863      @Override
1864      public boolean equalsDeep(Base other_) {
1865        if (!super.equalsDeep(other_))
1866          return false;
1867        if (!(other_ instanceof BiologicallyDerivedProduct))
1868          return false;
1869        BiologicallyDerivedProduct o = (BiologicallyDerivedProduct) other_;
1870        return compareDeep(productCategory, o.productCategory, true) && compareDeep(productCode, o.productCode, true)
1871           && compareDeep(parent, o.parent, true) && compareDeep(request, o.request, true) && compareDeep(identifier, o.identifier, true)
1872           && compareDeep(biologicalSource, o.biologicalSource, true) && compareDeep(processingFacility, o.processingFacility, true)
1873           && compareDeep(division, o.division, true) && compareDeep(status, o.status, true) && compareDeep(expirationDate, o.expirationDate, true)
1874           && compareDeep(collection, o.collection, true) && compareDeep(storageTempRequirements, o.storageTempRequirements, true)
1875           && compareDeep(property, o.property, true);
1876      }
1877
1878      @Override
1879      public boolean equalsShallow(Base other_) {
1880        if (!super.equalsShallow(other_))
1881          return false;
1882        if (!(other_ instanceof BiologicallyDerivedProduct))
1883          return false;
1884        BiologicallyDerivedProduct o = (BiologicallyDerivedProduct) other_;
1885        return compareValues(productCategory, o.productCategory, true) && compareValues(division, o.division, true)
1886           && compareValues(status, o.status, true) && compareValues(expirationDate, o.expirationDate, true);
1887      }
1888
1889      public boolean isEmpty() {
1890        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productCategory, productCode
1891          , parent, request, identifier, biologicalSource, processingFacility, division, status
1892          , expirationDate, collection, storageTempRequirements, property);
1893      }
1894
1895  @Override
1896  public ResourceType getResourceType() {
1897    return ResourceType.BiologicallyDerivedProduct;
1898   }
1899
1900 /**
1901   * Search parameter: <b>biological-source</b>
1902   * <p>
1903   * Description: <b>The biological source for the biologically derived product</b><br>
1904   * Type: <b>token</b><br>
1905   * Path: <b>BiologicallyDerivedProduct.biologicalSource</b><br>
1906   * </p>
1907   */
1908  @SearchParamDefinition(name="biological-source", path="BiologicallyDerivedProduct.biologicalSource", description="The biological source for the biologically derived product", type="token" )
1909  public static final String SP_BIOLOGICAL_SOURCE = "biological-source";
1910 /**
1911   * <b>Fluent Client</b> search parameter constant for <b>biological-source</b>
1912   * <p>
1913   * Description: <b>The biological source for the biologically derived product</b><br>
1914   * Type: <b>token</b><br>
1915   * Path: <b>BiologicallyDerivedProduct.biologicalSource</b><br>
1916   * </p>
1917   */
1918  public static final ca.uhn.fhir.rest.gclient.TokenClientParam BIOLOGICAL_SOURCE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_BIOLOGICAL_SOURCE);
1919
1920
1921}
1922