001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 033import java.util.ArrayList; 034import java.util.Date; 035import java.util.List; 036 037import org.hl7.fhir.exceptions.FHIRException; 038import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 039 040import ca.uhn.fhir.model.api.annotation.Block; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.Description; 043import ca.uhn.fhir.model.api.annotation.ResourceDef; 044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 045/** 046 * A request to perform an action. 047 */ 048@ResourceDef(name="Order", profile="http://hl7.org/fhir/Profile/Order") 049public class Order extends DomainResource { 050 051 @Block() 052 public static class OrderWhenComponent extends BackboneElement implements IBaseBackboneElement { 053 /** 054 * Code specifies when request should be done. The code may simply be a priority code. 055 */ 056 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 057 @Description(shortDefinition="Code specifies when request should be done. The code may simply be a priority code", formalDefinition="Code specifies when request should be done. The code may simply be a priority code." ) 058 protected CodeableConcept code; 059 060 /** 061 * A formal schedule. 062 */ 063 @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=1, modifier=false, summary=true) 064 @Description(shortDefinition="A formal schedule", formalDefinition="A formal schedule." ) 065 protected Timing schedule; 066 067 private static final long serialVersionUID = 307115287L; 068 069 /** 070 * Constructor 071 */ 072 public OrderWhenComponent() { 073 super(); 074 } 075 076 /** 077 * @return {@link #code} (Code specifies when request should be done. The code may simply be a priority code.) 078 */ 079 public CodeableConcept getCode() { 080 if (this.code == null) 081 if (Configuration.errorOnAutoCreate()) 082 throw new Error("Attempt to auto-create OrderWhenComponent.code"); 083 else if (Configuration.doAutoCreate()) 084 this.code = new CodeableConcept(); // cc 085 return this.code; 086 } 087 088 public boolean hasCode() { 089 return this.code != null && !this.code.isEmpty(); 090 } 091 092 /** 093 * @param value {@link #code} (Code specifies when request should be done. The code may simply be a priority code.) 094 */ 095 public OrderWhenComponent setCode(CodeableConcept value) { 096 this.code = value; 097 return this; 098 } 099 100 /** 101 * @return {@link #schedule} (A formal schedule.) 102 */ 103 public Timing getSchedule() { 104 if (this.schedule == null) 105 if (Configuration.errorOnAutoCreate()) 106 throw new Error("Attempt to auto-create OrderWhenComponent.schedule"); 107 else if (Configuration.doAutoCreate()) 108 this.schedule = new Timing(); // cc 109 return this.schedule; 110 } 111 112 public boolean hasSchedule() { 113 return this.schedule != null && !this.schedule.isEmpty(); 114 } 115 116 /** 117 * @param value {@link #schedule} (A formal schedule.) 118 */ 119 public OrderWhenComponent setSchedule(Timing value) { 120 this.schedule = value; 121 return this; 122 } 123 124 protected void listChildren(List<Property> childrenList) { 125 super.listChildren(childrenList); 126 childrenList.add(new Property("code", "CodeableConcept", "Code specifies when request should be done. The code may simply be a priority code.", 0, java.lang.Integer.MAX_VALUE, code)); 127 childrenList.add(new Property("schedule", "Timing", "A formal schedule.", 0, java.lang.Integer.MAX_VALUE, schedule)); 128 } 129 130 @Override 131 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 132 switch (hash) { 133 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 134 case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // Timing 135 default: return super.getProperty(hash, name, checkValid); 136 } 137 138 } 139 140 @Override 141 public void setProperty(int hash, String name, Base value) throws FHIRException { 142 switch (hash) { 143 case 3059181: // code 144 this.code = castToCodeableConcept(value); // CodeableConcept 145 break; 146 case -697920873: // schedule 147 this.schedule = castToTiming(value); // Timing 148 break; 149 default: super.setProperty(hash, name, value); 150 } 151 152 } 153 154 @Override 155 public void setProperty(String name, Base value) throws FHIRException { 156 if (name.equals("code")) 157 this.code = castToCodeableConcept(value); // CodeableConcept 158 else if (name.equals("schedule")) 159 this.schedule = castToTiming(value); // Timing 160 else 161 super.setProperty(name, value); 162 } 163 164 @Override 165 public Base makeProperty(int hash, String name) throws FHIRException { 166 switch (hash) { 167 case 3059181: return getCode(); // CodeableConcept 168 case -697920873: return getSchedule(); // Timing 169 default: return super.makeProperty(hash, name); 170 } 171 172 } 173 174 @Override 175 public Base addChild(String name) throws FHIRException { 176 if (name.equals("code")) { 177 this.code = new CodeableConcept(); 178 return this.code; 179 } 180 else if (name.equals("schedule")) { 181 this.schedule = new Timing(); 182 return this.schedule; 183 } 184 else 185 return super.addChild(name); 186 } 187 188 public OrderWhenComponent copy() { 189 OrderWhenComponent dst = new OrderWhenComponent(); 190 copyValues(dst); 191 dst.code = code == null ? null : code.copy(); 192 dst.schedule = schedule == null ? null : schedule.copy(); 193 return dst; 194 } 195 196 @Override 197 public boolean equalsDeep(Base other) { 198 if (!super.equalsDeep(other)) 199 return false; 200 if (!(other instanceof OrderWhenComponent)) 201 return false; 202 OrderWhenComponent o = (OrderWhenComponent) other; 203 return compareDeep(code, o.code, true) && compareDeep(schedule, o.schedule, true); 204 } 205 206 @Override 207 public boolean equalsShallow(Base other) { 208 if (!super.equalsShallow(other)) 209 return false; 210 if (!(other instanceof OrderWhenComponent)) 211 return false; 212 OrderWhenComponent o = (OrderWhenComponent) other; 213 return true; 214 } 215 216 public boolean isEmpty() { 217 return super.isEmpty() && (code == null || code.isEmpty()) && (schedule == null || schedule.isEmpty()) 218 ; 219 } 220 221 public String fhirType() { 222 return "Order.when"; 223 224 } 225 226 } 227 228 /** 229 * Identifiers assigned to this order by the orderer or by the receiver. 230 */ 231 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 232 @Description(shortDefinition="Identifiers assigned to this order by the orderer or by the receiver", formalDefinition="Identifiers assigned to this order by the orderer or by the receiver." ) 233 protected List<Identifier> identifier; 234 235 /** 236 * When the order was made. 237 */ 238 @Child(name = "date", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 239 @Description(shortDefinition="When the order was made", formalDefinition="When the order was made." ) 240 protected DateTimeType date; 241 242 /** 243 * Patient this order is about. 244 */ 245 @Child(name = "subject", type = {Patient.class, Group.class, Device.class, Substance.class}, order=2, min=0, max=1, modifier=false, summary=true) 246 @Description(shortDefinition="Patient this order is about", formalDefinition="Patient this order is about." ) 247 protected Reference subject; 248 249 /** 250 * The actual object that is the target of the reference (Patient this order is about.) 251 */ 252 protected Resource subjectTarget; 253 254 /** 255 * Who initiated the order. 256 */ 257 @Child(name = "source", type = {Practitioner.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true) 258 @Description(shortDefinition="Who initiated the order", formalDefinition="Who initiated the order." ) 259 protected Reference source; 260 261 /** 262 * The actual object that is the target of the reference (Who initiated the order.) 263 */ 264 protected Resource sourceTarget; 265 266 /** 267 * Who is intended to fulfill the order. 268 */ 269 @Child(name = "target", type = {Organization.class, Device.class, Practitioner.class}, order=4, min=0, max=1, modifier=false, summary=true) 270 @Description(shortDefinition="Who is intended to fulfill the order", formalDefinition="Who is intended to fulfill the order." ) 271 protected Reference target; 272 273 /** 274 * The actual object that is the target of the reference (Who is intended to fulfill the order.) 275 */ 276 protected Resource targetTarget; 277 278 /** 279 * Text - why the order was made. 280 */ 281 @Child(name = "reason", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true) 282 @Description(shortDefinition="Text - why the order was made", formalDefinition="Text - why the order was made." ) 283 protected Type reason; 284 285 /** 286 * When order should be fulfilled. 287 */ 288 @Child(name = "when", type = {}, order=6, min=0, max=1, modifier=false, summary=true) 289 @Description(shortDefinition="When order should be fulfilled", formalDefinition="When order should be fulfilled." ) 290 protected OrderWhenComponent when; 291 292 /** 293 * What action is being ordered. 294 */ 295 @Child(name = "detail", type = {}, order=7, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 296 @Description(shortDefinition="What action is being ordered", formalDefinition="What action is being ordered." ) 297 protected List<Reference> detail; 298 /** 299 * The actual objects that are the target of the reference (What action is being ordered.) 300 */ 301 protected List<Resource> detailTarget; 302 303 304 private static final long serialVersionUID = -1392311096L; 305 306 /** 307 * Constructor 308 */ 309 public Order() { 310 super(); 311 } 312 313 /** 314 * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.) 315 */ 316 public List<Identifier> getIdentifier() { 317 if (this.identifier == null) 318 this.identifier = new ArrayList<Identifier>(); 319 return this.identifier; 320 } 321 322 public boolean hasIdentifier() { 323 if (this.identifier == null) 324 return false; 325 for (Identifier item : this.identifier) 326 if (!item.isEmpty()) 327 return true; 328 return false; 329 } 330 331 /** 332 * @return {@link #identifier} (Identifiers assigned to this order by the orderer or by the receiver.) 333 */ 334 // syntactic sugar 335 public Identifier addIdentifier() { //3 336 Identifier t = new Identifier(); 337 if (this.identifier == null) 338 this.identifier = new ArrayList<Identifier>(); 339 this.identifier.add(t); 340 return t; 341 } 342 343 // syntactic sugar 344 public Order addIdentifier(Identifier t) { //3 345 if (t == null) 346 return this; 347 if (this.identifier == null) 348 this.identifier = new ArrayList<Identifier>(); 349 this.identifier.add(t); 350 return this; 351 } 352 353 /** 354 * @return {@link #date} (When the order was made.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 355 */ 356 public DateTimeType getDateElement() { 357 if (this.date == null) 358 if (Configuration.errorOnAutoCreate()) 359 throw new Error("Attempt to auto-create Order.date"); 360 else if (Configuration.doAutoCreate()) 361 this.date = new DateTimeType(); // bb 362 return this.date; 363 } 364 365 public boolean hasDateElement() { 366 return this.date != null && !this.date.isEmpty(); 367 } 368 369 public boolean hasDate() { 370 return this.date != null && !this.date.isEmpty(); 371 } 372 373 /** 374 * @param value {@link #date} (When the order was made.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value 375 */ 376 public Order setDateElement(DateTimeType value) { 377 this.date = value; 378 return this; 379 } 380 381 /** 382 * @return When the order was made. 383 */ 384 public Date getDate() { 385 return this.date == null ? null : this.date.getValue(); 386 } 387 388 /** 389 * @param value When the order was made. 390 */ 391 public Order setDate(Date value) { 392 if (value == null) 393 this.date = null; 394 else { 395 if (this.date == null) 396 this.date = new DateTimeType(); 397 this.date.setValue(value); 398 } 399 return this; 400 } 401 402 /** 403 * @return {@link #subject} (Patient this order is about.) 404 */ 405 public Reference getSubject() { 406 if (this.subject == null) 407 if (Configuration.errorOnAutoCreate()) 408 throw new Error("Attempt to auto-create Order.subject"); 409 else if (Configuration.doAutoCreate()) 410 this.subject = new Reference(); // cc 411 return this.subject; 412 } 413 414 public boolean hasSubject() { 415 return this.subject != null && !this.subject.isEmpty(); 416 } 417 418 /** 419 * @param value {@link #subject} (Patient this order is about.) 420 */ 421 public Order setSubject(Reference value) { 422 this.subject = value; 423 return this; 424 } 425 426 /** 427 * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Patient this order is about.) 428 */ 429 public Resource getSubjectTarget() { 430 return this.subjectTarget; 431 } 432 433 /** 434 * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Patient this order is about.) 435 */ 436 public Order setSubjectTarget(Resource value) { 437 this.subjectTarget = value; 438 return this; 439 } 440 441 /** 442 * @return {@link #source} (Who initiated the order.) 443 */ 444 public Reference getSource() { 445 if (this.source == null) 446 if (Configuration.errorOnAutoCreate()) 447 throw new Error("Attempt to auto-create Order.source"); 448 else if (Configuration.doAutoCreate()) 449 this.source = new Reference(); // cc 450 return this.source; 451 } 452 453 public boolean hasSource() { 454 return this.source != null && !this.source.isEmpty(); 455 } 456 457 /** 458 * @param value {@link #source} (Who initiated the order.) 459 */ 460 public Order setSource(Reference value) { 461 this.source = value; 462 return this; 463 } 464 465 /** 466 * @return {@link #source} 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. (Who initiated the order.) 467 */ 468 public Resource getSourceTarget() { 469 return this.sourceTarget; 470 } 471 472 /** 473 * @param value {@link #source} 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. (Who initiated the order.) 474 */ 475 public Order setSourceTarget(Resource value) { 476 this.sourceTarget = value; 477 return this; 478 } 479 480 /** 481 * @return {@link #target} (Who is intended to fulfill the order.) 482 */ 483 public Reference getTarget() { 484 if (this.target == null) 485 if (Configuration.errorOnAutoCreate()) 486 throw new Error("Attempt to auto-create Order.target"); 487 else if (Configuration.doAutoCreate()) 488 this.target = new Reference(); // cc 489 return this.target; 490 } 491 492 public boolean hasTarget() { 493 return this.target != null && !this.target.isEmpty(); 494 } 495 496 /** 497 * @param value {@link #target} (Who is intended to fulfill the order.) 498 */ 499 public Order setTarget(Reference value) { 500 this.target = value; 501 return this; 502 } 503 504 /** 505 * @return {@link #target} 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. (Who is intended to fulfill the order.) 506 */ 507 public Resource getTargetTarget() { 508 return this.targetTarget; 509 } 510 511 /** 512 * @param value {@link #target} 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. (Who is intended to fulfill the order.) 513 */ 514 public Order setTargetTarget(Resource value) { 515 this.targetTarget = value; 516 return this; 517 } 518 519 /** 520 * @return {@link #reason} (Text - why the order was made.) 521 */ 522 public Type getReason() { 523 return this.reason; 524 } 525 526 /** 527 * @return {@link #reason} (Text - why the order was made.) 528 */ 529 public CodeableConcept getReasonCodeableConcept() throws FHIRException { 530 if (!(this.reason instanceof CodeableConcept)) 531 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.reason.getClass().getName()+" was encountered"); 532 return (CodeableConcept) this.reason; 533 } 534 535 public boolean hasReasonCodeableConcept() { 536 return this.reason instanceof CodeableConcept; 537 } 538 539 /** 540 * @return {@link #reason} (Text - why the order was made.) 541 */ 542 public Reference getReasonReference() throws FHIRException { 543 if (!(this.reason instanceof Reference)) 544 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reason.getClass().getName()+" was encountered"); 545 return (Reference) this.reason; 546 } 547 548 public boolean hasReasonReference() { 549 return this.reason instanceof Reference; 550 } 551 552 public boolean hasReason() { 553 return this.reason != null && !this.reason.isEmpty(); 554 } 555 556 /** 557 * @param value {@link #reason} (Text - why the order was made.) 558 */ 559 public Order setReason(Type value) { 560 this.reason = value; 561 return this; 562 } 563 564 /** 565 * @return {@link #when} (When order should be fulfilled.) 566 */ 567 public OrderWhenComponent getWhen() { 568 if (this.when == null) 569 if (Configuration.errorOnAutoCreate()) 570 throw new Error("Attempt to auto-create Order.when"); 571 else if (Configuration.doAutoCreate()) 572 this.when = new OrderWhenComponent(); // cc 573 return this.when; 574 } 575 576 public boolean hasWhen() { 577 return this.when != null && !this.when.isEmpty(); 578 } 579 580 /** 581 * @param value {@link #when} (When order should be fulfilled.) 582 */ 583 public Order setWhen(OrderWhenComponent value) { 584 this.when = value; 585 return this; 586 } 587 588 /** 589 * @return {@link #detail} (What action is being ordered.) 590 */ 591 public List<Reference> getDetail() { 592 if (this.detail == null) 593 this.detail = new ArrayList<Reference>(); 594 return this.detail; 595 } 596 597 public boolean hasDetail() { 598 if (this.detail == null) 599 return false; 600 for (Reference item : this.detail) 601 if (!item.isEmpty()) 602 return true; 603 return false; 604 } 605 606 /** 607 * @return {@link #detail} (What action is being ordered.) 608 */ 609 // syntactic sugar 610 public Reference addDetail() { //3 611 Reference t = new Reference(); 612 if (this.detail == null) 613 this.detail = new ArrayList<Reference>(); 614 this.detail.add(t); 615 return t; 616 } 617 618 // syntactic sugar 619 public Order addDetail(Reference t) { //3 620 if (t == null) 621 return this; 622 if (this.detail == null) 623 this.detail = new ArrayList<Reference>(); 624 this.detail.add(t); 625 return this; 626 } 627 628 /** 629 * @return {@link #detail} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. What action is being ordered.) 630 */ 631 public List<Resource> getDetailTarget() { 632 if (this.detailTarget == null) 633 this.detailTarget = new ArrayList<Resource>(); 634 return this.detailTarget; 635 } 636 637 protected void listChildren(List<Property> childrenList) { 638 super.listChildren(childrenList); 639 childrenList.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the orderer or by the receiver.", 0, java.lang.Integer.MAX_VALUE, identifier)); 640 childrenList.add(new Property("date", "dateTime", "When the order was made.", 0, java.lang.Integer.MAX_VALUE, date)); 641 childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Substance)", "Patient this order is about.", 0, java.lang.Integer.MAX_VALUE, subject)); 642 childrenList.add(new Property("source", "Reference(Practitioner|Organization)", "Who initiated the order.", 0, java.lang.Integer.MAX_VALUE, source)); 643 childrenList.add(new Property("target", "Reference(Organization|Device|Practitioner)", "Who is intended to fulfill the order.", 0, java.lang.Integer.MAX_VALUE, target)); 644 childrenList.add(new Property("reason[x]", "CodeableConcept|Reference(Any)", "Text - why the order was made.", 0, java.lang.Integer.MAX_VALUE, reason)); 645 childrenList.add(new Property("when", "", "When order should be fulfilled.", 0, java.lang.Integer.MAX_VALUE, when)); 646 childrenList.add(new Property("detail", "Reference(Any)", "What action is being ordered.", 0, java.lang.Integer.MAX_VALUE, detail)); 647 } 648 649 @Override 650 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 651 switch (hash) { 652 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 653 case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType 654 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference 655 case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Reference 656 case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Reference 657 case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // Type 658 case 3648314: /*when*/ return this.when == null ? new Base[0] : new Base[] {this.when}; // OrderWhenComponent 659 case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // Reference 660 default: return super.getProperty(hash, name, checkValid); 661 } 662 663 } 664 665 @Override 666 public void setProperty(int hash, String name, Base value) throws FHIRException { 667 switch (hash) { 668 case -1618432855: // identifier 669 this.getIdentifier().add(castToIdentifier(value)); // Identifier 670 break; 671 case 3076014: // date 672 this.date = castToDateTime(value); // DateTimeType 673 break; 674 case -1867885268: // subject 675 this.subject = castToReference(value); // Reference 676 break; 677 case -896505829: // source 678 this.source = castToReference(value); // Reference 679 break; 680 case -880905839: // target 681 this.target = castToReference(value); // Reference 682 break; 683 case -934964668: // reason 684 this.reason = (Type) value; // Type 685 break; 686 case 3648314: // when 687 this.when = (OrderWhenComponent) value; // OrderWhenComponent 688 break; 689 case -1335224239: // detail 690 this.getDetail().add(castToReference(value)); // Reference 691 break; 692 default: super.setProperty(hash, name, value); 693 } 694 695 } 696 697 @Override 698 public void setProperty(String name, Base value) throws FHIRException { 699 if (name.equals("identifier")) 700 this.getIdentifier().add(castToIdentifier(value)); 701 else if (name.equals("date")) 702 this.date = castToDateTime(value); // DateTimeType 703 else if (name.equals("subject")) 704 this.subject = castToReference(value); // Reference 705 else if (name.equals("source")) 706 this.source = castToReference(value); // Reference 707 else if (name.equals("target")) 708 this.target = castToReference(value); // Reference 709 else if (name.equals("reason[x]")) 710 this.reason = (Type) value; // Type 711 else if (name.equals("when")) 712 this.when = (OrderWhenComponent) value; // OrderWhenComponent 713 else if (name.equals("detail")) 714 this.getDetail().add(castToReference(value)); 715 else 716 super.setProperty(name, value); 717 } 718 719 @Override 720 public Base makeProperty(int hash, String name) throws FHIRException { 721 switch (hash) { 722 case -1618432855: return addIdentifier(); // Identifier 723 case 3076014: throw new FHIRException("Cannot make property date as it is not a complex type"); // DateTimeType 724 case -1867885268: return getSubject(); // Reference 725 case -896505829: return getSource(); // Reference 726 case -880905839: return getTarget(); // Reference 727 case -669418564: return getReason(); // Type 728 case 3648314: return getWhen(); // OrderWhenComponent 729 case -1335224239: return addDetail(); // Reference 730 default: return super.makeProperty(hash, name); 731 } 732 733 } 734 735 @Override 736 public Base addChild(String name) throws FHIRException { 737 if (name.equals("identifier")) { 738 return addIdentifier(); 739 } 740 else if (name.equals("date")) { 741 throw new FHIRException("Cannot call addChild on a primitive type Order.date"); 742 } 743 else if (name.equals("subject")) { 744 this.subject = new Reference(); 745 return this.subject; 746 } 747 else if (name.equals("source")) { 748 this.source = new Reference(); 749 return this.source; 750 } 751 else if (name.equals("target")) { 752 this.target = new Reference(); 753 return this.target; 754 } 755 else if (name.equals("reasonCodeableConcept")) { 756 this.reason = new CodeableConcept(); 757 return this.reason; 758 } 759 else if (name.equals("reasonReference")) { 760 this.reason = new Reference(); 761 return this.reason; 762 } 763 else if (name.equals("when")) { 764 this.when = new OrderWhenComponent(); 765 return this.when; 766 } 767 else if (name.equals("detail")) { 768 return addDetail(); 769 } 770 else 771 return super.addChild(name); 772 } 773 774 public String fhirType() { 775 return "Order"; 776 777 } 778 779 public Order copy() { 780 Order dst = new Order(); 781 copyValues(dst); 782 if (identifier != null) { 783 dst.identifier = new ArrayList<Identifier>(); 784 for (Identifier i : identifier) 785 dst.identifier.add(i.copy()); 786 }; 787 dst.date = date == null ? null : date.copy(); 788 dst.subject = subject == null ? null : subject.copy(); 789 dst.source = source == null ? null : source.copy(); 790 dst.target = target == null ? null : target.copy(); 791 dst.reason = reason == null ? null : reason.copy(); 792 dst.when = when == null ? null : when.copy(); 793 if (detail != null) { 794 dst.detail = new ArrayList<Reference>(); 795 for (Reference i : detail) 796 dst.detail.add(i.copy()); 797 }; 798 return dst; 799 } 800 801 protected Order typedCopy() { 802 return copy(); 803 } 804 805 @Override 806 public boolean equalsDeep(Base other) { 807 if (!super.equalsDeep(other)) 808 return false; 809 if (!(other instanceof Order)) 810 return false; 811 Order o = (Order) other; 812 return compareDeep(identifier, o.identifier, true) && compareDeep(date, o.date, true) && compareDeep(subject, o.subject, true) 813 && compareDeep(source, o.source, true) && compareDeep(target, o.target, true) && compareDeep(reason, o.reason, true) 814 && compareDeep(when, o.when, true) && compareDeep(detail, o.detail, true); 815 } 816 817 @Override 818 public boolean equalsShallow(Base other) { 819 if (!super.equalsShallow(other)) 820 return false; 821 if (!(other instanceof Order)) 822 return false; 823 Order o = (Order) other; 824 return compareValues(date, o.date, true); 825 } 826 827 public boolean isEmpty() { 828 return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (date == null || date.isEmpty()) 829 && (subject == null || subject.isEmpty()) && (source == null || source.isEmpty()) && (target == null || target.isEmpty()) 830 && (reason == null || reason.isEmpty()) && (when == null || when.isEmpty()) && (detail == null || detail.isEmpty()) 831 ; 832 } 833 834 @Override 835 public ResourceType getResourceType() { 836 return ResourceType.Order; 837 } 838 839 /** 840 * Search parameter: <b>detail</b> 841 * <p> 842 * Description: <b>What action is being ordered</b><br> 843 * Type: <b>reference</b><br> 844 * Path: <b>Order.detail</b><br> 845 * </p> 846 */ 847 @SearchParamDefinition(name="detail", path="Order.detail", description="What action is being ordered", type="reference" ) 848 public static final String SP_DETAIL = "detail"; 849 /** 850 * <b>Fluent Client</b> search parameter constant for <b>detail</b> 851 * <p> 852 * Description: <b>What action is being ordered</b><br> 853 * Type: <b>reference</b><br> 854 * Path: <b>Order.detail</b><br> 855 * </p> 856 */ 857 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DETAIL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DETAIL); 858 859/** 860 * Constant for fluent queries to be used to add include statements. Specifies 861 * the path value of "<b>Order:detail</b>". 862 */ 863 public static final ca.uhn.fhir.model.api.Include INCLUDE_DETAIL = new ca.uhn.fhir.model.api.Include("Order:detail").toLocked(); 864 865 /** 866 * Search parameter: <b>patient</b> 867 * <p> 868 * Description: <b>Patient this order is about</b><br> 869 * Type: <b>reference</b><br> 870 * Path: <b>Order.subject</b><br> 871 * </p> 872 */ 873 @SearchParamDefinition(name="patient", path="Order.subject", description="Patient this order is about", type="reference" ) 874 public static final String SP_PATIENT = "patient"; 875 /** 876 * <b>Fluent Client</b> search parameter constant for <b>patient</b> 877 * <p> 878 * Description: <b>Patient this order is about</b><br> 879 * Type: <b>reference</b><br> 880 * Path: <b>Order.subject</b><br> 881 * </p> 882 */ 883 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); 884 885/** 886 * Constant for fluent queries to be used to add include statements. Specifies 887 * the path value of "<b>Order:patient</b>". 888 */ 889 public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Order:patient").toLocked(); 890 891 /** 892 * Search parameter: <b>source</b> 893 * <p> 894 * Description: <b>Who initiated the order</b><br> 895 * Type: <b>reference</b><br> 896 * Path: <b>Order.source</b><br> 897 * </p> 898 */ 899 @SearchParamDefinition(name="source", path="Order.source", description="Who initiated the order", type="reference" ) 900 public static final String SP_SOURCE = "source"; 901 /** 902 * <b>Fluent Client</b> search parameter constant for <b>source</b> 903 * <p> 904 * Description: <b>Who initiated the order</b><br> 905 * Type: <b>reference</b><br> 906 * Path: <b>Order.source</b><br> 907 * </p> 908 */ 909 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE); 910 911/** 912 * Constant for fluent queries to be used to add include statements. Specifies 913 * the path value of "<b>Order:source</b>". 914 */ 915 public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("Order:source").toLocked(); 916 917 /** 918 * Search parameter: <b>subject</b> 919 * <p> 920 * Description: <b>Patient this order is about</b><br> 921 * Type: <b>reference</b><br> 922 * Path: <b>Order.subject</b><br> 923 * </p> 924 */ 925 @SearchParamDefinition(name="subject", path="Order.subject", description="Patient this order is about", type="reference" ) 926 public static final String SP_SUBJECT = "subject"; 927 /** 928 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 929 * <p> 930 * Description: <b>Patient this order is about</b><br> 931 * Type: <b>reference</b><br> 932 * Path: <b>Order.subject</b><br> 933 * </p> 934 */ 935 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 936 937/** 938 * Constant for fluent queries to be used to add include statements. Specifies 939 * the path value of "<b>Order:subject</b>". 940 */ 941 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Order:subject").toLocked(); 942 943 /** 944 * Search parameter: <b>when</b> 945 * <p> 946 * Description: <b>A formal schedule</b><br> 947 * Type: <b>date</b><br> 948 * Path: <b>Order.when.schedule</b><br> 949 * </p> 950 */ 951 @SearchParamDefinition(name="when", path="Order.when.schedule", description="A formal schedule", type="date" ) 952 public static final String SP_WHEN = "when"; 953 /** 954 * <b>Fluent Client</b> search parameter constant for <b>when</b> 955 * <p> 956 * Description: <b>A formal schedule</b><br> 957 * Type: <b>date</b><br> 958 * Path: <b>Order.when.schedule</b><br> 959 * </p> 960 */ 961 public static final ca.uhn.fhir.rest.gclient.DateClientParam WHEN = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_WHEN); 962 963 /** 964 * Search parameter: <b>target</b> 965 * <p> 966 * Description: <b>Who is intended to fulfill the order</b><br> 967 * Type: <b>reference</b><br> 968 * Path: <b>Order.target</b><br> 969 * </p> 970 */ 971 @SearchParamDefinition(name="target", path="Order.target", description="Who is intended to fulfill the order", type="reference" ) 972 public static final String SP_TARGET = "target"; 973 /** 974 * <b>Fluent Client</b> search parameter constant for <b>target</b> 975 * <p> 976 * Description: <b>Who is intended to fulfill the order</b><br> 977 * Type: <b>reference</b><br> 978 * Path: <b>Order.target</b><br> 979 * </p> 980 */ 981 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam TARGET = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_TARGET); 982 983/** 984 * Constant for fluent queries to be used to add include statements. Specifies 985 * the path value of "<b>Order:target</b>". 986 */ 987 public static final ca.uhn.fhir.model.api.Include INCLUDE_TARGET = new ca.uhn.fhir.model.api.Include("Order:target").toLocked(); 988 989 /** 990 * Search parameter: <b>when_code</b> 991 * <p> 992 * Description: <b>Code specifies when request should be done. The code may simply be a priority code</b><br> 993 * Type: <b>token</b><br> 994 * Path: <b>Order.when.code</b><br> 995 * </p> 996 */ 997 @SearchParamDefinition(name="when_code", path="Order.when.code", description="Code specifies when request should be done. The code may simply be a priority code", type="token" ) 998 public static final String SP_WHENCODE = "when_code"; 999 /** 1000 * <b>Fluent Client</b> search parameter constant for <b>when_code</b> 1001 * <p> 1002 * Description: <b>Code specifies when request should be done. The code may simply be a priority code</b><br> 1003 * Type: <b>token</b><br> 1004 * Path: <b>Order.when.code</b><br> 1005 * </p> 1006 */ 1007 public static final ca.uhn.fhir.rest.gclient.TokenClientParam WHENCODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_WHENCODE); 1008 1009 /** 1010 * Search parameter: <b>date</b> 1011 * <p> 1012 * Description: <b>When the order was made</b><br> 1013 * Type: <b>date</b><br> 1014 * Path: <b>Order.date</b><br> 1015 * </p> 1016 */ 1017 @SearchParamDefinition(name="date", path="Order.date", description="When the order was made", type="date" ) 1018 public static final String SP_DATE = "date"; 1019 /** 1020 * <b>Fluent Client</b> search parameter constant for <b>date</b> 1021 * <p> 1022 * Description: <b>When the order was made</b><br> 1023 * Type: <b>date</b><br> 1024 * Path: <b>Order.date</b><br> 1025 * </p> 1026 */ 1027 public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE); 1028 1029 /** 1030 * Search parameter: <b>identifier</b> 1031 * <p> 1032 * Description: <b>Instance id from source, target, and/or others</b><br> 1033 * Type: <b>token</b><br> 1034 * Path: <b>Order.identifier</b><br> 1035 * </p> 1036 */ 1037 @SearchParamDefinition(name="identifier", path="Order.identifier", description="Instance id from source, target, and/or others", type="token" ) 1038 public static final String SP_IDENTIFIER = "identifier"; 1039 /** 1040 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1041 * <p> 1042 * Description: <b>Instance id from source, target, and/or others</b><br> 1043 * Type: <b>token</b><br> 1044 * Path: <b>Order.identifier</b><br> 1045 * </p> 1046 */ 1047 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1048 1049 1050} 1051