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