001package org.hl7.fhir.instance.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.*;
034
035import org.hl7.fhir.exceptions.FHIRException;
036import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
037import org.hl7.fhir.utilities.Utilities;
038
039import ca.uhn.fhir.model.api.annotation.*;
040/**
041 * A sample to be used for analysis.
042 */
043@ResourceDef(name="Specimen", profile="http://hl7.org/fhir/Profile/Specimen")
044public class Specimen extends DomainResource {
045
046    public enum SpecimenStatus {
047        /**
048         * The physical specimen is present and in good condition.
049         */
050        AVAILABLE, 
051        /**
052         * There is no physical specimen because it is either lost, destroyed or consumed.
053         */
054        UNAVAILABLE, 
055        /**
056         * The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old.
057         */
058        UNSATISFACTORY, 
059        /**
060         * The specimen was entered in error and therefore nullified.
061         */
062        ENTEREDINERROR, 
063        /**
064         * added to help the parsers
065         */
066        NULL;
067        public static SpecimenStatus fromCode(String codeString) throws FHIRException {
068            if (codeString == null || "".equals(codeString))
069                return null;
070        if ("available".equals(codeString))
071          return AVAILABLE;
072        if ("unavailable".equals(codeString))
073          return UNAVAILABLE;
074        if ("unsatisfactory".equals(codeString))
075          return UNSATISFACTORY;
076        if ("entered-in-error".equals(codeString))
077          return ENTEREDINERROR;
078        throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'");
079        }
080        public String toCode() {
081          switch (this) {
082            case AVAILABLE: return "available";
083            case UNAVAILABLE: return "unavailable";
084            case UNSATISFACTORY: return "unsatisfactory";
085            case ENTEREDINERROR: return "entered-in-error";
086            default: return "?";
087          }
088        }
089        public String getSystem() {
090          switch (this) {
091            case AVAILABLE: return "http://hl7.org/fhir/specimen-status";
092            case UNAVAILABLE: return "http://hl7.org/fhir/specimen-status";
093            case UNSATISFACTORY: return "http://hl7.org/fhir/specimen-status";
094            case ENTEREDINERROR: return "http://hl7.org/fhir/specimen-status";
095            default: return "?";
096          }
097        }
098        public String getDefinition() {
099          switch (this) {
100            case AVAILABLE: return "The physical specimen is present and in good condition.";
101            case UNAVAILABLE: return "There is no physical specimen because it is either lost, destroyed or consumed.";
102            case UNSATISFACTORY: return "The specimen cannot be used because of a quality issue such as a broken container, contamination, or too old.";
103            case ENTEREDINERROR: return "The specimen was entered in error and therefore nullified.";
104            default: return "?";
105          }
106        }
107        public String getDisplay() {
108          switch (this) {
109            case AVAILABLE: return "Available";
110            case UNAVAILABLE: return "Unavailable";
111            case UNSATISFACTORY: return "Unsatisfactory";
112            case ENTEREDINERROR: return "Entered-in-error";
113            default: return "?";
114          }
115        }
116    }
117
118  public static class SpecimenStatusEnumFactory implements EnumFactory<SpecimenStatus> {
119    public SpecimenStatus fromCode(String codeString) throws IllegalArgumentException {
120      if (codeString == null || "".equals(codeString))
121            if (codeString == null || "".equals(codeString))
122                return null;
123        if ("available".equals(codeString))
124          return SpecimenStatus.AVAILABLE;
125        if ("unavailable".equals(codeString))
126          return SpecimenStatus.UNAVAILABLE;
127        if ("unsatisfactory".equals(codeString))
128          return SpecimenStatus.UNSATISFACTORY;
129        if ("entered-in-error".equals(codeString))
130          return SpecimenStatus.ENTEREDINERROR;
131        throw new IllegalArgumentException("Unknown SpecimenStatus code '"+codeString+"'");
132        }
133        public Enumeration<SpecimenStatus> fromType(Base code) throws FHIRException {
134          if (code == null || code.isEmpty())
135            return null;
136          String codeString = ((PrimitiveType) code).asStringValue();
137          if (codeString == null || "".equals(codeString))
138            return null;
139        if ("available".equals(codeString))
140          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.AVAILABLE);
141        if ("unavailable".equals(codeString))
142          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.UNAVAILABLE);
143        if ("unsatisfactory".equals(codeString))
144          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.UNSATISFACTORY);
145        if ("entered-in-error".equals(codeString))
146          return new Enumeration<SpecimenStatus>(this, SpecimenStatus.ENTEREDINERROR);
147        throw new FHIRException("Unknown SpecimenStatus code '"+codeString+"'");
148        }
149    public String toCode(SpecimenStatus code) {
150      if (code == SpecimenStatus.AVAILABLE)
151        return "available";
152      if (code == SpecimenStatus.UNAVAILABLE)
153        return "unavailable";
154      if (code == SpecimenStatus.UNSATISFACTORY)
155        return "unsatisfactory";
156      if (code == SpecimenStatus.ENTEREDINERROR)
157        return "entered-in-error";
158      return "?";
159      }
160    }
161
162    @Block()
163    public static class SpecimenCollectionComponent extends BackboneElement implements IBaseBackboneElement {
164        /**
165         * Person who collected the specimen.
166         */
167        @Child(name = "collector", type = {Practitioner.class}, order=1, min=0, max=1, modifier=false, summary=true)
168        @Description(shortDefinition="Who collected the specimen", formalDefinition="Person who collected the specimen." )
169        protected Reference collector;
170
171        /**
172         * The actual object that is the target of the reference (Person who collected the specimen.)
173         */
174        protected Practitioner collectorTarget;
175
176        /**
177         * To communicate any details or issues encountered during the specimen collection procedure.
178         */
179        @Child(name = "comment", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
180        @Description(shortDefinition="Collector comments", formalDefinition="To communicate any details or issues encountered during the specimen collection procedure." )
181        protected List<StringType> comment;
182
183        /**
184         * Time when specimen was collected from subject - the physiologically relevant time.
185         */
186        @Child(name = "collected", type = {DateTimeType.class, Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
187        @Description(shortDefinition="Collection time", formalDefinition="Time when specimen was collected from subject - the physiologically relevant time." )
188        protected Type collected;
189
190        /**
191         * The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.
192         */
193        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
194        @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." )
195        protected SimpleQuantity quantity;
196
197        /**
198         * A coded value specifying the technique that is used to perform the procedure.
199         */
200        @Child(name = "method", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
201        @Description(shortDefinition="Technique used to perform collection", formalDefinition="A coded value specifying the technique that is used to perform the procedure." )
202        protected CodeableConcept method;
203
204        /**
205         * 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.
206         */
207        @Child(name = "bodySite", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
208        @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." )
209        protected CodeableConcept bodySite;
210
211        private static final long serialVersionUID = -1418734687L;
212
213    /*
214     * Constructor
215     */
216      public SpecimenCollectionComponent() {
217        super();
218      }
219
220        /**
221         * @return {@link #collector} (Person who collected the specimen.)
222         */
223        public Reference getCollector() { 
224          if (this.collector == null)
225            if (Configuration.errorOnAutoCreate())
226              throw new Error("Attempt to auto-create SpecimenCollectionComponent.collector");
227            else if (Configuration.doAutoCreate())
228              this.collector = new Reference(); // cc
229          return this.collector;
230        }
231
232        public boolean hasCollector() { 
233          return this.collector != null && !this.collector.isEmpty();
234        }
235
236        /**
237         * @param value {@link #collector} (Person who collected the specimen.)
238         */
239        public SpecimenCollectionComponent setCollector(Reference value) { 
240          this.collector = value;
241          return this;
242        }
243
244        /**
245         * @return {@link #collector} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Person who collected the specimen.)
246         */
247        public Practitioner getCollectorTarget() { 
248          if (this.collectorTarget == null)
249            if (Configuration.errorOnAutoCreate())
250              throw new Error("Attempt to auto-create SpecimenCollectionComponent.collector");
251            else if (Configuration.doAutoCreate())
252              this.collectorTarget = new Practitioner(); // aa
253          return this.collectorTarget;
254        }
255
256        /**
257         * @param value {@link #collector} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Person who collected the specimen.)
258         */
259        public SpecimenCollectionComponent setCollectorTarget(Practitioner value) { 
260          this.collectorTarget = value;
261          return this;
262        }
263
264        /**
265         * @return {@link #comment} (To communicate any details or issues encountered during the specimen collection procedure.)
266         */
267        public List<StringType> getComment() { 
268          if (this.comment == null)
269            this.comment = new ArrayList<StringType>();
270          return this.comment;
271        }
272
273        public boolean hasComment() { 
274          if (this.comment == null)
275            return false;
276          for (StringType item : this.comment)
277            if (!item.isEmpty())
278              return true;
279          return false;
280        }
281
282        /**
283         * @return {@link #comment} (To communicate any details or issues encountered during the specimen collection procedure.)
284         */
285    // syntactic sugar
286        public StringType addCommentElement() {//2 
287          StringType t = new StringType();
288          if (this.comment == null)
289            this.comment = new ArrayList<StringType>();
290          this.comment.add(t);
291          return t;
292        }
293
294        /**
295         * @param value {@link #comment} (To communicate any details or issues encountered during the specimen collection procedure.)
296         */
297        public SpecimenCollectionComponent addComment(String value) { //1
298          StringType t = new StringType();
299          t.setValue(value);
300          if (this.comment == null)
301            this.comment = new ArrayList<StringType>();
302          this.comment.add(t);
303          return this;
304        }
305
306        /**
307         * @param value {@link #comment} (To communicate any details or issues encountered during the specimen collection procedure.)
308         */
309        public boolean hasComment(String value) { 
310          if (this.comment == null)
311            return false;
312          for (StringType v : this.comment)
313            if (v.equals(value)) // string
314              return true;
315          return false;
316        }
317
318        /**
319         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
320         */
321        public Type getCollected() { 
322          return this.collected;
323        }
324
325        /**
326         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
327         */
328        public DateTimeType getCollectedDateTimeType() throws FHIRException { 
329          if (!(this.collected instanceof DateTimeType))
330            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.collected.getClass().getName()+" was encountered");
331          return (DateTimeType) this.collected;
332        }
333
334        public boolean hasCollectedDateTimeType() { 
335          return this.collected instanceof DateTimeType;
336        }
337
338        /**
339         * @return {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
340         */
341        public Period getCollectedPeriod() throws FHIRException { 
342          if (!(this.collected instanceof Period))
343            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.collected.getClass().getName()+" was encountered");
344          return (Period) this.collected;
345        }
346
347        public boolean hasCollectedPeriod() { 
348          return this.collected instanceof Period;
349        }
350
351        public boolean hasCollected() { 
352          return this.collected != null && !this.collected.isEmpty();
353        }
354
355        /**
356         * @param value {@link #collected} (Time when specimen was collected from subject - the physiologically relevant time.)
357         */
358        public SpecimenCollectionComponent setCollected(Type value) { 
359          this.collected = value;
360          return this;
361        }
362
363        /**
364         * @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.)
365         */
366        public SimpleQuantity getQuantity() { 
367          if (this.quantity == null)
368            if (Configuration.errorOnAutoCreate())
369              throw new Error("Attempt to auto-create SpecimenCollectionComponent.quantity");
370            else if (Configuration.doAutoCreate())
371              this.quantity = new SimpleQuantity(); // cc
372          return this.quantity;
373        }
374
375        public boolean hasQuantity() { 
376          return this.quantity != null && !this.quantity.isEmpty();
377        }
378
379        /**
380         * @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.)
381         */
382        public SpecimenCollectionComponent setQuantity(SimpleQuantity value) { 
383          this.quantity = value;
384          return this;
385        }
386
387        /**
388         * @return {@link #method} (A coded value specifying the technique that is used to perform the procedure.)
389         */
390        public CodeableConcept getMethod() { 
391          if (this.method == null)
392            if (Configuration.errorOnAutoCreate())
393              throw new Error("Attempt to auto-create SpecimenCollectionComponent.method");
394            else if (Configuration.doAutoCreate())
395              this.method = new CodeableConcept(); // cc
396          return this.method;
397        }
398
399        public boolean hasMethod() { 
400          return this.method != null && !this.method.isEmpty();
401        }
402
403        /**
404         * @param value {@link #method} (A coded value specifying the technique that is used to perform the procedure.)
405         */
406        public SpecimenCollectionComponent setMethod(CodeableConcept value) { 
407          this.method = value;
408          return this;
409        }
410
411        /**
412         * @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.)
413         */
414        public CodeableConcept getBodySite() { 
415          if (this.bodySite == null)
416            if (Configuration.errorOnAutoCreate())
417              throw new Error("Attempt to auto-create SpecimenCollectionComponent.bodySite");
418            else if (Configuration.doAutoCreate())
419              this.bodySite = new CodeableConcept(); // cc
420          return this.bodySite;
421        }
422
423        public boolean hasBodySite() { 
424          return this.bodySite != null && !this.bodySite.isEmpty();
425        }
426
427        /**
428         * @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.)
429         */
430        public SpecimenCollectionComponent setBodySite(CodeableConcept value) { 
431          this.bodySite = value;
432          return this;
433        }
434
435        protected void listChildren(List<Property> childrenList) {
436          super.listChildren(childrenList);
437          childrenList.add(new Property("collector", "Reference(Practitioner)", "Person who collected the specimen.", 0, java.lang.Integer.MAX_VALUE, collector));
438          childrenList.add(new Property("comment", "string", "To communicate any details or issues encountered during the specimen collection procedure.", 0, java.lang.Integer.MAX_VALUE, comment));
439          childrenList.add(new Property("collected[x]", "dateTime|Period", "Time when specimen was collected from subject - the physiologically relevant time.", 0, java.lang.Integer.MAX_VALUE, collected));
440          childrenList.add(new Property("quantity", "SimpleQuantity", "The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.", 0, java.lang.Integer.MAX_VALUE, quantity));
441          childrenList.add(new Property("method", "CodeableConcept", "A coded value specifying the technique that is used to perform the procedure.", 0, java.lang.Integer.MAX_VALUE, method));
442          childrenList.add(new Property("bodySite", "CodeableConcept", "Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens.", 0, java.lang.Integer.MAX_VALUE, bodySite));
443        }
444
445      @Override
446      public void setProperty(String name, Base value) throws FHIRException {
447        if (name.equals("collector"))
448          this.collector = castToReference(value); // Reference
449        else if (name.equals("comment"))
450          this.getComment().add(castToString(value));
451        else if (name.equals("collected[x]"))
452          this.collected = (Type) value; // Type
453        else if (name.equals("quantity"))
454          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
455        else if (name.equals("method"))
456          this.method = castToCodeableConcept(value); // CodeableConcept
457        else if (name.equals("bodySite"))
458          this.bodySite = castToCodeableConcept(value); // CodeableConcept
459        else
460          super.setProperty(name, value);
461      }
462
463      @Override
464      public Base addChild(String name) throws FHIRException {
465        if (name.equals("collector")) {
466          this.collector = new Reference();
467          return this.collector;
468        }
469        else if (name.equals("comment")) {
470          throw new FHIRException("Cannot call addChild on a primitive type Specimen.comment");
471        }
472        else if (name.equals("collectedDateTime")) {
473          this.collected = new DateTimeType();
474          return this.collected;
475        }
476        else if (name.equals("collectedPeriod")) {
477          this.collected = new Period();
478          return this.collected;
479        }
480        else if (name.equals("quantity")) {
481          this.quantity = new SimpleQuantity();
482          return this.quantity;
483        }
484        else if (name.equals("method")) {
485          this.method = new CodeableConcept();
486          return this.method;
487        }
488        else if (name.equals("bodySite")) {
489          this.bodySite = new CodeableConcept();
490          return this.bodySite;
491        }
492        else
493          return super.addChild(name);
494      }
495
496      public SpecimenCollectionComponent copy() {
497        SpecimenCollectionComponent dst = new SpecimenCollectionComponent();
498        copyValues(dst);
499        dst.collector = collector == null ? null : collector.copy();
500        if (comment != null) {
501          dst.comment = new ArrayList<StringType>();
502          for (StringType i : comment)
503            dst.comment.add(i.copy());
504        };
505        dst.collected = collected == null ? null : collected.copy();
506        dst.quantity = quantity == null ? null : quantity.copy();
507        dst.method = method == null ? null : method.copy();
508        dst.bodySite = bodySite == null ? null : bodySite.copy();
509        return dst;
510      }
511
512      @Override
513      public boolean equalsDeep(Base other) {
514        if (!super.equalsDeep(other))
515          return false;
516        if (!(other instanceof SpecimenCollectionComponent))
517          return false;
518        SpecimenCollectionComponent o = (SpecimenCollectionComponent) other;
519        return compareDeep(collector, o.collector, true) && compareDeep(comment, o.comment, true) && compareDeep(collected, o.collected, true)
520           && compareDeep(quantity, o.quantity, true) && compareDeep(method, o.method, true) && compareDeep(bodySite, o.bodySite, true)
521          ;
522      }
523
524      @Override
525      public boolean equalsShallow(Base other) {
526        if (!super.equalsShallow(other))
527          return false;
528        if (!(other instanceof SpecimenCollectionComponent))
529          return false;
530        SpecimenCollectionComponent o = (SpecimenCollectionComponent) other;
531        return compareValues(comment, o.comment, true);
532      }
533
534      public boolean isEmpty() {
535        return super.isEmpty() && (collector == null || collector.isEmpty()) && (comment == null || comment.isEmpty())
536           && (collected == null || collected.isEmpty()) && (quantity == null || quantity.isEmpty())
537           && (method == null || method.isEmpty()) && (bodySite == null || bodySite.isEmpty());
538      }
539
540  public String fhirType() {
541    return "Specimen.collection";
542
543  }
544
545  }
546
547    @Block()
548    public static class SpecimenTreatmentComponent extends BackboneElement implements IBaseBackboneElement {
549        /**
550         * Textual description of procedure.
551         */
552        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
553        @Description(shortDefinition="Textual description of procedure", formalDefinition="Textual description of procedure." )
554        protected StringType description;
555
556        /**
557         * A coded value specifying the procedure used to process the specimen.
558         */
559        @Child(name = "procedure", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
560        @Description(shortDefinition="Indicates the treatment or processing step  applied to the specimen", formalDefinition="A coded value specifying the procedure used to process the specimen." )
561        protected CodeableConcept procedure;
562
563        /**
564         * Material used in the processing step.
565         */
566        @Child(name = "additive", type = {Substance.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
567        @Description(shortDefinition="Material used in the processing step", formalDefinition="Material used in the processing step." )
568        protected List<Reference> additive;
569        /**
570         * The actual objects that are the target of the reference (Material used in the processing step.)
571         */
572        protected List<Substance> additiveTarget;
573
574
575        private static final long serialVersionUID = -373251521L;
576
577    /*
578     * Constructor
579     */
580      public SpecimenTreatmentComponent() {
581        super();
582      }
583
584        /**
585         * @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
586         */
587        public StringType getDescriptionElement() { 
588          if (this.description == null)
589            if (Configuration.errorOnAutoCreate())
590              throw new Error("Attempt to auto-create SpecimenTreatmentComponent.description");
591            else if (Configuration.doAutoCreate())
592              this.description = new StringType(); // bb
593          return this.description;
594        }
595
596        public boolean hasDescriptionElement() { 
597          return this.description != null && !this.description.isEmpty();
598        }
599
600        public boolean hasDescription() { 
601          return this.description != null && !this.description.isEmpty();
602        }
603
604        /**
605         * @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
606         */
607        public SpecimenTreatmentComponent setDescriptionElement(StringType value) { 
608          this.description = value;
609          return this;
610        }
611
612        /**
613         * @return Textual description of procedure.
614         */
615        public String getDescription() { 
616          return this.description == null ? null : this.description.getValue();
617        }
618
619        /**
620         * @param value Textual description of procedure.
621         */
622        public SpecimenTreatmentComponent setDescription(String value) { 
623          if (Utilities.noString(value))
624            this.description = null;
625          else {
626            if (this.description == null)
627              this.description = new StringType();
628            this.description.setValue(value);
629          }
630          return this;
631        }
632
633        /**
634         * @return {@link #procedure} (A coded value specifying the procedure used to process the specimen.)
635         */
636        public CodeableConcept getProcedure() { 
637          if (this.procedure == null)
638            if (Configuration.errorOnAutoCreate())
639              throw new Error("Attempt to auto-create SpecimenTreatmentComponent.procedure");
640            else if (Configuration.doAutoCreate())
641              this.procedure = new CodeableConcept(); // cc
642          return this.procedure;
643        }
644
645        public boolean hasProcedure() { 
646          return this.procedure != null && !this.procedure.isEmpty();
647        }
648
649        /**
650         * @param value {@link #procedure} (A coded value specifying the procedure used to process the specimen.)
651         */
652        public SpecimenTreatmentComponent setProcedure(CodeableConcept value) { 
653          this.procedure = value;
654          return this;
655        }
656
657        /**
658         * @return {@link #additive} (Material used in the processing step.)
659         */
660        public List<Reference> getAdditive() { 
661          if (this.additive == null)
662            this.additive = new ArrayList<Reference>();
663          return this.additive;
664        }
665
666        public boolean hasAdditive() { 
667          if (this.additive == null)
668            return false;
669          for (Reference item : this.additive)
670            if (!item.isEmpty())
671              return true;
672          return false;
673        }
674
675        /**
676         * @return {@link #additive} (Material used in the processing step.)
677         */
678    // syntactic sugar
679        public Reference addAdditive() { //3
680          Reference t = new Reference();
681          if (this.additive == null)
682            this.additive = new ArrayList<Reference>();
683          this.additive.add(t);
684          return t;
685        }
686
687    // syntactic sugar
688        public SpecimenTreatmentComponent addAdditive(Reference t) { //3
689          if (t == null)
690            return this;
691          if (this.additive == null)
692            this.additive = new ArrayList<Reference>();
693          this.additive.add(t);
694          return this;
695        }
696
697        /**
698         * @return {@link #additive} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Material used in the processing step.)
699         */
700        public List<Substance> getAdditiveTarget() { 
701          if (this.additiveTarget == null)
702            this.additiveTarget = new ArrayList<Substance>();
703          return this.additiveTarget;
704        }
705
706    // syntactic sugar
707        /**
708         * @return {@link #additive} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Material used in the processing step.)
709         */
710        public Substance addAdditiveTarget() { 
711          Substance r = new Substance();
712          if (this.additiveTarget == null)
713            this.additiveTarget = new ArrayList<Substance>();
714          this.additiveTarget.add(r);
715          return r;
716        }
717
718        protected void listChildren(List<Property> childrenList) {
719          super.listChildren(childrenList);
720          childrenList.add(new Property("description", "string", "Textual description of procedure.", 0, java.lang.Integer.MAX_VALUE, description));
721          childrenList.add(new Property("procedure", "CodeableConcept", "A coded value specifying the procedure used to process the specimen.", 0, java.lang.Integer.MAX_VALUE, procedure));
722          childrenList.add(new Property("additive", "Reference(Substance)", "Material used in the processing step.", 0, java.lang.Integer.MAX_VALUE, additive));
723        }
724
725      @Override
726      public void setProperty(String name, Base value) throws FHIRException {
727        if (name.equals("description"))
728          this.description = castToString(value); // StringType
729        else if (name.equals("procedure"))
730          this.procedure = castToCodeableConcept(value); // CodeableConcept
731        else if (name.equals("additive"))
732          this.getAdditive().add(castToReference(value));
733        else
734          super.setProperty(name, value);
735      }
736
737      @Override
738      public Base addChild(String name) throws FHIRException {
739        if (name.equals("description")) {
740          throw new FHIRException("Cannot call addChild on a primitive type Specimen.description");
741        }
742        else if (name.equals("procedure")) {
743          this.procedure = new CodeableConcept();
744          return this.procedure;
745        }
746        else if (name.equals("additive")) {
747          return addAdditive();
748        }
749        else
750          return super.addChild(name);
751      }
752
753      public SpecimenTreatmentComponent copy() {
754        SpecimenTreatmentComponent dst = new SpecimenTreatmentComponent();
755        copyValues(dst);
756        dst.description = description == null ? null : description.copy();
757        dst.procedure = procedure == null ? null : procedure.copy();
758        if (additive != null) {
759          dst.additive = new ArrayList<Reference>();
760          for (Reference i : additive)
761            dst.additive.add(i.copy());
762        };
763        return dst;
764      }
765
766      @Override
767      public boolean equalsDeep(Base other) {
768        if (!super.equalsDeep(other))
769          return false;
770        if (!(other instanceof SpecimenTreatmentComponent))
771          return false;
772        SpecimenTreatmentComponent o = (SpecimenTreatmentComponent) other;
773        return compareDeep(description, o.description, true) && compareDeep(procedure, o.procedure, true)
774           && compareDeep(additive, o.additive, true);
775      }
776
777      @Override
778      public boolean equalsShallow(Base other) {
779        if (!super.equalsShallow(other))
780          return false;
781        if (!(other instanceof SpecimenTreatmentComponent))
782          return false;
783        SpecimenTreatmentComponent o = (SpecimenTreatmentComponent) other;
784        return compareValues(description, o.description, true);
785      }
786
787      public boolean isEmpty() {
788        return super.isEmpty() && (description == null || description.isEmpty()) && (procedure == null || procedure.isEmpty())
789           && (additive == null || additive.isEmpty());
790      }
791
792  public String fhirType() {
793    return "Specimen.treatment";
794
795  }
796
797  }
798
799    @Block()
800    public static class SpecimenContainerComponent extends BackboneElement implements IBaseBackboneElement {
801        /**
802         * 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.
803         */
804        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
805        @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." )
806        protected List<Identifier> identifier;
807
808        /**
809         * Textual description of the container.
810         */
811        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
812        @Description(shortDefinition="Textual description of the container", formalDefinition="Textual description of the container." )
813        protected StringType description;
814
815        /**
816         * The type of container associated with the specimen (e.g. slide, aliquot, etc.).
817         */
818        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
819        @Description(shortDefinition="Kind of container directly associated with specimen", formalDefinition="The type of container associated with the specimen (e.g. slide, aliquot, etc.)." )
820        protected CodeableConcept type;
821
822        /**
823         * The capacity (volume or other measure) the container may contain.
824         */
825        @Child(name = "capacity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
826        @Description(shortDefinition="Container volume or size", formalDefinition="The capacity (volume or other measure) the container may contain." )
827        protected SimpleQuantity capacity;
828
829        /**
830         * The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.
831         */
832        @Child(name = "specimenQuantity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
833        @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." )
834        protected SimpleQuantity specimenQuantity;
835
836        /**
837         * Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.
838         */
839        @Child(name = "additive", type = {CodeableConcept.class, Substance.class}, order=6, min=0, max=1, modifier=false, summary=false)
840        @Description(shortDefinition="Additive associated with container", formalDefinition="Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA." )
841        protected Type additive;
842
843        private static final long serialVersionUID = 187274879L;
844
845    /*
846     * Constructor
847     */
848      public SpecimenContainerComponent() {
849        super();
850      }
851
852        /**
853         * @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.)
854         */
855        public List<Identifier> getIdentifier() { 
856          if (this.identifier == null)
857            this.identifier = new ArrayList<Identifier>();
858          return this.identifier;
859        }
860
861        public boolean hasIdentifier() { 
862          if (this.identifier == null)
863            return false;
864          for (Identifier item : this.identifier)
865            if (!item.isEmpty())
866              return true;
867          return false;
868        }
869
870        /**
871         * @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.)
872         */
873    // syntactic sugar
874        public Identifier addIdentifier() { //3
875          Identifier t = new Identifier();
876          if (this.identifier == null)
877            this.identifier = new ArrayList<Identifier>();
878          this.identifier.add(t);
879          return t;
880        }
881
882    // syntactic sugar
883        public SpecimenContainerComponent addIdentifier(Identifier t) { //3
884          if (t == null)
885            return this;
886          if (this.identifier == null)
887            this.identifier = new ArrayList<Identifier>();
888          this.identifier.add(t);
889          return this;
890        }
891
892        /**
893         * @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
894         */
895        public StringType getDescriptionElement() { 
896          if (this.description == null)
897            if (Configuration.errorOnAutoCreate())
898              throw new Error("Attempt to auto-create SpecimenContainerComponent.description");
899            else if (Configuration.doAutoCreate())
900              this.description = new StringType(); // bb
901          return this.description;
902        }
903
904        public boolean hasDescriptionElement() { 
905          return this.description != null && !this.description.isEmpty();
906        }
907
908        public boolean hasDescription() { 
909          return this.description != null && !this.description.isEmpty();
910        }
911
912        /**
913         * @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
914         */
915        public SpecimenContainerComponent setDescriptionElement(StringType value) { 
916          this.description = value;
917          return this;
918        }
919
920        /**
921         * @return Textual description of the container.
922         */
923        public String getDescription() { 
924          return this.description == null ? null : this.description.getValue();
925        }
926
927        /**
928         * @param value Textual description of the container.
929         */
930        public SpecimenContainerComponent setDescription(String value) { 
931          if (Utilities.noString(value))
932            this.description = null;
933          else {
934            if (this.description == null)
935              this.description = new StringType();
936            this.description.setValue(value);
937          }
938          return this;
939        }
940
941        /**
942         * @return {@link #type} (The type of container associated with the specimen (e.g. slide, aliquot, etc.).)
943         */
944        public CodeableConcept getType() { 
945          if (this.type == null)
946            if (Configuration.errorOnAutoCreate())
947              throw new Error("Attempt to auto-create SpecimenContainerComponent.type");
948            else if (Configuration.doAutoCreate())
949              this.type = new CodeableConcept(); // cc
950          return this.type;
951        }
952
953        public boolean hasType() { 
954          return this.type != null && !this.type.isEmpty();
955        }
956
957        /**
958         * @param value {@link #type} (The type of container associated with the specimen (e.g. slide, aliquot, etc.).)
959         */
960        public SpecimenContainerComponent setType(CodeableConcept value) { 
961          this.type = value;
962          return this;
963        }
964
965        /**
966         * @return {@link #capacity} (The capacity (volume or other measure) the container may contain.)
967         */
968        public SimpleQuantity getCapacity() { 
969          if (this.capacity == null)
970            if (Configuration.errorOnAutoCreate())
971              throw new Error("Attempt to auto-create SpecimenContainerComponent.capacity");
972            else if (Configuration.doAutoCreate())
973              this.capacity = new SimpleQuantity(); // cc
974          return this.capacity;
975        }
976
977        public boolean hasCapacity() { 
978          return this.capacity != null && !this.capacity.isEmpty();
979        }
980
981        /**
982         * @param value {@link #capacity} (The capacity (volume or other measure) the container may contain.)
983         */
984        public SpecimenContainerComponent setCapacity(SimpleQuantity value) { 
985          this.capacity = value;
986          return this;
987        }
988
989        /**
990         * @return {@link #specimenQuantity} (The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.)
991         */
992        public SimpleQuantity getSpecimenQuantity() { 
993          if (this.specimenQuantity == null)
994            if (Configuration.errorOnAutoCreate())
995              throw new Error("Attempt to auto-create SpecimenContainerComponent.specimenQuantity");
996            else if (Configuration.doAutoCreate())
997              this.specimenQuantity = new SimpleQuantity(); // cc
998          return this.specimenQuantity;
999        }
1000
1001        public boolean hasSpecimenQuantity() { 
1002          return this.specimenQuantity != null && !this.specimenQuantity.isEmpty();
1003        }
1004
1005        /**
1006         * @param value {@link #specimenQuantity} (The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.)
1007         */
1008        public SpecimenContainerComponent setSpecimenQuantity(SimpleQuantity value) { 
1009          this.specimenQuantity = value;
1010          return this;
1011        }
1012
1013        /**
1014         * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1015         */
1016        public Type getAdditive() { 
1017          return this.additive;
1018        }
1019
1020        /**
1021         * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1022         */
1023        public CodeableConcept getAdditiveCodeableConcept() throws FHIRException { 
1024          if (!(this.additive instanceof CodeableConcept))
1025            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.additive.getClass().getName()+" was encountered");
1026          return (CodeableConcept) this.additive;
1027        }
1028
1029        public boolean hasAdditiveCodeableConcept() { 
1030          return this.additive instanceof CodeableConcept;
1031        }
1032
1033        /**
1034         * @return {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1035         */
1036        public Reference getAdditiveReference() throws FHIRException { 
1037          if (!(this.additive instanceof Reference))
1038            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.additive.getClass().getName()+" was encountered");
1039          return (Reference) this.additive;
1040        }
1041
1042        public boolean hasAdditiveReference() { 
1043          return this.additive instanceof Reference;
1044        }
1045
1046        public boolean hasAdditive() { 
1047          return this.additive != null && !this.additive.isEmpty();
1048        }
1049
1050        /**
1051         * @param value {@link #additive} (Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1052         */
1053        public SpecimenContainerComponent setAdditive(Type value) { 
1054          this.additive = value;
1055          return this;
1056        }
1057
1058        protected void listChildren(List<Property> childrenList) {
1059          super.listChildren(childrenList);
1060          childrenList.add(new Property("identifier", "Identifier", "Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.", 0, java.lang.Integer.MAX_VALUE, identifier));
1061          childrenList.add(new Property("description", "string", "Textual description of the container.", 0, java.lang.Integer.MAX_VALUE, description));
1062          childrenList.add(new Property("type", "CodeableConcept", "The type of container associated with the specimen (e.g. slide, aliquot, etc.).", 0, java.lang.Integer.MAX_VALUE, type));
1063          childrenList.add(new Property("capacity", "SimpleQuantity", "The capacity (volume or other measure) the container may contain.", 0, java.lang.Integer.MAX_VALUE, capacity));
1064          childrenList.add(new Property("specimenQuantity", "SimpleQuantity", "The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.", 0, java.lang.Integer.MAX_VALUE, specimenQuantity));
1065          childrenList.add(new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, java.lang.Integer.MAX_VALUE, additive));
1066        }
1067
1068      @Override
1069      public void setProperty(String name, Base value) throws FHIRException {
1070        if (name.equals("identifier"))
1071          this.getIdentifier().add(castToIdentifier(value));
1072        else if (name.equals("description"))
1073          this.description = castToString(value); // StringType
1074        else if (name.equals("type"))
1075          this.type = castToCodeableConcept(value); // CodeableConcept
1076        else if (name.equals("capacity"))
1077          this.capacity = castToSimpleQuantity(value); // SimpleQuantity
1078        else if (name.equals("specimenQuantity"))
1079          this.specimenQuantity = castToSimpleQuantity(value); // SimpleQuantity
1080        else if (name.equals("additive[x]"))
1081          this.additive = (Type) value; // Type
1082        else
1083          super.setProperty(name, value);
1084      }
1085
1086      @Override
1087      public Base addChild(String name) throws FHIRException {
1088        if (name.equals("identifier")) {
1089          return addIdentifier();
1090        }
1091        else if (name.equals("description")) {
1092          throw new FHIRException("Cannot call addChild on a primitive type Specimen.description");
1093        }
1094        else if (name.equals("type")) {
1095          this.type = new CodeableConcept();
1096          return this.type;
1097        }
1098        else if (name.equals("capacity")) {
1099          this.capacity = new SimpleQuantity();
1100          return this.capacity;
1101        }
1102        else if (name.equals("specimenQuantity")) {
1103          this.specimenQuantity = new SimpleQuantity();
1104          return this.specimenQuantity;
1105        }
1106        else if (name.equals("additiveCodeableConcept")) {
1107          this.additive = new CodeableConcept();
1108          return this.additive;
1109        }
1110        else if (name.equals("additiveReference")) {
1111          this.additive = new Reference();
1112          return this.additive;
1113        }
1114        else
1115          return super.addChild(name);
1116      }
1117
1118      public SpecimenContainerComponent copy() {
1119        SpecimenContainerComponent dst = new SpecimenContainerComponent();
1120        copyValues(dst);
1121        if (identifier != null) {
1122          dst.identifier = new ArrayList<Identifier>();
1123          for (Identifier i : identifier)
1124            dst.identifier.add(i.copy());
1125        };
1126        dst.description = description == null ? null : description.copy();
1127        dst.type = type == null ? null : type.copy();
1128        dst.capacity = capacity == null ? null : capacity.copy();
1129        dst.specimenQuantity = specimenQuantity == null ? null : specimenQuantity.copy();
1130        dst.additive = additive == null ? null : additive.copy();
1131        return dst;
1132      }
1133
1134      @Override
1135      public boolean equalsDeep(Base other) {
1136        if (!super.equalsDeep(other))
1137          return false;
1138        if (!(other instanceof SpecimenContainerComponent))
1139          return false;
1140        SpecimenContainerComponent o = (SpecimenContainerComponent) other;
1141        return compareDeep(identifier, o.identifier, true) && compareDeep(description, o.description, true)
1142           && compareDeep(type, o.type, true) && compareDeep(capacity, o.capacity, true) && compareDeep(specimenQuantity, o.specimenQuantity, true)
1143           && compareDeep(additive, o.additive, true);
1144      }
1145
1146      @Override
1147      public boolean equalsShallow(Base other) {
1148        if (!super.equalsShallow(other))
1149          return false;
1150        if (!(other instanceof SpecimenContainerComponent))
1151          return false;
1152        SpecimenContainerComponent o = (SpecimenContainerComponent) other;
1153        return compareValues(description, o.description, true);
1154      }
1155
1156      public boolean isEmpty() {
1157        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (description == null || description.isEmpty())
1158           && (type == null || type.isEmpty()) && (capacity == null || capacity.isEmpty()) && (specimenQuantity == null || specimenQuantity.isEmpty())
1159           && (additive == null || additive.isEmpty());
1160      }
1161
1162  public String fhirType() {
1163    return "Specimen.container";
1164
1165  }
1166
1167  }
1168
1169    /**
1170     * Id for specimen.
1171     */
1172    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1173    @Description(shortDefinition="External Identifier", formalDefinition="Id for specimen." )
1174    protected List<Identifier> identifier;
1175
1176    /**
1177     * The availability of the specimen.
1178     */
1179    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1180    @Description(shortDefinition="available | unavailable | unsatisfactory | entered-in-error", formalDefinition="The availability of the specimen." )
1181    protected Enumeration<SpecimenStatus> status;
1182
1183    /**
1184     * The kind of material that forms the specimen.
1185     */
1186    @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1187    @Description(shortDefinition="Kind of material that forms the specimen", formalDefinition="The kind of material that forms the specimen." )
1188    protected CodeableConcept type;
1189
1190    /**
1191     * Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.
1192     */
1193    @Child(name = "parent", type = {Specimen.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1194    @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." )
1195    protected List<Reference> parent;
1196    /**
1197     * The actual objects that are the target of the reference (Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.)
1198     */
1199    protected List<Specimen> parentTarget;
1200
1201
1202    /**
1203     * Where the specimen came from. This may be from the patient(s) or from the environment or a device.
1204     */
1205    @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Substance.class}, order=4, min=1, max=1, modifier=false, summary=true)
1206    @Description(shortDefinition="Where the specimen came from. This may be from the patient(s) or from the environment or a device", formalDefinition="Where the specimen came from. This may be from the patient(s) or from the environment or a device." )
1207    protected Reference subject;
1208
1209    /**
1210     * The actual object that is the target of the reference (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1211     */
1212    protected Resource subjectTarget;
1213
1214    /**
1215     * 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.
1216     */
1217    @Child(name = "accessionIdentifier", type = {Identifier.class}, order=5, min=0, max=1, modifier=false, summary=true)
1218    @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." )
1219    protected Identifier accessionIdentifier;
1220
1221    /**
1222     * Time when specimen was received for processing or testing.
1223     */
1224    @Child(name = "receivedTime", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1225    @Description(shortDefinition="The time when specimen was received for processing", formalDefinition="Time when specimen was received for processing or testing." )
1226    protected DateTimeType receivedTime;
1227
1228    /**
1229     * Details concerning the specimen collection.
1230     */
1231    @Child(name = "collection", type = {}, order=7, min=0, max=1, modifier=false, summary=false)
1232    @Description(shortDefinition="Collection details", formalDefinition="Details concerning the specimen collection." )
1233    protected SpecimenCollectionComponent collection;
1234
1235    /**
1236     * Details concerning treatment and processing steps for the specimen.
1237     */
1238    @Child(name = "treatment", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1239    @Description(shortDefinition="Treatment and processing step details", formalDefinition="Details concerning treatment and processing steps for the specimen." )
1240    protected List<SpecimenTreatmentComponent> treatment;
1241
1242    /**
1243     * The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.
1244     */
1245    @Child(name = "container", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1246    @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." )
1247    protected List<SpecimenContainerComponent> container;
1248
1249    private static final long serialVersionUID = 1025605602L;
1250
1251  /*
1252   * Constructor
1253   */
1254    public Specimen() {
1255      super();
1256    }
1257
1258  /*
1259   * Constructor
1260   */
1261    public Specimen(Reference subject) {
1262      super();
1263      this.subject = subject;
1264    }
1265
1266    /**
1267     * @return {@link #identifier} (Id for specimen.)
1268     */
1269    public List<Identifier> getIdentifier() { 
1270      if (this.identifier == null)
1271        this.identifier = new ArrayList<Identifier>();
1272      return this.identifier;
1273    }
1274
1275    public boolean hasIdentifier() { 
1276      if (this.identifier == null)
1277        return false;
1278      for (Identifier item : this.identifier)
1279        if (!item.isEmpty())
1280          return true;
1281      return false;
1282    }
1283
1284    /**
1285     * @return {@link #identifier} (Id for specimen.)
1286     */
1287    // syntactic sugar
1288    public Identifier addIdentifier() { //3
1289      Identifier t = new Identifier();
1290      if (this.identifier == null)
1291        this.identifier = new ArrayList<Identifier>();
1292      this.identifier.add(t);
1293      return t;
1294    }
1295
1296    // syntactic sugar
1297    public Specimen addIdentifier(Identifier t) { //3
1298      if (t == null)
1299        return this;
1300      if (this.identifier == null)
1301        this.identifier = new ArrayList<Identifier>();
1302      this.identifier.add(t);
1303      return this;
1304    }
1305
1306    /**
1307     * @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
1308     */
1309    public Enumeration<SpecimenStatus> getStatusElement() { 
1310      if (this.status == null)
1311        if (Configuration.errorOnAutoCreate())
1312          throw new Error("Attempt to auto-create Specimen.status");
1313        else if (Configuration.doAutoCreate())
1314          this.status = new Enumeration<SpecimenStatus>(new SpecimenStatusEnumFactory()); // bb
1315      return this.status;
1316    }
1317
1318    public boolean hasStatusElement() { 
1319      return this.status != null && !this.status.isEmpty();
1320    }
1321
1322    public boolean hasStatus() { 
1323      return this.status != null && !this.status.isEmpty();
1324    }
1325
1326    /**
1327     * @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
1328     */
1329    public Specimen setStatusElement(Enumeration<SpecimenStatus> value) { 
1330      this.status = value;
1331      return this;
1332    }
1333
1334    /**
1335     * @return The availability of the specimen.
1336     */
1337    public SpecimenStatus getStatus() { 
1338      return this.status == null ? null : this.status.getValue();
1339    }
1340
1341    /**
1342     * @param value The availability of the specimen.
1343     */
1344    public Specimen setStatus(SpecimenStatus value) { 
1345      if (value == null)
1346        this.status = null;
1347      else {
1348        if (this.status == null)
1349          this.status = new Enumeration<SpecimenStatus>(new SpecimenStatusEnumFactory());
1350        this.status.setValue(value);
1351      }
1352      return this;
1353    }
1354
1355    /**
1356     * @return {@link #type} (The kind of material that forms the specimen.)
1357     */
1358    public CodeableConcept getType() { 
1359      if (this.type == null)
1360        if (Configuration.errorOnAutoCreate())
1361          throw new Error("Attempt to auto-create Specimen.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 kind of material that forms the specimen.)
1373     */
1374    public Specimen setType(CodeableConcept value) { 
1375      this.type = value;
1376      return this;
1377    }
1378
1379    /**
1380     * @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.)
1381     */
1382    public List<Reference> getParent() { 
1383      if (this.parent == null)
1384        this.parent = new ArrayList<Reference>();
1385      return this.parent;
1386    }
1387
1388    public boolean hasParent() { 
1389      if (this.parent == null)
1390        return false;
1391      for (Reference item : this.parent)
1392        if (!item.isEmpty())
1393          return true;
1394      return false;
1395    }
1396
1397    /**
1398     * @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.)
1399     */
1400    // syntactic sugar
1401    public Reference addParent() { //3
1402      Reference t = new Reference();
1403      if (this.parent == null)
1404        this.parent = new ArrayList<Reference>();
1405      this.parent.add(t);
1406      return t;
1407    }
1408
1409    // syntactic sugar
1410    public Specimen addParent(Reference t) { //3
1411      if (t == null)
1412        return this;
1413      if (this.parent == null)
1414        this.parent = new ArrayList<Reference>();
1415      this.parent.add(t);
1416      return this;
1417    }
1418
1419    /**
1420     * @return {@link #parent} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.)
1421     */
1422    public List<Specimen> getParentTarget() { 
1423      if (this.parentTarget == null)
1424        this.parentTarget = new ArrayList<Specimen>();
1425      return this.parentTarget;
1426    }
1427
1428    // syntactic sugar
1429    /**
1430     * @return {@link #parent} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.)
1431     */
1432    public Specimen addParentTarget() { 
1433      Specimen r = new Specimen();
1434      if (this.parentTarget == null)
1435        this.parentTarget = new ArrayList<Specimen>();
1436      this.parentTarget.add(r);
1437      return r;
1438    }
1439
1440    /**
1441     * @return {@link #subject} (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1442     */
1443    public Reference getSubject() { 
1444      if (this.subject == null)
1445        if (Configuration.errorOnAutoCreate())
1446          throw new Error("Attempt to auto-create Specimen.subject");
1447        else if (Configuration.doAutoCreate())
1448          this.subject = new Reference(); // cc
1449      return this.subject;
1450    }
1451
1452    public boolean hasSubject() { 
1453      return this.subject != null && !this.subject.isEmpty();
1454    }
1455
1456    /**
1457     * @param value {@link #subject} (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1458     */
1459    public Specimen setSubject(Reference value) { 
1460      this.subject = value;
1461      return this;
1462    }
1463
1464    /**
1465     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1466     */
1467    public Resource getSubjectTarget() { 
1468      return this.subjectTarget;
1469    }
1470
1471    /**
1472     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Where the specimen came from. This may be from the patient(s) or from the environment or a device.)
1473     */
1474    public Specimen setSubjectTarget(Resource value) { 
1475      this.subjectTarget = value;
1476      return this;
1477    }
1478
1479    /**
1480     * @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.)
1481     */
1482    public Identifier getAccessionIdentifier() { 
1483      if (this.accessionIdentifier == null)
1484        if (Configuration.errorOnAutoCreate())
1485          throw new Error("Attempt to auto-create Specimen.accessionIdentifier");
1486        else if (Configuration.doAutoCreate())
1487          this.accessionIdentifier = new Identifier(); // cc
1488      return this.accessionIdentifier;
1489    }
1490
1491    public boolean hasAccessionIdentifier() { 
1492      return this.accessionIdentifier != null && !this.accessionIdentifier.isEmpty();
1493    }
1494
1495    /**
1496     * @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.)
1497     */
1498    public Specimen setAccessionIdentifier(Identifier value) { 
1499      this.accessionIdentifier = value;
1500      return this;
1501    }
1502
1503    /**
1504     * @return {@link #receivedTime} (Time when specimen was received for processing or testing.). This is the underlying object with id, value and extensions. The accessor "getReceivedTime" gives direct access to the value
1505     */
1506    public DateTimeType getReceivedTimeElement() { 
1507      if (this.receivedTime == null)
1508        if (Configuration.errorOnAutoCreate())
1509          throw new Error("Attempt to auto-create Specimen.receivedTime");
1510        else if (Configuration.doAutoCreate())
1511          this.receivedTime = new DateTimeType(); // bb
1512      return this.receivedTime;
1513    }
1514
1515    public boolean hasReceivedTimeElement() { 
1516      return this.receivedTime != null && !this.receivedTime.isEmpty();
1517    }
1518
1519    public boolean hasReceivedTime() { 
1520      return this.receivedTime != null && !this.receivedTime.isEmpty();
1521    }
1522
1523    /**
1524     * @param value {@link #receivedTime} (Time when specimen was received for processing or testing.). This is the underlying object with id, value and extensions. The accessor "getReceivedTime" gives direct access to the value
1525     */
1526    public Specimen setReceivedTimeElement(DateTimeType value) { 
1527      this.receivedTime = value;
1528      return this;
1529    }
1530
1531    /**
1532     * @return Time when specimen was received for processing or testing.
1533     */
1534    public Date getReceivedTime() { 
1535      return this.receivedTime == null ? null : this.receivedTime.getValue();
1536    }
1537
1538    /**
1539     * @param value Time when specimen was received for processing or testing.
1540     */
1541    public Specimen setReceivedTime(Date value) { 
1542      if (value == null)
1543        this.receivedTime = null;
1544      else {
1545        if (this.receivedTime == null)
1546          this.receivedTime = new DateTimeType();
1547        this.receivedTime.setValue(value);
1548      }
1549      return this;
1550    }
1551
1552    /**
1553     * @return {@link #collection} (Details concerning the specimen collection.)
1554     */
1555    public SpecimenCollectionComponent getCollection() { 
1556      if (this.collection == null)
1557        if (Configuration.errorOnAutoCreate())
1558          throw new Error("Attempt to auto-create Specimen.collection");
1559        else if (Configuration.doAutoCreate())
1560          this.collection = new SpecimenCollectionComponent(); // cc
1561      return this.collection;
1562    }
1563
1564    public boolean hasCollection() { 
1565      return this.collection != null && !this.collection.isEmpty();
1566    }
1567
1568    /**
1569     * @param value {@link #collection} (Details concerning the specimen collection.)
1570     */
1571    public Specimen setCollection(SpecimenCollectionComponent value) { 
1572      this.collection = value;
1573      return this;
1574    }
1575
1576    /**
1577     * @return {@link #treatment} (Details concerning treatment and processing steps for the specimen.)
1578     */
1579    public List<SpecimenTreatmentComponent> getTreatment() { 
1580      if (this.treatment == null)
1581        this.treatment = new ArrayList<SpecimenTreatmentComponent>();
1582      return this.treatment;
1583    }
1584
1585    public boolean hasTreatment() { 
1586      if (this.treatment == null)
1587        return false;
1588      for (SpecimenTreatmentComponent item : this.treatment)
1589        if (!item.isEmpty())
1590          return true;
1591      return false;
1592    }
1593
1594    /**
1595     * @return {@link #treatment} (Details concerning treatment and processing steps for the specimen.)
1596     */
1597    // syntactic sugar
1598    public SpecimenTreatmentComponent addTreatment() { //3
1599      SpecimenTreatmentComponent t = new SpecimenTreatmentComponent();
1600      if (this.treatment == null)
1601        this.treatment = new ArrayList<SpecimenTreatmentComponent>();
1602      this.treatment.add(t);
1603      return t;
1604    }
1605
1606    // syntactic sugar
1607    public Specimen addTreatment(SpecimenTreatmentComponent t) { //3
1608      if (t == null)
1609        return this;
1610      if (this.treatment == null)
1611        this.treatment = new ArrayList<SpecimenTreatmentComponent>();
1612      this.treatment.add(t);
1613      return this;
1614    }
1615
1616    /**
1617     * @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.)
1618     */
1619    public List<SpecimenContainerComponent> getContainer() { 
1620      if (this.container == null)
1621        this.container = new ArrayList<SpecimenContainerComponent>();
1622      return this.container;
1623    }
1624
1625    public boolean hasContainer() { 
1626      if (this.container == null)
1627        return false;
1628      for (SpecimenContainerComponent item : this.container)
1629        if (!item.isEmpty())
1630          return true;
1631      return false;
1632    }
1633
1634    /**
1635     * @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.)
1636     */
1637    // syntactic sugar
1638    public SpecimenContainerComponent addContainer() { //3
1639      SpecimenContainerComponent t = new SpecimenContainerComponent();
1640      if (this.container == null)
1641        this.container = new ArrayList<SpecimenContainerComponent>();
1642      this.container.add(t);
1643      return t;
1644    }
1645
1646    // syntactic sugar
1647    public Specimen addContainer(SpecimenContainerComponent t) { //3
1648      if (t == null)
1649        return this;
1650      if (this.container == null)
1651        this.container = new ArrayList<SpecimenContainerComponent>();
1652      this.container.add(t);
1653      return this;
1654    }
1655
1656      protected void listChildren(List<Property> childrenList) {
1657        super.listChildren(childrenList);
1658        childrenList.add(new Property("identifier", "Identifier", "Id for specimen.", 0, java.lang.Integer.MAX_VALUE, identifier));
1659        childrenList.add(new Property("status", "code", "The availability of the specimen.", 0, java.lang.Integer.MAX_VALUE, status));
1660        childrenList.add(new Property("type", "CodeableConcept", "The kind of material that forms the specimen.", 0, java.lang.Integer.MAX_VALUE, type));
1661        childrenList.add(new Property("parent", "Reference(Specimen)", "Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.", 0, java.lang.Integer.MAX_VALUE, parent));
1662        childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Substance)", "Where the specimen came from. This may be from the patient(s) or from the environment or a device.", 0, java.lang.Integer.MAX_VALUE, subject));
1663        childrenList.add(new Property("accessionIdentifier", "Identifier", "The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.", 0, java.lang.Integer.MAX_VALUE, accessionIdentifier));
1664        childrenList.add(new Property("receivedTime", "dateTime", "Time when specimen was received for processing or testing.", 0, java.lang.Integer.MAX_VALUE, receivedTime));
1665        childrenList.add(new Property("collection", "", "Details concerning the specimen collection.", 0, java.lang.Integer.MAX_VALUE, collection));
1666        childrenList.add(new Property("treatment", "", "Details concerning treatment and processing steps for the specimen.", 0, java.lang.Integer.MAX_VALUE, treatment));
1667        childrenList.add(new Property("container", "", "The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.", 0, java.lang.Integer.MAX_VALUE, container));
1668      }
1669
1670      @Override
1671      public void setProperty(String name, Base value) throws FHIRException {
1672        if (name.equals("identifier"))
1673          this.getIdentifier().add(castToIdentifier(value));
1674        else if (name.equals("status"))
1675          this.status = new SpecimenStatusEnumFactory().fromType(value); // Enumeration<SpecimenStatus>
1676        else if (name.equals("type"))
1677          this.type = castToCodeableConcept(value); // CodeableConcept
1678        else if (name.equals("parent"))
1679          this.getParent().add(castToReference(value));
1680        else if (name.equals("subject"))
1681          this.subject = castToReference(value); // Reference
1682        else if (name.equals("accessionIdentifier"))
1683          this.accessionIdentifier = castToIdentifier(value); // Identifier
1684        else if (name.equals("receivedTime"))
1685          this.receivedTime = castToDateTime(value); // DateTimeType
1686        else if (name.equals("collection"))
1687          this.collection = (SpecimenCollectionComponent) value; // SpecimenCollectionComponent
1688        else if (name.equals("treatment"))
1689          this.getTreatment().add((SpecimenTreatmentComponent) value);
1690        else if (name.equals("container"))
1691          this.getContainer().add((SpecimenContainerComponent) value);
1692        else
1693          super.setProperty(name, value);
1694      }
1695
1696      @Override
1697      public Base addChild(String name) throws FHIRException {
1698        if (name.equals("identifier")) {
1699          return addIdentifier();
1700        }
1701        else if (name.equals("status")) {
1702          throw new FHIRException("Cannot call addChild on a primitive type Specimen.status");
1703        }
1704        else if (name.equals("type")) {
1705          this.type = new CodeableConcept();
1706          return this.type;
1707        }
1708        else if (name.equals("parent")) {
1709          return addParent();
1710        }
1711        else if (name.equals("subject")) {
1712          this.subject = new Reference();
1713          return this.subject;
1714        }
1715        else if (name.equals("accessionIdentifier")) {
1716          this.accessionIdentifier = new Identifier();
1717          return this.accessionIdentifier;
1718        }
1719        else if (name.equals("receivedTime")) {
1720          throw new FHIRException("Cannot call addChild on a primitive type Specimen.receivedTime");
1721        }
1722        else if (name.equals("collection")) {
1723          this.collection = new SpecimenCollectionComponent();
1724          return this.collection;
1725        }
1726        else if (name.equals("treatment")) {
1727          return addTreatment();
1728        }
1729        else if (name.equals("container")) {
1730          return addContainer();
1731        }
1732        else
1733          return super.addChild(name);
1734      }
1735
1736  public String fhirType() {
1737    return "Specimen";
1738
1739  }
1740
1741      public Specimen copy() {
1742        Specimen dst = new Specimen();
1743        copyValues(dst);
1744        if (identifier != null) {
1745          dst.identifier = new ArrayList<Identifier>();
1746          for (Identifier i : identifier)
1747            dst.identifier.add(i.copy());
1748        };
1749        dst.status = status == null ? null : status.copy();
1750        dst.type = type == null ? null : type.copy();
1751        if (parent != null) {
1752          dst.parent = new ArrayList<Reference>();
1753          for (Reference i : parent)
1754            dst.parent.add(i.copy());
1755        };
1756        dst.subject = subject == null ? null : subject.copy();
1757        dst.accessionIdentifier = accessionIdentifier == null ? null : accessionIdentifier.copy();
1758        dst.receivedTime = receivedTime == null ? null : receivedTime.copy();
1759        dst.collection = collection == null ? null : collection.copy();
1760        if (treatment != null) {
1761          dst.treatment = new ArrayList<SpecimenTreatmentComponent>();
1762          for (SpecimenTreatmentComponent i : treatment)
1763            dst.treatment.add(i.copy());
1764        };
1765        if (container != null) {
1766          dst.container = new ArrayList<SpecimenContainerComponent>();
1767          for (SpecimenContainerComponent i : container)
1768            dst.container.add(i.copy());
1769        };
1770        return dst;
1771      }
1772
1773      protected Specimen typedCopy() {
1774        return copy();
1775      }
1776
1777      @Override
1778      public boolean equalsDeep(Base other) {
1779        if (!super.equalsDeep(other))
1780          return false;
1781        if (!(other instanceof Specimen))
1782          return false;
1783        Specimen o = (Specimen) other;
1784        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
1785           && compareDeep(parent, o.parent, true) && compareDeep(subject, o.subject, true) && compareDeep(accessionIdentifier, o.accessionIdentifier, true)
1786           && compareDeep(receivedTime, o.receivedTime, true) && compareDeep(collection, o.collection, true)
1787           && compareDeep(treatment, o.treatment, true) && compareDeep(container, o.container, true);
1788      }
1789
1790      @Override
1791      public boolean equalsShallow(Base other) {
1792        if (!super.equalsShallow(other))
1793          return false;
1794        if (!(other instanceof Specimen))
1795          return false;
1796        Specimen o = (Specimen) other;
1797        return compareValues(status, o.status, true) && compareValues(receivedTime, o.receivedTime, true);
1798      }
1799
1800      public boolean isEmpty() {
1801        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
1802           && (type == null || type.isEmpty()) && (parent == null || parent.isEmpty()) && (subject == null || subject.isEmpty())
1803           && (accessionIdentifier == null || accessionIdentifier.isEmpty()) && (receivedTime == null || receivedTime.isEmpty())
1804           && (collection == null || collection.isEmpty()) && (treatment == null || treatment.isEmpty())
1805           && (container == null || container.isEmpty());
1806      }
1807
1808  @Override
1809  public ResourceType getResourceType() {
1810    return ResourceType.Specimen;
1811   }
1812
1813  @SearchParamDefinition(name="container", path="Specimen.container.type", description="The kind of specimen container", type="token" )
1814  public static final String SP_CONTAINER = "container";
1815  @SearchParamDefinition(name="identifier", path="Specimen.identifier", description="The unique identifier associated with the specimen", type="token" )
1816  public static final String SP_IDENTIFIER = "identifier";
1817  @SearchParamDefinition(name="parent", path="Specimen.parent", description="The parent of the specimen", type="reference" )
1818  public static final String SP_PARENT = "parent";
1819  @SearchParamDefinition(name="container-id", path="Specimen.container.identifier", description="The unique identifier associated with the specimen container", type="token" )
1820  public static final String SP_CONTAINERID = "container-id";
1821  @SearchParamDefinition(name="bodysite", path="Specimen.collection.bodySite", description="The code for the body site from where the specimen originated", type="token" )
1822  public static final String SP_BODYSITE = "bodysite";
1823  @SearchParamDefinition(name="subject", path="Specimen.subject", description="The subject of the specimen", type="reference" )
1824  public static final String SP_SUBJECT = "subject";
1825  @SearchParamDefinition(name="patient", path="Specimen.subject", description="The patient the specimen comes from", type="reference" )
1826  public static final String SP_PATIENT = "patient";
1827  @SearchParamDefinition(name="collected", path="Specimen.collection.collected[x]", description="The date the specimen was collected", type="date" )
1828  public static final String SP_COLLECTED = "collected";
1829  @SearchParamDefinition(name="accession", path="Specimen.accessionIdentifier", description="The accession number associated with the specimen", type="token" )
1830  public static final String SP_ACCESSION = "accession";
1831  @SearchParamDefinition(name="type", path="Specimen.type", description="The specimen type", type="token" )
1832  public static final String SP_TYPE = "type";
1833  @SearchParamDefinition(name="collector", path="Specimen.collection.collector", description="Who collected the specimen", type="reference" )
1834  public static final String SP_COLLECTOR = "collector";
1835
1836}
1837