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