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