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