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