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