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