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