
001package org.hl7.fhir.r4.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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 033import java.util.ArrayList; 034import java.util.List; 035 036import org.hl7.fhir.exceptions.FHIRException; 037import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 038import org.hl7.fhir.utilities.Utilities; 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/** 047 * The interactions of the medicinal product with other medicinal products, or 048 * other forms of interactions. 049 */ 050@ResourceDef(name = "MedicinalProductInteraction", profile = "http://hl7.org/fhir/StructureDefinition/MedicinalProductInteraction") 051public class MedicinalProductInteraction extends DomainResource { 052 053 @Block() 054 public static class MedicinalProductInteractionInteractantComponent extends BackboneElement 055 implements IBaseBackboneElement { 056 /** 057 * The specific medication, food or laboratory test that interacts. 058 */ 059 @Child(name = "item", type = { MedicinalProduct.class, Medication.class, Substance.class, 060 ObservationDefinition.class, 061 CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = true) 062 @Description(shortDefinition = "The specific medication, food or laboratory test that interacts", formalDefinition = "The specific medication, food or laboratory test that interacts.") 063 protected Type item; 064 065 private static final long serialVersionUID = 1445276561L; 066 067 /** 068 * Constructor 069 */ 070 public MedicinalProductInteractionInteractantComponent() { 071 super(); 072 } 073 074 /** 075 * Constructor 076 */ 077 public MedicinalProductInteractionInteractantComponent(Type item) { 078 super(); 079 this.item = item; 080 } 081 082 /** 083 * @return {@link #item} (The specific medication, food or laboratory test that 084 * interacts.) 085 */ 086 public Type getItem() { 087 return this.item; 088 } 089 090 /** 091 * @return {@link #item} (The specific medication, food or laboratory test that 092 * interacts.) 093 */ 094 public Reference getItemReference() throws FHIRException { 095 if (this.item == null) 096 this.item = new Reference(); 097 if (!(this.item instanceof Reference)) 098 throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.item.getClass().getName() 099 + " was encountered"); 100 return (Reference) this.item; 101 } 102 103 public boolean hasItemReference() { 104 return this.item instanceof Reference; 105 } 106 107 /** 108 * @return {@link #item} (The specific medication, food or laboratory test that 109 * interacts.) 110 */ 111 public CodeableConcept getItemCodeableConcept() throws FHIRException { 112 if (this.item == null) 113 this.item = new CodeableConcept(); 114 if (!(this.item instanceof CodeableConcept)) 115 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but " 116 + this.item.getClass().getName() + " was encountered"); 117 return (CodeableConcept) this.item; 118 } 119 120 public boolean hasItemCodeableConcept() { 121 return this.item instanceof CodeableConcept; 122 } 123 124 public boolean hasItem() { 125 return this.item != null && !this.item.isEmpty(); 126 } 127 128 /** 129 * @param value {@link #item} (The specific medication, food or laboratory test 130 * that interacts.) 131 */ 132 public MedicinalProductInteractionInteractantComponent setItem(Type value) { 133 if (value != null && !(value instanceof Reference || value instanceof CodeableConcept)) 134 throw new Error("Not the right type for MedicinalProductInteraction.interactant.item[x]: " + value.fhirType()); 135 this.item = value; 136 return this; 137 } 138 139 protected void listChildren(List<Property> children) { 140 super.listChildren(children); 141 children.add(new Property("item[x]", 142 "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", 143 "The specific medication, food or laboratory test that interacts.", 0, 1, item)); 144 } 145 146 @Override 147 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 148 switch (_hash) { 149 case 2116201613: 150 /* item[x] */ return new Property("item[x]", 151 "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", 152 "The specific medication, food or laboratory test that interacts.", 0, 1, item); 153 case 3242771: 154 /* item */ return new Property("item[x]", 155 "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", 156 "The specific medication, food or laboratory test that interacts.", 0, 1, item); 157 case 1376364920: 158 /* itemReference */ return new Property("item[x]", 159 "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", 160 "The specific medication, food or laboratory test that interacts.", 0, 1, item); 161 case 106644494: 162 /* itemCodeableConcept */ return new Property("item[x]", 163 "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", 164 "The specific medication, food or laboratory test that interacts.", 0, 1, item); 165 default: 166 return super.getNamedProperty(_hash, _name, _checkValid); 167 } 168 169 } 170 171 @Override 172 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 173 switch (hash) { 174 case 3242771: 175 /* item */ return this.item == null ? new Base[0] : new Base[] { this.item }; // Type 176 default: 177 return super.getProperty(hash, name, checkValid); 178 } 179 180 } 181 182 @Override 183 public Base setProperty(int hash, String name, Base value) throws FHIRException { 184 switch (hash) { 185 case 3242771: // item 186 this.item = castToType(value); // Type 187 return value; 188 default: 189 return super.setProperty(hash, name, value); 190 } 191 192 } 193 194 @Override 195 public Base setProperty(String name, Base value) throws FHIRException { 196 if (name.equals("item[x]")) { 197 this.item = castToType(value); // Type 198 } else 199 return super.setProperty(name, value); 200 return value; 201 } 202 203 @Override 204 public void removeChild(String name, Base value) throws FHIRException { 205 if (name.equals("item[x]")) { 206 this.item = null; 207 } else 208 super.removeChild(name, value); 209 210 } 211 212 @Override 213 public Base makeProperty(int hash, String name) throws FHIRException { 214 switch (hash) { 215 case 2116201613: 216 return getItem(); 217 case 3242771: 218 return getItem(); 219 default: 220 return super.makeProperty(hash, name); 221 } 222 223 } 224 225 @Override 226 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 227 switch (hash) { 228 case 3242771: 229 /* item */ return new String[] { "Reference", "CodeableConcept" }; 230 default: 231 return super.getTypesForProperty(hash, name); 232 } 233 234 } 235 236 @Override 237 public Base addChild(String name) throws FHIRException { 238 if (name.equals("itemReference")) { 239 this.item = new Reference(); 240 return this.item; 241 } else if (name.equals("itemCodeableConcept")) { 242 this.item = new CodeableConcept(); 243 return this.item; 244 } else 245 return super.addChild(name); 246 } 247 248 public MedicinalProductInteractionInteractantComponent copy() { 249 MedicinalProductInteractionInteractantComponent dst = new MedicinalProductInteractionInteractantComponent(); 250 copyValues(dst); 251 return dst; 252 } 253 254 public void copyValues(MedicinalProductInteractionInteractantComponent dst) { 255 super.copyValues(dst); 256 dst.item = item == null ? null : item.copy(); 257 } 258 259 @Override 260 public boolean equalsDeep(Base other_) { 261 if (!super.equalsDeep(other_)) 262 return false; 263 if (!(other_ instanceof MedicinalProductInteractionInteractantComponent)) 264 return false; 265 MedicinalProductInteractionInteractantComponent o = (MedicinalProductInteractionInteractantComponent) other_; 266 return compareDeep(item, o.item, true); 267 } 268 269 @Override 270 public boolean equalsShallow(Base other_) { 271 if (!super.equalsShallow(other_)) 272 return false; 273 if (!(other_ instanceof MedicinalProductInteractionInteractantComponent)) 274 return false; 275 MedicinalProductInteractionInteractantComponent o = (MedicinalProductInteractionInteractantComponent) other_; 276 return true; 277 } 278 279 public boolean isEmpty() { 280 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item); 281 } 282 283 public String fhirType() { 284 return "MedicinalProductInteraction.interactant"; 285 286 } 287 288 } 289 290 /** 291 * The medication for which this is a described interaction. 292 */ 293 @Child(name = "subject", type = { MedicinalProduct.class, Medication.class, 294 Substance.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 295 @Description(shortDefinition = "The medication for which this is a described interaction", formalDefinition = "The medication for which this is a described interaction.") 296 protected List<Reference> subject; 297 /** 298 * The actual objects that are the target of the reference (The medication for 299 * which this is a described interaction.) 300 */ 301 protected List<Resource> subjectTarget; 302 303 /** 304 * The interaction described. 305 */ 306 @Child(name = "description", type = { 307 StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 308 @Description(shortDefinition = "The interaction described", formalDefinition = "The interaction described.") 309 protected StringType description; 310 311 /** 312 * The specific medication, food or laboratory test that interacts. 313 */ 314 @Child(name = "interactant", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 315 @Description(shortDefinition = "The specific medication, food or laboratory test that interacts", formalDefinition = "The specific medication, food or laboratory test that interacts.") 316 protected List<MedicinalProductInteractionInteractantComponent> interactant; 317 318 /** 319 * The type of the interaction e.g. drug-drug interaction, drug-food 320 * interaction, drug-lab test interaction. 321 */ 322 @Child(name = "type", type = { CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 323 @Description(shortDefinition = "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction", formalDefinition = "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.") 324 protected CodeableConcept type; 325 326 /** 327 * The effect of the interaction, for example "reduced gastric absorption of 328 * primary medication". 329 */ 330 @Child(name = "effect", type = { 331 CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true) 332 @Description(shortDefinition = "The effect of the interaction, for example \"reduced gastric absorption of primary medication\"", formalDefinition = "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".") 333 protected CodeableConcept effect; 334 335 /** 336 * The incidence of the interaction, e.g. theoretical, observed. 337 */ 338 @Child(name = "incidence", type = { 339 CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true) 340 @Description(shortDefinition = "The incidence of the interaction, e.g. theoretical, observed", formalDefinition = "The incidence of the interaction, e.g. theoretical, observed.") 341 protected CodeableConcept incidence; 342 343 /** 344 * Actions for managing the interaction. 345 */ 346 @Child(name = "management", type = { 347 CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 348 @Description(shortDefinition = "Actions for managing the interaction", formalDefinition = "Actions for managing the interaction.") 349 protected CodeableConcept management; 350 351 private static final long serialVersionUID = -1872687169L; 352 353 /** 354 * Constructor 355 */ 356 public MedicinalProductInteraction() { 357 super(); 358 } 359 360 /** 361 * @return {@link #subject} (The medication for which this is a described 362 * interaction.) 363 */ 364 public List<Reference> getSubject() { 365 if (this.subject == null) 366 this.subject = new ArrayList<Reference>(); 367 return this.subject; 368 } 369 370 /** 371 * @return Returns a reference to <code>this</code> for easy method chaining 372 */ 373 public MedicinalProductInteraction setSubject(List<Reference> theSubject) { 374 this.subject = theSubject; 375 return this; 376 } 377 378 public boolean hasSubject() { 379 if (this.subject == null) 380 return false; 381 for (Reference item : this.subject) 382 if (!item.isEmpty()) 383 return true; 384 return false; 385 } 386 387 public Reference addSubject() { // 3 388 Reference t = new Reference(); 389 if (this.subject == null) 390 this.subject = new ArrayList<Reference>(); 391 this.subject.add(t); 392 return t; 393 } 394 395 public MedicinalProductInteraction addSubject(Reference t) { // 3 396 if (t == null) 397 return this; 398 if (this.subject == null) 399 this.subject = new ArrayList<Reference>(); 400 this.subject.add(t); 401 return this; 402 } 403 404 /** 405 * @return The first repetition of repeating field {@link #subject}, creating it 406 * if it does not already exist 407 */ 408 public Reference getSubjectFirstRep() { 409 if (getSubject().isEmpty()) { 410 addSubject(); 411 } 412 return getSubject().get(0); 413 } 414 415 /** 416 * @return {@link #description} (The interaction described.). This is the 417 * underlying object with id, value and extensions. The accessor 418 * "getDescription" gives direct access to the value 419 */ 420 public StringType getDescriptionElement() { 421 if (this.description == null) 422 if (Configuration.errorOnAutoCreate()) 423 throw new Error("Attempt to auto-create MedicinalProductInteraction.description"); 424 else if (Configuration.doAutoCreate()) 425 this.description = new StringType(); // bb 426 return this.description; 427 } 428 429 public boolean hasDescriptionElement() { 430 return this.description != null && !this.description.isEmpty(); 431 } 432 433 public boolean hasDescription() { 434 return this.description != null && !this.description.isEmpty(); 435 } 436 437 /** 438 * @param value {@link #description} (The interaction described.). This is the 439 * underlying object with id, value and extensions. The accessor 440 * "getDescription" gives direct access to the value 441 */ 442 public MedicinalProductInteraction setDescriptionElement(StringType value) { 443 this.description = value; 444 return this; 445 } 446 447 /** 448 * @return The interaction described. 449 */ 450 public String getDescription() { 451 return this.description == null ? null : this.description.getValue(); 452 } 453 454 /** 455 * @param value The interaction described. 456 */ 457 public MedicinalProductInteraction setDescription(String value) { 458 if (Utilities.noString(value)) 459 this.description = null; 460 else { 461 if (this.description == null) 462 this.description = new StringType(); 463 this.description.setValue(value); 464 } 465 return this; 466 } 467 468 /** 469 * @return {@link #interactant} (The specific medication, food or laboratory 470 * test that interacts.) 471 */ 472 public List<MedicinalProductInteractionInteractantComponent> getInteractant() { 473 if (this.interactant == null) 474 this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>(); 475 return this.interactant; 476 } 477 478 /** 479 * @return Returns a reference to <code>this</code> for easy method chaining 480 */ 481 public MedicinalProductInteraction setInteractant( 482 List<MedicinalProductInteractionInteractantComponent> theInteractant) { 483 this.interactant = theInteractant; 484 return this; 485 } 486 487 public boolean hasInteractant() { 488 if (this.interactant == null) 489 return false; 490 for (MedicinalProductInteractionInteractantComponent item : this.interactant) 491 if (!item.isEmpty()) 492 return true; 493 return false; 494 } 495 496 public MedicinalProductInteractionInteractantComponent addInteractant() { // 3 497 MedicinalProductInteractionInteractantComponent t = new MedicinalProductInteractionInteractantComponent(); 498 if (this.interactant == null) 499 this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>(); 500 this.interactant.add(t); 501 return t; 502 } 503 504 public MedicinalProductInteraction addInteractant(MedicinalProductInteractionInteractantComponent t) { // 3 505 if (t == null) 506 return this; 507 if (this.interactant == null) 508 this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>(); 509 this.interactant.add(t); 510 return this; 511 } 512 513 /** 514 * @return The first repetition of repeating field {@link #interactant}, 515 * creating it if it does not already exist 516 */ 517 public MedicinalProductInteractionInteractantComponent getInteractantFirstRep() { 518 if (getInteractant().isEmpty()) { 519 addInteractant(); 520 } 521 return getInteractant().get(0); 522 } 523 524 /** 525 * @return {@link #type} (The type of the interaction e.g. drug-drug 526 * interaction, drug-food interaction, drug-lab test interaction.) 527 */ 528 public CodeableConcept getType() { 529 if (this.type == null) 530 if (Configuration.errorOnAutoCreate()) 531 throw new Error("Attempt to auto-create MedicinalProductInteraction.type"); 532 else if (Configuration.doAutoCreate()) 533 this.type = new CodeableConcept(); // cc 534 return this.type; 535 } 536 537 public boolean hasType() { 538 return this.type != null && !this.type.isEmpty(); 539 } 540 541 /** 542 * @param value {@link #type} (The type of the interaction e.g. drug-drug 543 * interaction, drug-food interaction, drug-lab test interaction.) 544 */ 545 public MedicinalProductInteraction setType(CodeableConcept value) { 546 this.type = value; 547 return this; 548 } 549 550 /** 551 * @return {@link #effect} (The effect of the interaction, for example "reduced 552 * gastric absorption of primary medication".) 553 */ 554 public CodeableConcept getEffect() { 555 if (this.effect == null) 556 if (Configuration.errorOnAutoCreate()) 557 throw new Error("Attempt to auto-create MedicinalProductInteraction.effect"); 558 else if (Configuration.doAutoCreate()) 559 this.effect = new CodeableConcept(); // cc 560 return this.effect; 561 } 562 563 public boolean hasEffect() { 564 return this.effect != null && !this.effect.isEmpty(); 565 } 566 567 /** 568 * @param value {@link #effect} (The effect of the interaction, for example 569 * "reduced gastric absorption of primary medication".) 570 */ 571 public MedicinalProductInteraction setEffect(CodeableConcept value) { 572 this.effect = value; 573 return this; 574 } 575 576 /** 577 * @return {@link #incidence} (The incidence of the interaction, e.g. 578 * theoretical, observed.) 579 */ 580 public CodeableConcept getIncidence() { 581 if (this.incidence == null) 582 if (Configuration.errorOnAutoCreate()) 583 throw new Error("Attempt to auto-create MedicinalProductInteraction.incidence"); 584 else if (Configuration.doAutoCreate()) 585 this.incidence = new CodeableConcept(); // cc 586 return this.incidence; 587 } 588 589 public boolean hasIncidence() { 590 return this.incidence != null && !this.incidence.isEmpty(); 591 } 592 593 /** 594 * @param value {@link #incidence} (The incidence of the interaction, e.g. 595 * theoretical, observed.) 596 */ 597 public MedicinalProductInteraction setIncidence(CodeableConcept value) { 598 this.incidence = value; 599 return this; 600 } 601 602 /** 603 * @return {@link #management} (Actions for managing the interaction.) 604 */ 605 public CodeableConcept getManagement() { 606 if (this.management == null) 607 if (Configuration.errorOnAutoCreate()) 608 throw new Error("Attempt to auto-create MedicinalProductInteraction.management"); 609 else if (Configuration.doAutoCreate()) 610 this.management = new CodeableConcept(); // cc 611 return this.management; 612 } 613 614 public boolean hasManagement() { 615 return this.management != null && !this.management.isEmpty(); 616 } 617 618 /** 619 * @param value {@link #management} (Actions for managing the interaction.) 620 */ 621 public MedicinalProductInteraction setManagement(CodeableConcept value) { 622 this.management = value; 623 return this; 624 } 625 626 protected void listChildren(List<Property> children) { 627 super.listChildren(children); 628 children.add(new Property("subject", "Reference(MedicinalProduct|Medication|Substance)", 629 "The medication for which this is a described interaction.", 0, java.lang.Integer.MAX_VALUE, subject)); 630 children.add(new Property("description", "string", "The interaction described.", 0, 1, description)); 631 children.add(new Property("interactant", "", "The specific medication, food or laboratory test that interacts.", 0, 632 java.lang.Integer.MAX_VALUE, interactant)); 633 children.add(new Property("type", "CodeableConcept", 634 "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.", 0, 635 1, type)); 636 children.add(new Property("effect", "CodeableConcept", 637 "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".", 0, 1, 638 effect)); 639 children.add(new Property("incidence", "CodeableConcept", 640 "The incidence of the interaction, e.g. theoretical, observed.", 0, 1, incidence)); 641 children 642 .add(new Property("management", "CodeableConcept", "Actions for managing the interaction.", 0, 1, management)); 643 } 644 645 @Override 646 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 647 switch (_hash) { 648 case -1867885268: 649 /* subject */ return new Property("subject", "Reference(MedicinalProduct|Medication|Substance)", 650 "The medication for which this is a described interaction.", 0, java.lang.Integer.MAX_VALUE, subject); 651 case -1724546052: 652 /* description */ return new Property("description", "string", "The interaction described.", 0, 1, description); 653 case 1844097009: 654 /* interactant */ return new Property("interactant", "", 655 "The specific medication, food or laboratory test that interacts.", 0, java.lang.Integer.MAX_VALUE, 656 interactant); 657 case 3575610: 658 /* type */ return new Property("type", "CodeableConcept", 659 "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.", 660 0, 1, type); 661 case -1306084975: 662 /* effect */ return new Property("effect", "CodeableConcept", 663 "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".", 0, 1, 664 effect); 665 case -1598467132: 666 /* incidence */ return new Property("incidence", "CodeableConcept", 667 "The incidence of the interaction, e.g. theoretical, observed.", 0, 1, incidence); 668 case -1799980989: 669 /* management */ return new Property("management", "CodeableConcept", "Actions for managing the interaction.", 0, 670 1, management); 671 default: 672 return super.getNamedProperty(_hash, _name, _checkValid); 673 } 674 675 } 676 677 @Override 678 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 679 switch (hash) { 680 case -1867885268: 681 /* subject */ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference 682 case -1724546052: 683 /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType 684 case 1844097009: 685 /* interactant */ return this.interactant == null ? new Base[0] 686 : this.interactant.toArray(new Base[this.interactant.size()]); // MedicinalProductInteractionInteractantComponent 687 case 3575610: 688 /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept 689 case -1306084975: 690 /* effect */ return this.effect == null ? new Base[0] : new Base[] { this.effect }; // CodeableConcept 691 case -1598467132: 692 /* incidence */ return this.incidence == null ? new Base[0] : new Base[] { this.incidence }; // CodeableConcept 693 case -1799980989: 694 /* management */ return this.management == null ? new Base[0] : new Base[] { this.management }; // CodeableConcept 695 default: 696 return super.getProperty(hash, name, checkValid); 697 } 698 699 } 700 701 @Override 702 public Base setProperty(int hash, String name, Base value) throws FHIRException { 703 switch (hash) { 704 case -1867885268: // subject 705 this.getSubject().add(castToReference(value)); // Reference 706 return value; 707 case -1724546052: // description 708 this.description = castToString(value); // StringType 709 return value; 710 case 1844097009: // interactant 711 this.getInteractant().add((MedicinalProductInteractionInteractantComponent) value); // MedicinalProductInteractionInteractantComponent 712 return value; 713 case 3575610: // type 714 this.type = castToCodeableConcept(value); // CodeableConcept 715 return value; 716 case -1306084975: // effect 717 this.effect = castToCodeableConcept(value); // CodeableConcept 718 return value; 719 case -1598467132: // incidence 720 this.incidence = castToCodeableConcept(value); // CodeableConcept 721 return value; 722 case -1799980989: // management 723 this.management = castToCodeableConcept(value); // CodeableConcept 724 return value; 725 default: 726 return super.setProperty(hash, name, value); 727 } 728 729 } 730 731 @Override 732 public Base setProperty(String name, Base value) throws FHIRException { 733 if (name.equals("subject")) { 734 this.getSubject().add(castToReference(value)); 735 } else if (name.equals("description")) { 736 this.description = castToString(value); // StringType 737 } else if (name.equals("interactant")) { 738 this.getInteractant().add((MedicinalProductInteractionInteractantComponent) value); 739 } else if (name.equals("type")) { 740 this.type = castToCodeableConcept(value); // CodeableConcept 741 } else if (name.equals("effect")) { 742 this.effect = castToCodeableConcept(value); // CodeableConcept 743 } else if (name.equals("incidence")) { 744 this.incidence = castToCodeableConcept(value); // CodeableConcept 745 } else if (name.equals("management")) { 746 this.management = castToCodeableConcept(value); // CodeableConcept 747 } else 748 return super.setProperty(name, value); 749 return value; 750 } 751 752 @Override 753 public void removeChild(String name, Base value) throws FHIRException { 754 if (name.equals("subject")) { 755 this.getSubject().remove(castToReference(value)); 756 } else if (name.equals("description")) { 757 this.description = null; 758 } else if (name.equals("interactant")) { 759 this.getInteractant().remove((MedicinalProductInteractionInteractantComponent) value); 760 } else if (name.equals("type")) { 761 this.type = null; 762 } else if (name.equals("effect")) { 763 this.effect = null; 764 } else if (name.equals("incidence")) { 765 this.incidence = null; 766 } else if (name.equals("management")) { 767 this.management = null; 768 } else 769 super.removeChild(name, value); 770 771 } 772 773 @Override 774 public Base makeProperty(int hash, String name) throws FHIRException { 775 switch (hash) { 776 case -1867885268: 777 return addSubject(); 778 case -1724546052: 779 return getDescriptionElement(); 780 case 1844097009: 781 return addInteractant(); 782 case 3575610: 783 return getType(); 784 case -1306084975: 785 return getEffect(); 786 case -1598467132: 787 return getIncidence(); 788 case -1799980989: 789 return getManagement(); 790 default: 791 return super.makeProperty(hash, name); 792 } 793 794 } 795 796 @Override 797 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 798 switch (hash) { 799 case -1867885268: 800 /* subject */ return new String[] { "Reference" }; 801 case -1724546052: 802 /* description */ return new String[] { "string" }; 803 case 1844097009: 804 /* interactant */ return new String[] {}; 805 case 3575610: 806 /* type */ return new String[] { "CodeableConcept" }; 807 case -1306084975: 808 /* effect */ return new String[] { "CodeableConcept" }; 809 case -1598467132: 810 /* incidence */ return new String[] { "CodeableConcept" }; 811 case -1799980989: 812 /* management */ return new String[] { "CodeableConcept" }; 813 default: 814 return super.getTypesForProperty(hash, name); 815 } 816 817 } 818 819 @Override 820 public Base addChild(String name) throws FHIRException { 821 if (name.equals("subject")) { 822 return addSubject(); 823 } else if (name.equals("description")) { 824 throw new FHIRException("Cannot call addChild on a singleton property MedicinalProductInteraction.description"); 825 } else if (name.equals("interactant")) { 826 return addInteractant(); 827 } else if (name.equals("type")) { 828 this.type = new CodeableConcept(); 829 return this.type; 830 } else if (name.equals("effect")) { 831 this.effect = new CodeableConcept(); 832 return this.effect; 833 } else if (name.equals("incidence")) { 834 this.incidence = new CodeableConcept(); 835 return this.incidence; 836 } else if (name.equals("management")) { 837 this.management = new CodeableConcept(); 838 return this.management; 839 } else 840 return super.addChild(name); 841 } 842 843 public String fhirType() { 844 return "MedicinalProductInteraction"; 845 846 } 847 848 public MedicinalProductInteraction copy() { 849 MedicinalProductInteraction dst = new MedicinalProductInteraction(); 850 copyValues(dst); 851 return dst; 852 } 853 854 public void copyValues(MedicinalProductInteraction dst) { 855 super.copyValues(dst); 856 if (subject != null) { 857 dst.subject = new ArrayList<Reference>(); 858 for (Reference i : subject) 859 dst.subject.add(i.copy()); 860 } 861 ; 862 dst.description = description == null ? null : description.copy(); 863 if (interactant != null) { 864 dst.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>(); 865 for (MedicinalProductInteractionInteractantComponent i : interactant) 866 dst.interactant.add(i.copy()); 867 } 868 ; 869 dst.type = type == null ? null : type.copy(); 870 dst.effect = effect == null ? null : effect.copy(); 871 dst.incidence = incidence == null ? null : incidence.copy(); 872 dst.management = management == null ? null : management.copy(); 873 } 874 875 protected MedicinalProductInteraction typedCopy() { 876 return copy(); 877 } 878 879 @Override 880 public boolean equalsDeep(Base other_) { 881 if (!super.equalsDeep(other_)) 882 return false; 883 if (!(other_ instanceof MedicinalProductInteraction)) 884 return false; 885 MedicinalProductInteraction o = (MedicinalProductInteraction) other_; 886 return compareDeep(subject, o.subject, true) && compareDeep(description, o.description, true) 887 && compareDeep(interactant, o.interactant, true) && compareDeep(type, o.type, true) 888 && compareDeep(effect, o.effect, true) && compareDeep(incidence, o.incidence, true) 889 && compareDeep(management, o.management, true); 890 } 891 892 @Override 893 public boolean equalsShallow(Base other_) { 894 if (!super.equalsShallow(other_)) 895 return false; 896 if (!(other_ instanceof MedicinalProductInteraction)) 897 return false; 898 MedicinalProductInteraction o = (MedicinalProductInteraction) other_; 899 return compareValues(description, o.description, true); 900 } 901 902 public boolean isEmpty() { 903 return super.isEmpty() 904 && ca.uhn.fhir.util.ElementUtil.isEmpty(subject, description, interactant, type, effect, incidence, management); 905 } 906 907 @Override 908 public ResourceType getResourceType() { 909 return ResourceType.MedicinalProductInteraction; 910 } 911 912 /** 913 * Search parameter: <b>subject</b> 914 * <p> 915 * Description: <b>The medication for which this is an interaction</b><br> 916 * Type: <b>reference</b><br> 917 * Path: <b>MedicinalProductInteraction.subject</b><br> 918 * </p> 919 */ 920 @SearchParamDefinition(name = "subject", path = "MedicinalProductInteraction.subject", description = "The medication for which this is an interaction", type = "reference", target = { 921 Medication.class, MedicinalProduct.class, Substance.class }) 922 public static final String SP_SUBJECT = "subject"; 923 /** 924 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 925 * <p> 926 * Description: <b>The medication for which this is an interaction</b><br> 927 * Type: <b>reference</b><br> 928 * Path: <b>MedicinalProductInteraction.subject</b><br> 929 * </p> 930 */ 931 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( 932 SP_SUBJECT); 933 934 /** 935 * Constant for fluent queries to be used to add include statements. Specifies 936 * the path value of "<b>MedicinalProductInteraction:subject</b>". 937 */ 938 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include( 939 "MedicinalProductInteraction:subject").toLocked(); 940 941}