001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.utilities.Utilities;
061import ca.uhn.fhir.model.api.annotation.ResourceDef;
062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
063import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
064import ca.uhn.fhir.model.api.annotation.Child;
065import ca.uhn.fhir.model.api.annotation.ChildOrder;
066import ca.uhn.fhir.model.api.annotation.Description;
067import ca.uhn.fhir.model.api.annotation.Block;
068/**
069 * A kind of specimen with associated set of requirements.
070 */
071@ResourceDef(name="SpecimenDefinition", profile="http://hl7.org/fhir/StructureDefinition/SpecimenDefinition")
072public class SpecimenDefinition extends DomainResource {
073
074    public enum PublicationStatus {
075        /**
076         * This resource is still under development and is not yet considered to be ready for normal use.
077         */
078        DRAFT, 
079        /**
080         * This resource is ready for normal use.
081         */
082        ACTIVE, 
083        /**
084         * This resource has been withdrawn or superseded and should no longer be used.
085         */
086        RETIRED, 
087        /**
088         * The authoring system does not know which of the status values currently applies for this resource.  Note: This concept is not to be used for "other" - one of the listed statuses is presumed to apply, it's just not known which one.
089         */
090        UNKNOWN, 
091        /**
092         * added to help the parsers with the generic types
093         */
094        NULL;
095        public static PublicationStatus fromCode(String codeString) throws FHIRException {
096            if (codeString == null || "".equals(codeString))
097                return null;
098        if ("draft".equals(codeString))
099          return DRAFT;
100        if ("active".equals(codeString))
101          return ACTIVE;
102        if ("retired".equals(codeString))
103          return RETIRED;
104        if ("unknown".equals(codeString))
105          return UNKNOWN;
106        if (Configuration.isAcceptInvalidEnums())
107          return null;
108        else
109          throw new FHIRException("Unknown PublicationStatus code '"+codeString+"'");
110        }
111        public String toCode() {
112          switch (this) {
113            case DRAFT: return "draft";
114            case ACTIVE: return "active";
115            case RETIRED: return "retired";
116            case UNKNOWN: return "unknown";
117            default: return "?";
118          }
119        }
120        public String getSystem() {
121          switch (this) {
122            case DRAFT: return "http://hl7.org/fhir/publication-status";
123            case ACTIVE: return "http://hl7.org/fhir/publication-status";
124            case RETIRED: return "http://hl7.org/fhir/publication-status";
125            case UNKNOWN: return "http://hl7.org/fhir/publication-status";
126            default: return "?";
127          }
128        }
129        public String getDefinition() {
130          switch (this) {
131            case DRAFT: return "This resource is still under development and is not yet considered to be ready for normal use.";
132            case ACTIVE: return "This resource is ready for normal use.";
133            case RETIRED: return "This resource has been withdrawn or superseded and should no longer be used.";
134            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this resource.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, it's just not known which one.";
135            default: return "?";
136          }
137        }
138        public String getDisplay() {
139          switch (this) {
140            case DRAFT: return "Draft";
141            case ACTIVE: return "Active";
142            case RETIRED: return "Retired";
143            case UNKNOWN: return "Unknown";
144            default: return "?";
145          }
146        }
147    }
148
149  public static class PublicationStatusEnumFactory implements EnumFactory<PublicationStatus> {
150    public PublicationStatus fromCode(String codeString) throws IllegalArgumentException {
151      if (codeString == null || "".equals(codeString))
152            if (codeString == null || "".equals(codeString))
153                return null;
154        if ("draft".equals(codeString))
155          return PublicationStatus.DRAFT;
156        if ("active".equals(codeString))
157          return PublicationStatus.ACTIVE;
158        if ("retired".equals(codeString))
159          return PublicationStatus.RETIRED;
160        if ("unknown".equals(codeString))
161          return PublicationStatus.UNKNOWN;
162        throw new IllegalArgumentException("Unknown PublicationStatus code '"+codeString+"'");
163        }
164        public Enumeration<PublicationStatus> fromType(Base code) throws FHIRException {
165          if (code == null)
166            return null;
167          if (code.isEmpty())
168            return new Enumeration<PublicationStatus>(this);
169          String codeString = ((PrimitiveType) code).asStringValue();
170          if (codeString == null || "".equals(codeString))
171            return null;
172        if ("draft".equals(codeString))
173          return new Enumeration<PublicationStatus>(this, PublicationStatus.DRAFT);
174        if ("active".equals(codeString))
175          return new Enumeration<PublicationStatus>(this, PublicationStatus.ACTIVE);
176        if ("retired".equals(codeString))
177          return new Enumeration<PublicationStatus>(this, PublicationStatus.RETIRED);
178        if ("unknown".equals(codeString))
179          return new Enumeration<PublicationStatus>(this, PublicationStatus.UNKNOWN);
180        throw new FHIRException("Unknown PublicationStatus code '"+codeString+"'");
181        }
182    public String toCode(PublicationStatus code) {
183      if (code == PublicationStatus.DRAFT)
184        return "draft";
185      if (code == PublicationStatus.ACTIVE)
186        return "active";
187      if (code == PublicationStatus.RETIRED)
188        return "retired";
189      if (code == PublicationStatus.UNKNOWN)
190        return "unknown";
191      return "?";
192      }
193    public String toSystem(PublicationStatus code) {
194      return code.getSystem();
195      }
196    }
197
198    public enum SpecimenContainedPreference {
199        /**
200         * This type of contained specimen is preferred to collect this kind of specimen.
201         */
202        PREFERRED, 
203        /**
204         * This type of conditioned specimen is an alternate.
205         */
206        ALTERNATE, 
207        /**
208         * added to help the parsers with the generic types
209         */
210        NULL;
211        public static SpecimenContainedPreference fromCode(String codeString) throws FHIRException {
212            if (codeString == null || "".equals(codeString))
213                return null;
214        if ("preferred".equals(codeString))
215          return PREFERRED;
216        if ("alternate".equals(codeString))
217          return ALTERNATE;
218        if (Configuration.isAcceptInvalidEnums())
219          return null;
220        else
221          throw new FHIRException("Unknown SpecimenContainedPreference code '"+codeString+"'");
222        }
223        public String toCode() {
224          switch (this) {
225            case PREFERRED: return "preferred";
226            case ALTERNATE: return "alternate";
227            default: return "?";
228          }
229        }
230        public String getSystem() {
231          switch (this) {
232            case PREFERRED: return "http://hl7.org/fhir/specimen-contained-preference";
233            case ALTERNATE: return "http://hl7.org/fhir/specimen-contained-preference";
234            default: return "?";
235          }
236        }
237        public String getDefinition() {
238          switch (this) {
239            case PREFERRED: return "This type of contained specimen is preferred to collect this kind of specimen.";
240            case ALTERNATE: return "This type of conditioned specimen is an alternate.";
241            default: return "?";
242          }
243        }
244        public String getDisplay() {
245          switch (this) {
246            case PREFERRED: return "Preferred";
247            case ALTERNATE: return "Alternate";
248            default: return "?";
249          }
250        }
251    }
252
253  public static class SpecimenContainedPreferenceEnumFactory implements EnumFactory<SpecimenContainedPreference> {
254    public SpecimenContainedPreference fromCode(String codeString) throws IllegalArgumentException {
255      if (codeString == null || "".equals(codeString))
256            if (codeString == null || "".equals(codeString))
257                return null;
258        if ("preferred".equals(codeString))
259          return SpecimenContainedPreference.PREFERRED;
260        if ("alternate".equals(codeString))
261          return SpecimenContainedPreference.ALTERNATE;
262        throw new IllegalArgumentException("Unknown SpecimenContainedPreference code '"+codeString+"'");
263        }
264        public Enumeration<SpecimenContainedPreference> fromType(Base code) throws FHIRException {
265          if (code == null)
266            return null;
267          if (code.isEmpty())
268            return new Enumeration<SpecimenContainedPreference>(this);
269          String codeString = ((PrimitiveType) code).asStringValue();
270          if (codeString == null || "".equals(codeString))
271            return null;
272        if ("preferred".equals(codeString))
273          return new Enumeration<SpecimenContainedPreference>(this, SpecimenContainedPreference.PREFERRED);
274        if ("alternate".equals(codeString))
275          return new Enumeration<SpecimenContainedPreference>(this, SpecimenContainedPreference.ALTERNATE);
276        throw new FHIRException("Unknown SpecimenContainedPreference code '"+codeString+"'");
277        }
278    public String toCode(SpecimenContainedPreference code) {
279      if (code == SpecimenContainedPreference.PREFERRED)
280        return "preferred";
281      if (code == SpecimenContainedPreference.ALTERNATE)
282        return "alternate";
283      return "?";
284      }
285    public String toSystem(SpecimenContainedPreference code) {
286      return code.getSystem();
287      }
288    }
289
290    @Block()
291    public static class SpecimenDefinitionTypeTestedComponent extends BackboneElement implements IBaseBackboneElement {
292        /**
293         * Primary of secondary specimen.
294         */
295        @Child(name = "isDerived", type = {BooleanType.class}, order=1, min=0, max=1, modifier=false, summary=false)
296        @Description(shortDefinition="Primary or secondary specimen", formalDefinition="Primary of secondary specimen." )
297        protected BooleanType isDerived;
298
299        /**
300         * The kind of specimen conditioned for testing expected by lab.
301         */
302        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
303        @Description(shortDefinition="Type of intended specimen", formalDefinition="The kind of specimen conditioned for testing expected by lab." )
304        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v2-0487")
305        protected CodeableConcept type;
306
307        /**
308         * The preference for this type of conditioned specimen.
309         */
310        @Child(name = "preference", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=false)
311        @Description(shortDefinition="preferred | alternate", formalDefinition="The preference for this type of conditioned specimen." )
312        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-contained-preference")
313        protected Enumeration<SpecimenContainedPreference> preference;
314
315        /**
316         * The specimen's container.
317         */
318        @Child(name = "container", type = {}, order=4, min=0, max=1, modifier=false, summary=false)
319        @Description(shortDefinition="The specimen's container", formalDefinition="The specimen's container." )
320        protected SpecimenDefinitionTypeTestedContainerComponent container;
321
322        /**
323         * Requirements for delivery and special handling of this kind of conditioned specimen.
324         */
325        @Child(name = "requirement", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
326        @Description(shortDefinition="Specimen requirements", formalDefinition="Requirements for delivery and special handling of this kind of conditioned specimen." )
327        protected StringType requirement;
328
329        /**
330         * The usual time that a specimen of this kind is retained after the ordered tests are completed, for the purpose of additional testing.
331         */
332        @Child(name = "retentionTime", type = {Duration.class}, order=6, min=0, max=1, modifier=false, summary=false)
333        @Description(shortDefinition="Specimen retention time", formalDefinition="The usual time that a specimen of this kind is retained after the ordered tests are completed, for the purpose of additional testing." )
334        protected Duration retentionTime;
335
336        /**
337         * Specimen can be used by only one test or panel if the value is "true".
338         */
339        @Child(name = "singleUse", type = {BooleanType.class}, order=7, min=0, max=1, modifier=false, summary=false)
340        @Description(shortDefinition="Specimen for single use only", formalDefinition="Specimen can be used by only one test or panel if the value is \"true\"." )
341        protected BooleanType singleUse;
342
343        /**
344         * Criterion for rejection of the specimen in its container by the laboratory.
345         */
346        @Child(name = "rejectionCriterion", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
347        @Description(shortDefinition="Rejection criterion", formalDefinition="Criterion for rejection of the specimen in its container by the laboratory." )
348        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/rejection-criteria")
349        protected List<CodeableConcept> rejectionCriterion;
350
351        /**
352         * Set of instructions for preservation/transport of the specimen at a defined temperature interval, prior the testing process.
353         */
354        @Child(name = "handling", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
355        @Description(shortDefinition="Specimen handling before testing", formalDefinition="Set of instructions for preservation/transport of the specimen at a defined temperature interval, prior the testing process." )
356        protected List<SpecimenDefinitionTypeTestedHandlingComponent> handling;
357
358        /**
359         * Where the specimen will be tested: e.g., lab, sector, device or any combination of these.
360         */
361        @Child(name = "testingDestination", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
362        @Description(shortDefinition="Where the specimen will be tested", formalDefinition="Where the specimen will be tested: e.g., lab, sector, device or any combination of these." )
363        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/diagnostic-service-sections")
364        protected List<CodeableConcept> testingDestination;
365
366        private static final long serialVersionUID = 1859673754L;
367
368    /**
369     * Constructor
370     */
371      public SpecimenDefinitionTypeTestedComponent() {
372        super();
373      }
374
375    /**
376     * Constructor
377     */
378      public SpecimenDefinitionTypeTestedComponent(Enumeration<SpecimenContainedPreference> preference) {
379        super();
380        this.preference = preference;
381      }
382
383        /**
384         * @return {@link #isDerived} (Primary of secondary specimen.). This is the underlying object with id, value and extensions. The accessor "getIsDerived" gives direct access to the value
385         */
386        public BooleanType getIsDerivedElement() { 
387          if (this.isDerived == null)
388            if (Configuration.errorOnAutoCreate())
389              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedComponent.isDerived");
390            else if (Configuration.doAutoCreate())
391              this.isDerived = new BooleanType(); // bb
392          return this.isDerived;
393        }
394
395        public boolean hasIsDerivedElement() { 
396          return this.isDerived != null && !this.isDerived.isEmpty();
397        }
398
399        public boolean hasIsDerived() { 
400          return this.isDerived != null && !this.isDerived.isEmpty();
401        }
402
403        /**
404         * @param value {@link #isDerived} (Primary of secondary specimen.). This is the underlying object with id, value and extensions. The accessor "getIsDerived" gives direct access to the value
405         */
406        public SpecimenDefinitionTypeTestedComponent setIsDerivedElement(BooleanType value) { 
407          this.isDerived = value;
408          return this;
409        }
410
411        /**
412         * @return Primary of secondary specimen.
413         */
414        public boolean getIsDerived() { 
415          return this.isDerived == null || this.isDerived.isEmpty() ? false : this.isDerived.getValue();
416        }
417
418        /**
419         * @param value Primary of secondary specimen.
420         */
421        public SpecimenDefinitionTypeTestedComponent setIsDerived(boolean value) { 
422            if (this.isDerived == null)
423              this.isDerived = new BooleanType();
424            this.isDerived.setValue(value);
425          return this;
426        }
427
428        /**
429         * @return {@link #type} (The kind of specimen conditioned for testing expected by lab.)
430         */
431        public CodeableConcept getType() { 
432          if (this.type == null)
433            if (Configuration.errorOnAutoCreate())
434              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedComponent.type");
435            else if (Configuration.doAutoCreate())
436              this.type = new CodeableConcept(); // cc
437          return this.type;
438        }
439
440        public boolean hasType() { 
441          return this.type != null && !this.type.isEmpty();
442        }
443
444        /**
445         * @param value {@link #type} (The kind of specimen conditioned for testing expected by lab.)
446         */
447        public SpecimenDefinitionTypeTestedComponent setType(CodeableConcept value) { 
448          this.type = value;
449          return this;
450        }
451
452        /**
453         * @return {@link #preference} (The preference for this type of conditioned specimen.). This is the underlying object with id, value and extensions. The accessor "getPreference" gives direct access to the value
454         */
455        public Enumeration<SpecimenContainedPreference> getPreferenceElement() { 
456          if (this.preference == null)
457            if (Configuration.errorOnAutoCreate())
458              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedComponent.preference");
459            else if (Configuration.doAutoCreate())
460              this.preference = new Enumeration<SpecimenContainedPreference>(new SpecimenContainedPreferenceEnumFactory()); // bb
461          return this.preference;
462        }
463
464        public boolean hasPreferenceElement() { 
465          return this.preference != null && !this.preference.isEmpty();
466        }
467
468        public boolean hasPreference() { 
469          return this.preference != null && !this.preference.isEmpty();
470        }
471
472        /**
473         * @param value {@link #preference} (The preference for this type of conditioned specimen.). This is the underlying object with id, value and extensions. The accessor "getPreference" gives direct access to the value
474         */
475        public SpecimenDefinitionTypeTestedComponent setPreferenceElement(Enumeration<SpecimenContainedPreference> value) { 
476          this.preference = value;
477          return this;
478        }
479
480        /**
481         * @return The preference for this type of conditioned specimen.
482         */
483        public SpecimenContainedPreference getPreference() { 
484          return this.preference == null ? null : this.preference.getValue();
485        }
486
487        /**
488         * @param value The preference for this type of conditioned specimen.
489         */
490        public SpecimenDefinitionTypeTestedComponent setPreference(SpecimenContainedPreference value) { 
491            if (this.preference == null)
492              this.preference = new Enumeration<SpecimenContainedPreference>(new SpecimenContainedPreferenceEnumFactory());
493            this.preference.setValue(value);
494          return this;
495        }
496
497        /**
498         * @return {@link #container} (The specimen's container.)
499         */
500        public SpecimenDefinitionTypeTestedContainerComponent getContainer() { 
501          if (this.container == null)
502            if (Configuration.errorOnAutoCreate())
503              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedComponent.container");
504            else if (Configuration.doAutoCreate())
505              this.container = new SpecimenDefinitionTypeTestedContainerComponent(); // cc
506          return this.container;
507        }
508
509        public boolean hasContainer() { 
510          return this.container != null && !this.container.isEmpty();
511        }
512
513        /**
514         * @param value {@link #container} (The specimen's container.)
515         */
516        public SpecimenDefinitionTypeTestedComponent setContainer(SpecimenDefinitionTypeTestedContainerComponent value) { 
517          this.container = value;
518          return this;
519        }
520
521        /**
522         * @return {@link #requirement} (Requirements for delivery and special handling of this kind of conditioned specimen.). This is the underlying object with id, value and extensions. The accessor "getRequirement" gives direct access to the value
523         */
524        public StringType getRequirementElement() { 
525          if (this.requirement == null)
526            if (Configuration.errorOnAutoCreate())
527              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedComponent.requirement");
528            else if (Configuration.doAutoCreate())
529              this.requirement = new StringType(); // bb
530          return this.requirement;
531        }
532
533        public boolean hasRequirementElement() { 
534          return this.requirement != null && !this.requirement.isEmpty();
535        }
536
537        public boolean hasRequirement() { 
538          return this.requirement != null && !this.requirement.isEmpty();
539        }
540
541        /**
542         * @param value {@link #requirement} (Requirements for delivery and special handling of this kind of conditioned specimen.). This is the underlying object with id, value and extensions. The accessor "getRequirement" gives direct access to the value
543         */
544        public SpecimenDefinitionTypeTestedComponent setRequirementElement(StringType value) { 
545          this.requirement = value;
546          return this;
547        }
548
549        /**
550         * @return Requirements for delivery and special handling of this kind of conditioned specimen.
551         */
552        public String getRequirement() { 
553          return this.requirement == null ? null : this.requirement.getValue();
554        }
555
556        /**
557         * @param value Requirements for delivery and special handling of this kind of conditioned specimen.
558         */
559        public SpecimenDefinitionTypeTestedComponent setRequirement(String value) { 
560          if (Utilities.noString(value))
561            this.requirement = null;
562          else {
563            if (this.requirement == null)
564              this.requirement = new StringType();
565            this.requirement.setValue(value);
566          }
567          return this;
568        }
569
570        /**
571         * @return {@link #retentionTime} (The usual time that a specimen of this kind is retained after the ordered tests are completed, for the purpose of additional testing.)
572         */
573        public Duration getRetentionTime() { 
574          if (this.retentionTime == null)
575            if (Configuration.errorOnAutoCreate())
576              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedComponent.retentionTime");
577            else if (Configuration.doAutoCreate())
578              this.retentionTime = new Duration(); // cc
579          return this.retentionTime;
580        }
581
582        public boolean hasRetentionTime() { 
583          return this.retentionTime != null && !this.retentionTime.isEmpty();
584        }
585
586        /**
587         * @param value {@link #retentionTime} (The usual time that a specimen of this kind is retained after the ordered tests are completed, for the purpose of additional testing.)
588         */
589        public SpecimenDefinitionTypeTestedComponent setRetentionTime(Duration value) { 
590          this.retentionTime = value;
591          return this;
592        }
593
594        /**
595         * @return {@link #singleUse} (Specimen can be used by only one test or panel if the value is "true".). This is the underlying object with id, value and extensions. The accessor "getSingleUse" gives direct access to the value
596         */
597        public BooleanType getSingleUseElement() { 
598          if (this.singleUse == null)
599            if (Configuration.errorOnAutoCreate())
600              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedComponent.singleUse");
601            else if (Configuration.doAutoCreate())
602              this.singleUse = new BooleanType(); // bb
603          return this.singleUse;
604        }
605
606        public boolean hasSingleUseElement() { 
607          return this.singleUse != null && !this.singleUse.isEmpty();
608        }
609
610        public boolean hasSingleUse() { 
611          return this.singleUse != null && !this.singleUse.isEmpty();
612        }
613
614        /**
615         * @param value {@link #singleUse} (Specimen can be used by only one test or panel if the value is "true".). This is the underlying object with id, value and extensions. The accessor "getSingleUse" gives direct access to the value
616         */
617        public SpecimenDefinitionTypeTestedComponent setSingleUseElement(BooleanType value) { 
618          this.singleUse = value;
619          return this;
620        }
621
622        /**
623         * @return Specimen can be used by only one test or panel if the value is "true".
624         */
625        public boolean getSingleUse() { 
626          return this.singleUse == null || this.singleUse.isEmpty() ? false : this.singleUse.getValue();
627        }
628
629        /**
630         * @param value Specimen can be used by only one test or panel if the value is "true".
631         */
632        public SpecimenDefinitionTypeTestedComponent setSingleUse(boolean value) { 
633            if (this.singleUse == null)
634              this.singleUse = new BooleanType();
635            this.singleUse.setValue(value);
636          return this;
637        }
638
639        /**
640         * @return {@link #rejectionCriterion} (Criterion for rejection of the specimen in its container by the laboratory.)
641         */
642        public List<CodeableConcept> getRejectionCriterion() { 
643          if (this.rejectionCriterion == null)
644            this.rejectionCriterion = new ArrayList<CodeableConcept>();
645          return this.rejectionCriterion;
646        }
647
648        /**
649         * @return Returns a reference to <code>this</code> for easy method chaining
650         */
651        public SpecimenDefinitionTypeTestedComponent setRejectionCriterion(List<CodeableConcept> theRejectionCriterion) { 
652          this.rejectionCriterion = theRejectionCriterion;
653          return this;
654        }
655
656        public boolean hasRejectionCriterion() { 
657          if (this.rejectionCriterion == null)
658            return false;
659          for (CodeableConcept item : this.rejectionCriterion)
660            if (!item.isEmpty())
661              return true;
662          return false;
663        }
664
665        public CodeableConcept addRejectionCriterion() { //3
666          CodeableConcept t = new CodeableConcept();
667          if (this.rejectionCriterion == null)
668            this.rejectionCriterion = new ArrayList<CodeableConcept>();
669          this.rejectionCriterion.add(t);
670          return t;
671        }
672
673        public SpecimenDefinitionTypeTestedComponent addRejectionCriterion(CodeableConcept t) { //3
674          if (t == null)
675            return this;
676          if (this.rejectionCriterion == null)
677            this.rejectionCriterion = new ArrayList<CodeableConcept>();
678          this.rejectionCriterion.add(t);
679          return this;
680        }
681
682        /**
683         * @return The first repetition of repeating field {@link #rejectionCriterion}, creating it if it does not already exist
684         */
685        public CodeableConcept getRejectionCriterionFirstRep() { 
686          if (getRejectionCriterion().isEmpty()) {
687            addRejectionCriterion();
688          }
689          return getRejectionCriterion().get(0);
690        }
691
692        /**
693         * @return {@link #handling} (Set of instructions for preservation/transport of the specimen at a defined temperature interval, prior the testing process.)
694         */
695        public List<SpecimenDefinitionTypeTestedHandlingComponent> getHandling() { 
696          if (this.handling == null)
697            this.handling = new ArrayList<SpecimenDefinitionTypeTestedHandlingComponent>();
698          return this.handling;
699        }
700
701        /**
702         * @return Returns a reference to <code>this</code> for easy method chaining
703         */
704        public SpecimenDefinitionTypeTestedComponent setHandling(List<SpecimenDefinitionTypeTestedHandlingComponent> theHandling) { 
705          this.handling = theHandling;
706          return this;
707        }
708
709        public boolean hasHandling() { 
710          if (this.handling == null)
711            return false;
712          for (SpecimenDefinitionTypeTestedHandlingComponent item : this.handling)
713            if (!item.isEmpty())
714              return true;
715          return false;
716        }
717
718        public SpecimenDefinitionTypeTestedHandlingComponent addHandling() { //3
719          SpecimenDefinitionTypeTestedHandlingComponent t = new SpecimenDefinitionTypeTestedHandlingComponent();
720          if (this.handling == null)
721            this.handling = new ArrayList<SpecimenDefinitionTypeTestedHandlingComponent>();
722          this.handling.add(t);
723          return t;
724        }
725
726        public SpecimenDefinitionTypeTestedComponent addHandling(SpecimenDefinitionTypeTestedHandlingComponent t) { //3
727          if (t == null)
728            return this;
729          if (this.handling == null)
730            this.handling = new ArrayList<SpecimenDefinitionTypeTestedHandlingComponent>();
731          this.handling.add(t);
732          return this;
733        }
734
735        /**
736         * @return The first repetition of repeating field {@link #handling}, creating it if it does not already exist
737         */
738        public SpecimenDefinitionTypeTestedHandlingComponent getHandlingFirstRep() { 
739          if (getHandling().isEmpty()) {
740            addHandling();
741          }
742          return getHandling().get(0);
743        }
744
745        /**
746         * @return {@link #testingDestination} (Where the specimen will be tested: e.g., lab, sector, device or any combination of these.)
747         */
748        public List<CodeableConcept> getTestingDestination() { 
749          if (this.testingDestination == null)
750            this.testingDestination = new ArrayList<CodeableConcept>();
751          return this.testingDestination;
752        }
753
754        /**
755         * @return Returns a reference to <code>this</code> for easy method chaining
756         */
757        public SpecimenDefinitionTypeTestedComponent setTestingDestination(List<CodeableConcept> theTestingDestination) { 
758          this.testingDestination = theTestingDestination;
759          return this;
760        }
761
762        public boolean hasTestingDestination() { 
763          if (this.testingDestination == null)
764            return false;
765          for (CodeableConcept item : this.testingDestination)
766            if (!item.isEmpty())
767              return true;
768          return false;
769        }
770
771        public CodeableConcept addTestingDestination() { //3
772          CodeableConcept t = new CodeableConcept();
773          if (this.testingDestination == null)
774            this.testingDestination = new ArrayList<CodeableConcept>();
775          this.testingDestination.add(t);
776          return t;
777        }
778
779        public SpecimenDefinitionTypeTestedComponent addTestingDestination(CodeableConcept t) { //3
780          if (t == null)
781            return this;
782          if (this.testingDestination == null)
783            this.testingDestination = new ArrayList<CodeableConcept>();
784          this.testingDestination.add(t);
785          return this;
786        }
787
788        /**
789         * @return The first repetition of repeating field {@link #testingDestination}, creating it if it does not already exist
790         */
791        public CodeableConcept getTestingDestinationFirstRep() { 
792          if (getTestingDestination().isEmpty()) {
793            addTestingDestination();
794          }
795          return getTestingDestination().get(0);
796        }
797
798        protected void listChildren(List<Property> children) {
799          super.listChildren(children);
800          children.add(new Property("isDerived", "boolean", "Primary of secondary specimen.", 0, 1, isDerived));
801          children.add(new Property("type", "CodeableConcept", "The kind of specimen conditioned for testing expected by lab.", 0, 1, type));
802          children.add(new Property("preference", "code", "The preference for this type of conditioned specimen.", 0, 1, preference));
803          children.add(new Property("container", "", "The specimen's container.", 0, 1, container));
804          children.add(new Property("requirement", "string", "Requirements for delivery and special handling of this kind of conditioned specimen.", 0, 1, requirement));
805          children.add(new Property("retentionTime", "Duration", "The usual time that a specimen of this kind is retained after the ordered tests are completed, for the purpose of additional testing.", 0, 1, retentionTime));
806          children.add(new Property("singleUse", "boolean", "Specimen can be used by only one test or panel if the value is \"true\".", 0, 1, singleUse));
807          children.add(new Property("rejectionCriterion", "CodeableConcept", "Criterion for rejection of the specimen in its container by the laboratory.", 0, java.lang.Integer.MAX_VALUE, rejectionCriterion));
808          children.add(new Property("handling", "", "Set of instructions for preservation/transport of the specimen at a defined temperature interval, prior the testing process.", 0, java.lang.Integer.MAX_VALUE, handling));
809          children.add(new Property("testingDestination", "CodeableConcept", "Where the specimen will be tested: e.g., lab, sector, device or any combination of these.", 0, java.lang.Integer.MAX_VALUE, testingDestination));
810        }
811
812        @Override
813        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
814          switch (_hash) {
815          case 976346515: /*isDerived*/  return new Property("isDerived", "boolean", "Primary of secondary specimen.", 0, 1, isDerived);
816          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of specimen conditioned for testing expected by lab.", 0, 1, type);
817          case -1459831589: /*preference*/  return new Property("preference", "code", "The preference for this type of conditioned specimen.", 0, 1, preference);
818          case -410956671: /*container*/  return new Property("container", "", "The specimen's container.", 0, 1, container);
819          case 363387971: /*requirement*/  return new Property("requirement", "string", "Requirements for delivery and special handling of this kind of conditioned specimen.", 0, 1, requirement);
820          case 1434969867: /*retentionTime*/  return new Property("retentionTime", "Duration", "The usual time that a specimen of this kind is retained after the ordered tests are completed, for the purpose of additional testing.", 0, 1, retentionTime);
821          case -1494547425: /*singleUse*/  return new Property("singleUse", "boolean", "Specimen can be used by only one test or panel if the value is \"true\".", 0, 1, singleUse);
822          case -553706344: /*rejectionCriterion*/  return new Property("rejectionCriterion", "CodeableConcept", "Criterion for rejection of the specimen in its container by the laboratory.", 0, java.lang.Integer.MAX_VALUE, rejectionCriterion);
823          case 2072805: /*handling*/  return new Property("handling", "", "Set of instructions for preservation/transport of the specimen at a defined temperature interval, prior the testing process.", 0, java.lang.Integer.MAX_VALUE, handling);
824          case 939511774: /*testingDestination*/  return new Property("testingDestination", "CodeableConcept", "Where the specimen will be tested: e.g., lab, sector, device or any combination of these.", 0, java.lang.Integer.MAX_VALUE, testingDestination);
825          default: return super.getNamedProperty(_hash, _name, _checkValid);
826          }
827
828        }
829
830      @Override
831      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
832        switch (hash) {
833        case 976346515: /*isDerived*/ return this.isDerived == null ? new Base[0] : new Base[] {this.isDerived}; // BooleanType
834        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
835        case -1459831589: /*preference*/ return this.preference == null ? new Base[0] : new Base[] {this.preference}; // Enumeration<SpecimenContainedPreference>
836        case -410956671: /*container*/ return this.container == null ? new Base[0] : new Base[] {this.container}; // SpecimenDefinitionTypeTestedContainerComponent
837        case 363387971: /*requirement*/ return this.requirement == null ? new Base[0] : new Base[] {this.requirement}; // StringType
838        case 1434969867: /*retentionTime*/ return this.retentionTime == null ? new Base[0] : new Base[] {this.retentionTime}; // Duration
839        case -1494547425: /*singleUse*/ return this.singleUse == null ? new Base[0] : new Base[] {this.singleUse}; // BooleanType
840        case -553706344: /*rejectionCriterion*/ return this.rejectionCriterion == null ? new Base[0] : this.rejectionCriterion.toArray(new Base[this.rejectionCriterion.size()]); // CodeableConcept
841        case 2072805: /*handling*/ return this.handling == null ? new Base[0] : this.handling.toArray(new Base[this.handling.size()]); // SpecimenDefinitionTypeTestedHandlingComponent
842        case 939511774: /*testingDestination*/ return this.testingDestination == null ? new Base[0] : this.testingDestination.toArray(new Base[this.testingDestination.size()]); // CodeableConcept
843        default: return super.getProperty(hash, name, checkValid);
844        }
845
846      }
847
848      @Override
849      public Base setProperty(int hash, String name, Base value) throws FHIRException {
850        switch (hash) {
851        case 976346515: // isDerived
852          this.isDerived = castToBoolean(value); // BooleanType
853          return value;
854        case 3575610: // type
855          this.type = castToCodeableConcept(value); // CodeableConcept
856          return value;
857        case -1459831589: // preference
858          value = new SpecimenContainedPreferenceEnumFactory().fromType(castToCode(value));
859          this.preference = (Enumeration) value; // Enumeration<SpecimenContainedPreference>
860          return value;
861        case -410956671: // container
862          this.container = (SpecimenDefinitionTypeTestedContainerComponent) value; // SpecimenDefinitionTypeTestedContainerComponent
863          return value;
864        case 363387971: // requirement
865          this.requirement = castToString(value); // StringType
866          return value;
867        case 1434969867: // retentionTime
868          this.retentionTime = castToDuration(value); // Duration
869          return value;
870        case -1494547425: // singleUse
871          this.singleUse = castToBoolean(value); // BooleanType
872          return value;
873        case -553706344: // rejectionCriterion
874          this.getRejectionCriterion().add(castToCodeableConcept(value)); // CodeableConcept
875          return value;
876        case 2072805: // handling
877          this.getHandling().add((SpecimenDefinitionTypeTestedHandlingComponent) value); // SpecimenDefinitionTypeTestedHandlingComponent
878          return value;
879        case 939511774: // testingDestination
880          this.getTestingDestination().add(castToCodeableConcept(value)); // CodeableConcept
881          return value;
882        default: return super.setProperty(hash, name, value);
883        }
884
885      }
886
887      @Override
888      public Base setProperty(String name, Base value) throws FHIRException {
889        if (name.equals("isDerived")) {
890          this.isDerived = castToBoolean(value); // BooleanType
891        } else if (name.equals("type")) {
892          this.type = castToCodeableConcept(value); // CodeableConcept
893        } else if (name.equals("preference")) {
894          value = new SpecimenContainedPreferenceEnumFactory().fromType(castToCode(value));
895          this.preference = (Enumeration) value; // Enumeration<SpecimenContainedPreference>
896        } else if (name.equals("container")) {
897          this.container = (SpecimenDefinitionTypeTestedContainerComponent) value; // SpecimenDefinitionTypeTestedContainerComponent
898        } else if (name.equals("requirement")) {
899          this.requirement = castToString(value); // StringType
900        } else if (name.equals("retentionTime")) {
901          this.retentionTime = castToDuration(value); // Duration
902        } else if (name.equals("singleUse")) {
903          this.singleUse = castToBoolean(value); // BooleanType
904        } else if (name.equals("rejectionCriterion")) {
905          this.getRejectionCriterion().add(castToCodeableConcept(value));
906        } else if (name.equals("handling")) {
907          this.getHandling().add((SpecimenDefinitionTypeTestedHandlingComponent) value);
908        } else if (name.equals("testingDestination")) {
909          this.getTestingDestination().add(castToCodeableConcept(value));
910        } else
911          return super.setProperty(name, value);
912        return value;
913      }
914
915      @Override
916      public Base makeProperty(int hash, String name) throws FHIRException {
917        switch (hash) {
918        case 976346515:  return getIsDerivedElement();
919        case 3575610:  return getType();
920        case -1459831589:  return getPreferenceElement();
921        case -410956671:  return getContainer();
922        case 363387971:  return getRequirementElement();
923        case 1434969867:  return getRetentionTime();
924        case -1494547425:  return getSingleUseElement();
925        case -553706344:  return addRejectionCriterion(); 
926        case 2072805:  return addHandling(); 
927        case 939511774:  return addTestingDestination(); 
928        default: return super.makeProperty(hash, name);
929        }
930
931      }
932
933      @Override
934      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
935        switch (hash) {
936        case 976346515: /*isDerived*/ return new String[] {"boolean"};
937        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
938        case -1459831589: /*preference*/ return new String[] {"code"};
939        case -410956671: /*container*/ return new String[] {};
940        case 363387971: /*requirement*/ return new String[] {"string"};
941        case 1434969867: /*retentionTime*/ return new String[] {"Duration"};
942        case -1494547425: /*singleUse*/ return new String[] {"boolean"};
943        case -553706344: /*rejectionCriterion*/ return new String[] {"CodeableConcept"};
944        case 2072805: /*handling*/ return new String[] {};
945        case 939511774: /*testingDestination*/ return new String[] {"CodeableConcept"};
946        default: return super.getTypesForProperty(hash, name);
947        }
948
949      }
950
951      @Override
952      public Base addChild(String name) throws FHIRException {
953        if (name.equals("isDerived")) {
954          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.isDerived");
955        }
956        else if (name.equals("type")) {
957          this.type = new CodeableConcept();
958          return this.type;
959        }
960        else if (name.equals("preference")) {
961          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.preference");
962        }
963        else if (name.equals("container")) {
964          this.container = new SpecimenDefinitionTypeTestedContainerComponent();
965          return this.container;
966        }
967        else if (name.equals("requirement")) {
968          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.requirement");
969        }
970        else if (name.equals("retentionTime")) {
971          this.retentionTime = new Duration();
972          return this.retentionTime;
973        }
974        else if (name.equals("singleUse")) {
975          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.singleUse");
976        }
977        else if (name.equals("rejectionCriterion")) {
978          return addRejectionCriterion();
979        }
980        else if (name.equals("handling")) {
981          return addHandling();
982        }
983        else if (name.equals("testingDestination")) {
984          return addTestingDestination();
985        }
986        else
987          return super.addChild(name);
988      }
989
990      public SpecimenDefinitionTypeTestedComponent copy() {
991        SpecimenDefinitionTypeTestedComponent dst = new SpecimenDefinitionTypeTestedComponent();
992        copyValues(dst);
993        return dst;
994      }
995
996      public void copyValues(SpecimenDefinitionTypeTestedComponent dst) {
997        super.copyValues(dst);
998        dst.isDerived = isDerived == null ? null : isDerived.copy();
999        dst.type = type == null ? null : type.copy();
1000        dst.preference = preference == null ? null : preference.copy();
1001        dst.container = container == null ? null : container.copy();
1002        dst.requirement = requirement == null ? null : requirement.copy();
1003        dst.retentionTime = retentionTime == null ? null : retentionTime.copy();
1004        dst.singleUse = singleUse == null ? null : singleUse.copy();
1005        if (rejectionCriterion != null) {
1006          dst.rejectionCriterion = new ArrayList<CodeableConcept>();
1007          for (CodeableConcept i : rejectionCriterion)
1008            dst.rejectionCriterion.add(i.copy());
1009        };
1010        if (handling != null) {
1011          dst.handling = new ArrayList<SpecimenDefinitionTypeTestedHandlingComponent>();
1012          for (SpecimenDefinitionTypeTestedHandlingComponent i : handling)
1013            dst.handling.add(i.copy());
1014        };
1015        if (testingDestination != null) {
1016          dst.testingDestination = new ArrayList<CodeableConcept>();
1017          for (CodeableConcept i : testingDestination)
1018            dst.testingDestination.add(i.copy());
1019        };
1020      }
1021
1022      @Override
1023      public boolean equalsDeep(Base other_) {
1024        if (!super.equalsDeep(other_))
1025          return false;
1026        if (!(other_ instanceof SpecimenDefinitionTypeTestedComponent))
1027          return false;
1028        SpecimenDefinitionTypeTestedComponent o = (SpecimenDefinitionTypeTestedComponent) other_;
1029        return compareDeep(isDerived, o.isDerived, true) && compareDeep(type, o.type, true) && compareDeep(preference, o.preference, true)
1030           && compareDeep(container, o.container, true) && compareDeep(requirement, o.requirement, true) && compareDeep(retentionTime, o.retentionTime, true)
1031           && compareDeep(singleUse, o.singleUse, true) && compareDeep(rejectionCriterion, o.rejectionCriterion, true)
1032           && compareDeep(handling, o.handling, true) && compareDeep(testingDestination, o.testingDestination, true)
1033          ;
1034      }
1035
1036      @Override
1037      public boolean equalsShallow(Base other_) {
1038        if (!super.equalsShallow(other_))
1039          return false;
1040        if (!(other_ instanceof SpecimenDefinitionTypeTestedComponent))
1041          return false;
1042        SpecimenDefinitionTypeTestedComponent o = (SpecimenDefinitionTypeTestedComponent) other_;
1043        return compareValues(isDerived, o.isDerived, true) && compareValues(preference, o.preference, true)
1044           && compareValues(requirement, o.requirement, true) && compareValues(singleUse, o.singleUse, true);
1045      }
1046
1047      public boolean isEmpty() {
1048        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(isDerived, type, preference
1049          , container, requirement, retentionTime, singleUse, rejectionCriterion, handling
1050          , testingDestination);
1051      }
1052
1053  public String fhirType() {
1054    return "SpecimenDefinition.typeTested";
1055
1056  }
1057
1058  }
1059
1060    @Block()
1061    public static class SpecimenDefinitionTypeTestedContainerComponent extends BackboneElement implements IBaseBackboneElement {
1062        /**
1063         * The type of material of the container.
1064         */
1065        @Child(name = "material", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1066        @Description(shortDefinition="Container material", formalDefinition="The type of material of the container." )
1067        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/container-material")
1068        protected CodeableConcept material;
1069
1070        /**
1071         * The type of container used to contain this kind of specimen.
1072         */
1073        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1074        @Description(shortDefinition="Kind of container associated with the kind of specimen", formalDefinition="The type of container used to contain this kind of specimen." )
1075        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-container-type")
1076        protected CodeableConcept type;
1077
1078        /**
1079         * Color of container cap.
1080         */
1081        @Child(name = "cap", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1082        @Description(shortDefinition="Color of container cap", formalDefinition="Color of container cap." )
1083        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/container-cap")
1084        protected CodeableConcept cap;
1085
1086        /**
1087         * The textual description of the kind of container.
1088         */
1089        @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1090        @Description(shortDefinition="Container description", formalDefinition="The textual description of the kind of container." )
1091        protected StringType description;
1092
1093        /**
1094         * The capacity (volume or other measure) of this kind of container.
1095         */
1096        @Child(name = "capacity", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
1097        @Description(shortDefinition="Container capacity", formalDefinition="The capacity (volume or other measure) of this kind of container." )
1098        protected Quantity capacity;
1099
1100        /**
1101         * The minimum volume to be conditioned in the container.
1102         */
1103        @Child(name = "minimumVolume", type = {Quantity.class, StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
1104        @Description(shortDefinition="Minimum volume", formalDefinition="The minimum volume to be conditioned in the container." )
1105        protected Type minimumVolume;
1106
1107        /**
1108         * Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.
1109         */
1110        @Child(name = "additive", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1111        @Description(shortDefinition="Additive associated with container", formalDefinition="Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA." )
1112        protected List<SpecimenDefinitionTypeTestedContainerAdditiveComponent> additive;
1113
1114        /**
1115         * Special processing that should be applied to the container for this kind of specimen.
1116         */
1117        @Child(name = "preparation", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
1118        @Description(shortDefinition="Specimen container preparation", formalDefinition="Special processing that should be applied to the container for this kind of specimen." )
1119        protected StringType preparation;
1120
1121        private static final long serialVersionUID = 175789710L;
1122
1123    /**
1124     * Constructor
1125     */
1126      public SpecimenDefinitionTypeTestedContainerComponent() {
1127        super();
1128      }
1129
1130        /**
1131         * @return {@link #material} (The type of material of the container.)
1132         */
1133        public CodeableConcept getMaterial() { 
1134          if (this.material == null)
1135            if (Configuration.errorOnAutoCreate())
1136              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedContainerComponent.material");
1137            else if (Configuration.doAutoCreate())
1138              this.material = new CodeableConcept(); // cc
1139          return this.material;
1140        }
1141
1142        public boolean hasMaterial() { 
1143          return this.material != null && !this.material.isEmpty();
1144        }
1145
1146        /**
1147         * @param value {@link #material} (The type of material of the container.)
1148         */
1149        public SpecimenDefinitionTypeTestedContainerComponent setMaterial(CodeableConcept value) { 
1150          this.material = value;
1151          return this;
1152        }
1153
1154        /**
1155         * @return {@link #type} (The type of container used to contain this kind of specimen.)
1156         */
1157        public CodeableConcept getType() { 
1158          if (this.type == null)
1159            if (Configuration.errorOnAutoCreate())
1160              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedContainerComponent.type");
1161            else if (Configuration.doAutoCreate())
1162              this.type = new CodeableConcept(); // cc
1163          return this.type;
1164        }
1165
1166        public boolean hasType() { 
1167          return this.type != null && !this.type.isEmpty();
1168        }
1169
1170        /**
1171         * @param value {@link #type} (The type of container used to contain this kind of specimen.)
1172         */
1173        public SpecimenDefinitionTypeTestedContainerComponent setType(CodeableConcept value) { 
1174          this.type = value;
1175          return this;
1176        }
1177
1178        /**
1179         * @return {@link #cap} (Color of container cap.)
1180         */
1181        public CodeableConcept getCap() { 
1182          if (this.cap == null)
1183            if (Configuration.errorOnAutoCreate())
1184              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedContainerComponent.cap");
1185            else if (Configuration.doAutoCreate())
1186              this.cap = new CodeableConcept(); // cc
1187          return this.cap;
1188        }
1189
1190        public boolean hasCap() { 
1191          return this.cap != null && !this.cap.isEmpty();
1192        }
1193
1194        /**
1195         * @param value {@link #cap} (Color of container cap.)
1196         */
1197        public SpecimenDefinitionTypeTestedContainerComponent setCap(CodeableConcept value) { 
1198          this.cap = value;
1199          return this;
1200        }
1201
1202        /**
1203         * @return {@link #description} (The textual description of the kind of container.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1204         */
1205        public StringType getDescriptionElement() { 
1206          if (this.description == null)
1207            if (Configuration.errorOnAutoCreate())
1208              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedContainerComponent.description");
1209            else if (Configuration.doAutoCreate())
1210              this.description = new StringType(); // bb
1211          return this.description;
1212        }
1213
1214        public boolean hasDescriptionElement() { 
1215          return this.description != null && !this.description.isEmpty();
1216        }
1217
1218        public boolean hasDescription() { 
1219          return this.description != null && !this.description.isEmpty();
1220        }
1221
1222        /**
1223         * @param value {@link #description} (The textual description of the kind of container.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1224         */
1225        public SpecimenDefinitionTypeTestedContainerComponent setDescriptionElement(StringType value) { 
1226          this.description = value;
1227          return this;
1228        }
1229
1230        /**
1231         * @return The textual description of the kind of container.
1232         */
1233        public String getDescription() { 
1234          return this.description == null ? null : this.description.getValue();
1235        }
1236
1237        /**
1238         * @param value The textual description of the kind of container.
1239         */
1240        public SpecimenDefinitionTypeTestedContainerComponent setDescription(String value) { 
1241          if (Utilities.noString(value))
1242            this.description = null;
1243          else {
1244            if (this.description == null)
1245              this.description = new StringType();
1246            this.description.setValue(value);
1247          }
1248          return this;
1249        }
1250
1251        /**
1252         * @return {@link #capacity} (The capacity (volume or other measure) of this kind of container.)
1253         */
1254        public Quantity getCapacity() { 
1255          if (this.capacity == null)
1256            if (Configuration.errorOnAutoCreate())
1257              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedContainerComponent.capacity");
1258            else if (Configuration.doAutoCreate())
1259              this.capacity = new Quantity(); // cc
1260          return this.capacity;
1261        }
1262
1263        public boolean hasCapacity() { 
1264          return this.capacity != null && !this.capacity.isEmpty();
1265        }
1266
1267        /**
1268         * @param value {@link #capacity} (The capacity (volume or other measure) of this kind of container.)
1269         */
1270        public SpecimenDefinitionTypeTestedContainerComponent setCapacity(Quantity value) { 
1271          this.capacity = value;
1272          return this;
1273        }
1274
1275        /**
1276         * @return {@link #minimumVolume} (The minimum volume to be conditioned in the container.)
1277         */
1278        public Type getMinimumVolume() { 
1279          return this.minimumVolume;
1280        }
1281
1282        /**
1283         * @return {@link #minimumVolume} (The minimum volume to be conditioned in the container.)
1284         */
1285        public Quantity getMinimumVolumeQuantity() throws FHIRException { 
1286          if (this.minimumVolume == null)
1287            this.minimumVolume = new Quantity();
1288          if (!(this.minimumVolume instanceof Quantity))
1289            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.minimumVolume.getClass().getName()+" was encountered");
1290          return (Quantity) this.minimumVolume;
1291        }
1292
1293        public boolean hasMinimumVolumeQuantity() { 
1294          return this != null && this.minimumVolume instanceof Quantity;
1295        }
1296
1297        /**
1298         * @return {@link #minimumVolume} (The minimum volume to be conditioned in the container.)
1299         */
1300        public StringType getMinimumVolumeStringType() throws FHIRException { 
1301          if (this.minimumVolume == null)
1302            this.minimumVolume = new StringType();
1303          if (!(this.minimumVolume instanceof StringType))
1304            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.minimumVolume.getClass().getName()+" was encountered");
1305          return (StringType) this.minimumVolume;
1306        }
1307
1308        public boolean hasMinimumVolumeStringType() { 
1309          return this != null && this.minimumVolume instanceof StringType;
1310        }
1311
1312        public boolean hasMinimumVolume() { 
1313          return this.minimumVolume != null && !this.minimumVolume.isEmpty();
1314        }
1315
1316        /**
1317         * @param value {@link #minimumVolume} (The minimum volume to be conditioned in the container.)
1318         */
1319        public SpecimenDefinitionTypeTestedContainerComponent setMinimumVolume(Type value) { 
1320          if (value != null && !(value instanceof Quantity || value instanceof StringType))
1321            throw new Error("Not the right type for SpecimenDefinition.typeTested.container.minimumVolume[x]: "+value.fhirType());
1322          this.minimumVolume = value;
1323          return this;
1324        }
1325
1326        /**
1327         * @return {@link #additive} (Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1328         */
1329        public List<SpecimenDefinitionTypeTestedContainerAdditiveComponent> getAdditive() { 
1330          if (this.additive == null)
1331            this.additive = new ArrayList<SpecimenDefinitionTypeTestedContainerAdditiveComponent>();
1332          return this.additive;
1333        }
1334
1335        /**
1336         * @return Returns a reference to <code>this</code> for easy method chaining
1337         */
1338        public SpecimenDefinitionTypeTestedContainerComponent setAdditive(List<SpecimenDefinitionTypeTestedContainerAdditiveComponent> theAdditive) { 
1339          this.additive = theAdditive;
1340          return this;
1341        }
1342
1343        public boolean hasAdditive() { 
1344          if (this.additive == null)
1345            return false;
1346          for (SpecimenDefinitionTypeTestedContainerAdditiveComponent item : this.additive)
1347            if (!item.isEmpty())
1348              return true;
1349          return false;
1350        }
1351
1352        public SpecimenDefinitionTypeTestedContainerAdditiveComponent addAdditive() { //3
1353          SpecimenDefinitionTypeTestedContainerAdditiveComponent t = new SpecimenDefinitionTypeTestedContainerAdditiveComponent();
1354          if (this.additive == null)
1355            this.additive = new ArrayList<SpecimenDefinitionTypeTestedContainerAdditiveComponent>();
1356          this.additive.add(t);
1357          return t;
1358        }
1359
1360        public SpecimenDefinitionTypeTestedContainerComponent addAdditive(SpecimenDefinitionTypeTestedContainerAdditiveComponent t) { //3
1361          if (t == null)
1362            return this;
1363          if (this.additive == null)
1364            this.additive = new ArrayList<SpecimenDefinitionTypeTestedContainerAdditiveComponent>();
1365          this.additive.add(t);
1366          return this;
1367        }
1368
1369        /**
1370         * @return The first repetition of repeating field {@link #additive}, creating it if it does not already exist
1371         */
1372        public SpecimenDefinitionTypeTestedContainerAdditiveComponent getAdditiveFirstRep() { 
1373          if (getAdditive().isEmpty()) {
1374            addAdditive();
1375          }
1376          return getAdditive().get(0);
1377        }
1378
1379        /**
1380         * @return {@link #preparation} (Special processing that should be applied to the container for this kind of specimen.). This is the underlying object with id, value and extensions. The accessor "getPreparation" gives direct access to the value
1381         */
1382        public StringType getPreparationElement() { 
1383          if (this.preparation == null)
1384            if (Configuration.errorOnAutoCreate())
1385              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedContainerComponent.preparation");
1386            else if (Configuration.doAutoCreate())
1387              this.preparation = new StringType(); // bb
1388          return this.preparation;
1389        }
1390
1391        public boolean hasPreparationElement() { 
1392          return this.preparation != null && !this.preparation.isEmpty();
1393        }
1394
1395        public boolean hasPreparation() { 
1396          return this.preparation != null && !this.preparation.isEmpty();
1397        }
1398
1399        /**
1400         * @param value {@link #preparation} (Special processing that should be applied to the container for this kind of specimen.). This is the underlying object with id, value and extensions. The accessor "getPreparation" gives direct access to the value
1401         */
1402        public SpecimenDefinitionTypeTestedContainerComponent setPreparationElement(StringType value) { 
1403          this.preparation = value;
1404          return this;
1405        }
1406
1407        /**
1408         * @return Special processing that should be applied to the container for this kind of specimen.
1409         */
1410        public String getPreparation() { 
1411          return this.preparation == null ? null : this.preparation.getValue();
1412        }
1413
1414        /**
1415         * @param value Special processing that should be applied to the container for this kind of specimen.
1416         */
1417        public SpecimenDefinitionTypeTestedContainerComponent setPreparation(String value) { 
1418          if (Utilities.noString(value))
1419            this.preparation = null;
1420          else {
1421            if (this.preparation == null)
1422              this.preparation = new StringType();
1423            this.preparation.setValue(value);
1424          }
1425          return this;
1426        }
1427
1428        protected void listChildren(List<Property> children) {
1429          super.listChildren(children);
1430          children.add(new Property("material", "CodeableConcept", "The type of material of the container.", 0, 1, material));
1431          children.add(new Property("type", "CodeableConcept", "The type of container used to contain this kind of specimen.", 0, 1, type));
1432          children.add(new Property("cap", "CodeableConcept", "Color of container cap.", 0, 1, cap));
1433          children.add(new Property("description", "string", "The textual description of the kind of container.", 0, 1, description));
1434          children.add(new Property("capacity", "SimpleQuantity", "The capacity (volume or other measure) of this kind of container.", 0, 1, capacity));
1435          children.add(new Property("minimumVolume[x]", "SimpleQuantity|string", "The minimum volume to be conditioned in the container.", 0, 1, minimumVolume));
1436          children.add(new Property("additive", "", "Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, java.lang.Integer.MAX_VALUE, additive));
1437          children.add(new Property("preparation", "string", "Special processing that should be applied to the container for this kind of specimen.", 0, 1, preparation));
1438        }
1439
1440        @Override
1441        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1442          switch (_hash) {
1443          case 299066663: /*material*/  return new Property("material", "CodeableConcept", "The type of material of the container.", 0, 1, material);
1444          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of container used to contain this kind of specimen.", 0, 1, type);
1445          case 98258: /*cap*/  return new Property("cap", "CodeableConcept", "Color of container cap.", 0, 1, cap);
1446          case -1724546052: /*description*/  return new Property("description", "string", "The textual description of the kind of container.", 0, 1, description);
1447          case -67824454: /*capacity*/  return new Property("capacity", "SimpleQuantity", "The capacity (volume or other measure) of this kind of container.", 0, 1, capacity);
1448          case 371830456: /*minimumVolume[x]*/  return new Property("minimumVolume[x]", "SimpleQuantity|string", "The minimum volume to be conditioned in the container.", 0, 1, minimumVolume);
1449          case -1674665784: /*minimumVolume*/  return new Property("minimumVolume[x]", "SimpleQuantity|string", "The minimum volume to be conditioned in the container.", 0, 1, minimumVolume);
1450          case -532143757: /*minimumVolumeQuantity*/  return new Property("minimumVolume[x]", "SimpleQuantity|string", "The minimum volume to be conditioned in the container.", 0, 1, minimumVolume);
1451          case 248461049: /*minimumVolumeString*/  return new Property("minimumVolume[x]", "SimpleQuantity|string", "The minimum volume to be conditioned in the container.", 0, 1, minimumVolume);
1452          case -1226589236: /*additive*/  return new Property("additive", "", "Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, java.lang.Integer.MAX_VALUE, additive);
1453          case -1315428713: /*preparation*/  return new Property("preparation", "string", "Special processing that should be applied to the container for this kind of specimen.", 0, 1, preparation);
1454          default: return super.getNamedProperty(_hash, _name, _checkValid);
1455          }
1456
1457        }
1458
1459      @Override
1460      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1461        switch (hash) {
1462        case 299066663: /*material*/ return this.material == null ? new Base[0] : new Base[] {this.material}; // CodeableConcept
1463        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1464        case 98258: /*cap*/ return this.cap == null ? new Base[0] : new Base[] {this.cap}; // CodeableConcept
1465        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1466        case -67824454: /*capacity*/ return this.capacity == null ? new Base[0] : new Base[] {this.capacity}; // Quantity
1467        case -1674665784: /*minimumVolume*/ return this.minimumVolume == null ? new Base[0] : new Base[] {this.minimumVolume}; // Type
1468        case -1226589236: /*additive*/ return this.additive == null ? new Base[0] : this.additive.toArray(new Base[this.additive.size()]); // SpecimenDefinitionTypeTestedContainerAdditiveComponent
1469        case -1315428713: /*preparation*/ return this.preparation == null ? new Base[0] : new Base[] {this.preparation}; // StringType
1470        default: return super.getProperty(hash, name, checkValid);
1471        }
1472
1473      }
1474
1475      @Override
1476      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1477        switch (hash) {
1478        case 299066663: // material
1479          this.material = castToCodeableConcept(value); // CodeableConcept
1480          return value;
1481        case 3575610: // type
1482          this.type = castToCodeableConcept(value); // CodeableConcept
1483          return value;
1484        case 98258: // cap
1485          this.cap = castToCodeableConcept(value); // CodeableConcept
1486          return value;
1487        case -1724546052: // description
1488          this.description = castToString(value); // StringType
1489          return value;
1490        case -67824454: // capacity
1491          this.capacity = castToQuantity(value); // Quantity
1492          return value;
1493        case -1674665784: // minimumVolume
1494          this.minimumVolume = castToType(value); // Type
1495          return value;
1496        case -1226589236: // additive
1497          this.getAdditive().add((SpecimenDefinitionTypeTestedContainerAdditiveComponent) value); // SpecimenDefinitionTypeTestedContainerAdditiveComponent
1498          return value;
1499        case -1315428713: // preparation
1500          this.preparation = castToString(value); // StringType
1501          return value;
1502        default: return super.setProperty(hash, name, value);
1503        }
1504
1505      }
1506
1507      @Override
1508      public Base setProperty(String name, Base value) throws FHIRException {
1509        if (name.equals("material")) {
1510          this.material = castToCodeableConcept(value); // CodeableConcept
1511        } else if (name.equals("type")) {
1512          this.type = castToCodeableConcept(value); // CodeableConcept
1513        } else if (name.equals("cap")) {
1514          this.cap = castToCodeableConcept(value); // CodeableConcept
1515        } else if (name.equals("description")) {
1516          this.description = castToString(value); // StringType
1517        } else if (name.equals("capacity")) {
1518          this.capacity = castToQuantity(value); // Quantity
1519        } else if (name.equals("minimumVolume[x]")) {
1520          this.minimumVolume = castToType(value); // Type
1521        } else if (name.equals("additive")) {
1522          this.getAdditive().add((SpecimenDefinitionTypeTestedContainerAdditiveComponent) value);
1523        } else if (name.equals("preparation")) {
1524          this.preparation = castToString(value); // StringType
1525        } else
1526          return super.setProperty(name, value);
1527        return value;
1528      }
1529
1530      @Override
1531      public Base makeProperty(int hash, String name) throws FHIRException {
1532        switch (hash) {
1533        case 299066663:  return getMaterial();
1534        case 3575610:  return getType();
1535        case 98258:  return getCap();
1536        case -1724546052:  return getDescriptionElement();
1537        case -67824454:  return getCapacity();
1538        case 371830456:  return getMinimumVolume();
1539        case -1674665784:  return getMinimumVolume();
1540        case -1226589236:  return addAdditive(); 
1541        case -1315428713:  return getPreparationElement();
1542        default: return super.makeProperty(hash, name);
1543        }
1544
1545      }
1546
1547      @Override
1548      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1549        switch (hash) {
1550        case 299066663: /*material*/ return new String[] {"CodeableConcept"};
1551        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1552        case 98258: /*cap*/ return new String[] {"CodeableConcept"};
1553        case -1724546052: /*description*/ return new String[] {"string"};
1554        case -67824454: /*capacity*/ return new String[] {"SimpleQuantity"};
1555        case -1674665784: /*minimumVolume*/ return new String[] {"SimpleQuantity", "string"};
1556        case -1226589236: /*additive*/ return new String[] {};
1557        case -1315428713: /*preparation*/ return new String[] {"string"};
1558        default: return super.getTypesForProperty(hash, name);
1559        }
1560
1561      }
1562
1563      @Override
1564      public Base addChild(String name) throws FHIRException {
1565        if (name.equals("material")) {
1566          this.material = new CodeableConcept();
1567          return this.material;
1568        }
1569        else if (name.equals("type")) {
1570          this.type = new CodeableConcept();
1571          return this.type;
1572        }
1573        else if (name.equals("cap")) {
1574          this.cap = new CodeableConcept();
1575          return this.cap;
1576        }
1577        else if (name.equals("description")) {
1578          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.description");
1579        }
1580        else if (name.equals("capacity")) {
1581          this.capacity = new Quantity();
1582          return this.capacity;
1583        }
1584        else if (name.equals("minimumVolumeQuantity")) {
1585          this.minimumVolume = new Quantity();
1586          return this.minimumVolume;
1587        }
1588        else if (name.equals("minimumVolumeString")) {
1589          this.minimumVolume = new StringType();
1590          return this.minimumVolume;
1591        }
1592        else if (name.equals("additive")) {
1593          return addAdditive();
1594        }
1595        else if (name.equals("preparation")) {
1596          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.preparation");
1597        }
1598        else
1599          return super.addChild(name);
1600      }
1601
1602      public SpecimenDefinitionTypeTestedContainerComponent copy() {
1603        SpecimenDefinitionTypeTestedContainerComponent dst = new SpecimenDefinitionTypeTestedContainerComponent();
1604        copyValues(dst);
1605        return dst;
1606      }
1607
1608      public void copyValues(SpecimenDefinitionTypeTestedContainerComponent dst) {
1609        super.copyValues(dst);
1610        dst.material = material == null ? null : material.copy();
1611        dst.type = type == null ? null : type.copy();
1612        dst.cap = cap == null ? null : cap.copy();
1613        dst.description = description == null ? null : description.copy();
1614        dst.capacity = capacity == null ? null : capacity.copy();
1615        dst.minimumVolume = minimumVolume == null ? null : minimumVolume.copy();
1616        if (additive != null) {
1617          dst.additive = new ArrayList<SpecimenDefinitionTypeTestedContainerAdditiveComponent>();
1618          for (SpecimenDefinitionTypeTestedContainerAdditiveComponent i : additive)
1619            dst.additive.add(i.copy());
1620        };
1621        dst.preparation = preparation == null ? null : preparation.copy();
1622      }
1623
1624      @Override
1625      public boolean equalsDeep(Base other_) {
1626        if (!super.equalsDeep(other_))
1627          return false;
1628        if (!(other_ instanceof SpecimenDefinitionTypeTestedContainerComponent))
1629          return false;
1630        SpecimenDefinitionTypeTestedContainerComponent o = (SpecimenDefinitionTypeTestedContainerComponent) other_;
1631        return compareDeep(material, o.material, true) && compareDeep(type, o.type, true) && compareDeep(cap, o.cap, true)
1632           && compareDeep(description, o.description, true) && compareDeep(capacity, o.capacity, true) && compareDeep(minimumVolume, o.minimumVolume, true)
1633           && compareDeep(additive, o.additive, true) && compareDeep(preparation, o.preparation, true);
1634      }
1635
1636      @Override
1637      public boolean equalsShallow(Base other_) {
1638        if (!super.equalsShallow(other_))
1639          return false;
1640        if (!(other_ instanceof SpecimenDefinitionTypeTestedContainerComponent))
1641          return false;
1642        SpecimenDefinitionTypeTestedContainerComponent o = (SpecimenDefinitionTypeTestedContainerComponent) other_;
1643        return compareValues(description, o.description, true) && compareValues(preparation, o.preparation, true)
1644          ;
1645      }
1646
1647      public boolean isEmpty() {
1648        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(material, type, cap, description
1649          , capacity, minimumVolume, additive, preparation);
1650      }
1651
1652  public String fhirType() {
1653    return "SpecimenDefinition.typeTested.container";
1654
1655  }
1656
1657  }
1658
1659    @Block()
1660    public static class SpecimenDefinitionTypeTestedContainerAdditiveComponent extends BackboneElement implements IBaseBackboneElement {
1661        /**
1662         * Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.
1663         */
1664        @Child(name = "additive", type = {CodeableConcept.class, Substance.class}, order=1, min=1, max=1, modifier=false, summary=false)
1665        @Description(shortDefinition="Additive associated with container", formalDefinition="Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA." )
1666        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v2-0371")
1667        protected Type additive;
1668
1669        private static final long serialVersionUID = 1819209272L;
1670
1671    /**
1672     * Constructor
1673     */
1674      public SpecimenDefinitionTypeTestedContainerAdditiveComponent() {
1675        super();
1676      }
1677
1678    /**
1679     * Constructor
1680     */
1681      public SpecimenDefinitionTypeTestedContainerAdditiveComponent(Type additive) {
1682        super();
1683        this.additive = additive;
1684      }
1685
1686        /**
1687         * @return {@link #additive} (Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1688         */
1689        public Type getAdditive() { 
1690          return this.additive;
1691        }
1692
1693        /**
1694         * @return {@link #additive} (Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1695         */
1696        public CodeableConcept getAdditiveCodeableConcept() throws FHIRException { 
1697          if (this.additive == null)
1698            this.additive = new CodeableConcept();
1699          if (!(this.additive instanceof CodeableConcept))
1700            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.additive.getClass().getName()+" was encountered");
1701          return (CodeableConcept) this.additive;
1702        }
1703
1704        public boolean hasAdditiveCodeableConcept() { 
1705          return this != null && this.additive instanceof CodeableConcept;
1706        }
1707
1708        /**
1709         * @return {@link #additive} (Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1710         */
1711        public Reference getAdditiveReference() throws FHIRException { 
1712          if (this.additive == null)
1713            this.additive = new Reference();
1714          if (!(this.additive instanceof Reference))
1715            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.additive.getClass().getName()+" was encountered");
1716          return (Reference) this.additive;
1717        }
1718
1719        public boolean hasAdditiveReference() { 
1720          return this != null && this.additive instanceof Reference;
1721        }
1722
1723        public boolean hasAdditive() { 
1724          return this.additive != null && !this.additive.isEmpty();
1725        }
1726
1727        /**
1728         * @param value {@link #additive} (Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.)
1729         */
1730        public SpecimenDefinitionTypeTestedContainerAdditiveComponent setAdditive(Type value) { 
1731          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1732            throw new Error("Not the right type for SpecimenDefinition.typeTested.container.additive.additive[x]: "+value.fhirType());
1733          this.additive = value;
1734          return this;
1735        }
1736
1737        protected void listChildren(List<Property> children) {
1738          super.listChildren(children);
1739          children.add(new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive));
1740        }
1741
1742        @Override
1743        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1744          switch (_hash) {
1745          case 261915956: /*additive[x]*/  return new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive);
1746          case -1226589236: /*additive*/  return new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive);
1747          case 1330272821: /*additiveCodeableConcept*/  return new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive);
1748          case -386783009: /*additiveReference*/  return new Property("additive[x]", "CodeableConcept|Reference(Substance)", "Substance introduced in the kind of container to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.", 0, 1, additive);
1749          default: return super.getNamedProperty(_hash, _name, _checkValid);
1750          }
1751
1752        }
1753
1754      @Override
1755      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1756        switch (hash) {
1757        case -1226589236: /*additive*/ return this.additive == null ? new Base[0] : new Base[] {this.additive}; // Type
1758        default: return super.getProperty(hash, name, checkValid);
1759        }
1760
1761      }
1762
1763      @Override
1764      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1765        switch (hash) {
1766        case -1226589236: // additive
1767          this.additive = castToType(value); // Type
1768          return value;
1769        default: return super.setProperty(hash, name, value);
1770        }
1771
1772      }
1773
1774      @Override
1775      public Base setProperty(String name, Base value) throws FHIRException {
1776        if (name.equals("additive[x]")) {
1777          this.additive = castToType(value); // Type
1778        } else
1779          return super.setProperty(name, value);
1780        return value;
1781      }
1782
1783      @Override
1784      public Base makeProperty(int hash, String name) throws FHIRException {
1785        switch (hash) {
1786        case 261915956:  return getAdditive();
1787        case -1226589236:  return getAdditive();
1788        default: return super.makeProperty(hash, name);
1789        }
1790
1791      }
1792
1793      @Override
1794      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1795        switch (hash) {
1796        case -1226589236: /*additive*/ return new String[] {"CodeableConcept", "Reference"};
1797        default: return super.getTypesForProperty(hash, name);
1798        }
1799
1800      }
1801
1802      @Override
1803      public Base addChild(String name) throws FHIRException {
1804        if (name.equals("additiveCodeableConcept")) {
1805          this.additive = new CodeableConcept();
1806          return this.additive;
1807        }
1808        else if (name.equals("additiveReference")) {
1809          this.additive = new Reference();
1810          return this.additive;
1811        }
1812        else
1813          return super.addChild(name);
1814      }
1815
1816      public SpecimenDefinitionTypeTestedContainerAdditiveComponent copy() {
1817        SpecimenDefinitionTypeTestedContainerAdditiveComponent dst = new SpecimenDefinitionTypeTestedContainerAdditiveComponent();
1818        copyValues(dst);
1819        return dst;
1820      }
1821
1822      public void copyValues(SpecimenDefinitionTypeTestedContainerAdditiveComponent dst) {
1823        super.copyValues(dst);
1824        dst.additive = additive == null ? null : additive.copy();
1825      }
1826
1827      @Override
1828      public boolean equalsDeep(Base other_) {
1829        if (!super.equalsDeep(other_))
1830          return false;
1831        if (!(other_ instanceof SpecimenDefinitionTypeTestedContainerAdditiveComponent))
1832          return false;
1833        SpecimenDefinitionTypeTestedContainerAdditiveComponent o = (SpecimenDefinitionTypeTestedContainerAdditiveComponent) other_;
1834        return compareDeep(additive, o.additive, true);
1835      }
1836
1837      @Override
1838      public boolean equalsShallow(Base other_) {
1839        if (!super.equalsShallow(other_))
1840          return false;
1841        if (!(other_ instanceof SpecimenDefinitionTypeTestedContainerAdditiveComponent))
1842          return false;
1843        SpecimenDefinitionTypeTestedContainerAdditiveComponent o = (SpecimenDefinitionTypeTestedContainerAdditiveComponent) other_;
1844        return true;
1845      }
1846
1847      public boolean isEmpty() {
1848        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(additive);
1849      }
1850
1851  public String fhirType() {
1852    return "SpecimenDefinition.typeTested.container.additive";
1853
1854  }
1855
1856  }
1857
1858    @Block()
1859    public static class SpecimenDefinitionTypeTestedHandlingComponent extends BackboneElement implements IBaseBackboneElement {
1860        /**
1861         * It qualifies the interval of temperature, which characterizes an occurrence of handling. Conditions that are not related to temperature may be handled in the instruction element.
1862         */
1863        @Child(name = "temperatureQualifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1864        @Description(shortDefinition="Temperature qualifier", formalDefinition="It qualifies the interval of temperature, which characterizes an occurrence of handling. Conditions that are not related to temperature may be handled in the instruction element." )
1865        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/handling-condition")
1866        protected CodeableConcept temperatureQualifier;
1867
1868        /**
1869         * The temperature interval for this set of handling instructions.
1870         */
1871        @Child(name = "temperatureRange", type = {Range.class}, order=2, min=0, max=1, modifier=false, summary=false)
1872        @Description(shortDefinition="Temperature range", formalDefinition="The temperature interval for this set of handling instructions." )
1873        protected Range temperatureRange;
1874
1875        /**
1876         * The maximum time interval of preservation of the specimen with these conditions.
1877         */
1878        @Child(name = "maxDuration", type = {Duration.class}, order=3, min=0, max=1, modifier=false, summary=false)
1879        @Description(shortDefinition="Maximum preservation time", formalDefinition="The maximum time interval of preservation of the specimen with these conditions." )
1880        protected Duration maxDuration;
1881
1882        /**
1883         * Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'.
1884         */
1885        @Child(name = "instruction", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1886        @Description(shortDefinition="Preservation instruction", formalDefinition="Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'." )
1887        protected StringType instruction;
1888
1889        private static final long serialVersionUID = 2130906844L;
1890
1891    /**
1892     * Constructor
1893     */
1894      public SpecimenDefinitionTypeTestedHandlingComponent() {
1895        super();
1896      }
1897
1898        /**
1899         * @return {@link #temperatureQualifier} (It qualifies the interval of temperature, which characterizes an occurrence of handling. Conditions that are not related to temperature may be handled in the instruction element.)
1900         */
1901        public CodeableConcept getTemperatureQualifier() { 
1902          if (this.temperatureQualifier == null)
1903            if (Configuration.errorOnAutoCreate())
1904              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedHandlingComponent.temperatureQualifier");
1905            else if (Configuration.doAutoCreate())
1906              this.temperatureQualifier = new CodeableConcept(); // cc
1907          return this.temperatureQualifier;
1908        }
1909
1910        public boolean hasTemperatureQualifier() { 
1911          return this.temperatureQualifier != null && !this.temperatureQualifier.isEmpty();
1912        }
1913
1914        /**
1915         * @param value {@link #temperatureQualifier} (It qualifies the interval of temperature, which characterizes an occurrence of handling. Conditions that are not related to temperature may be handled in the instruction element.)
1916         */
1917        public SpecimenDefinitionTypeTestedHandlingComponent setTemperatureQualifier(CodeableConcept value) { 
1918          this.temperatureQualifier = value;
1919          return this;
1920        }
1921
1922        /**
1923         * @return {@link #temperatureRange} (The temperature interval for this set of handling instructions.)
1924         */
1925        public Range getTemperatureRange() { 
1926          if (this.temperatureRange == null)
1927            if (Configuration.errorOnAutoCreate())
1928              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedHandlingComponent.temperatureRange");
1929            else if (Configuration.doAutoCreate())
1930              this.temperatureRange = new Range(); // cc
1931          return this.temperatureRange;
1932        }
1933
1934        public boolean hasTemperatureRange() { 
1935          return this.temperatureRange != null && !this.temperatureRange.isEmpty();
1936        }
1937
1938        /**
1939         * @param value {@link #temperatureRange} (The temperature interval for this set of handling instructions.)
1940         */
1941        public SpecimenDefinitionTypeTestedHandlingComponent setTemperatureRange(Range value) { 
1942          this.temperatureRange = value;
1943          return this;
1944        }
1945
1946        /**
1947         * @return {@link #maxDuration} (The maximum time interval of preservation of the specimen with these conditions.)
1948         */
1949        public Duration getMaxDuration() { 
1950          if (this.maxDuration == null)
1951            if (Configuration.errorOnAutoCreate())
1952              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedHandlingComponent.maxDuration");
1953            else if (Configuration.doAutoCreate())
1954              this.maxDuration = new Duration(); // cc
1955          return this.maxDuration;
1956        }
1957
1958        public boolean hasMaxDuration() { 
1959          return this.maxDuration != null && !this.maxDuration.isEmpty();
1960        }
1961
1962        /**
1963         * @param value {@link #maxDuration} (The maximum time interval of preservation of the specimen with these conditions.)
1964         */
1965        public SpecimenDefinitionTypeTestedHandlingComponent setMaxDuration(Duration value) { 
1966          this.maxDuration = value;
1967          return this;
1968        }
1969
1970        /**
1971         * @return {@link #instruction} (Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
1972         */
1973        public StringType getInstructionElement() { 
1974          if (this.instruction == null)
1975            if (Configuration.errorOnAutoCreate())
1976              throw new Error("Attempt to auto-create SpecimenDefinitionTypeTestedHandlingComponent.instruction");
1977            else if (Configuration.doAutoCreate())
1978              this.instruction = new StringType(); // bb
1979          return this.instruction;
1980        }
1981
1982        public boolean hasInstructionElement() { 
1983          return this.instruction != null && !this.instruction.isEmpty();
1984        }
1985
1986        public boolean hasInstruction() { 
1987          return this.instruction != null && !this.instruction.isEmpty();
1988        }
1989
1990        /**
1991         * @param value {@link #instruction} (Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
1992         */
1993        public SpecimenDefinitionTypeTestedHandlingComponent setInstructionElement(StringType value) { 
1994          this.instruction = value;
1995          return this;
1996        }
1997
1998        /**
1999         * @return Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'.
2000         */
2001        public String getInstruction() { 
2002          return this.instruction == null ? null : this.instruction.getValue();
2003        }
2004
2005        /**
2006         * @param value Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'.
2007         */
2008        public SpecimenDefinitionTypeTestedHandlingComponent setInstruction(String value) { 
2009          if (Utilities.noString(value))
2010            this.instruction = null;
2011          else {
2012            if (this.instruction == null)
2013              this.instruction = new StringType();
2014            this.instruction.setValue(value);
2015          }
2016          return this;
2017        }
2018
2019        protected void listChildren(List<Property> children) {
2020          super.listChildren(children);
2021          children.add(new Property("temperatureQualifier", "CodeableConcept", "It qualifies the interval of temperature, which characterizes an occurrence of handling. Conditions that are not related to temperature may be handled in the instruction element.", 0, 1, temperatureQualifier));
2022          children.add(new Property("temperatureRange", "Range", "The temperature interval for this set of handling instructions.", 0, 1, temperatureRange));
2023          children.add(new Property("maxDuration", "Duration", "The maximum time interval of preservation of the specimen with these conditions.", 0, 1, maxDuration));
2024          children.add(new Property("instruction", "string", "Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'.", 0, 1, instruction));
2025        }
2026
2027        @Override
2028        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2029          switch (_hash) {
2030          case 548941206: /*temperatureQualifier*/  return new Property("temperatureQualifier", "CodeableConcept", "It qualifies the interval of temperature, which characterizes an occurrence of handling. Conditions that are not related to temperature may be handled in the instruction element.", 0, 1, temperatureQualifier);
2031          case -39203799: /*temperatureRange*/  return new Property("temperatureRange", "Range", "The temperature interval for this set of handling instructions.", 0, 1, temperatureRange);
2032          case 40284952: /*maxDuration*/  return new Property("maxDuration", "Duration", "The maximum time interval of preservation of the specimen with these conditions.", 0, 1, maxDuration);
2033          case 301526158: /*instruction*/  return new Property("instruction", "string", "Additional textual instructions for the preservation or transport of the specimen. For instance, 'Protect from light exposure'.", 0, 1, instruction);
2034          default: return super.getNamedProperty(_hash, _name, _checkValid);
2035          }
2036
2037        }
2038
2039      @Override
2040      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2041        switch (hash) {
2042        case 548941206: /*temperatureQualifier*/ return this.temperatureQualifier == null ? new Base[0] : new Base[] {this.temperatureQualifier}; // CodeableConcept
2043        case -39203799: /*temperatureRange*/ return this.temperatureRange == null ? new Base[0] : new Base[] {this.temperatureRange}; // Range
2044        case 40284952: /*maxDuration*/ return this.maxDuration == null ? new Base[0] : new Base[] {this.maxDuration}; // Duration
2045        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
2046        default: return super.getProperty(hash, name, checkValid);
2047        }
2048
2049      }
2050
2051      @Override
2052      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2053        switch (hash) {
2054        case 548941206: // temperatureQualifier
2055          this.temperatureQualifier = castToCodeableConcept(value); // CodeableConcept
2056          return value;
2057        case -39203799: // temperatureRange
2058          this.temperatureRange = castToRange(value); // Range
2059          return value;
2060        case 40284952: // maxDuration
2061          this.maxDuration = castToDuration(value); // Duration
2062          return value;
2063        case 301526158: // instruction
2064          this.instruction = castToString(value); // StringType
2065          return value;
2066        default: return super.setProperty(hash, name, value);
2067        }
2068
2069      }
2070
2071      @Override
2072      public Base setProperty(String name, Base value) throws FHIRException {
2073        if (name.equals("temperatureQualifier")) {
2074          this.temperatureQualifier = castToCodeableConcept(value); // CodeableConcept
2075        } else if (name.equals("temperatureRange")) {
2076          this.temperatureRange = castToRange(value); // Range
2077        } else if (name.equals("maxDuration")) {
2078          this.maxDuration = castToDuration(value); // Duration
2079        } else if (name.equals("instruction")) {
2080          this.instruction = castToString(value); // StringType
2081        } else
2082          return super.setProperty(name, value);
2083        return value;
2084      }
2085
2086      @Override
2087      public Base makeProperty(int hash, String name) throws FHIRException {
2088        switch (hash) {
2089        case 548941206:  return getTemperatureQualifier();
2090        case -39203799:  return getTemperatureRange();
2091        case 40284952:  return getMaxDuration();
2092        case 301526158:  return getInstructionElement();
2093        default: return super.makeProperty(hash, name);
2094        }
2095
2096      }
2097
2098      @Override
2099      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2100        switch (hash) {
2101        case 548941206: /*temperatureQualifier*/ return new String[] {"CodeableConcept"};
2102        case -39203799: /*temperatureRange*/ return new String[] {"Range"};
2103        case 40284952: /*maxDuration*/ return new String[] {"Duration"};
2104        case 301526158: /*instruction*/ return new String[] {"string"};
2105        default: return super.getTypesForProperty(hash, name);
2106        }
2107
2108      }
2109
2110      @Override
2111      public Base addChild(String name) throws FHIRException {
2112        if (name.equals("temperatureQualifier")) {
2113          this.temperatureQualifier = new CodeableConcept();
2114          return this.temperatureQualifier;
2115        }
2116        else if (name.equals("temperatureRange")) {
2117          this.temperatureRange = new Range();
2118          return this.temperatureRange;
2119        }
2120        else if (name.equals("maxDuration")) {
2121          this.maxDuration = new Duration();
2122          return this.maxDuration;
2123        }
2124        else if (name.equals("instruction")) {
2125          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.instruction");
2126        }
2127        else
2128          return super.addChild(name);
2129      }
2130
2131      public SpecimenDefinitionTypeTestedHandlingComponent copy() {
2132        SpecimenDefinitionTypeTestedHandlingComponent dst = new SpecimenDefinitionTypeTestedHandlingComponent();
2133        copyValues(dst);
2134        return dst;
2135      }
2136
2137      public void copyValues(SpecimenDefinitionTypeTestedHandlingComponent dst) {
2138        super.copyValues(dst);
2139        dst.temperatureQualifier = temperatureQualifier == null ? null : temperatureQualifier.copy();
2140        dst.temperatureRange = temperatureRange == null ? null : temperatureRange.copy();
2141        dst.maxDuration = maxDuration == null ? null : maxDuration.copy();
2142        dst.instruction = instruction == null ? null : instruction.copy();
2143      }
2144
2145      @Override
2146      public boolean equalsDeep(Base other_) {
2147        if (!super.equalsDeep(other_))
2148          return false;
2149        if (!(other_ instanceof SpecimenDefinitionTypeTestedHandlingComponent))
2150          return false;
2151        SpecimenDefinitionTypeTestedHandlingComponent o = (SpecimenDefinitionTypeTestedHandlingComponent) other_;
2152        return compareDeep(temperatureQualifier, o.temperatureQualifier, true) && compareDeep(temperatureRange, o.temperatureRange, true)
2153           && compareDeep(maxDuration, o.maxDuration, true) && compareDeep(instruction, o.instruction, true)
2154          ;
2155      }
2156
2157      @Override
2158      public boolean equalsShallow(Base other_) {
2159        if (!super.equalsShallow(other_))
2160          return false;
2161        if (!(other_ instanceof SpecimenDefinitionTypeTestedHandlingComponent))
2162          return false;
2163        SpecimenDefinitionTypeTestedHandlingComponent o = (SpecimenDefinitionTypeTestedHandlingComponent) other_;
2164        return compareValues(instruction, o.instruction, true);
2165      }
2166
2167      public boolean isEmpty() {
2168        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(temperatureQualifier, temperatureRange
2169          , maxDuration, instruction);
2170      }
2171
2172  public String fhirType() {
2173    return "SpecimenDefinition.typeTested.handling";
2174
2175  }
2176
2177  }
2178
2179    /**
2180     * An absolute URL that is used to identify this SpecimenDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions.
2181     */
2182    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
2183    @Description(shortDefinition="Logical canonical URL to reference this SpecimenDefinition (globally unique)", formalDefinition="An absolute URL that is used to identify this SpecimenDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions." )
2184    protected UriType url;
2185
2186    /**
2187     * A business identifier assigned to this SpecimenDefinition.
2188     */
2189    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
2190    @Description(shortDefinition="Business identifier", formalDefinition="A business identifier assigned to this SpecimenDefinition." )
2191    protected Identifier identifier;
2192
2193    /**
2194     * The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique.
2195     */
2196    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2197    @Description(shortDefinition="Business version of the SpecimenDefinition", formalDefinition="The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique." )
2198    protected StringType version;
2199
2200    /**
2201     * A short, descriptive, user-friendly title for the SpecimenDefinition.
2202     */
2203    @Child(name = "title", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2204    @Description(shortDefinition="Name for this SpecimenDefinition (Human friendly)", formalDefinition="A short, descriptive, user-friendly title for the SpecimenDefinition." )
2205    protected StringType title;
2206
2207    /**
2208     * The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition.
2209     */
2210    @Child(name = "derivedFromCanonical", type = {CanonicalType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2211    @Description(shortDefinition="Based on FHIR definition of another SpecimenDefinition", formalDefinition="The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition." )
2212    protected List<CanonicalType> derivedFromCanonical;
2213
2214    /**
2215     * The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition.
2216     */
2217    @Child(name = "derivedFromUri", type = {UriType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2218    @Description(shortDefinition="Based on external definition", formalDefinition="The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition." )
2219    protected List<UriType> derivedFromUri;
2220
2221    /**
2222     * The current state of theSpecimenDefinition.
2223     */
2224    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
2225    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The current state of theSpecimenDefinition." )
2226    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
2227    protected Enumeration<PublicationStatus> status;
2228
2229    /**
2230     * A flag to indicate that this SpecimenDefinition is not authored for  genuine usage.
2231     */
2232    @Child(name = "experimental", type = {BooleanType.class}, order=7, min=0, max=1, modifier=true, summary=true)
2233    @Description(shortDefinition="If this SpecimenDefinition is not for real usage", formalDefinition="A flag to indicate that this SpecimenDefinition is not authored for  genuine usage." )
2234    protected BooleanType experimental;
2235
2236    /**
2237     * A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.
2238     */
2239    @Child(name = "subject", type = {CodeableConcept.class, Group.class}, order=8, min=0, max=1, modifier=false, summary=true)
2240    @Description(shortDefinition="Type of subject for specimen collection", formalDefinition="A code or group definition that describes the intended subject  from which this kind of specimen is to be collected." )
2241    protected Type subject;
2242
2243    /**
2244     * For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.
2245     */
2246    @Child(name = "date", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
2247    @Description(shortDefinition="Date status first applied", formalDefinition="For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal." )
2248    protected DateTimeType date;
2249
2250    /**
2251     * Helps establish the "authority/credibility" of the SpecimenDefinition. May also allow for contact.
2252     */
2253    @Child(name = "publisher", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=0, max=1, modifier=false, summary=true)
2254    @Description(shortDefinition="The name of the individual or organization that published the SpecimenDefinition", formalDefinition="Helps establish the \"authority/credibility\" of the SpecimenDefinition. May also allow for contact." )
2255    protected Reference publisher;
2256
2257    /**
2258     * Contact details to assist a user in finding and communicating with the publisher.
2259     */
2260    @Child(name = "contact", type = {ContactDetail.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2261    @Description(shortDefinition="Contact details for the publisher", formalDefinition="Contact details to assist a user in finding and communicating with the publisher." )
2262    protected List<ContactDetail> contact;
2263
2264    /**
2265     * A free text natural language description of the SpecimenDefinition from the consumer's perspective.
2266     */
2267    @Child(name = "description", type = {MarkdownType.class}, order=12, min=0, max=1, modifier=false, summary=false)
2268    @Description(shortDefinition="Natural language description of the SpecimenDefinition", formalDefinition="A free text natural language description of the SpecimenDefinition from the consumer's perspective." )
2269    protected MarkdownType description;
2270
2271    /**
2272     * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of specimen definitions.
2273     */
2274    @Child(name = "useContext", type = {UsageContext.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2275    @Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of specimen definitions." )
2276    protected List<UsageContext> useContext;
2277
2278    /**
2279     * A jurisdiction in which the SpecimenDefinition is intended to be used.
2280     */
2281    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2282    @Description(shortDefinition="Intended jurisdiction for this SpecimenDefinition (if applicable)", formalDefinition="A jurisdiction in which the SpecimenDefinition is intended to be used." )
2283    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/jurisdiction")
2284    protected List<CodeableConcept> jurisdiction;
2285
2286    /**
2287     * Explains why this SpecimeDefinition is needed and why it has been designed as it has.
2288     */
2289    @Child(name = "purpose", type = {MarkdownType.class}, order=15, min=0, max=1, modifier=false, summary=false)
2290    @Description(shortDefinition="Why this SpecimenDefinition is defined", formalDefinition="Explains why this SpecimeDefinition is needed and why it has been designed as it has." )
2291    protected MarkdownType purpose;
2292
2293    /**
2294     * Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition.
2295     */
2296    @Child(name = "copyright", type = {MarkdownType.class}, order=16, min=0, max=1, modifier=false, summary=false)
2297    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition." )
2298    protected MarkdownType copyright;
2299
2300    /**
2301     * The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
2302     */
2303    @Child(name = "approvalDate", type = {DateType.class}, order=17, min=0, max=1, modifier=false, summary=false)
2304    @Description(shortDefinition="When SpecimenDefinition was approved by publisher", formalDefinition="The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage." )
2305    protected DateType approvalDate;
2306
2307    /**
2308     * The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
2309     */
2310    @Child(name = "lastReviewDate", type = {DateType.class}, order=18, min=0, max=1, modifier=false, summary=false)
2311    @Description(shortDefinition="Last review date for the SpecimenDefinition", formalDefinition="The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date." )
2312    protected DateType lastReviewDate;
2313
2314    /**
2315     * The period during which the SpecimenDefinition content was or is planned to be effective.
2316     */
2317    @Child(name = "effectivePeriod", type = {Period.class}, order=19, min=0, max=1, modifier=false, summary=true)
2318    @Description(shortDefinition="The effective date range for the SpecimenDefinition", formalDefinition="The period during which the SpecimenDefinition content was or is planned to be effective." )
2319    protected Period effectivePeriod;
2320
2321    /**
2322     * The kind of material to be collected.
2323     */
2324    @Child(name = "typeCollected", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=true)
2325    @Description(shortDefinition="Kind of material to collect", formalDefinition="The kind of material to be collected." )
2326    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v2-0487")
2327    protected CodeableConcept typeCollected;
2328
2329    /**
2330     * Preparation of the patient for specimen collection.
2331     */
2332    @Child(name = "patientPreparation", type = {CodeableConcept.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2333    @Description(shortDefinition="Patient preparation for collection", formalDefinition="Preparation of the patient for specimen collection." )
2334    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/prepare-patient-prior-specimen-collection")
2335    protected List<CodeableConcept> patientPreparation;
2336
2337    /**
2338     * Time aspect of specimen collection (duration or offset).
2339     */
2340    @Child(name = "timeAspect", type = {StringType.class}, order=22, min=0, max=1, modifier=false, summary=true)
2341    @Description(shortDefinition="Time aspect for collection", formalDefinition="Time aspect of specimen collection (duration or offset)." )
2342    protected StringType timeAspect;
2343
2344    /**
2345     * The action to be performed for collecting the specimen.
2346     */
2347    @Child(name = "collection", type = {CodeableConcept.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2348    @Description(shortDefinition="Specimen collection procedure", formalDefinition="The action to be performed for collecting the specimen." )
2349    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/specimen-collection")
2350    protected List<CodeableConcept> collection;
2351
2352    /**
2353     * Specimen conditioned in a container as expected by the testing laboratory.
2354     */
2355    @Child(name = "typeTested", type = {}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2356    @Description(shortDefinition="Specimen in container intended for testing by lab", formalDefinition="Specimen conditioned in a container as expected by the testing laboratory." )
2357    protected List<SpecimenDefinitionTypeTestedComponent> typeTested;
2358
2359    private static final long serialVersionUID = 2132875693L;
2360
2361  /**
2362   * Constructor
2363   */
2364    public SpecimenDefinition() {
2365      super();
2366    }
2367
2368  /**
2369   * Constructor
2370   */
2371    public SpecimenDefinition(Enumeration<PublicationStatus> status) {
2372      super();
2373      this.status = status;
2374    }
2375
2376    /**
2377     * @return {@link #url} (An absolute URL that is used to identify this SpecimenDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2378     */
2379    public UriType getUrlElement() { 
2380      if (this.url == null)
2381        if (Configuration.errorOnAutoCreate())
2382          throw new Error("Attempt to auto-create SpecimenDefinition.url");
2383        else if (Configuration.doAutoCreate())
2384          this.url = new UriType(); // bb
2385      return this.url;
2386    }
2387
2388    public boolean hasUrlElement() { 
2389      return this.url != null && !this.url.isEmpty();
2390    }
2391
2392    public boolean hasUrl() { 
2393      return this.url != null && !this.url.isEmpty();
2394    }
2395
2396    /**
2397     * @param value {@link #url} (An absolute URL that is used to identify this SpecimenDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2398     */
2399    public SpecimenDefinition setUrlElement(UriType value) { 
2400      this.url = value;
2401      return this;
2402    }
2403
2404    /**
2405     * @return An absolute URL that is used to identify this SpecimenDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions.
2406     */
2407    public String getUrl() { 
2408      return this.url == null ? null : this.url.getValue();
2409    }
2410
2411    /**
2412     * @param value An absolute URL that is used to identify this SpecimenDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions.
2413     */
2414    public SpecimenDefinition setUrl(String value) { 
2415      if (Utilities.noString(value))
2416        this.url = null;
2417      else {
2418        if (this.url == null)
2419          this.url = new UriType();
2420        this.url.setValue(value);
2421      }
2422      return this;
2423    }
2424
2425    /**
2426     * @return {@link #identifier} (A business identifier assigned to this SpecimenDefinition.)
2427     */
2428    public Identifier getIdentifier() { 
2429      if (this.identifier == null)
2430        if (Configuration.errorOnAutoCreate())
2431          throw new Error("Attempt to auto-create SpecimenDefinition.identifier");
2432        else if (Configuration.doAutoCreate())
2433          this.identifier = new Identifier(); // cc
2434      return this.identifier;
2435    }
2436
2437    public boolean hasIdentifier() { 
2438      return this.identifier != null && !this.identifier.isEmpty();
2439    }
2440
2441    /**
2442     * @param value {@link #identifier} (A business identifier assigned to this SpecimenDefinition.)
2443     */
2444    public SpecimenDefinition setIdentifier(Identifier value) { 
2445      this.identifier = value;
2446      return this;
2447    }
2448
2449    /**
2450     * @return {@link #version} (The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2451     */
2452    public StringType getVersionElement() { 
2453      if (this.version == null)
2454        if (Configuration.errorOnAutoCreate())
2455          throw new Error("Attempt to auto-create SpecimenDefinition.version");
2456        else if (Configuration.doAutoCreate())
2457          this.version = new StringType(); // bb
2458      return this.version;
2459    }
2460
2461    public boolean hasVersionElement() { 
2462      return this.version != null && !this.version.isEmpty();
2463    }
2464
2465    public boolean hasVersion() { 
2466      return this.version != null && !this.version.isEmpty();
2467    }
2468
2469    /**
2470     * @param value {@link #version} (The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2471     */
2472    public SpecimenDefinition setVersionElement(StringType value) { 
2473      this.version = value;
2474      return this;
2475    }
2476
2477    /**
2478     * @return The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique.
2479     */
2480    public String getVersion() { 
2481      return this.version == null ? null : this.version.getValue();
2482    }
2483
2484    /**
2485     * @param value The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique.
2486     */
2487    public SpecimenDefinition setVersion(String value) { 
2488      if (Utilities.noString(value))
2489        this.version = null;
2490      else {
2491        if (this.version == null)
2492          this.version = new StringType();
2493        this.version.setValue(value);
2494      }
2495      return this;
2496    }
2497
2498    /**
2499     * @return {@link #title} (A short, descriptive, user-friendly title for the SpecimenDefinition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2500     */
2501    public StringType getTitleElement() { 
2502      if (this.title == null)
2503        if (Configuration.errorOnAutoCreate())
2504          throw new Error("Attempt to auto-create SpecimenDefinition.title");
2505        else if (Configuration.doAutoCreate())
2506          this.title = new StringType(); // bb
2507      return this.title;
2508    }
2509
2510    public boolean hasTitleElement() { 
2511      return this.title != null && !this.title.isEmpty();
2512    }
2513
2514    public boolean hasTitle() { 
2515      return this.title != null && !this.title.isEmpty();
2516    }
2517
2518    /**
2519     * @param value {@link #title} (A short, descriptive, user-friendly title for the SpecimenDefinition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2520     */
2521    public SpecimenDefinition setTitleElement(StringType value) { 
2522      this.title = value;
2523      return this;
2524    }
2525
2526    /**
2527     * @return A short, descriptive, user-friendly title for the SpecimenDefinition.
2528     */
2529    public String getTitle() { 
2530      return this.title == null ? null : this.title.getValue();
2531    }
2532
2533    /**
2534     * @param value A short, descriptive, user-friendly title for the SpecimenDefinition.
2535     */
2536    public SpecimenDefinition setTitle(String value) { 
2537      if (Utilities.noString(value))
2538        this.title = null;
2539      else {
2540        if (this.title == null)
2541          this.title = new StringType();
2542        this.title.setValue(value);
2543      }
2544      return this;
2545    }
2546
2547    /**
2548     * @return {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition.)
2549     */
2550    public List<CanonicalType> getDerivedFromCanonical() { 
2551      if (this.derivedFromCanonical == null)
2552        this.derivedFromCanonical = new ArrayList<CanonicalType>();
2553      return this.derivedFromCanonical;
2554    }
2555
2556    /**
2557     * @return Returns a reference to <code>this</code> for easy method chaining
2558     */
2559    public SpecimenDefinition setDerivedFromCanonical(List<CanonicalType> theDerivedFromCanonical) { 
2560      this.derivedFromCanonical = theDerivedFromCanonical;
2561      return this;
2562    }
2563
2564    public boolean hasDerivedFromCanonical() { 
2565      if (this.derivedFromCanonical == null)
2566        return false;
2567      for (CanonicalType item : this.derivedFromCanonical)
2568        if (!item.isEmpty())
2569          return true;
2570      return false;
2571    }
2572
2573    /**
2574     * @return {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition.)
2575     */
2576    public CanonicalType addDerivedFromCanonicalElement() {//2 
2577      CanonicalType t = new CanonicalType();
2578      if (this.derivedFromCanonical == null)
2579        this.derivedFromCanonical = new ArrayList<CanonicalType>();
2580      this.derivedFromCanonical.add(t);
2581      return t;
2582    }
2583
2584    /**
2585     * @param value {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition.)
2586     */
2587    public SpecimenDefinition addDerivedFromCanonical(String value) { //1
2588      CanonicalType t = new CanonicalType();
2589      t.setValue(value);
2590      if (this.derivedFromCanonical == null)
2591        this.derivedFromCanonical = new ArrayList<CanonicalType>();
2592      this.derivedFromCanonical.add(t);
2593      return this;
2594    }
2595
2596    /**
2597     * @param value {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition.)
2598     */
2599    public boolean hasDerivedFromCanonical(String value) { 
2600      if (this.derivedFromCanonical == null)
2601        return false;
2602      for (CanonicalType v : this.derivedFromCanonical)
2603        if (v.getValue().equals(value)) // canonical(SpecimenDefinition)
2604          return true;
2605      return false;
2606    }
2607
2608    /**
2609     * @return {@link #derivedFromUri} (The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition.)
2610     */
2611    public List<UriType> getDerivedFromUri() { 
2612      if (this.derivedFromUri == null)
2613        this.derivedFromUri = new ArrayList<UriType>();
2614      return this.derivedFromUri;
2615    }
2616
2617    /**
2618     * @return Returns a reference to <code>this</code> for easy method chaining
2619     */
2620    public SpecimenDefinition setDerivedFromUri(List<UriType> theDerivedFromUri) { 
2621      this.derivedFromUri = theDerivedFromUri;
2622      return this;
2623    }
2624
2625    public boolean hasDerivedFromUri() { 
2626      if (this.derivedFromUri == null)
2627        return false;
2628      for (UriType item : this.derivedFromUri)
2629        if (!item.isEmpty())
2630          return true;
2631      return false;
2632    }
2633
2634    /**
2635     * @return {@link #derivedFromUri} (The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition.)
2636     */
2637    public UriType addDerivedFromUriElement() {//2 
2638      UriType t = new UriType();
2639      if (this.derivedFromUri == null)
2640        this.derivedFromUri = new ArrayList<UriType>();
2641      this.derivedFromUri.add(t);
2642      return t;
2643    }
2644
2645    /**
2646     * @param value {@link #derivedFromUri} (The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition.)
2647     */
2648    public SpecimenDefinition addDerivedFromUri(String value) { //1
2649      UriType t = new UriType();
2650      t.setValue(value);
2651      if (this.derivedFromUri == null)
2652        this.derivedFromUri = new ArrayList<UriType>();
2653      this.derivedFromUri.add(t);
2654      return this;
2655    }
2656
2657    /**
2658     * @param value {@link #derivedFromUri} (The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition.)
2659     */
2660    public boolean hasDerivedFromUri(String value) { 
2661      if (this.derivedFromUri == null)
2662        return false;
2663      for (UriType v : this.derivedFromUri)
2664        if (v.getValue().equals(value)) // uri
2665          return true;
2666      return false;
2667    }
2668
2669    /**
2670     * @return {@link #status} (The current state of theSpecimenDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2671     */
2672    public Enumeration<PublicationStatus> getStatusElement() { 
2673      if (this.status == null)
2674        if (Configuration.errorOnAutoCreate())
2675          throw new Error("Attempt to auto-create SpecimenDefinition.status");
2676        else if (Configuration.doAutoCreate())
2677          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
2678      return this.status;
2679    }
2680
2681    public boolean hasStatusElement() { 
2682      return this.status != null && !this.status.isEmpty();
2683    }
2684
2685    public boolean hasStatus() { 
2686      return this.status != null && !this.status.isEmpty();
2687    }
2688
2689    /**
2690     * @param value {@link #status} (The current state of theSpecimenDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2691     */
2692    public SpecimenDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
2693      this.status = value;
2694      return this;
2695    }
2696
2697    /**
2698     * @return The current state of theSpecimenDefinition.
2699     */
2700    public PublicationStatus getStatus() { 
2701      return this.status == null ? null : this.status.getValue();
2702    }
2703
2704    /**
2705     * @param value The current state of theSpecimenDefinition.
2706     */
2707    public SpecimenDefinition setStatus(PublicationStatus value) { 
2708        if (this.status == null)
2709          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
2710        this.status.setValue(value);
2711      return this;
2712    }
2713
2714    /**
2715     * @return {@link #experimental} (A flag to indicate that this SpecimenDefinition is not authored for  genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
2716     */
2717    public BooleanType getExperimentalElement() { 
2718      if (this.experimental == null)
2719        if (Configuration.errorOnAutoCreate())
2720          throw new Error("Attempt to auto-create SpecimenDefinition.experimental");
2721        else if (Configuration.doAutoCreate())
2722          this.experimental = new BooleanType(); // bb
2723      return this.experimental;
2724    }
2725
2726    public boolean hasExperimentalElement() { 
2727      return this.experimental != null && !this.experimental.isEmpty();
2728    }
2729
2730    public boolean hasExperimental() { 
2731      return this.experimental != null && !this.experimental.isEmpty();
2732    }
2733
2734    /**
2735     * @param value {@link #experimental} (A flag to indicate that this SpecimenDefinition is not authored for  genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
2736     */
2737    public SpecimenDefinition setExperimentalElement(BooleanType value) { 
2738      this.experimental = value;
2739      return this;
2740    }
2741
2742    /**
2743     * @return A flag to indicate that this SpecimenDefinition is not authored for  genuine usage.
2744     */
2745    public boolean getExperimental() { 
2746      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
2747    }
2748
2749    /**
2750     * @param value A flag to indicate that this SpecimenDefinition is not authored for  genuine usage.
2751     */
2752    public SpecimenDefinition setExperimental(boolean value) { 
2753        if (this.experimental == null)
2754          this.experimental = new BooleanType();
2755        this.experimental.setValue(value);
2756      return this;
2757    }
2758
2759    /**
2760     * @return {@link #subject} (A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.)
2761     */
2762    public Type getSubject() { 
2763      return this.subject;
2764    }
2765
2766    /**
2767     * @return {@link #subject} (A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.)
2768     */
2769    public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
2770      if (this.subject == null)
2771        this.subject = new CodeableConcept();
2772      if (!(this.subject instanceof CodeableConcept))
2773        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
2774      return (CodeableConcept) this.subject;
2775    }
2776
2777    public boolean hasSubjectCodeableConcept() { 
2778      return this != null && this.subject instanceof CodeableConcept;
2779    }
2780
2781    /**
2782     * @return {@link #subject} (A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.)
2783     */
2784    public Reference getSubjectReference() throws FHIRException { 
2785      if (this.subject == null)
2786        this.subject = new Reference();
2787      if (!(this.subject instanceof Reference))
2788        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
2789      return (Reference) this.subject;
2790    }
2791
2792    public boolean hasSubjectReference() { 
2793      return this != null && this.subject instanceof Reference;
2794    }
2795
2796    public boolean hasSubject() { 
2797      return this.subject != null && !this.subject.isEmpty();
2798    }
2799
2800    /**
2801     * @param value {@link #subject} (A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.)
2802     */
2803    public SpecimenDefinition setSubject(Type value) { 
2804      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2805        throw new Error("Not the right type for SpecimenDefinition.subject[x]: "+value.fhirType());
2806      this.subject = value;
2807      return this;
2808    }
2809
2810    /**
2811     * @return {@link #date} (For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2812     */
2813    public DateTimeType getDateElement() { 
2814      if (this.date == null)
2815        if (Configuration.errorOnAutoCreate())
2816          throw new Error("Attempt to auto-create SpecimenDefinition.date");
2817        else if (Configuration.doAutoCreate())
2818          this.date = new DateTimeType(); // bb
2819      return this.date;
2820    }
2821
2822    public boolean hasDateElement() { 
2823      return this.date != null && !this.date.isEmpty();
2824    }
2825
2826    public boolean hasDate() { 
2827      return this.date != null && !this.date.isEmpty();
2828    }
2829
2830    /**
2831     * @param value {@link #date} (For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2832     */
2833    public SpecimenDefinition setDateElement(DateTimeType value) { 
2834      this.date = value;
2835      return this;
2836    }
2837
2838    /**
2839     * @return For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.
2840     */
2841    public Date getDate() { 
2842      return this.date == null ? null : this.date.getValue();
2843    }
2844
2845    /**
2846     * @param value For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.
2847     */
2848    public SpecimenDefinition setDate(Date value) { 
2849      if (value == null)
2850        this.date = null;
2851      else {
2852        if (this.date == null)
2853          this.date = new DateTimeType();
2854        this.date.setValue(value);
2855      }
2856      return this;
2857    }
2858
2859    /**
2860     * @return {@link #publisher} (Helps establish the "authority/credibility" of the SpecimenDefinition. May also allow for contact.)
2861     */
2862    public Reference getPublisher() { 
2863      if (this.publisher == null)
2864        if (Configuration.errorOnAutoCreate())
2865          throw new Error("Attempt to auto-create SpecimenDefinition.publisher");
2866        else if (Configuration.doAutoCreate())
2867          this.publisher = new Reference(); // cc
2868      return this.publisher;
2869    }
2870
2871    public boolean hasPublisher() { 
2872      return this.publisher != null && !this.publisher.isEmpty();
2873    }
2874
2875    /**
2876     * @param value {@link #publisher} (Helps establish the "authority/credibility" of the SpecimenDefinition. May also allow for contact.)
2877     */
2878    public SpecimenDefinition setPublisher(Reference value) { 
2879      this.publisher = value;
2880      return this;
2881    }
2882
2883    /**
2884     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
2885     */
2886    public List<ContactDetail> getContact() { 
2887      if (this.contact == null)
2888        this.contact = new ArrayList<ContactDetail>();
2889      return this.contact;
2890    }
2891
2892    /**
2893     * @return Returns a reference to <code>this</code> for easy method chaining
2894     */
2895    public SpecimenDefinition setContact(List<ContactDetail> theContact) { 
2896      this.contact = theContact;
2897      return this;
2898    }
2899
2900    public boolean hasContact() { 
2901      if (this.contact == null)
2902        return false;
2903      for (ContactDetail item : this.contact)
2904        if (!item.isEmpty())
2905          return true;
2906      return false;
2907    }
2908
2909    public ContactDetail addContact() { //3
2910      ContactDetail t = new ContactDetail();
2911      if (this.contact == null)
2912        this.contact = new ArrayList<ContactDetail>();
2913      this.contact.add(t);
2914      return t;
2915    }
2916
2917    public SpecimenDefinition addContact(ContactDetail t) { //3
2918      if (t == null)
2919        return this;
2920      if (this.contact == null)
2921        this.contact = new ArrayList<ContactDetail>();
2922      this.contact.add(t);
2923      return this;
2924    }
2925
2926    /**
2927     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
2928     */
2929    public ContactDetail getContactFirstRep() { 
2930      if (getContact().isEmpty()) {
2931        addContact();
2932      }
2933      return getContact().get(0);
2934    }
2935
2936    /**
2937     * @return {@link #description} (A free text natural language description of the SpecimenDefinition from the consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2938     */
2939    public MarkdownType getDescriptionElement() { 
2940      if (this.description == null)
2941        if (Configuration.errorOnAutoCreate())
2942          throw new Error("Attempt to auto-create SpecimenDefinition.description");
2943        else if (Configuration.doAutoCreate())
2944          this.description = new MarkdownType(); // bb
2945      return this.description;
2946    }
2947
2948    public boolean hasDescriptionElement() { 
2949      return this.description != null && !this.description.isEmpty();
2950    }
2951
2952    public boolean hasDescription() { 
2953      return this.description != null && !this.description.isEmpty();
2954    }
2955
2956    /**
2957     * @param value {@link #description} (A free text natural language description of the SpecimenDefinition from the consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2958     */
2959    public SpecimenDefinition setDescriptionElement(MarkdownType value) { 
2960      this.description = value;
2961      return this;
2962    }
2963
2964    /**
2965     * @return A free text natural language description of the SpecimenDefinition from the consumer's perspective.
2966     */
2967    public String getDescription() { 
2968      return this.description == null ? null : this.description.getValue();
2969    }
2970
2971    /**
2972     * @param value A free text natural language description of the SpecimenDefinition from the consumer's perspective.
2973     */
2974    public SpecimenDefinition setDescription(String value) { 
2975      if (value == null)
2976        this.description = null;
2977      else {
2978        if (this.description == null)
2979          this.description = new MarkdownType();
2980        this.description.setValue(value);
2981      }
2982      return this;
2983    }
2984
2985    /**
2986     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of specimen definitions.)
2987     */
2988    public List<UsageContext> getUseContext() { 
2989      if (this.useContext == null)
2990        this.useContext = new ArrayList<UsageContext>();
2991      return this.useContext;
2992    }
2993
2994    /**
2995     * @return Returns a reference to <code>this</code> for easy method chaining
2996     */
2997    public SpecimenDefinition setUseContext(List<UsageContext> theUseContext) { 
2998      this.useContext = theUseContext;
2999      return this;
3000    }
3001
3002    public boolean hasUseContext() { 
3003      if (this.useContext == null)
3004        return false;
3005      for (UsageContext item : this.useContext)
3006        if (!item.isEmpty())
3007          return true;
3008      return false;
3009    }
3010
3011    public UsageContext addUseContext() { //3
3012      UsageContext t = new UsageContext();
3013      if (this.useContext == null)
3014        this.useContext = new ArrayList<UsageContext>();
3015      this.useContext.add(t);
3016      return t;
3017    }
3018
3019    public SpecimenDefinition addUseContext(UsageContext t) { //3
3020      if (t == null)
3021        return this;
3022      if (this.useContext == null)
3023        this.useContext = new ArrayList<UsageContext>();
3024      this.useContext.add(t);
3025      return this;
3026    }
3027
3028    /**
3029     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
3030     */
3031    public UsageContext getUseContextFirstRep() { 
3032      if (getUseContext().isEmpty()) {
3033        addUseContext();
3034      }
3035      return getUseContext().get(0);
3036    }
3037
3038    /**
3039     * @return {@link #jurisdiction} (A jurisdiction in which the SpecimenDefinition is intended to be used.)
3040     */
3041    public List<CodeableConcept> getJurisdiction() { 
3042      if (this.jurisdiction == null)
3043        this.jurisdiction = new ArrayList<CodeableConcept>();
3044      return this.jurisdiction;
3045    }
3046
3047    /**
3048     * @return Returns a reference to <code>this</code> for easy method chaining
3049     */
3050    public SpecimenDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) { 
3051      this.jurisdiction = theJurisdiction;
3052      return this;
3053    }
3054
3055    public boolean hasJurisdiction() { 
3056      if (this.jurisdiction == null)
3057        return false;
3058      for (CodeableConcept item : this.jurisdiction)
3059        if (!item.isEmpty())
3060          return true;
3061      return false;
3062    }
3063
3064    public CodeableConcept addJurisdiction() { //3
3065      CodeableConcept t = new CodeableConcept();
3066      if (this.jurisdiction == null)
3067        this.jurisdiction = new ArrayList<CodeableConcept>();
3068      this.jurisdiction.add(t);
3069      return t;
3070    }
3071
3072    public SpecimenDefinition addJurisdiction(CodeableConcept t) { //3
3073      if (t == null)
3074        return this;
3075      if (this.jurisdiction == null)
3076        this.jurisdiction = new ArrayList<CodeableConcept>();
3077      this.jurisdiction.add(t);
3078      return this;
3079    }
3080
3081    /**
3082     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
3083     */
3084    public CodeableConcept getJurisdictionFirstRep() { 
3085      if (getJurisdiction().isEmpty()) {
3086        addJurisdiction();
3087      }
3088      return getJurisdiction().get(0);
3089    }
3090
3091    /**
3092     * @return {@link #purpose} (Explains why this SpecimeDefinition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
3093     */
3094    public MarkdownType getPurposeElement() { 
3095      if (this.purpose == null)
3096        if (Configuration.errorOnAutoCreate())
3097          throw new Error("Attempt to auto-create SpecimenDefinition.purpose");
3098        else if (Configuration.doAutoCreate())
3099          this.purpose = new MarkdownType(); // bb
3100      return this.purpose;
3101    }
3102
3103    public boolean hasPurposeElement() { 
3104      return this.purpose != null && !this.purpose.isEmpty();
3105    }
3106
3107    public boolean hasPurpose() { 
3108      return this.purpose != null && !this.purpose.isEmpty();
3109    }
3110
3111    /**
3112     * @param value {@link #purpose} (Explains why this SpecimeDefinition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
3113     */
3114    public SpecimenDefinition setPurposeElement(MarkdownType value) { 
3115      this.purpose = value;
3116      return this;
3117    }
3118
3119    /**
3120     * @return Explains why this SpecimeDefinition is needed and why it has been designed as it has.
3121     */
3122    public String getPurpose() { 
3123      return this.purpose == null ? null : this.purpose.getValue();
3124    }
3125
3126    /**
3127     * @param value Explains why this SpecimeDefinition is needed and why it has been designed as it has.
3128     */
3129    public SpecimenDefinition setPurpose(String value) { 
3130      if (value == null)
3131        this.purpose = null;
3132      else {
3133        if (this.purpose == null)
3134          this.purpose = new MarkdownType();
3135        this.purpose.setValue(value);
3136      }
3137      return this;
3138    }
3139
3140    /**
3141     * @return {@link #copyright} (Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
3142     */
3143    public MarkdownType getCopyrightElement() { 
3144      if (this.copyright == null)
3145        if (Configuration.errorOnAutoCreate())
3146          throw new Error("Attempt to auto-create SpecimenDefinition.copyright");
3147        else if (Configuration.doAutoCreate())
3148          this.copyright = new MarkdownType(); // bb
3149      return this.copyright;
3150    }
3151
3152    public boolean hasCopyrightElement() { 
3153      return this.copyright != null && !this.copyright.isEmpty();
3154    }
3155
3156    public boolean hasCopyright() { 
3157      return this.copyright != null && !this.copyright.isEmpty();
3158    }
3159
3160    /**
3161     * @param value {@link #copyright} (Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
3162     */
3163    public SpecimenDefinition setCopyrightElement(MarkdownType value) { 
3164      this.copyright = value;
3165      return this;
3166    }
3167
3168    /**
3169     * @return Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition.
3170     */
3171    public String getCopyright() { 
3172      return this.copyright == null ? null : this.copyright.getValue();
3173    }
3174
3175    /**
3176     * @param value Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition.
3177     */
3178    public SpecimenDefinition setCopyright(String value) { 
3179      if (value == null)
3180        this.copyright = null;
3181      else {
3182        if (this.copyright == null)
3183          this.copyright = new MarkdownType();
3184        this.copyright.setValue(value);
3185      }
3186      return this;
3187    }
3188
3189    /**
3190     * @return {@link #approvalDate} (The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
3191     */
3192    public DateType getApprovalDateElement() { 
3193      if (this.approvalDate == null)
3194        if (Configuration.errorOnAutoCreate())
3195          throw new Error("Attempt to auto-create SpecimenDefinition.approvalDate");
3196        else if (Configuration.doAutoCreate())
3197          this.approvalDate = new DateType(); // bb
3198      return this.approvalDate;
3199    }
3200
3201    public boolean hasApprovalDateElement() { 
3202      return this.approvalDate != null && !this.approvalDate.isEmpty();
3203    }
3204
3205    public boolean hasApprovalDate() { 
3206      return this.approvalDate != null && !this.approvalDate.isEmpty();
3207    }
3208
3209    /**
3210     * @param value {@link #approvalDate} (The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
3211     */
3212    public SpecimenDefinition setApprovalDateElement(DateType value) { 
3213      this.approvalDate = value;
3214      return this;
3215    }
3216
3217    /**
3218     * @return The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3219     */
3220    public Date getApprovalDate() { 
3221      return this.approvalDate == null ? null : this.approvalDate.getValue();
3222    }
3223
3224    /**
3225     * @param value The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
3226     */
3227    public SpecimenDefinition setApprovalDate(Date value) { 
3228      if (value == null)
3229        this.approvalDate = null;
3230      else {
3231        if (this.approvalDate == null)
3232          this.approvalDate = new DateType();
3233        this.approvalDate.setValue(value);
3234      }
3235      return this;
3236    }
3237
3238    /**
3239     * @return {@link #lastReviewDate} (The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
3240     */
3241    public DateType getLastReviewDateElement() { 
3242      if (this.lastReviewDate == null)
3243        if (Configuration.errorOnAutoCreate())
3244          throw new Error("Attempt to auto-create SpecimenDefinition.lastReviewDate");
3245        else if (Configuration.doAutoCreate())
3246          this.lastReviewDate = new DateType(); // bb
3247      return this.lastReviewDate;
3248    }
3249
3250    public boolean hasLastReviewDateElement() { 
3251      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
3252    }
3253
3254    public boolean hasLastReviewDate() { 
3255      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
3256    }
3257
3258    /**
3259     * @param value {@link #lastReviewDate} (The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
3260     */
3261    public SpecimenDefinition setLastReviewDateElement(DateType value) { 
3262      this.lastReviewDate = value;
3263      return this;
3264    }
3265
3266    /**
3267     * @return The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
3268     */
3269    public Date getLastReviewDate() { 
3270      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
3271    }
3272
3273    /**
3274     * @param value The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
3275     */
3276    public SpecimenDefinition setLastReviewDate(Date value) { 
3277      if (value == null)
3278        this.lastReviewDate = null;
3279      else {
3280        if (this.lastReviewDate == null)
3281          this.lastReviewDate = new DateType();
3282        this.lastReviewDate.setValue(value);
3283      }
3284      return this;
3285    }
3286
3287    /**
3288     * @return {@link #effectivePeriod} (The period during which the SpecimenDefinition content was or is planned to be effective.)
3289     */
3290    public Period getEffectivePeriod() { 
3291      if (this.effectivePeriod == null)
3292        if (Configuration.errorOnAutoCreate())
3293          throw new Error("Attempt to auto-create SpecimenDefinition.effectivePeriod");
3294        else if (Configuration.doAutoCreate())
3295          this.effectivePeriod = new Period(); // cc
3296      return this.effectivePeriod;
3297    }
3298
3299    public boolean hasEffectivePeriod() { 
3300      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
3301    }
3302
3303    /**
3304     * @param value {@link #effectivePeriod} (The period during which the SpecimenDefinition content was or is planned to be effective.)
3305     */
3306    public SpecimenDefinition setEffectivePeriod(Period value) { 
3307      this.effectivePeriod = value;
3308      return this;
3309    }
3310
3311    /**
3312     * @return {@link #typeCollected} (The kind of material to be collected.)
3313     */
3314    public CodeableConcept getTypeCollected() { 
3315      if (this.typeCollected == null)
3316        if (Configuration.errorOnAutoCreate())
3317          throw new Error("Attempt to auto-create SpecimenDefinition.typeCollected");
3318        else if (Configuration.doAutoCreate())
3319          this.typeCollected = new CodeableConcept(); // cc
3320      return this.typeCollected;
3321    }
3322
3323    public boolean hasTypeCollected() { 
3324      return this.typeCollected != null && !this.typeCollected.isEmpty();
3325    }
3326
3327    /**
3328     * @param value {@link #typeCollected} (The kind of material to be collected.)
3329     */
3330    public SpecimenDefinition setTypeCollected(CodeableConcept value) { 
3331      this.typeCollected = value;
3332      return this;
3333    }
3334
3335    /**
3336     * @return {@link #patientPreparation} (Preparation of the patient for specimen collection.)
3337     */
3338    public List<CodeableConcept> getPatientPreparation() { 
3339      if (this.patientPreparation == null)
3340        this.patientPreparation = new ArrayList<CodeableConcept>();
3341      return this.patientPreparation;
3342    }
3343
3344    /**
3345     * @return Returns a reference to <code>this</code> for easy method chaining
3346     */
3347    public SpecimenDefinition setPatientPreparation(List<CodeableConcept> thePatientPreparation) { 
3348      this.patientPreparation = thePatientPreparation;
3349      return this;
3350    }
3351
3352    public boolean hasPatientPreparation() { 
3353      if (this.patientPreparation == null)
3354        return false;
3355      for (CodeableConcept item : this.patientPreparation)
3356        if (!item.isEmpty())
3357          return true;
3358      return false;
3359    }
3360
3361    public CodeableConcept addPatientPreparation() { //3
3362      CodeableConcept t = new CodeableConcept();
3363      if (this.patientPreparation == null)
3364        this.patientPreparation = new ArrayList<CodeableConcept>();
3365      this.patientPreparation.add(t);
3366      return t;
3367    }
3368
3369    public SpecimenDefinition addPatientPreparation(CodeableConcept t) { //3
3370      if (t == null)
3371        return this;
3372      if (this.patientPreparation == null)
3373        this.patientPreparation = new ArrayList<CodeableConcept>();
3374      this.patientPreparation.add(t);
3375      return this;
3376    }
3377
3378    /**
3379     * @return The first repetition of repeating field {@link #patientPreparation}, creating it if it does not already exist
3380     */
3381    public CodeableConcept getPatientPreparationFirstRep() { 
3382      if (getPatientPreparation().isEmpty()) {
3383        addPatientPreparation();
3384      }
3385      return getPatientPreparation().get(0);
3386    }
3387
3388    /**
3389     * @return {@link #timeAspect} (Time aspect of specimen collection (duration or offset).). This is the underlying object with id, value and extensions. The accessor "getTimeAspect" gives direct access to the value
3390     */
3391    public StringType getTimeAspectElement() { 
3392      if (this.timeAspect == null)
3393        if (Configuration.errorOnAutoCreate())
3394          throw new Error("Attempt to auto-create SpecimenDefinition.timeAspect");
3395        else if (Configuration.doAutoCreate())
3396          this.timeAspect = new StringType(); // bb
3397      return this.timeAspect;
3398    }
3399
3400    public boolean hasTimeAspectElement() { 
3401      return this.timeAspect != null && !this.timeAspect.isEmpty();
3402    }
3403
3404    public boolean hasTimeAspect() { 
3405      return this.timeAspect != null && !this.timeAspect.isEmpty();
3406    }
3407
3408    /**
3409     * @param value {@link #timeAspect} (Time aspect of specimen collection (duration or offset).). This is the underlying object with id, value and extensions. The accessor "getTimeAspect" gives direct access to the value
3410     */
3411    public SpecimenDefinition setTimeAspectElement(StringType value) { 
3412      this.timeAspect = value;
3413      return this;
3414    }
3415
3416    /**
3417     * @return Time aspect of specimen collection (duration or offset).
3418     */
3419    public String getTimeAspect() { 
3420      return this.timeAspect == null ? null : this.timeAspect.getValue();
3421    }
3422
3423    /**
3424     * @param value Time aspect of specimen collection (duration or offset).
3425     */
3426    public SpecimenDefinition setTimeAspect(String value) { 
3427      if (Utilities.noString(value))
3428        this.timeAspect = null;
3429      else {
3430        if (this.timeAspect == null)
3431          this.timeAspect = new StringType();
3432        this.timeAspect.setValue(value);
3433      }
3434      return this;
3435    }
3436
3437    /**
3438     * @return {@link #collection} (The action to be performed for collecting the specimen.)
3439     */
3440    public List<CodeableConcept> getCollection() { 
3441      if (this.collection == null)
3442        this.collection = new ArrayList<CodeableConcept>();
3443      return this.collection;
3444    }
3445
3446    /**
3447     * @return Returns a reference to <code>this</code> for easy method chaining
3448     */
3449    public SpecimenDefinition setCollection(List<CodeableConcept> theCollection) { 
3450      this.collection = theCollection;
3451      return this;
3452    }
3453
3454    public boolean hasCollection() { 
3455      if (this.collection == null)
3456        return false;
3457      for (CodeableConcept item : this.collection)
3458        if (!item.isEmpty())
3459          return true;
3460      return false;
3461    }
3462
3463    public CodeableConcept addCollection() { //3
3464      CodeableConcept t = new CodeableConcept();
3465      if (this.collection == null)
3466        this.collection = new ArrayList<CodeableConcept>();
3467      this.collection.add(t);
3468      return t;
3469    }
3470
3471    public SpecimenDefinition addCollection(CodeableConcept t) { //3
3472      if (t == null)
3473        return this;
3474      if (this.collection == null)
3475        this.collection = new ArrayList<CodeableConcept>();
3476      this.collection.add(t);
3477      return this;
3478    }
3479
3480    /**
3481     * @return The first repetition of repeating field {@link #collection}, creating it if it does not already exist
3482     */
3483    public CodeableConcept getCollectionFirstRep() { 
3484      if (getCollection().isEmpty()) {
3485        addCollection();
3486      }
3487      return getCollection().get(0);
3488    }
3489
3490    /**
3491     * @return {@link #typeTested} (Specimen conditioned in a container as expected by the testing laboratory.)
3492     */
3493    public List<SpecimenDefinitionTypeTestedComponent> getTypeTested() { 
3494      if (this.typeTested == null)
3495        this.typeTested = new ArrayList<SpecimenDefinitionTypeTestedComponent>();
3496      return this.typeTested;
3497    }
3498
3499    /**
3500     * @return Returns a reference to <code>this</code> for easy method chaining
3501     */
3502    public SpecimenDefinition setTypeTested(List<SpecimenDefinitionTypeTestedComponent> theTypeTested) { 
3503      this.typeTested = theTypeTested;
3504      return this;
3505    }
3506
3507    public boolean hasTypeTested() { 
3508      if (this.typeTested == null)
3509        return false;
3510      for (SpecimenDefinitionTypeTestedComponent item : this.typeTested)
3511        if (!item.isEmpty())
3512          return true;
3513      return false;
3514    }
3515
3516    public SpecimenDefinitionTypeTestedComponent addTypeTested() { //3
3517      SpecimenDefinitionTypeTestedComponent t = new SpecimenDefinitionTypeTestedComponent();
3518      if (this.typeTested == null)
3519        this.typeTested = new ArrayList<SpecimenDefinitionTypeTestedComponent>();
3520      this.typeTested.add(t);
3521      return t;
3522    }
3523
3524    public SpecimenDefinition addTypeTested(SpecimenDefinitionTypeTestedComponent t) { //3
3525      if (t == null)
3526        return this;
3527      if (this.typeTested == null)
3528        this.typeTested = new ArrayList<SpecimenDefinitionTypeTestedComponent>();
3529      this.typeTested.add(t);
3530      return this;
3531    }
3532
3533    /**
3534     * @return The first repetition of repeating field {@link #typeTested}, creating it if it does not already exist
3535     */
3536    public SpecimenDefinitionTypeTestedComponent getTypeTestedFirstRep() { 
3537      if (getTypeTested().isEmpty()) {
3538        addTypeTested();
3539      }
3540      return getTypeTested().get(0);
3541    }
3542
3543      protected void listChildren(List<Property> children) {
3544        super.listChildren(children);
3545        children.add(new Property("url", "uri", "An absolute URL that is used to identify this SpecimenDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions.", 0, 1, url));
3546        children.add(new Property("identifier", "Identifier", "A business identifier assigned to this SpecimenDefinition.", 0, 1, identifier));
3547        children.add(new Property("version", "string", "The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique.", 0, 1, version));
3548        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the SpecimenDefinition.", 0, 1, title));
3549        children.add(new Property("derivedFromCanonical", "canonical(SpecimenDefinition)", "The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromCanonical));
3550        children.add(new Property("derivedFromUri", "uri", "The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromUri));
3551        children.add(new Property("status", "code", "The current state of theSpecimenDefinition.", 0, 1, status));
3552        children.add(new Property("experimental", "boolean", "A flag to indicate that this SpecimenDefinition is not authored for  genuine usage.", 0, 1, experimental));
3553        children.add(new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.", 0, 1, subject));
3554        children.add(new Property("date", "dateTime", "For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.", 0, 1, date));
3555        children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "Helps establish the \"authority/credibility\" of the SpecimenDefinition. May also allow for contact.", 0, 1, publisher));
3556        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
3557        children.add(new Property("description", "markdown", "A free text natural language description of the SpecimenDefinition from the consumer's perspective.", 0, 1, description));
3558        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of specimen definitions.", 0, java.lang.Integer.MAX_VALUE, useContext));
3559        children.add(new Property("jurisdiction", "CodeableConcept", "A jurisdiction in which the SpecimenDefinition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
3560        children.add(new Property("purpose", "markdown", "Explains why this SpecimeDefinition is needed and why it has been designed as it has.", 0, 1, purpose));
3561        children.add(new Property("copyright", "markdown", "Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition.", 0, 1, copyright));
3562        children.add(new Property("approvalDate", "date", "The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate));
3563        children.add(new Property("lastReviewDate", "date", "The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.", 0, 1, lastReviewDate));
3564        children.add(new Property("effectivePeriod", "Period", "The period during which the SpecimenDefinition content was or is planned to be effective.", 0, 1, effectivePeriod));
3565        children.add(new Property("typeCollected", "CodeableConcept", "The kind of material to be collected.", 0, 1, typeCollected));
3566        children.add(new Property("patientPreparation", "CodeableConcept", "Preparation of the patient for specimen collection.", 0, java.lang.Integer.MAX_VALUE, patientPreparation));
3567        children.add(new Property("timeAspect", "string", "Time aspect of specimen collection (duration or offset).", 0, 1, timeAspect));
3568        children.add(new Property("collection", "CodeableConcept", "The action to be performed for collecting the specimen.", 0, java.lang.Integer.MAX_VALUE, collection));
3569        children.add(new Property("typeTested", "", "Specimen conditioned in a container as expected by the testing laboratory.", 0, java.lang.Integer.MAX_VALUE, typeTested));
3570      }
3571
3572      @Override
3573      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3574        switch (_hash) {
3575        case 116079: /*url*/  return new Property("url", "uri", "An absolute URL that is used to identify this SpecimenDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this SpecimenDefinition is (or will be) published. The URL SHOULD include the major version of the SpecimenDefinition. For more information see Technical and Business Versions.", 0, 1, url);
3576        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A business identifier assigned to this SpecimenDefinition.", 0, 1, identifier);
3577        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the SpecimenDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the SpecimenDefinition author and is not expected to be globally unique.", 0, 1, version);
3578        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the SpecimenDefinition.", 0, 1, title);
3579        case -978133683: /*derivedFromCanonical*/  return new Property("derivedFromCanonical", "canonical(SpecimenDefinition)", "The canonical URL pointing to another FHIR-defined SpecimenDefinition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromCanonical);
3580        case -1076333435: /*derivedFromUri*/  return new Property("derivedFromUri", "uri", "The URL pointing to an externally-defined type of specimen, guideline or other definition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromUri);
3581        case -892481550: /*status*/  return new Property("status", "code", "The current state of theSpecimenDefinition.", 0, 1, status);
3582        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A flag to indicate that this SpecimenDefinition is not authored for  genuine usage.", 0, 1, experimental);
3583        case -573640748: /*subject[x]*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.", 0, 1, subject);
3584        case -1867885268: /*subject*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.", 0, 1, subject);
3585        case -1257122603: /*subjectCodeableConcept*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.", 0, 1, subject);
3586        case 772938623: /*subjectReference*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject  from which this kind of specimen is to be collected.", 0, 1, subject);
3587        case 3076014: /*date*/  return new Property("date", "dateTime", "For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.", 0, 1, date);
3588        case 1447404028: /*publisher*/  return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "Helps establish the \"authority/credibility\" of the SpecimenDefinition. May also allow for contact.", 0, 1, publisher);
3589        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
3590        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the SpecimenDefinition from the consumer's perspective.", 0, 1, description);
3591        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of specimen definitions.", 0, java.lang.Integer.MAX_VALUE, useContext);
3592        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A jurisdiction in which the SpecimenDefinition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
3593        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explains why this SpecimeDefinition is needed and why it has been designed as it has.", 0, 1, purpose);
3594        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "Copyright statement relating to the SpecimenDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the SpecimenDefinition.", 0, 1, copyright);
3595        case 223539345: /*approvalDate*/  return new Property("approvalDate", "date", "The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate);
3596        case -1687512484: /*lastReviewDate*/  return new Property("lastReviewDate", "date", "The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.", 0, 1, lastReviewDate);
3597        case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "The period during which the SpecimenDefinition content was or is planned to be effective.", 0, 1, effectivePeriod);
3598        case 588504367: /*typeCollected*/  return new Property("typeCollected", "CodeableConcept", "The kind of material to be collected.", 0, 1, typeCollected);
3599        case -879411630: /*patientPreparation*/  return new Property("patientPreparation", "CodeableConcept", "Preparation of the patient for specimen collection.", 0, java.lang.Integer.MAX_VALUE, patientPreparation);
3600        case 276972933: /*timeAspect*/  return new Property("timeAspect", "string", "Time aspect of specimen collection (duration or offset).", 0, 1, timeAspect);
3601        case -1741312354: /*collection*/  return new Property("collection", "CodeableConcept", "The action to be performed for collecting the specimen.", 0, java.lang.Integer.MAX_VALUE, collection);
3602        case -1407902581: /*typeTested*/  return new Property("typeTested", "", "Specimen conditioned in a container as expected by the testing laboratory.", 0, java.lang.Integer.MAX_VALUE, typeTested);
3603        default: return super.getNamedProperty(_hash, _name, _checkValid);
3604        }
3605
3606      }
3607
3608      @Override
3609      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3610        switch (hash) {
3611        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
3612        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
3613        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
3614        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
3615        case -978133683: /*derivedFromCanonical*/ return this.derivedFromCanonical == null ? new Base[0] : this.derivedFromCanonical.toArray(new Base[this.derivedFromCanonical.size()]); // CanonicalType
3616        case -1076333435: /*derivedFromUri*/ return this.derivedFromUri == null ? new Base[0] : this.derivedFromUri.toArray(new Base[this.derivedFromUri.size()]); // UriType
3617        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
3618        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
3619        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Type
3620        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
3621        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // Reference
3622        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
3623        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
3624        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
3625        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
3626        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
3627        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
3628        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
3629        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
3630        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
3631        case 588504367: /*typeCollected*/ return this.typeCollected == null ? new Base[0] : new Base[] {this.typeCollected}; // CodeableConcept
3632        case -879411630: /*patientPreparation*/ return this.patientPreparation == null ? new Base[0] : this.patientPreparation.toArray(new Base[this.patientPreparation.size()]); // CodeableConcept
3633        case 276972933: /*timeAspect*/ return this.timeAspect == null ? new Base[0] : new Base[] {this.timeAspect}; // StringType
3634        case -1741312354: /*collection*/ return this.collection == null ? new Base[0] : this.collection.toArray(new Base[this.collection.size()]); // CodeableConcept
3635        case -1407902581: /*typeTested*/ return this.typeTested == null ? new Base[0] : this.typeTested.toArray(new Base[this.typeTested.size()]); // SpecimenDefinitionTypeTestedComponent
3636        default: return super.getProperty(hash, name, checkValid);
3637        }
3638
3639      }
3640
3641      @Override
3642      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3643        switch (hash) {
3644        case 116079: // url
3645          this.url = castToUri(value); // UriType
3646          return value;
3647        case -1618432855: // identifier
3648          this.identifier = castToIdentifier(value); // Identifier
3649          return value;
3650        case 351608024: // version
3651          this.version = castToString(value); // StringType
3652          return value;
3653        case 110371416: // title
3654          this.title = castToString(value); // StringType
3655          return value;
3656        case -978133683: // derivedFromCanonical
3657          this.getDerivedFromCanonical().add(castToCanonical(value)); // CanonicalType
3658          return value;
3659        case -1076333435: // derivedFromUri
3660          this.getDerivedFromUri().add(castToUri(value)); // UriType
3661          return value;
3662        case -892481550: // status
3663          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
3664          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3665          return value;
3666        case -404562712: // experimental
3667          this.experimental = castToBoolean(value); // BooleanType
3668          return value;
3669        case -1867885268: // subject
3670          this.subject = castToType(value); // Type
3671          return value;
3672        case 3076014: // date
3673          this.date = castToDateTime(value); // DateTimeType
3674          return value;
3675        case 1447404028: // publisher
3676          this.publisher = castToReference(value); // Reference
3677          return value;
3678        case 951526432: // contact
3679          this.getContact().add(castToContactDetail(value)); // ContactDetail
3680          return value;
3681        case -1724546052: // description
3682          this.description = castToMarkdown(value); // MarkdownType
3683          return value;
3684        case -669707736: // useContext
3685          this.getUseContext().add(castToUsageContext(value)); // UsageContext
3686          return value;
3687        case -507075711: // jurisdiction
3688          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
3689          return value;
3690        case -220463842: // purpose
3691          this.purpose = castToMarkdown(value); // MarkdownType
3692          return value;
3693        case 1522889671: // copyright
3694          this.copyright = castToMarkdown(value); // MarkdownType
3695          return value;
3696        case 223539345: // approvalDate
3697          this.approvalDate = castToDate(value); // DateType
3698          return value;
3699        case -1687512484: // lastReviewDate
3700          this.lastReviewDate = castToDate(value); // DateType
3701          return value;
3702        case -403934648: // effectivePeriod
3703          this.effectivePeriod = castToPeriod(value); // Period
3704          return value;
3705        case 588504367: // typeCollected
3706          this.typeCollected = castToCodeableConcept(value); // CodeableConcept
3707          return value;
3708        case -879411630: // patientPreparation
3709          this.getPatientPreparation().add(castToCodeableConcept(value)); // CodeableConcept
3710          return value;
3711        case 276972933: // timeAspect
3712          this.timeAspect = castToString(value); // StringType
3713          return value;
3714        case -1741312354: // collection
3715          this.getCollection().add(castToCodeableConcept(value)); // CodeableConcept
3716          return value;
3717        case -1407902581: // typeTested
3718          this.getTypeTested().add((SpecimenDefinitionTypeTestedComponent) value); // SpecimenDefinitionTypeTestedComponent
3719          return value;
3720        default: return super.setProperty(hash, name, value);
3721        }
3722
3723      }
3724
3725      @Override
3726      public Base setProperty(String name, Base value) throws FHIRException {
3727        if (name.equals("url")) {
3728          this.url = castToUri(value); // UriType
3729        } else if (name.equals("identifier")) {
3730          this.identifier = castToIdentifier(value); // Identifier
3731        } else if (name.equals("version")) {
3732          this.version = castToString(value); // StringType
3733        } else if (name.equals("title")) {
3734          this.title = castToString(value); // StringType
3735        } else if (name.equals("derivedFromCanonical")) {
3736          this.getDerivedFromCanonical().add(castToCanonical(value));
3737        } else if (name.equals("derivedFromUri")) {
3738          this.getDerivedFromUri().add(castToUri(value));
3739        } else if (name.equals("status")) {
3740          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
3741          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3742        } else if (name.equals("experimental")) {
3743          this.experimental = castToBoolean(value); // BooleanType
3744        } else if (name.equals("subject[x]")) {
3745          this.subject = castToType(value); // Type
3746        } else if (name.equals("date")) {
3747          this.date = castToDateTime(value); // DateTimeType
3748        } else if (name.equals("publisher")) {
3749          this.publisher = castToReference(value); // Reference
3750        } else if (name.equals("contact")) {
3751          this.getContact().add(castToContactDetail(value));
3752        } else if (name.equals("description")) {
3753          this.description = castToMarkdown(value); // MarkdownType
3754        } else if (name.equals("useContext")) {
3755          this.getUseContext().add(castToUsageContext(value));
3756        } else if (name.equals("jurisdiction")) {
3757          this.getJurisdiction().add(castToCodeableConcept(value));
3758        } else if (name.equals("purpose")) {
3759          this.purpose = castToMarkdown(value); // MarkdownType
3760        } else if (name.equals("copyright")) {
3761          this.copyright = castToMarkdown(value); // MarkdownType
3762        } else if (name.equals("approvalDate")) {
3763          this.approvalDate = castToDate(value); // DateType
3764        } else if (name.equals("lastReviewDate")) {
3765          this.lastReviewDate = castToDate(value); // DateType
3766        } else if (name.equals("effectivePeriod")) {
3767          this.effectivePeriod = castToPeriod(value); // Period
3768        } else if (name.equals("typeCollected")) {
3769          this.typeCollected = castToCodeableConcept(value); // CodeableConcept
3770        } else if (name.equals("patientPreparation")) {
3771          this.getPatientPreparation().add(castToCodeableConcept(value));
3772        } else if (name.equals("timeAspect")) {
3773          this.timeAspect = castToString(value); // StringType
3774        } else if (name.equals("collection")) {
3775          this.getCollection().add(castToCodeableConcept(value));
3776        } else if (name.equals("typeTested")) {
3777          this.getTypeTested().add((SpecimenDefinitionTypeTestedComponent) value);
3778        } else
3779          return super.setProperty(name, value);
3780        return value;
3781      }
3782
3783      @Override
3784      public Base makeProperty(int hash, String name) throws FHIRException {
3785        switch (hash) {
3786        case 116079:  return getUrlElement();
3787        case -1618432855:  return getIdentifier();
3788        case 351608024:  return getVersionElement();
3789        case 110371416:  return getTitleElement();
3790        case -978133683:  return addDerivedFromCanonicalElement();
3791        case -1076333435:  return addDerivedFromUriElement();
3792        case -892481550:  return getStatusElement();
3793        case -404562712:  return getExperimentalElement();
3794        case -573640748:  return getSubject();
3795        case -1867885268:  return getSubject();
3796        case 3076014:  return getDateElement();
3797        case 1447404028:  return getPublisher();
3798        case 951526432:  return addContact(); 
3799        case -1724546052:  return getDescriptionElement();
3800        case -669707736:  return addUseContext(); 
3801        case -507075711:  return addJurisdiction(); 
3802        case -220463842:  return getPurposeElement();
3803        case 1522889671:  return getCopyrightElement();
3804        case 223539345:  return getApprovalDateElement();
3805        case -1687512484:  return getLastReviewDateElement();
3806        case -403934648:  return getEffectivePeriod();
3807        case 588504367:  return getTypeCollected();
3808        case -879411630:  return addPatientPreparation(); 
3809        case 276972933:  return getTimeAspectElement();
3810        case -1741312354:  return addCollection(); 
3811        case -1407902581:  return addTypeTested(); 
3812        default: return super.makeProperty(hash, name);
3813        }
3814
3815      }
3816
3817      @Override
3818      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3819        switch (hash) {
3820        case 116079: /*url*/ return new String[] {"uri"};
3821        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3822        case 351608024: /*version*/ return new String[] {"string"};
3823        case 110371416: /*title*/ return new String[] {"string"};
3824        case -978133683: /*derivedFromCanonical*/ return new String[] {"canonical"};
3825        case -1076333435: /*derivedFromUri*/ return new String[] {"uri"};
3826        case -892481550: /*status*/ return new String[] {"code"};
3827        case -404562712: /*experimental*/ return new String[] {"boolean"};
3828        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference"};
3829        case 3076014: /*date*/ return new String[] {"dateTime"};
3830        case 1447404028: /*publisher*/ return new String[] {"Reference"};
3831        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
3832        case -1724546052: /*description*/ return new String[] {"markdown"};
3833        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
3834        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
3835        case -220463842: /*purpose*/ return new String[] {"markdown"};
3836        case 1522889671: /*copyright*/ return new String[] {"markdown"};
3837        case 223539345: /*approvalDate*/ return new String[] {"date"};
3838        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
3839        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
3840        case 588504367: /*typeCollected*/ return new String[] {"CodeableConcept"};
3841        case -879411630: /*patientPreparation*/ return new String[] {"CodeableConcept"};
3842        case 276972933: /*timeAspect*/ return new String[] {"string"};
3843        case -1741312354: /*collection*/ return new String[] {"CodeableConcept"};
3844        case -1407902581: /*typeTested*/ return new String[] {};
3845        default: return super.getTypesForProperty(hash, name);
3846        }
3847
3848      }
3849
3850      @Override
3851      public Base addChild(String name) throws FHIRException {
3852        if (name.equals("url")) {
3853          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.url");
3854        }
3855        else if (name.equals("identifier")) {
3856          this.identifier = new Identifier();
3857          return this.identifier;
3858        }
3859        else if (name.equals("version")) {
3860          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.version");
3861        }
3862        else if (name.equals("title")) {
3863          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.title");
3864        }
3865        else if (name.equals("derivedFromCanonical")) {
3866          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.derivedFromCanonical");
3867        }
3868        else if (name.equals("derivedFromUri")) {
3869          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.derivedFromUri");
3870        }
3871        else if (name.equals("status")) {
3872          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.status");
3873        }
3874        else if (name.equals("experimental")) {
3875          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.experimental");
3876        }
3877        else if (name.equals("subjectCodeableConcept")) {
3878          this.subject = new CodeableConcept();
3879          return this.subject;
3880        }
3881        else if (name.equals("subjectReference")) {
3882          this.subject = new Reference();
3883          return this.subject;
3884        }
3885        else if (name.equals("date")) {
3886          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.date");
3887        }
3888        else if (name.equals("publisher")) {
3889          this.publisher = new Reference();
3890          return this.publisher;
3891        }
3892        else if (name.equals("contact")) {
3893          return addContact();
3894        }
3895        else if (name.equals("description")) {
3896          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.description");
3897        }
3898        else if (name.equals("useContext")) {
3899          return addUseContext();
3900        }
3901        else if (name.equals("jurisdiction")) {
3902          return addJurisdiction();
3903        }
3904        else if (name.equals("purpose")) {
3905          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.purpose");
3906        }
3907        else if (name.equals("copyright")) {
3908          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.copyright");
3909        }
3910        else if (name.equals("approvalDate")) {
3911          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.approvalDate");
3912        }
3913        else if (name.equals("lastReviewDate")) {
3914          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.lastReviewDate");
3915        }
3916        else if (name.equals("effectivePeriod")) {
3917          this.effectivePeriod = new Period();
3918          return this.effectivePeriod;
3919        }
3920        else if (name.equals("typeCollected")) {
3921          this.typeCollected = new CodeableConcept();
3922          return this.typeCollected;
3923        }
3924        else if (name.equals("patientPreparation")) {
3925          return addPatientPreparation();
3926        }
3927        else if (name.equals("timeAspect")) {
3928          throw new FHIRException("Cannot call addChild on a primitive type SpecimenDefinition.timeAspect");
3929        }
3930        else if (name.equals("collection")) {
3931          return addCollection();
3932        }
3933        else if (name.equals("typeTested")) {
3934          return addTypeTested();
3935        }
3936        else
3937          return super.addChild(name);
3938      }
3939
3940  public String fhirType() {
3941    return "SpecimenDefinition";
3942
3943  }
3944
3945      public SpecimenDefinition copy() {
3946        SpecimenDefinition dst = new SpecimenDefinition();
3947        copyValues(dst);
3948        return dst;
3949      }
3950
3951      public void copyValues(SpecimenDefinition dst) {
3952        super.copyValues(dst);
3953        dst.url = url == null ? null : url.copy();
3954        dst.identifier = identifier == null ? null : identifier.copy();
3955        dst.version = version == null ? null : version.copy();
3956        dst.title = title == null ? null : title.copy();
3957        if (derivedFromCanonical != null) {
3958          dst.derivedFromCanonical = new ArrayList<CanonicalType>();
3959          for (CanonicalType i : derivedFromCanonical)
3960            dst.derivedFromCanonical.add(i.copy());
3961        };
3962        if (derivedFromUri != null) {
3963          dst.derivedFromUri = new ArrayList<UriType>();
3964          for (UriType i : derivedFromUri)
3965            dst.derivedFromUri.add(i.copy());
3966        };
3967        dst.status = status == null ? null : status.copy();
3968        dst.experimental = experimental == null ? null : experimental.copy();
3969        dst.subject = subject == null ? null : subject.copy();
3970        dst.date = date == null ? null : date.copy();
3971        dst.publisher = publisher == null ? null : publisher.copy();
3972        if (contact != null) {
3973          dst.contact = new ArrayList<ContactDetail>();
3974          for (ContactDetail i : contact)
3975            dst.contact.add(i.copy());
3976        };
3977        dst.description = description == null ? null : description.copy();
3978        if (useContext != null) {
3979          dst.useContext = new ArrayList<UsageContext>();
3980          for (UsageContext i : useContext)
3981            dst.useContext.add(i.copy());
3982        };
3983        if (jurisdiction != null) {
3984          dst.jurisdiction = new ArrayList<CodeableConcept>();
3985          for (CodeableConcept i : jurisdiction)
3986            dst.jurisdiction.add(i.copy());
3987        };
3988        dst.purpose = purpose == null ? null : purpose.copy();
3989        dst.copyright = copyright == null ? null : copyright.copy();
3990        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
3991        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
3992        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
3993        dst.typeCollected = typeCollected == null ? null : typeCollected.copy();
3994        if (patientPreparation != null) {
3995          dst.patientPreparation = new ArrayList<CodeableConcept>();
3996          for (CodeableConcept i : patientPreparation)
3997            dst.patientPreparation.add(i.copy());
3998        };
3999        dst.timeAspect = timeAspect == null ? null : timeAspect.copy();
4000        if (collection != null) {
4001          dst.collection = new ArrayList<CodeableConcept>();
4002          for (CodeableConcept i : collection)
4003            dst.collection.add(i.copy());
4004        };
4005        if (typeTested != null) {
4006          dst.typeTested = new ArrayList<SpecimenDefinitionTypeTestedComponent>();
4007          for (SpecimenDefinitionTypeTestedComponent i : typeTested)
4008            dst.typeTested.add(i.copy());
4009        };
4010      }
4011
4012      protected SpecimenDefinition typedCopy() {
4013        return copy();
4014      }
4015
4016      @Override
4017      public boolean equalsDeep(Base other_) {
4018        if (!super.equalsDeep(other_))
4019          return false;
4020        if (!(other_ instanceof SpecimenDefinition))
4021          return false;
4022        SpecimenDefinition o = (SpecimenDefinition) other_;
4023        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
4024           && compareDeep(title, o.title, true) && compareDeep(derivedFromCanonical, o.derivedFromCanonical, true)
4025           && compareDeep(derivedFromUri, o.derivedFromUri, true) && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true)
4026           && compareDeep(subject, o.subject, true) && compareDeep(date, o.date, true) && compareDeep(publisher, o.publisher, true)
4027           && compareDeep(contact, o.contact, true) && compareDeep(description, o.description, true) && compareDeep(useContext, o.useContext, true)
4028           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
4029           && compareDeep(approvalDate, o.approvalDate, true) && compareDeep(lastReviewDate, o.lastReviewDate, true)
4030           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(typeCollected, o.typeCollected, true)
4031           && compareDeep(patientPreparation, o.patientPreparation, true) && compareDeep(timeAspect, o.timeAspect, true)
4032           && compareDeep(collection, o.collection, true) && compareDeep(typeTested, o.typeTested, true);
4033      }
4034
4035      @Override
4036      public boolean equalsShallow(Base other_) {
4037        if (!super.equalsShallow(other_))
4038          return false;
4039        if (!(other_ instanceof SpecimenDefinition))
4040          return false;
4041        SpecimenDefinition o = (SpecimenDefinition) other_;
4042        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(title, o.title, true)
4043           && compareValues(derivedFromUri, o.derivedFromUri, true) && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true)
4044           && compareValues(date, o.date, true) && compareValues(description, o.description, true) && compareValues(purpose, o.purpose, true)
4045           && compareValues(copyright, o.copyright, true) && compareValues(approvalDate, o.approvalDate, true)
4046           && compareValues(lastReviewDate, o.lastReviewDate, true) && compareValues(timeAspect, o.timeAspect, true)
4047          ;
4048      }
4049
4050      public boolean isEmpty() {
4051        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, identifier, version
4052          , title, derivedFromCanonical, derivedFromUri, status, experimental, subject, date
4053          , publisher, contact, description, useContext, jurisdiction, purpose, copyright
4054          , approvalDate, lastReviewDate, effectivePeriod, typeCollected, patientPreparation
4055          , timeAspect, collection, typeTested);
4056      }
4057
4058  @Override
4059  public ResourceType getResourceType() {
4060    return ResourceType.SpecimenDefinition;
4061   }
4062
4063 /**
4064   * Search parameter: <b>container</b>
4065   * <p>
4066   * Description: <b>The type of specimen conditioned in container expected by the lab</b><br>
4067   * Type: <b>token</b><br>
4068   * Path: <b>SpecimenDefinition.typeTested.container.type</b><br>
4069   * </p>
4070   */
4071  @SearchParamDefinition(name="container", path="SpecimenDefinition.typeTested.container.type", description="The type of specimen conditioned in container expected by the lab", type="token" )
4072  public static final String SP_CONTAINER = "container";
4073 /**
4074   * <b>Fluent Client</b> search parameter constant for <b>container</b>
4075   * <p>
4076   * Description: <b>The type of specimen conditioned in container expected by the lab</b><br>
4077   * Type: <b>token</b><br>
4078   * Path: <b>SpecimenDefinition.typeTested.container.type</b><br>
4079   * </p>
4080   */
4081  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTAINER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTAINER);
4082
4083 /**
4084   * Search parameter: <b>identifier</b>
4085   * <p>
4086   * Description: <b>The unique identifier associated with the SpecimenDefinition</b><br>
4087   * Type: <b>token</b><br>
4088   * Path: <b>SpecimenDefinition.identifier</b><br>
4089   * </p>
4090   */
4091  @SearchParamDefinition(name="identifier", path="SpecimenDefinition.identifier", description="The unique identifier associated with the SpecimenDefinition", type="token" )
4092  public static final String SP_IDENTIFIER = "identifier";
4093 /**
4094   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4095   * <p>
4096   * Description: <b>The unique identifier associated with the SpecimenDefinition</b><br>
4097   * Type: <b>token</b><br>
4098   * Path: <b>SpecimenDefinition.identifier</b><br>
4099   * </p>
4100   */
4101  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4102
4103 /**
4104   * Search parameter: <b>is-derived</b>
4105   * <p>
4106   * Description: <b>Primary specimen (false) or derived specimen (true)</b><br>
4107   * Type: <b>token</b><br>
4108   * Path: <b>SpecimenDefinition.typeTested.isDerived</b><br>
4109   * </p>
4110   */
4111  @SearchParamDefinition(name="is-derived", path="SpecimenDefinition.typeTested.isDerived", description="Primary specimen (false) or derived specimen (true)", type="token" )
4112  public static final String SP_IS_DERIVED = "is-derived";
4113 /**
4114   * <b>Fluent Client</b> search parameter constant for <b>is-derived</b>
4115   * <p>
4116   * Description: <b>Primary specimen (false) or derived specimen (true)</b><br>
4117   * Type: <b>token</b><br>
4118   * Path: <b>SpecimenDefinition.typeTested.isDerived</b><br>
4119   * </p>
4120   */
4121  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IS_DERIVED = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IS_DERIVED);
4122
4123 /**
4124   * Search parameter: <b>type-tested</b>
4125   * <p>
4126   * Description: <b>The type of specimen conditioned for testing</b><br>
4127   * Type: <b>token</b><br>
4128   * Path: <b>SpecimenDefinition.typeTested.type</b><br>
4129   * </p>
4130   */
4131  @SearchParamDefinition(name="type-tested", path="SpecimenDefinition.typeTested.type", description="The type of specimen conditioned for testing", type="token" )
4132  public static final String SP_TYPE_TESTED = "type-tested";
4133 /**
4134   * <b>Fluent Client</b> search parameter constant for <b>type-tested</b>
4135   * <p>
4136   * Description: <b>The type of specimen conditioned for testing</b><br>
4137   * Type: <b>token</b><br>
4138   * Path: <b>SpecimenDefinition.typeTested.type</b><br>
4139   * </p>
4140   */
4141  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE_TESTED = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE_TESTED);
4142
4143 /**
4144   * Search parameter: <b>experimental</b>
4145   * <p>
4146   * Description: <b>Not for genuine usage (true)</b><br>
4147   * Type: <b>token</b><br>
4148   * Path: <b>SpecimenDefinition.experimental</b><br>
4149   * </p>
4150   */
4151  @SearchParamDefinition(name="experimental", path="SpecimenDefinition.experimental", description="Not for genuine usage (true)", type="token" )
4152  public static final String SP_EXPERIMENTAL = "experimental";
4153 /**
4154   * <b>Fluent Client</b> search parameter constant for <b>experimental</b>
4155   * <p>
4156   * Description: <b>Not for genuine usage (true)</b><br>
4157   * Type: <b>token</b><br>
4158   * Path: <b>SpecimenDefinition.experimental</b><br>
4159   * </p>
4160   */
4161  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EXPERIMENTAL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EXPERIMENTAL);
4162
4163 /**
4164   * Search parameter: <b>type</b>
4165   * <p>
4166   * Description: <b>The type of collected specimen</b><br>
4167   * Type: <b>token</b><br>
4168   * Path: <b>SpecimenDefinition.typeCollected</b><br>
4169   * </p>
4170   */
4171  @SearchParamDefinition(name="type", path="SpecimenDefinition.typeCollected", description="The type of collected specimen", type="token" )
4172  public static final String SP_TYPE = "type";
4173 /**
4174   * <b>Fluent Client</b> search parameter constant for <b>type</b>
4175   * <p>
4176   * Description: <b>The type of collected specimen</b><br>
4177   * Type: <b>token</b><br>
4178   * Path: <b>SpecimenDefinition.typeCollected</b><br>
4179   * </p>
4180   */
4181  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
4182
4183 /**
4184   * Search parameter: <b>title</b>
4185   * <p>
4186   * Description: <b>Human-friendly name of the SpecimenDefinition</b><br>
4187   * Type: <b>string</b><br>
4188   * Path: <b>SpecimenDefinition.title</b><br>
4189   * </p>
4190   */
4191  @SearchParamDefinition(name="title", path="SpecimenDefinition.title", description="Human-friendly name of the SpecimenDefinition", type="string" )
4192  public static final String SP_TITLE = "title";
4193 /**
4194   * <b>Fluent Client</b> search parameter constant for <b>title</b>
4195   * <p>
4196   * Description: <b>Human-friendly name of the SpecimenDefinition</b><br>
4197   * Type: <b>string</b><br>
4198   * Path: <b>SpecimenDefinition.title</b><br>
4199   * </p>
4200   */
4201  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
4202
4203 /**
4204   * Search parameter: <b>status</b>
4205   * <p>
4206   * Description: <b>Publication status of the SpecimenDefinition: draft, active, retired, unknown</b><br>
4207   * Type: <b>token</b><br>
4208   * Path: <b>SpecimenDefinition.status</b><br>
4209   * </p>
4210   */
4211  @SearchParamDefinition(name="status", path="SpecimenDefinition.status", description="Publication status of the SpecimenDefinition: draft, active, retired, unknown", type="token" )
4212  public static final String SP_STATUS = "status";
4213 /**
4214   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4215   * <p>
4216   * Description: <b>Publication status of the SpecimenDefinition: draft, active, retired, unknown</b><br>
4217   * Type: <b>token</b><br>
4218   * Path: <b>SpecimenDefinition.status</b><br>
4219   * </p>
4220   */
4221  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4222
4223
4224}
4225