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