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