001package org.hl7.fhir.r4.model; 002 003 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034 035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 036 037import java.util.*; 038 039import org.hl7.fhir.utilities.Utilities; 040import ca.uhn.fhir.model.api.annotation.ResourceDef; 041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.ChildOrder; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046import org.hl7.fhir.instance.model.api.*; 047import org.hl7.fhir.exceptions.FHIRException; 048/** 049 * Record of delivery of what is supplied. 050 */ 051@ResourceDef(name="SupplyDelivery", profile="http://hl7.org/fhir/StructureDefinition/SupplyDelivery") 052public class SupplyDelivery extends DomainResource { 053 054 public enum SupplyDeliveryStatus { 055 /** 056 * Supply has been requested, but not delivered. 057 */ 058 INPROGRESS, 059 /** 060 * Supply has been delivered ("completed"). 061 */ 062 COMPLETED, 063 /** 064 * Delivery was not completed. 065 */ 066 ABANDONED, 067 /** 068 * This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be "abandoned" rather than "entered-in-error".). 069 */ 070 ENTEREDINERROR, 071 /** 072 * added to help the parsers with the generic types 073 */ 074 NULL; 075 public static SupplyDeliveryStatus fromCode(String codeString) throws FHIRException { 076 if (codeString == null || "".equals(codeString)) 077 return null; 078 if ("in-progress".equals(codeString)) 079 return INPROGRESS; 080 if ("completed".equals(codeString)) 081 return COMPLETED; 082 if ("abandoned".equals(codeString)) 083 return ABANDONED; 084 if ("entered-in-error".equals(codeString)) 085 return ENTEREDINERROR; 086 if (Configuration.isAcceptInvalidEnums()) 087 return null; 088 else 089 throw new FHIRException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 090 } 091 public String toCode() { 092 switch (this) { 093 case INPROGRESS: return "in-progress"; 094 case COMPLETED: return "completed"; 095 case ABANDONED: return "abandoned"; 096 case ENTEREDINERROR: return "entered-in-error"; 097 default: return "?"; 098 } 099 } 100 public String getSystem() { 101 switch (this) { 102 case INPROGRESS: return "http://hl7.org/fhir/supplydelivery-status"; 103 case COMPLETED: return "http://hl7.org/fhir/supplydelivery-status"; 104 case ABANDONED: return "http://hl7.org/fhir/supplydelivery-status"; 105 case ENTEREDINERROR: return "http://hl7.org/fhir/supplydelivery-status"; 106 default: return "?"; 107 } 108 } 109 public String getDefinition() { 110 switch (this) { 111 case INPROGRESS: return "Supply has been requested, but not delivered."; 112 case COMPLETED: return "Supply has been delivered (\"completed\")."; 113 case ABANDONED: return "Delivery was not completed."; 114 case ENTEREDINERROR: return "This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"abandoned\" rather than \"entered-in-error\".)."; 115 default: return "?"; 116 } 117 } 118 public String getDisplay() { 119 switch (this) { 120 case INPROGRESS: return "In Progress"; 121 case COMPLETED: return "Delivered"; 122 case ABANDONED: return "Abandoned"; 123 case ENTEREDINERROR: return "Entered In Error"; 124 default: return "?"; 125 } 126 } 127 } 128 129 public static class SupplyDeliveryStatusEnumFactory implements EnumFactory<SupplyDeliveryStatus> { 130 public SupplyDeliveryStatus fromCode(String codeString) throws IllegalArgumentException { 131 if (codeString == null || "".equals(codeString)) 132 if (codeString == null || "".equals(codeString)) 133 return null; 134 if ("in-progress".equals(codeString)) 135 return SupplyDeliveryStatus.INPROGRESS; 136 if ("completed".equals(codeString)) 137 return SupplyDeliveryStatus.COMPLETED; 138 if ("abandoned".equals(codeString)) 139 return SupplyDeliveryStatus.ABANDONED; 140 if ("entered-in-error".equals(codeString)) 141 return SupplyDeliveryStatus.ENTEREDINERROR; 142 throw new IllegalArgumentException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 143 } 144 public Enumeration<SupplyDeliveryStatus> fromType(Base code) throws FHIRException { 145 if (code == null) 146 return null; 147 if (code.isEmpty()) 148 return new Enumeration<SupplyDeliveryStatus>(this); 149 String codeString = ((PrimitiveType) code).asStringValue(); 150 if (codeString == null || "".equals(codeString)) 151 return null; 152 if ("in-progress".equals(codeString)) 153 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.INPROGRESS); 154 if ("completed".equals(codeString)) 155 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.COMPLETED); 156 if ("abandoned".equals(codeString)) 157 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.ABANDONED); 158 if ("entered-in-error".equals(codeString)) 159 return new Enumeration<SupplyDeliveryStatus>(this, SupplyDeliveryStatus.ENTEREDINERROR); 160 throw new FHIRException("Unknown SupplyDeliveryStatus code '"+codeString+"'"); 161 } 162 public String toCode(SupplyDeliveryStatus code) { 163 if (code == SupplyDeliveryStatus.INPROGRESS) 164 return "in-progress"; 165 if (code == SupplyDeliveryStatus.COMPLETED) 166 return "completed"; 167 if (code == SupplyDeliveryStatus.ABANDONED) 168 return "abandoned"; 169 if (code == SupplyDeliveryStatus.ENTEREDINERROR) 170 return "entered-in-error"; 171 return "?"; 172 } 173 public String toSystem(SupplyDeliveryStatus code) { 174 return code.getSystem(); 175 } 176 } 177 178 @Block() 179 public static class SupplyDeliverySuppliedItemComponent extends BackboneElement implements IBaseBackboneElement { 180 /** 181 * The amount of supply that has been dispensed. Includes unit of measure. 182 */ 183 @Child(name = "quantity", type = {Quantity.class}, order=1, min=0, max=1, modifier=false, summary=false) 184 @Description(shortDefinition="Amount dispensed", formalDefinition="The amount of supply that has been dispensed. Includes unit of measure." ) 185 protected Quantity quantity; 186 187 /** 188 * Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list. 189 */ 190 @Child(name = "item", type = {CodeableConcept.class, Medication.class, Substance.class, Device.class}, order=2, min=0, max=1, modifier=false, summary=false) 191 @Description(shortDefinition="Medication, Substance, or Device supplied", formalDefinition="Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list." ) 192 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supply-item") 193 protected Type item; 194 195 private static final long serialVersionUID = 1628109307L; 196 197 /** 198 * Constructor 199 */ 200 public SupplyDeliverySuppliedItemComponent() { 201 super(); 202 } 203 204 /** 205 * @return {@link #quantity} (The amount of supply that has been dispensed. Includes unit of measure.) 206 */ 207 public Quantity getQuantity() { 208 if (this.quantity == null) 209 if (Configuration.errorOnAutoCreate()) 210 throw new Error("Attempt to auto-create SupplyDeliverySuppliedItemComponent.quantity"); 211 else if (Configuration.doAutoCreate()) 212 this.quantity = new Quantity(); // cc 213 return this.quantity; 214 } 215 216 public boolean hasQuantity() { 217 return this.quantity != null && !this.quantity.isEmpty(); 218 } 219 220 /** 221 * @param value {@link #quantity} (The amount of supply that has been dispensed. Includes unit of measure.) 222 */ 223 public SupplyDeliverySuppliedItemComponent setQuantity(Quantity value) { 224 this.quantity = value; 225 return this; 226 } 227 228 /** 229 * @return {@link #item} (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.) 230 */ 231 public Type getItem() { 232 return this.item; 233 } 234 235 /** 236 * @return {@link #item} (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.) 237 */ 238 public CodeableConcept getItemCodeableConcept() throws FHIRException { 239 if (this.item == null) 240 this.item = new CodeableConcept(); 241 if (!(this.item instanceof CodeableConcept)) 242 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered"); 243 return (CodeableConcept) this.item; 244 } 245 246 public boolean hasItemCodeableConcept() { 247 return this != null && this.item instanceof CodeableConcept; 248 } 249 250 /** 251 * @return {@link #item} (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.) 252 */ 253 public Reference getItemReference() throws FHIRException { 254 if (this.item == null) 255 this.item = new Reference(); 256 if (!(this.item instanceof Reference)) 257 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered"); 258 return (Reference) this.item; 259 } 260 261 public boolean hasItemReference() { 262 return this != null && this.item instanceof Reference; 263 } 264 265 public boolean hasItem() { 266 return this.item != null && !this.item.isEmpty(); 267 } 268 269 /** 270 * @param value {@link #item} (Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.) 271 */ 272 public SupplyDeliverySuppliedItemComponent setItem(Type value) { 273 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 274 throw new Error("Not the right type for SupplyDelivery.suppliedItem.item[x]: "+value.fhirType()); 275 this.item = value; 276 return this; 277 } 278 279 protected void listChildren(List<Property> children) { 280 super.listChildren(children); 281 children.add(new Property("quantity", "SimpleQuantity", "The amount of supply that has been dispensed. Includes unit of measure.", 0, 1, quantity)); 282 children.add(new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item)); 283 } 284 285 @Override 286 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 287 switch (_hash) { 288 case -1285004149: /*quantity*/ return new Property("quantity", "SimpleQuantity", "The amount of supply that has been dispensed. Includes unit of measure.", 0, 1, quantity); 289 case 2116201613: /*item[x]*/ return new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item); 290 case 3242771: /*item*/ return new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item); 291 case 106644494: /*itemCodeableConcept*/ return new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item); 292 case 1376364920: /*itemReference*/ return new Property("item[x]", "CodeableConcept|Reference(Medication|Substance|Device)", "Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.", 0, 1, item); 293 default: return super.getNamedProperty(_hash, _name, _checkValid); 294 } 295 296 } 297 298 @Override 299 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 300 switch (hash) { 301 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity 302 case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Type 303 default: return super.getProperty(hash, name, checkValid); 304 } 305 306 } 307 308 @Override 309 public Base setProperty(int hash, String name, Base value) throws FHIRException { 310 switch (hash) { 311 case -1285004149: // quantity 312 this.quantity = castToQuantity(value); // Quantity 313 return value; 314 case 3242771: // item 315 this.item = castToType(value); // Type 316 return value; 317 default: return super.setProperty(hash, name, value); 318 } 319 320 } 321 322 @Override 323 public Base setProperty(String name, Base value) throws FHIRException { 324 if (name.equals("quantity")) { 325 this.quantity = castToQuantity(value); // Quantity 326 } else if (name.equals("item[x]")) { 327 this.item = castToType(value); // Type 328 } else 329 return super.setProperty(name, value); 330 return value; 331 } 332 333 @Override 334 public Base makeProperty(int hash, String name) throws FHIRException { 335 switch (hash) { 336 case -1285004149: return getQuantity(); 337 case 2116201613: return getItem(); 338 case 3242771: return getItem(); 339 default: return super.makeProperty(hash, name); 340 } 341 342 } 343 344 @Override 345 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 346 switch (hash) { 347 case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"}; 348 case 3242771: /*item*/ return new String[] {"CodeableConcept", "Reference"}; 349 default: return super.getTypesForProperty(hash, name); 350 } 351 352 } 353 354 @Override 355 public Base addChild(String name) throws FHIRException { 356 if (name.equals("quantity")) { 357 this.quantity = new Quantity(); 358 return this.quantity; 359 } 360 else if (name.equals("itemCodeableConcept")) { 361 this.item = new CodeableConcept(); 362 return this.item; 363 } 364 else if (name.equals("itemReference")) { 365 this.item = new Reference(); 366 return this.item; 367 } 368 else 369 return super.addChild(name); 370 } 371 372 public SupplyDeliverySuppliedItemComponent copy() { 373 SupplyDeliverySuppliedItemComponent dst = new SupplyDeliverySuppliedItemComponent(); 374 copyValues(dst); 375 return dst; 376 } 377 378 public void copyValues(SupplyDeliverySuppliedItemComponent dst) { 379 super.copyValues(dst); 380 dst.quantity = quantity == null ? null : quantity.copy(); 381 dst.item = item == null ? null : item.copy(); 382 } 383 384 @Override 385 public boolean equalsDeep(Base other_) { 386 if (!super.equalsDeep(other_)) 387 return false; 388 if (!(other_ instanceof SupplyDeliverySuppliedItemComponent)) 389 return false; 390 SupplyDeliverySuppliedItemComponent o = (SupplyDeliverySuppliedItemComponent) other_; 391 return compareDeep(quantity, o.quantity, true) && compareDeep(item, o.item, true); 392 } 393 394 @Override 395 public boolean equalsShallow(Base other_) { 396 if (!super.equalsShallow(other_)) 397 return false; 398 if (!(other_ instanceof SupplyDeliverySuppliedItemComponent)) 399 return false; 400 SupplyDeliverySuppliedItemComponent o = (SupplyDeliverySuppliedItemComponent) other_; 401 return true; 402 } 403 404 public boolean isEmpty() { 405 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, item); 406 } 407 408 public String fhirType() { 409 return "SupplyDelivery.suppliedItem"; 410 411 } 412 413 } 414 415 /** 416 * Identifier for the supply delivery event that is used to identify it across multiple disparate systems. 417 */ 418 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 419 @Description(shortDefinition="External identifier", formalDefinition="Identifier for the supply delivery event that is used to identify it across multiple disparate systems." ) 420 protected List<Identifier> identifier; 421 422 /** 423 * A plan, proposal or order that is fulfilled in whole or in part by this event. 424 */ 425 @Child(name = "basedOn", type = {SupplyRequest.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 426 @Description(shortDefinition="Fulfills plan, proposal or order", formalDefinition="A plan, proposal or order that is fulfilled in whole or in part by this event." ) 427 protected List<Reference> basedOn; 428 /** 429 * The actual objects that are the target of the reference (A plan, proposal or order that is fulfilled in whole or in part by this event.) 430 */ 431 protected List<SupplyRequest> basedOnTarget; 432 433 434 /** 435 * A larger event of which this particular event is a component or step. 436 */ 437 @Child(name = "partOf", type = {SupplyDelivery.class, Contract.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 438 @Description(shortDefinition="Part of referenced event", formalDefinition="A larger event of which this particular event is a component or step." ) 439 protected List<Reference> partOf; 440 /** 441 * The actual objects that are the target of the reference (A larger event of which this particular event is a component or step.) 442 */ 443 protected List<Resource> partOfTarget; 444 445 446 /** 447 * A code specifying the state of the dispense event. 448 */ 449 @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true) 450 @Description(shortDefinition="in-progress | completed | abandoned | entered-in-error", formalDefinition="A code specifying the state of the dispense event." ) 451 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplydelivery-status") 452 protected Enumeration<SupplyDeliveryStatus> status; 453 454 /** 455 * A link to a resource representing the person whom the delivered item is for. 456 */ 457 @Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=false) 458 @Description(shortDefinition="Patient for whom the item is supplied", formalDefinition="A link to a resource representing the person whom the delivered item is for." ) 459 protected Reference patient; 460 461 /** 462 * The actual object that is the target of the reference (A link to a resource representing the person whom the delivered item is for.) 463 */ 464 protected Patient patientTarget; 465 466 /** 467 * Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc. 468 */ 469 @Child(name = "type", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false) 470 @Description(shortDefinition="Category of dispense event", formalDefinition="Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc." ) 471 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplydelivery-type") 472 protected CodeableConcept type; 473 474 /** 475 * The item that is being delivered or has been supplied. 476 */ 477 @Child(name = "suppliedItem", type = {}, order=6, min=0, max=1, modifier=false, summary=false) 478 @Description(shortDefinition="The item that is delivered or supplied", formalDefinition="The item that is being delivered or has been supplied." ) 479 protected SupplyDeliverySuppliedItemComponent suppliedItem; 480 481 /** 482 * The date or time(s) the activity occurred. 483 */ 484 @Child(name = "occurrence", type = {DateTimeType.class, Period.class, Timing.class}, order=7, min=0, max=1, modifier=false, summary=true) 485 @Description(shortDefinition="When event occurred", formalDefinition="The date or time(s) the activity occurred." ) 486 protected Type occurrence; 487 488 /** 489 * The individual responsible for dispensing the medication, supplier or device. 490 */ 491 @Child(name = "supplier", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=false) 492 @Description(shortDefinition="Dispenser", formalDefinition="The individual responsible for dispensing the medication, supplier or device." ) 493 protected Reference supplier; 494 495 /** 496 * The actual object that is the target of the reference (The individual responsible for dispensing the medication, supplier or device.) 497 */ 498 protected Resource supplierTarget; 499 500 /** 501 * Identification of the facility/location where the Supply was shipped to, as part of the dispense event. 502 */ 503 @Child(name = "destination", type = {Location.class}, order=9, min=0, max=1, modifier=false, summary=false) 504 @Description(shortDefinition="Where the Supply was sent", formalDefinition="Identification of the facility/location where the Supply was shipped to, as part of the dispense event." ) 505 protected Reference destination; 506 507 /** 508 * The actual object that is the target of the reference (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 509 */ 510 protected Location destinationTarget; 511 512 /** 513 * Identifies the person who picked up the Supply. 514 */ 515 @Child(name = "receiver", type = {Practitioner.class, PractitionerRole.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 516 @Description(shortDefinition="Who collected the Supply", formalDefinition="Identifies the person who picked up the Supply." ) 517 protected List<Reference> receiver; 518 /** 519 * The actual objects that are the target of the reference (Identifies the person who picked up the Supply.) 520 */ 521 protected List<Resource> receiverTarget; 522 523 524 private static final long serialVersionUID = -750389806L; 525 526 /** 527 * Constructor 528 */ 529 public SupplyDelivery() { 530 super(); 531 } 532 533 /** 534 * @return {@link #identifier} (Identifier for the supply delivery event that is used to identify it across multiple disparate systems.) 535 */ 536 public List<Identifier> getIdentifier() { 537 if (this.identifier == null) 538 this.identifier = new ArrayList<Identifier>(); 539 return this.identifier; 540 } 541 542 /** 543 * @return Returns a reference to <code>this</code> for easy method chaining 544 */ 545 public SupplyDelivery setIdentifier(List<Identifier> theIdentifier) { 546 this.identifier = theIdentifier; 547 return this; 548 } 549 550 public boolean hasIdentifier() { 551 if (this.identifier == null) 552 return false; 553 for (Identifier item : this.identifier) 554 if (!item.isEmpty()) 555 return true; 556 return false; 557 } 558 559 public Identifier addIdentifier() { //3 560 Identifier t = new Identifier(); 561 if (this.identifier == null) 562 this.identifier = new ArrayList<Identifier>(); 563 this.identifier.add(t); 564 return t; 565 } 566 567 public SupplyDelivery addIdentifier(Identifier t) { //3 568 if (t == null) 569 return this; 570 if (this.identifier == null) 571 this.identifier = new ArrayList<Identifier>(); 572 this.identifier.add(t); 573 return this; 574 } 575 576 /** 577 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 578 */ 579 public Identifier getIdentifierFirstRep() { 580 if (getIdentifier().isEmpty()) { 581 addIdentifier(); 582 } 583 return getIdentifier().get(0); 584 } 585 586 /** 587 * @return {@link #basedOn} (A plan, proposal or order that is fulfilled in whole or in part by this event.) 588 */ 589 public List<Reference> getBasedOn() { 590 if (this.basedOn == null) 591 this.basedOn = new ArrayList<Reference>(); 592 return this.basedOn; 593 } 594 595 /** 596 * @return Returns a reference to <code>this</code> for easy method chaining 597 */ 598 public SupplyDelivery setBasedOn(List<Reference> theBasedOn) { 599 this.basedOn = theBasedOn; 600 return this; 601 } 602 603 public boolean hasBasedOn() { 604 if (this.basedOn == null) 605 return false; 606 for (Reference item : this.basedOn) 607 if (!item.isEmpty()) 608 return true; 609 return false; 610 } 611 612 public Reference addBasedOn() { //3 613 Reference t = new Reference(); 614 if (this.basedOn == null) 615 this.basedOn = new ArrayList<Reference>(); 616 this.basedOn.add(t); 617 return t; 618 } 619 620 public SupplyDelivery addBasedOn(Reference t) { //3 621 if (t == null) 622 return this; 623 if (this.basedOn == null) 624 this.basedOn = new ArrayList<Reference>(); 625 this.basedOn.add(t); 626 return this; 627 } 628 629 /** 630 * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist 631 */ 632 public Reference getBasedOnFirstRep() { 633 if (getBasedOn().isEmpty()) { 634 addBasedOn(); 635 } 636 return getBasedOn().get(0); 637 } 638 639 /** 640 * @deprecated Use Reference#setResource(IBaseResource) instead 641 */ 642 @Deprecated 643 public List<SupplyRequest> getBasedOnTarget() { 644 if (this.basedOnTarget == null) 645 this.basedOnTarget = new ArrayList<SupplyRequest>(); 646 return this.basedOnTarget; 647 } 648 649 /** 650 * @deprecated Use Reference#setResource(IBaseResource) instead 651 */ 652 @Deprecated 653 public SupplyRequest addBasedOnTarget() { 654 SupplyRequest r = new SupplyRequest(); 655 if (this.basedOnTarget == null) 656 this.basedOnTarget = new ArrayList<SupplyRequest>(); 657 this.basedOnTarget.add(r); 658 return r; 659 } 660 661 /** 662 * @return {@link #partOf} (A larger event of which this particular event is a component or step.) 663 */ 664 public List<Reference> getPartOf() { 665 if (this.partOf == null) 666 this.partOf = new ArrayList<Reference>(); 667 return this.partOf; 668 } 669 670 /** 671 * @return Returns a reference to <code>this</code> for easy method chaining 672 */ 673 public SupplyDelivery setPartOf(List<Reference> thePartOf) { 674 this.partOf = thePartOf; 675 return this; 676 } 677 678 public boolean hasPartOf() { 679 if (this.partOf == null) 680 return false; 681 for (Reference item : this.partOf) 682 if (!item.isEmpty()) 683 return true; 684 return false; 685 } 686 687 public Reference addPartOf() { //3 688 Reference t = new Reference(); 689 if (this.partOf == null) 690 this.partOf = new ArrayList<Reference>(); 691 this.partOf.add(t); 692 return t; 693 } 694 695 public SupplyDelivery addPartOf(Reference t) { //3 696 if (t == null) 697 return this; 698 if (this.partOf == null) 699 this.partOf = new ArrayList<Reference>(); 700 this.partOf.add(t); 701 return this; 702 } 703 704 /** 705 * @return The first repetition of repeating field {@link #partOf}, creating it if it does not already exist 706 */ 707 public Reference getPartOfFirstRep() { 708 if (getPartOf().isEmpty()) { 709 addPartOf(); 710 } 711 return getPartOf().get(0); 712 } 713 714 /** 715 * @deprecated Use Reference#setResource(IBaseResource) instead 716 */ 717 @Deprecated 718 public List<Resource> getPartOfTarget() { 719 if (this.partOfTarget == null) 720 this.partOfTarget = new ArrayList<Resource>(); 721 return this.partOfTarget; 722 } 723 724 /** 725 * @return {@link #status} (A code specifying the state of the dispense event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 726 */ 727 public Enumeration<SupplyDeliveryStatus> getStatusElement() { 728 if (this.status == null) 729 if (Configuration.errorOnAutoCreate()) 730 throw new Error("Attempt to auto-create SupplyDelivery.status"); 731 else if (Configuration.doAutoCreate()) 732 this.status = new Enumeration<SupplyDeliveryStatus>(new SupplyDeliveryStatusEnumFactory()); // bb 733 return this.status; 734 } 735 736 public boolean hasStatusElement() { 737 return this.status != null && !this.status.isEmpty(); 738 } 739 740 public boolean hasStatus() { 741 return this.status != null && !this.status.isEmpty(); 742 } 743 744 /** 745 * @param value {@link #status} (A code specifying the state of the dispense event.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 746 */ 747 public SupplyDelivery setStatusElement(Enumeration<SupplyDeliveryStatus> value) { 748 this.status = value; 749 return this; 750 } 751 752 /** 753 * @return A code specifying the state of the dispense event. 754 */ 755 public SupplyDeliveryStatus getStatus() { 756 return this.status == null ? null : this.status.getValue(); 757 } 758 759 /** 760 * @param value A code specifying the state of the dispense event. 761 */ 762 public SupplyDelivery setStatus(SupplyDeliveryStatus value) { 763 if (value == null) 764 this.status = null; 765 else { 766 if (this.status == null) 767 this.status = new Enumeration<SupplyDeliveryStatus>(new SupplyDeliveryStatusEnumFactory()); 768 this.status.setValue(value); 769 } 770 return this; 771 } 772 773 /** 774 * @return {@link #patient} (A link to a resource representing the person whom the delivered item is for.) 775 */ 776 public Reference getPatient() { 777 if (this.patient == null) 778 if (Configuration.errorOnAutoCreate()) 779 throw new Error("Attempt to auto-create SupplyDelivery.patient"); 780 else if (Configuration.doAutoCreate()) 781 this.patient = new Reference(); // cc 782 return this.patient; 783 } 784 785 public boolean hasPatient() { 786 return this.patient != null && !this.patient.isEmpty(); 787 } 788 789 /** 790 * @param value {@link #patient} (A link to a resource representing the person whom the delivered item is for.) 791 */ 792 public SupplyDelivery setPatient(Reference value) { 793 this.patient = value; 794 return this; 795 } 796 797 /** 798 * @return {@link #patient} 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. (A link to a resource representing the person whom the delivered item is for.) 799 */ 800 public Patient getPatientTarget() { 801 if (this.patientTarget == null) 802 if (Configuration.errorOnAutoCreate()) 803 throw new Error("Attempt to auto-create SupplyDelivery.patient"); 804 else if (Configuration.doAutoCreate()) 805 this.patientTarget = new Patient(); // aa 806 return this.patientTarget; 807 } 808 809 /** 810 * @param value {@link #patient} 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. (A link to a resource representing the person whom the delivered item is for.) 811 */ 812 public SupplyDelivery setPatientTarget(Patient value) { 813 this.patientTarget = value; 814 return this; 815 } 816 817 /** 818 * @return {@link #type} (Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.) 819 */ 820 public CodeableConcept getType() { 821 if (this.type == null) 822 if (Configuration.errorOnAutoCreate()) 823 throw new Error("Attempt to auto-create SupplyDelivery.type"); 824 else if (Configuration.doAutoCreate()) 825 this.type = new CodeableConcept(); // cc 826 return this.type; 827 } 828 829 public boolean hasType() { 830 return this.type != null && !this.type.isEmpty(); 831 } 832 833 /** 834 * @param value {@link #type} (Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.) 835 */ 836 public SupplyDelivery setType(CodeableConcept value) { 837 this.type = value; 838 return this; 839 } 840 841 /** 842 * @return {@link #suppliedItem} (The item that is being delivered or has been supplied.) 843 */ 844 public SupplyDeliverySuppliedItemComponent getSuppliedItem() { 845 if (this.suppliedItem == null) 846 if (Configuration.errorOnAutoCreate()) 847 throw new Error("Attempt to auto-create SupplyDelivery.suppliedItem"); 848 else if (Configuration.doAutoCreate()) 849 this.suppliedItem = new SupplyDeliverySuppliedItemComponent(); // cc 850 return this.suppliedItem; 851 } 852 853 public boolean hasSuppliedItem() { 854 return this.suppliedItem != null && !this.suppliedItem.isEmpty(); 855 } 856 857 /** 858 * @param value {@link #suppliedItem} (The item that is being delivered or has been supplied.) 859 */ 860 public SupplyDelivery setSuppliedItem(SupplyDeliverySuppliedItemComponent value) { 861 this.suppliedItem = value; 862 return this; 863 } 864 865 /** 866 * @return {@link #occurrence} (The date or time(s) the activity occurred.) 867 */ 868 public Type getOccurrence() { 869 return this.occurrence; 870 } 871 872 /** 873 * @return {@link #occurrence} (The date or time(s) the activity occurred.) 874 */ 875 public DateTimeType getOccurrenceDateTimeType() throws FHIRException { 876 if (this.occurrence == null) 877 this.occurrence = new DateTimeType(); 878 if (!(this.occurrence instanceof DateTimeType)) 879 throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.occurrence.getClass().getName()+" was encountered"); 880 return (DateTimeType) this.occurrence; 881 } 882 883 public boolean hasOccurrenceDateTimeType() { 884 return this != null && this.occurrence instanceof DateTimeType; 885 } 886 887 /** 888 * @return {@link #occurrence} (The date or time(s) the activity occurred.) 889 */ 890 public Period getOccurrencePeriod() throws FHIRException { 891 if (this.occurrence == null) 892 this.occurrence = new Period(); 893 if (!(this.occurrence instanceof Period)) 894 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.occurrence.getClass().getName()+" was encountered"); 895 return (Period) this.occurrence; 896 } 897 898 public boolean hasOccurrencePeriod() { 899 return this != null && this.occurrence instanceof Period; 900 } 901 902 /** 903 * @return {@link #occurrence} (The date or time(s) the activity occurred.) 904 */ 905 public Timing getOccurrenceTiming() throws FHIRException { 906 if (this.occurrence == null) 907 this.occurrence = new Timing(); 908 if (!(this.occurrence instanceof Timing)) 909 throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.occurrence.getClass().getName()+" was encountered"); 910 return (Timing) this.occurrence; 911 } 912 913 public boolean hasOccurrenceTiming() { 914 return this != null && this.occurrence instanceof Timing; 915 } 916 917 public boolean hasOccurrence() { 918 return this.occurrence != null && !this.occurrence.isEmpty(); 919 } 920 921 /** 922 * @param value {@link #occurrence} (The date or time(s) the activity occurred.) 923 */ 924 public SupplyDelivery setOccurrence(Type value) { 925 if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Timing)) 926 throw new Error("Not the right type for SupplyDelivery.occurrence[x]: "+value.fhirType()); 927 this.occurrence = value; 928 return this; 929 } 930 931 /** 932 * @return {@link #supplier} (The individual responsible for dispensing the medication, supplier or device.) 933 */ 934 public Reference getSupplier() { 935 if (this.supplier == null) 936 if (Configuration.errorOnAutoCreate()) 937 throw new Error("Attempt to auto-create SupplyDelivery.supplier"); 938 else if (Configuration.doAutoCreate()) 939 this.supplier = new Reference(); // cc 940 return this.supplier; 941 } 942 943 public boolean hasSupplier() { 944 return this.supplier != null && !this.supplier.isEmpty(); 945 } 946 947 /** 948 * @param value {@link #supplier} (The individual responsible for dispensing the medication, supplier or device.) 949 */ 950 public SupplyDelivery setSupplier(Reference value) { 951 this.supplier = value; 952 return this; 953 } 954 955 /** 956 * @return {@link #supplier} 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. (The individual responsible for dispensing the medication, supplier or device.) 957 */ 958 public Resource getSupplierTarget() { 959 return this.supplierTarget; 960 } 961 962 /** 963 * @param value {@link #supplier} 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. (The individual responsible for dispensing the medication, supplier or device.) 964 */ 965 public SupplyDelivery setSupplierTarget(Resource value) { 966 this.supplierTarget = value; 967 return this; 968 } 969 970 /** 971 * @return {@link #destination} (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 972 */ 973 public Reference getDestination() { 974 if (this.destination == null) 975 if (Configuration.errorOnAutoCreate()) 976 throw new Error("Attempt to auto-create SupplyDelivery.destination"); 977 else if (Configuration.doAutoCreate()) 978 this.destination = new Reference(); // cc 979 return this.destination; 980 } 981 982 public boolean hasDestination() { 983 return this.destination != null && !this.destination.isEmpty(); 984 } 985 986 /** 987 * @param value {@link #destination} (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 988 */ 989 public SupplyDelivery setDestination(Reference value) { 990 this.destination = value; 991 return this; 992 } 993 994 /** 995 * @return {@link #destination} 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. (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 996 */ 997 public Location getDestinationTarget() { 998 if (this.destinationTarget == null) 999 if (Configuration.errorOnAutoCreate()) 1000 throw new Error("Attempt to auto-create SupplyDelivery.destination"); 1001 else if (Configuration.doAutoCreate()) 1002 this.destinationTarget = new Location(); // aa 1003 return this.destinationTarget; 1004 } 1005 1006 /** 1007 * @param value {@link #destination} 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. (Identification of the facility/location where the Supply was shipped to, as part of the dispense event.) 1008 */ 1009 public SupplyDelivery setDestinationTarget(Location value) { 1010 this.destinationTarget = value; 1011 return this; 1012 } 1013 1014 /** 1015 * @return {@link #receiver} (Identifies the person who picked up the Supply.) 1016 */ 1017 public List<Reference> getReceiver() { 1018 if (this.receiver == null) 1019 this.receiver = new ArrayList<Reference>(); 1020 return this.receiver; 1021 } 1022 1023 /** 1024 * @return Returns a reference to <code>this</code> for easy method chaining 1025 */ 1026 public SupplyDelivery setReceiver(List<Reference> theReceiver) { 1027 this.receiver = theReceiver; 1028 return this; 1029 } 1030 1031 public boolean hasReceiver() { 1032 if (this.receiver == null) 1033 return false; 1034 for (Reference item : this.receiver) 1035 if (!item.isEmpty()) 1036 return true; 1037 return false; 1038 } 1039 1040 public Reference addReceiver() { //3 1041 Reference t = new Reference(); 1042 if (this.receiver == null) 1043 this.receiver = new ArrayList<Reference>(); 1044 this.receiver.add(t); 1045 return t; 1046 } 1047 1048 public SupplyDelivery addReceiver(Reference t) { //3 1049 if (t == null) 1050 return this; 1051 if (this.receiver == null) 1052 this.receiver = new ArrayList<Reference>(); 1053 this.receiver.add(t); 1054 return this; 1055 } 1056 1057 /** 1058 * @return The first repetition of repeating field {@link #receiver}, creating it if it does not already exist 1059 */ 1060 public Reference getReceiverFirstRep() { 1061 if (getReceiver().isEmpty()) { 1062 addReceiver(); 1063 } 1064 return getReceiver().get(0); 1065 } 1066 1067 /** 1068 * @deprecated Use Reference#setResource(IBaseResource) instead 1069 */ 1070 @Deprecated 1071 public List<Resource> getReceiverTarget() { 1072 if (this.receiverTarget == null) 1073 this.receiverTarget = new ArrayList<Resource>(); 1074 return this.receiverTarget; 1075 } 1076 1077 protected void listChildren(List<Property> children) { 1078 super.listChildren(children); 1079 children.add(new Property("identifier", "Identifier", "Identifier for the supply delivery event that is used to identify it across multiple disparate systems.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1080 children.add(new Property("basedOn", "Reference(SupplyRequest)", "A plan, proposal or order that is fulfilled in whole or in part by this event.", 0, java.lang.Integer.MAX_VALUE, basedOn)); 1081 children.add(new Property("partOf", "Reference(SupplyDelivery|Contract)", "A larger event of which this particular event is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf)); 1082 children.add(new Property("status", "code", "A code specifying the state of the dispense event.", 0, 1, status)); 1083 children.add(new Property("patient", "Reference(Patient)", "A link to a resource representing the person whom the delivered item is for.", 0, 1, patient)); 1084 children.add(new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.", 0, 1, type)); 1085 children.add(new Property("suppliedItem", "", "The item that is being delivered or has been supplied.", 0, 1, suppliedItem)); 1086 children.add(new Property("occurrence[x]", "dateTime|Period|Timing", "The date or time(s) the activity occurred.", 0, 1, occurrence)); 1087 children.add(new Property("supplier", "Reference(Practitioner|PractitionerRole|Organization)", "The individual responsible for dispensing the medication, supplier or device.", 0, 1, supplier)); 1088 children.add(new Property("destination", "Reference(Location)", "Identification of the facility/location where the Supply was shipped to, as part of the dispense event.", 0, 1, destination)); 1089 children.add(new Property("receiver", "Reference(Practitioner|PractitionerRole)", "Identifies the person who picked up the Supply.", 0, java.lang.Integer.MAX_VALUE, receiver)); 1090 } 1091 1092 @Override 1093 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1094 switch (_hash) { 1095 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Identifier for the supply delivery event that is used to identify it across multiple disparate systems.", 0, java.lang.Integer.MAX_VALUE, identifier); 1096 case -332612366: /*basedOn*/ return new Property("basedOn", "Reference(SupplyRequest)", "A plan, proposal or order that is fulfilled in whole or in part by this event.", 0, java.lang.Integer.MAX_VALUE, basedOn); 1097 case -995410646: /*partOf*/ return new Property("partOf", "Reference(SupplyDelivery|Contract)", "A larger event of which this particular event is a component or step.", 0, java.lang.Integer.MAX_VALUE, partOf); 1098 case -892481550: /*status*/ return new Property("status", "code", "A code specifying the state of the dispense event.", 0, 1, status); 1099 case -791418107: /*patient*/ return new Property("patient", "Reference(Patient)", "A link to a resource representing the person whom the delivered item is for.", 0, 1, patient); 1100 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.", 0, 1, type); 1101 case 1993333233: /*suppliedItem*/ return new Property("suppliedItem", "", "The item that is being delivered or has been supplied.", 0, 1, suppliedItem); 1102 case -2022646513: /*occurrence[x]*/ return new Property("occurrence[x]", "dateTime|Period|Timing", "The date or time(s) the activity occurred.", 0, 1, occurrence); 1103 case 1687874001: /*occurrence*/ return new Property("occurrence[x]", "dateTime|Period|Timing", "The date or time(s) the activity occurred.", 0, 1, occurrence); 1104 case -298443636: /*occurrenceDateTime*/ return new Property("occurrence[x]", "dateTime|Period|Timing", "The date or time(s) the activity occurred.", 0, 1, occurrence); 1105 case 1397156594: /*occurrencePeriod*/ return new Property("occurrence[x]", "dateTime|Period|Timing", "The date or time(s) the activity occurred.", 0, 1, occurrence); 1106 case 1515218299: /*occurrenceTiming*/ return new Property("occurrence[x]", "dateTime|Period|Timing", "The date or time(s) the activity occurred.", 0, 1, occurrence); 1107 case -1663305268: /*supplier*/ return new Property("supplier", "Reference(Practitioner|PractitionerRole|Organization)", "The individual responsible for dispensing the medication, supplier or device.", 0, 1, supplier); 1108 case -1429847026: /*destination*/ return new Property("destination", "Reference(Location)", "Identification of the facility/location where the Supply was shipped to, as part of the dispense event.", 0, 1, destination); 1109 case -808719889: /*receiver*/ return new Property("receiver", "Reference(Practitioner|PractitionerRole)", "Identifies the person who picked up the Supply.", 0, java.lang.Integer.MAX_VALUE, receiver); 1110 default: return super.getNamedProperty(_hash, _name, _checkValid); 1111 } 1112 1113 } 1114 1115 @Override 1116 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1117 switch (hash) { 1118 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1119 case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference 1120 case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : this.partOf.toArray(new Base[this.partOf.size()]); // Reference 1121 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<SupplyDeliveryStatus> 1122 case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference 1123 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 1124 case 1993333233: /*suppliedItem*/ return this.suppliedItem == null ? new Base[0] : new Base[] {this.suppliedItem}; // SupplyDeliverySuppliedItemComponent 1125 case 1687874001: /*occurrence*/ return this.occurrence == null ? new Base[0] : new Base[] {this.occurrence}; // Type 1126 case -1663305268: /*supplier*/ return this.supplier == null ? new Base[0] : new Base[] {this.supplier}; // Reference 1127 case -1429847026: /*destination*/ return this.destination == null ? new Base[0] : new Base[] {this.destination}; // Reference 1128 case -808719889: /*receiver*/ return this.receiver == null ? new Base[0] : this.receiver.toArray(new Base[this.receiver.size()]); // Reference 1129 default: return super.getProperty(hash, name, checkValid); 1130 } 1131 1132 } 1133 1134 @Override 1135 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1136 switch (hash) { 1137 case -1618432855: // identifier 1138 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1139 return value; 1140 case -332612366: // basedOn 1141 this.getBasedOn().add(castToReference(value)); // Reference 1142 return value; 1143 case -995410646: // partOf 1144 this.getPartOf().add(castToReference(value)); // Reference 1145 return value; 1146 case -892481550: // status 1147 value = new SupplyDeliveryStatusEnumFactory().fromType(castToCode(value)); 1148 this.status = (Enumeration) value; // Enumeration<SupplyDeliveryStatus> 1149 return value; 1150 case -791418107: // patient 1151 this.patient = castToReference(value); // Reference 1152 return value; 1153 case 3575610: // type 1154 this.type = castToCodeableConcept(value); // CodeableConcept 1155 return value; 1156 case 1993333233: // suppliedItem 1157 this.suppliedItem = (SupplyDeliverySuppliedItemComponent) value; // SupplyDeliverySuppliedItemComponent 1158 return value; 1159 case 1687874001: // occurrence 1160 this.occurrence = castToType(value); // Type 1161 return value; 1162 case -1663305268: // supplier 1163 this.supplier = castToReference(value); // Reference 1164 return value; 1165 case -1429847026: // destination 1166 this.destination = castToReference(value); // Reference 1167 return value; 1168 case -808719889: // receiver 1169 this.getReceiver().add(castToReference(value)); // Reference 1170 return value; 1171 default: return super.setProperty(hash, name, value); 1172 } 1173 1174 } 1175 1176 @Override 1177 public Base setProperty(String name, Base value) throws FHIRException { 1178 if (name.equals("identifier")) { 1179 this.getIdentifier().add(castToIdentifier(value)); 1180 } else if (name.equals("basedOn")) { 1181 this.getBasedOn().add(castToReference(value)); 1182 } else if (name.equals("partOf")) { 1183 this.getPartOf().add(castToReference(value)); 1184 } else if (name.equals("status")) { 1185 value = new SupplyDeliveryStatusEnumFactory().fromType(castToCode(value)); 1186 this.status = (Enumeration) value; // Enumeration<SupplyDeliveryStatus> 1187 } else if (name.equals("patient")) { 1188 this.patient = castToReference(value); // Reference 1189 } else if (name.equals("type")) { 1190 this.type = castToCodeableConcept(value); // CodeableConcept 1191 } else if (name.equals("suppliedItem")) { 1192 this.suppliedItem = (SupplyDeliverySuppliedItemComponent) value; // SupplyDeliverySuppliedItemComponent 1193 } else if (name.equals("occurrence[x]")) { 1194 this.occurrence = castToType(value); // Type 1195 } else if (name.equals("supplier")) { 1196 this.supplier = castToReference(value); // Reference 1197 } else if (name.equals("destination")) { 1198 this.destination = castToReference(value); // Reference 1199 } else if (name.equals("receiver")) { 1200 this.getReceiver().add(castToReference(value)); 1201 } else 1202 return super.setProperty(name, value); 1203 return value; 1204 } 1205 1206 @Override 1207 public Base makeProperty(int hash, String name) throws FHIRException { 1208 switch (hash) { 1209 case -1618432855: return addIdentifier(); 1210 case -332612366: return addBasedOn(); 1211 case -995410646: return addPartOf(); 1212 case -892481550: return getStatusElement(); 1213 case -791418107: return getPatient(); 1214 case 3575610: return getType(); 1215 case 1993333233: return getSuppliedItem(); 1216 case -2022646513: return getOccurrence(); 1217 case 1687874001: return getOccurrence(); 1218 case -1663305268: return getSupplier(); 1219 case -1429847026: return getDestination(); 1220 case -808719889: return addReceiver(); 1221 default: return super.makeProperty(hash, name); 1222 } 1223 1224 } 1225 1226 @Override 1227 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1228 switch (hash) { 1229 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1230 case -332612366: /*basedOn*/ return new String[] {"Reference"}; 1231 case -995410646: /*partOf*/ return new String[] {"Reference"}; 1232 case -892481550: /*status*/ return new String[] {"code"}; 1233 case -791418107: /*patient*/ return new String[] {"Reference"}; 1234 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 1235 case 1993333233: /*suppliedItem*/ return new String[] {}; 1236 case 1687874001: /*occurrence*/ return new String[] {"dateTime", "Period", "Timing"}; 1237 case -1663305268: /*supplier*/ return new String[] {"Reference"}; 1238 case -1429847026: /*destination*/ return new String[] {"Reference"}; 1239 case -808719889: /*receiver*/ return new String[] {"Reference"}; 1240 default: return super.getTypesForProperty(hash, name); 1241 } 1242 1243 } 1244 1245 @Override 1246 public Base addChild(String name) throws FHIRException { 1247 if (name.equals("identifier")) { 1248 return addIdentifier(); 1249 } 1250 else if (name.equals("basedOn")) { 1251 return addBasedOn(); 1252 } 1253 else if (name.equals("partOf")) { 1254 return addPartOf(); 1255 } 1256 else if (name.equals("status")) { 1257 throw new FHIRException("Cannot call addChild on a primitive type SupplyDelivery.status"); 1258 } 1259 else if (name.equals("patient")) { 1260 this.patient = new Reference(); 1261 return this.patient; 1262 } 1263 else if (name.equals("type")) { 1264 this.type = new CodeableConcept(); 1265 return this.type; 1266 } 1267 else if (name.equals("suppliedItem")) { 1268 this.suppliedItem = new SupplyDeliverySuppliedItemComponent(); 1269 return this.suppliedItem; 1270 } 1271 else if (name.equals("occurrenceDateTime")) { 1272 this.occurrence = new DateTimeType(); 1273 return this.occurrence; 1274 } 1275 else if (name.equals("occurrencePeriod")) { 1276 this.occurrence = new Period(); 1277 return this.occurrence; 1278 } 1279 else if (name.equals("occurrenceTiming")) { 1280 this.occurrence = new Timing(); 1281 return this.occurrence; 1282 } 1283 else if (name.equals("supplier")) { 1284 this.supplier = new Reference(); 1285 return this.supplier; 1286 } 1287 else if (name.equals("destination")) { 1288 this.destination = new Reference(); 1289 return this.destination; 1290 } 1291 else if (name.equals("receiver")) { 1292 return addReceiver(); 1293 } 1294 else 1295 return super.addChild(name); 1296 } 1297 1298 public String fhirType() { 1299 return "SupplyDelivery"; 1300 1301 } 1302 1303 public SupplyDelivery copy() { 1304 SupplyDelivery dst = new SupplyDelivery(); 1305 copyValues(dst); 1306 return dst; 1307 } 1308 1309 public void copyValues(SupplyDelivery dst) { 1310 super.copyValues(dst); 1311 if (identifier != null) { 1312 dst.identifier = new ArrayList<Identifier>(); 1313 for (Identifier i : identifier) 1314 dst.identifier.add(i.copy()); 1315 }; 1316 if (basedOn != null) { 1317 dst.basedOn = new ArrayList<Reference>(); 1318 for (Reference i : basedOn) 1319 dst.basedOn.add(i.copy()); 1320 }; 1321 if (partOf != null) { 1322 dst.partOf = new ArrayList<Reference>(); 1323 for (Reference i : partOf) 1324 dst.partOf.add(i.copy()); 1325 }; 1326 dst.status = status == null ? null : status.copy(); 1327 dst.patient = patient == null ? null : patient.copy(); 1328 dst.type = type == null ? null : type.copy(); 1329 dst.suppliedItem = suppliedItem == null ? null : suppliedItem.copy(); 1330 dst.occurrence = occurrence == null ? null : occurrence.copy(); 1331 dst.supplier = supplier == null ? null : supplier.copy(); 1332 dst.destination = destination == null ? null : destination.copy(); 1333 if (receiver != null) { 1334 dst.receiver = new ArrayList<Reference>(); 1335 for (Reference i : receiver) 1336 dst.receiver.add(i.copy()); 1337 }; 1338 } 1339 1340 protected SupplyDelivery typedCopy() { 1341 return copy(); 1342 } 1343 1344 @Override 1345 public boolean equalsDeep(Base other_) { 1346 if (!super.equalsDeep(other_)) 1347 return false; 1348 if (!(other_ instanceof SupplyDelivery)) 1349 return false; 1350 SupplyDelivery o = (SupplyDelivery) other_; 1351 return compareDeep(identifier, o.identifier, true) && compareDeep(basedOn, o.basedOn, true) && compareDeep(partOf, o.partOf, true) 1352 && compareDeep(status, o.status, true) && compareDeep(patient, o.patient, true) && compareDeep(type, o.type, true) 1353 && compareDeep(suppliedItem, o.suppliedItem, true) && compareDeep(occurrence, o.occurrence, true) 1354 && compareDeep(supplier, o.supplier, true) && compareDeep(destination, o.destination, true) && compareDeep(receiver, o.receiver, true) 1355 ; 1356 } 1357 1358 @Override 1359 public boolean equalsShallow(Base other_) { 1360 if (!super.equalsShallow(other_)) 1361 return false; 1362 if (!(other_ instanceof SupplyDelivery)) 1363 return false; 1364 SupplyDelivery o = (SupplyDelivery) other_; 1365 return compareValues(status, o.status, true); 1366 } 1367 1368 public boolean isEmpty() { 1369 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, basedOn, partOf 1370 , status, patient, type, suppliedItem, occurrence, supplier, destination, receiver 1371 ); 1372 } 1373 1374 @Override 1375 public ResourceType getResourceType() { 1376 return ResourceType.SupplyDelivery; 1377 } 1378 1379 /** 1380 * Search parameter: <b>identifier</b> 1381 * <p> 1382 * Description: <b>External identifier</b><br> 1383 * Type: <b>token</b><br> 1384 * Path: <b>SupplyDelivery.identifier</b><br> 1385 * </p> 1386 */ 1387 @SearchParamDefinition(name="identifier", path="SupplyDelivery.identifier", description="External identifier", type="token" ) 1388 public static final String SP_IDENTIFIER = "identifier"; 1389 /** 1390 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1391 * <p> 1392 * Description: <b>External identifier</b><br> 1393 * Type: <b>token</b><br> 1394 * Path: <b>SupplyDelivery.identifier</b><br> 1395 * </p> 1396 */ 1397 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1398 1399 /** 1400 * Search parameter: <b>receiver</b> 1401 * <p> 1402 * Description: <b>Who collected the Supply</b><br> 1403 * Type: <b>reference</b><br> 1404 * Path: <b>SupplyDelivery.receiver</b><br> 1405 * </p> 1406 */ 1407 @SearchParamDefinition(name="receiver", path="SupplyDelivery.receiver", description="Who collected the Supply", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class, PractitionerRole.class } ) 1408 public static final String SP_RECEIVER = "receiver"; 1409 /** 1410 * <b>Fluent Client</b> search parameter constant for <b>receiver</b> 1411 * <p> 1412 * Description: <b>Who collected the Supply</b><br> 1413 * Type: <b>reference</b><br> 1414 * Path: <b>SupplyDelivery.receiver</b><br> 1415 * </p> 1416 */ 1417 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECEIVER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_RECEIVER); 1418 1419/** 1420 * Constant for fluent queries to be used to add include statements. Specifies 1421 * the path value of "<b>SupplyDelivery:receiver</b>". 1422 */ 1423 public static final ca.uhn.fhir.model.api.Include INCLUDE_RECEIVER = new ca.uhn.fhir.model.api.Include("SupplyDelivery:receiver").toLocked(); 1424 1425 /** 1426 * Search parameter: <b>patient</b> 1427 * <p> 1428 * Description: <b>Patient for whom the item is supplied</b><br> 1429 * Type: <b>reference</b><br> 1430 * Path: <b>SupplyDelivery.patient</b><br> 1431 * </p> 1432 */ 1433 @SearchParamDefinition(name="patient", path="SupplyDelivery.patient", description="Patient for whom the item is supplied", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } ) 1434 public static final String SP_PATIENT = "patient"; 1435 /** 1436 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 1437 * <p> 1438 * Description: <b>Patient for whom the item is supplied</b><br> 1439 * Type: <b>reference</b><br> 1440 * Path: <b>SupplyDelivery.patient</b><br> 1441 * </p> 1442 */ 1443 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 1444 1445/** 1446 * Constant for fluent queries to be used to add include statements. Specifies 1447 * the path value of "<b>SupplyDelivery:patient</b>". 1448 */ 1449 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("SupplyDelivery:patient").toLocked(); 1450 1451 /** 1452 * Search parameter: <b>supplier</b> 1453 * <p> 1454 * Description: <b>Dispenser</b><br> 1455 * Type: <b>reference</b><br> 1456 * Path: <b>SupplyDelivery.supplier</b><br> 1457 * </p> 1458 */ 1459 @SearchParamDefinition(name="supplier", path="SupplyDelivery.supplier", description="Dispenser", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Organization.class, Practitioner.class, PractitionerRole.class } ) 1460 public static final String SP_SUPPLIER = "supplier"; 1461 /** 1462 * <b>Fluent Client</b> search parameter constant for <b>supplier</b> 1463 * <p> 1464 * Description: <b>Dispenser</b><br> 1465 * Type: <b>reference</b><br> 1466 * Path: <b>SupplyDelivery.supplier</b><br> 1467 * </p> 1468 */ 1469 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUPPLIER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUPPLIER); 1470 1471/** 1472 * Constant for fluent queries to be used to add include statements. Specifies 1473 * the path value of "<b>SupplyDelivery:supplier</b>". 1474 */ 1475 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUPPLIER = new ca.uhn.fhir.model.api.Include("SupplyDelivery:supplier").toLocked(); 1476 1477 /** 1478 * Search parameter: <b>status</b> 1479 * <p> 1480 * Description: <b>in-progress | completed | abandoned | entered-in-error</b><br> 1481 * Type: <b>token</b><br> 1482 * Path: <b>SupplyDelivery.status</b><br> 1483 * </p> 1484 */ 1485 @SearchParamDefinition(name="status", path="SupplyDelivery.status", description="in-progress | completed | abandoned | entered-in-error", type="token" ) 1486 public static final String SP_STATUS = "status"; 1487 /** 1488 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1489 * <p> 1490 * Description: <b>in-progress | completed | abandoned | entered-in-error</b><br> 1491 * Type: <b>token</b><br> 1492 * Path: <b>SupplyDelivery.status</b><br> 1493 * </p> 1494 */ 1495 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1496 1497 1498}