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