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