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