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