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