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