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