001package org.hl7.fhir.r4.model; 002 003 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034 035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 036 037import java.util.*; 038 039import org.hl7.fhir.utilities.Utilities; 040import ca.uhn.fhir.model.api.annotation.ResourceDef; 041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.ChildOrder; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046import org.hl7.fhir.instance.model.api.*; 047import org.hl7.fhir.exceptions.FHIRException; 048/** 049 * The interactions of the medicinal product with other medicinal products, or other forms of interactions. 050 */ 051@ResourceDef(name="MedicinalProductInteraction", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductInteraction") 052public class MedicinalProductInteraction extends DomainResource { 053 054 @Block() 055 public static class MedicinalProductInteractionInteractantComponent extends BackboneElement 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, ObservationDefinition.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 060 @Description(shortDefinition="The specific medication, food or laboratory test that interacts", formalDefinition="The specific medication, food or laboratory test that interacts." ) 061 protected Type item; 062 063 private static final long serialVersionUID = 1445276561L; 064 065 /** 066 * Constructor 067 */ 068 public MedicinalProductInteractionInteractantComponent() { 069 super(); 070 } 071 072 /** 073 * Constructor 074 */ 075 public MedicinalProductInteractionInteractantComponent(Type item) { 076 super(); 077 this.item = item; 078 } 079 080 /** 081 * @return {@link #item} (The specific medication, food or laboratory test that interacts.) 082 */ 083 public Type getItem() { 084 return this.item; 085 } 086 087 /** 088 * @return {@link #item} (The specific medication, food or laboratory test that interacts.) 089 */ 090 public Reference getItemReference() throws FHIRException { 091 if (this.item == null) 092 this.item = new Reference(); 093 if (!(this.item instanceof Reference)) 094 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.item.getClass().getName()+" was encountered"); 095 return (Reference) this.item; 096 } 097 098 public boolean hasItemReference() { 099 return this != null && this.item instanceof Reference; 100 } 101 102 /** 103 * @return {@link #item} (The specific medication, food or laboratory test that interacts.) 104 */ 105 public CodeableConcept getItemCodeableConcept() throws FHIRException { 106 if (this.item == null) 107 this.item = new CodeableConcept(); 108 if (!(this.item instanceof CodeableConcept)) 109 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.item.getClass().getName()+" was encountered"); 110 return (CodeableConcept) this.item; 111 } 112 113 public boolean hasItemCodeableConcept() { 114 return this != null && this.item instanceof CodeableConcept; 115 } 116 117 public boolean hasItem() { 118 return this.item != null && !this.item.isEmpty(); 119 } 120 121 /** 122 * @param value {@link #item} (The specific medication, food or laboratory test that interacts.) 123 */ 124 public MedicinalProductInteractionInteractantComponent setItem(Type value) { 125 if (value != null && !(value instanceof Reference || value instanceof CodeableConcept)) 126 throw new Error("Not the right type for MedicinalProductInteraction.interactant.item[x]: "+value.fhirType()); 127 this.item = value; 128 return this; 129 } 130 131 protected void listChildren(List<Property> children) { 132 super.listChildren(children); 133 children.add(new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item)); 134 } 135 136 @Override 137 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 138 switch (_hash) { 139 case 2116201613: /*item[x]*/ return new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item); 140 case 3242771: /*item*/ return new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item); 141 case 1376364920: /*itemReference*/ return new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item); 142 case 106644494: /*itemCodeableConcept*/ return new Property("item[x]", "Reference(MedicinalProduct|Medication|Substance|ObservationDefinition)|CodeableConcept", "The specific medication, food or laboratory test that interacts.", 0, 1, item); 143 default: return super.getNamedProperty(_hash, _name, _checkValid); 144 } 145 146 } 147 148 @Override 149 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 150 switch (hash) { 151 case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // Type 152 default: return super.getProperty(hash, name, checkValid); 153 } 154 155 } 156 157 @Override 158 public Base setProperty(int hash, String name, Base value) throws FHIRException { 159 switch (hash) { 160 case 3242771: // item 161 this.item = castToType(value); // Type 162 return value; 163 default: return super.setProperty(hash, name, value); 164 } 165 166 } 167 168 @Override 169 public Base setProperty(String name, Base value) throws FHIRException { 170 if (name.equals("item[x]")) { 171 this.item = castToType(value); // Type 172 } else 173 return super.setProperty(name, value); 174 return value; 175 } 176 177 @Override 178 public Base makeProperty(int hash, String name) throws FHIRException { 179 switch (hash) { 180 case 2116201613: return getItem(); 181 case 3242771: return getItem(); 182 default: return super.makeProperty(hash, name); 183 } 184 185 } 186 187 @Override 188 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 189 switch (hash) { 190 case 3242771: /*item*/ return new String[] {"Reference", "CodeableConcept"}; 191 default: return super.getTypesForProperty(hash, name); 192 } 193 194 } 195 196 @Override 197 public Base addChild(String name) throws FHIRException { 198 if (name.equals("itemReference")) { 199 this.item = new Reference(); 200 return this.item; 201 } 202 else if (name.equals("itemCodeableConcept")) { 203 this.item = new CodeableConcept(); 204 return this.item; 205 } 206 else 207 return super.addChild(name); 208 } 209 210 public MedicinalProductInteractionInteractantComponent copy() { 211 MedicinalProductInteractionInteractantComponent dst = new MedicinalProductInteractionInteractantComponent(); 212 copyValues(dst); 213 return dst; 214 } 215 216 public void copyValues(MedicinalProductInteractionInteractantComponent dst) { 217 super.copyValues(dst); 218 dst.item = item == null ? null : item.copy(); 219 } 220 221 @Override 222 public boolean equalsDeep(Base other_) { 223 if (!super.equalsDeep(other_)) 224 return false; 225 if (!(other_ instanceof MedicinalProductInteractionInteractantComponent)) 226 return false; 227 MedicinalProductInteractionInteractantComponent o = (MedicinalProductInteractionInteractantComponent) other_; 228 return compareDeep(item, o.item, true); 229 } 230 231 @Override 232 public boolean equalsShallow(Base other_) { 233 if (!super.equalsShallow(other_)) 234 return false; 235 if (!(other_ instanceof MedicinalProductInteractionInteractantComponent)) 236 return false; 237 MedicinalProductInteractionInteractantComponent o = (MedicinalProductInteractionInteractantComponent) other_; 238 return true; 239 } 240 241 public boolean isEmpty() { 242 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item); 243 } 244 245 public String fhirType() { 246 return "MedicinalProductInteraction.interactant"; 247 248 } 249 250 } 251 252 /** 253 * The medication for which this is a described interaction. 254 */ 255 @Child(name = "subject", type = {MedicinalProduct.class, Medication.class, Substance.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 256 @Description(shortDefinition="The medication for which this is a described interaction", formalDefinition="The medication for which this is a described interaction." ) 257 protected List<Reference> subject; 258 /** 259 * The actual objects that are the target of the reference (The medication for which this is a described interaction.) 260 */ 261 protected List<Resource> subjectTarget; 262 263 264 /** 265 * The interaction described. 266 */ 267 @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 268 @Description(shortDefinition="The interaction described", formalDefinition="The interaction described." ) 269 protected StringType description; 270 271 /** 272 * The specific medication, food or laboratory test that interacts. 273 */ 274 @Child(name = "interactant", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 275 @Description(shortDefinition="The specific medication, food or laboratory test that interacts", formalDefinition="The specific medication, food or laboratory test that interacts." ) 276 protected List<MedicinalProductInteractionInteractantComponent> interactant; 277 278 /** 279 * The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction. 280 */ 281 @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 282 @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." ) 283 protected CodeableConcept type; 284 285 /** 286 * The effect of the interaction, for example "reduced gastric absorption of primary medication". 287 */ 288 @Child(name = "effect", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true) 289 @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\"." ) 290 protected CodeableConcept effect; 291 292 /** 293 * The incidence of the interaction, e.g. theoretical, observed. 294 */ 295 @Child(name = "incidence", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true) 296 @Description(shortDefinition="The incidence of the interaction, e.g. theoretical, observed", formalDefinition="The incidence of the interaction, e.g. theoretical, observed." ) 297 protected CodeableConcept incidence; 298 299 /** 300 * Actions for managing the interaction. 301 */ 302 @Child(name = "management", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 303 @Description(shortDefinition="Actions for managing the interaction", formalDefinition="Actions for managing the interaction." ) 304 protected CodeableConcept management; 305 306 private static final long serialVersionUID = -1872687169L; 307 308 /** 309 * Constructor 310 */ 311 public MedicinalProductInteraction() { 312 super(); 313 } 314 315 /** 316 * @return {@link #subject} (The medication for which this is a described interaction.) 317 */ 318 public List<Reference> getSubject() { 319 if (this.subject == null) 320 this.subject = new ArrayList<Reference>(); 321 return this.subject; 322 } 323 324 /** 325 * @return Returns a reference to <code>this</code> for easy method chaining 326 */ 327 public MedicinalProductInteraction setSubject(List<Reference> theSubject) { 328 this.subject = theSubject; 329 return this; 330 } 331 332 public boolean hasSubject() { 333 if (this.subject == null) 334 return false; 335 for (Reference item : this.subject) 336 if (!item.isEmpty()) 337 return true; 338 return false; 339 } 340 341 public Reference addSubject() { //3 342 Reference t = new Reference(); 343 if (this.subject == null) 344 this.subject = new ArrayList<Reference>(); 345 this.subject.add(t); 346 return t; 347 } 348 349 public MedicinalProductInteraction addSubject(Reference t) { //3 350 if (t == null) 351 return this; 352 if (this.subject == null) 353 this.subject = new ArrayList<Reference>(); 354 this.subject.add(t); 355 return this; 356 } 357 358 /** 359 * @return The first repetition of repeating field {@link #subject}, creating it if it does not already exist 360 */ 361 public Reference getSubjectFirstRep() { 362 if (getSubject().isEmpty()) { 363 addSubject(); 364 } 365 return getSubject().get(0); 366 } 367 368 /** 369 * @deprecated Use Reference#setResource(IBaseResource) instead 370 */ 371 @Deprecated 372 public List<Resource> getSubjectTarget() { 373 if (this.subjectTarget == null) 374 this.subjectTarget = new ArrayList<Resource>(); 375 return this.subjectTarget; 376 } 377 378 /** 379 * @return {@link #description} (The interaction described.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 380 */ 381 public StringType getDescriptionElement() { 382 if (this.description == null) 383 if (Configuration.errorOnAutoCreate()) 384 throw new Error("Attempt to auto-create MedicinalProductInteraction.description"); 385 else if (Configuration.doAutoCreate()) 386 this.description = new StringType(); // bb 387 return this.description; 388 } 389 390 public boolean hasDescriptionElement() { 391 return this.description != null && !this.description.isEmpty(); 392 } 393 394 public boolean hasDescription() { 395 return this.description != null && !this.description.isEmpty(); 396 } 397 398 /** 399 * @param value {@link #description} (The interaction described.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 400 */ 401 public MedicinalProductInteraction setDescriptionElement(StringType value) { 402 this.description = value; 403 return this; 404 } 405 406 /** 407 * @return The interaction described. 408 */ 409 public String getDescription() { 410 return this.description == null ? null : this.description.getValue(); 411 } 412 413 /** 414 * @param value The interaction described. 415 */ 416 public MedicinalProductInteraction setDescription(String value) { 417 if (Utilities.noString(value)) 418 this.description = null; 419 else { 420 if (this.description == null) 421 this.description = new StringType(); 422 this.description.setValue(value); 423 } 424 return this; 425 } 426 427 /** 428 * @return {@link #interactant} (The specific medication, food or laboratory test that interacts.) 429 */ 430 public List<MedicinalProductInteractionInteractantComponent> getInteractant() { 431 if (this.interactant == null) 432 this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>(); 433 return this.interactant; 434 } 435 436 /** 437 * @return Returns a reference to <code>this</code> for easy method chaining 438 */ 439 public MedicinalProductInteraction setInteractant(List<MedicinalProductInteractionInteractantComponent> theInteractant) { 440 this.interactant = theInteractant; 441 return this; 442 } 443 444 public boolean hasInteractant() { 445 if (this.interactant == null) 446 return false; 447 for (MedicinalProductInteractionInteractantComponent item : this.interactant) 448 if (!item.isEmpty()) 449 return true; 450 return false; 451 } 452 453 public MedicinalProductInteractionInteractantComponent addInteractant() { //3 454 MedicinalProductInteractionInteractantComponent t = new MedicinalProductInteractionInteractantComponent(); 455 if (this.interactant == null) 456 this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>(); 457 this.interactant.add(t); 458 return t; 459 } 460 461 public MedicinalProductInteraction addInteractant(MedicinalProductInteractionInteractantComponent t) { //3 462 if (t == null) 463 return this; 464 if (this.interactant == null) 465 this.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>(); 466 this.interactant.add(t); 467 return this; 468 } 469 470 /** 471 * @return The first repetition of repeating field {@link #interactant}, creating it if it does not already exist 472 */ 473 public MedicinalProductInteractionInteractantComponent getInteractantFirstRep() { 474 if (getInteractant().isEmpty()) { 475 addInteractant(); 476 } 477 return getInteractant().get(0); 478 } 479 480 /** 481 * @return {@link #type} (The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.) 482 */ 483 public CodeableConcept getType() { 484 if (this.type == null) 485 if (Configuration.errorOnAutoCreate()) 486 throw new Error("Attempt to auto-create MedicinalProductInteraction.type"); 487 else if (Configuration.doAutoCreate()) 488 this.type = new CodeableConcept(); // cc 489 return this.type; 490 } 491 492 public boolean hasType() { 493 return this.type != null && !this.type.isEmpty(); 494 } 495 496 /** 497 * @param value {@link #type} (The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.) 498 */ 499 public MedicinalProductInteraction setType(CodeableConcept value) { 500 this.type = value; 501 return this; 502 } 503 504 /** 505 * @return {@link #effect} (The effect of the interaction, for example "reduced gastric absorption of primary medication".) 506 */ 507 public CodeableConcept getEffect() { 508 if (this.effect == null) 509 if (Configuration.errorOnAutoCreate()) 510 throw new Error("Attempt to auto-create MedicinalProductInteraction.effect"); 511 else if (Configuration.doAutoCreate()) 512 this.effect = new CodeableConcept(); // cc 513 return this.effect; 514 } 515 516 public boolean hasEffect() { 517 return this.effect != null && !this.effect.isEmpty(); 518 } 519 520 /** 521 * @param value {@link #effect} (The effect of the interaction, for example "reduced gastric absorption of primary medication".) 522 */ 523 public MedicinalProductInteraction setEffect(CodeableConcept value) { 524 this.effect = value; 525 return this; 526 } 527 528 /** 529 * @return {@link #incidence} (The incidence of the interaction, e.g. theoretical, observed.) 530 */ 531 public CodeableConcept getIncidence() { 532 if (this.incidence == null) 533 if (Configuration.errorOnAutoCreate()) 534 throw new Error("Attempt to auto-create MedicinalProductInteraction.incidence"); 535 else if (Configuration.doAutoCreate()) 536 this.incidence = new CodeableConcept(); // cc 537 return this.incidence; 538 } 539 540 public boolean hasIncidence() { 541 return this.incidence != null && !this.incidence.isEmpty(); 542 } 543 544 /** 545 * @param value {@link #incidence} (The incidence of the interaction, e.g. theoretical, observed.) 546 */ 547 public MedicinalProductInteraction setIncidence(CodeableConcept value) { 548 this.incidence = value; 549 return this; 550 } 551 552 /** 553 * @return {@link #management} (Actions for managing the interaction.) 554 */ 555 public CodeableConcept getManagement() { 556 if (this.management == null) 557 if (Configuration.errorOnAutoCreate()) 558 throw new Error("Attempt to auto-create MedicinalProductInteraction.management"); 559 else if (Configuration.doAutoCreate()) 560 this.management = new CodeableConcept(); // cc 561 return this.management; 562 } 563 564 public boolean hasManagement() { 565 return this.management != null && !this.management.isEmpty(); 566 } 567 568 /** 569 * @param value {@link #management} (Actions for managing the interaction.) 570 */ 571 public MedicinalProductInteraction setManagement(CodeableConcept value) { 572 this.management = value; 573 return this; 574 } 575 576 protected void listChildren(List<Property> children) { 577 super.listChildren(children); 578 children.add(new Property("subject", "Reference(MedicinalProduct|Medication|Substance)", "The medication for which this is a described interaction.", 0, java.lang.Integer.MAX_VALUE, subject)); 579 children.add(new Property("description", "string", "The interaction described.", 0, 1, description)); 580 children.add(new Property("interactant", "", "The specific medication, food or laboratory test that interacts.", 0, java.lang.Integer.MAX_VALUE, interactant)); 581 children.add(new Property("type", "CodeableConcept", "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.", 0, 1, type)); 582 children.add(new Property("effect", "CodeableConcept", "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".", 0, 1, effect)); 583 children.add(new Property("incidence", "CodeableConcept", "The incidence of the interaction, e.g. theoretical, observed.", 0, 1, incidence)); 584 children.add(new Property("management", "CodeableConcept", "Actions for managing the interaction.", 0, 1, management)); 585 } 586 587 @Override 588 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 589 switch (_hash) { 590 case -1867885268: /*subject*/ return new Property("subject", "Reference(MedicinalProduct|Medication|Substance)", "The medication for which this is a described interaction.", 0, java.lang.Integer.MAX_VALUE, subject); 591 case -1724546052: /*description*/ return new Property("description", "string", "The interaction described.", 0, 1, description); 592 case 1844097009: /*interactant*/ return new Property("interactant", "", "The specific medication, food or laboratory test that interacts.", 0, java.lang.Integer.MAX_VALUE, interactant); 593 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "The type of the interaction e.g. drug-drug interaction, drug-food interaction, drug-lab test interaction.", 0, 1, type); 594 case -1306084975: /*effect*/ return new Property("effect", "CodeableConcept", "The effect of the interaction, for example \"reduced gastric absorption of primary medication\".", 0, 1, effect); 595 case -1598467132: /*incidence*/ return new Property("incidence", "CodeableConcept", "The incidence of the interaction, e.g. theoretical, observed.", 0, 1, incidence); 596 case -1799980989: /*management*/ return new Property("management", "CodeableConcept", "Actions for managing the interaction.", 0, 1, management); 597 default: return super.getNamedProperty(_hash, _name, _checkValid); 598 } 599 600 } 601 602 @Override 603 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 604 switch (hash) { 605 case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : this.subject.toArray(new Base[this.subject.size()]); // Reference 606 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 607 case 1844097009: /*interactant*/ return this.interactant == null ? new Base[0] : this.interactant.toArray(new Base[this.interactant.size()]); // MedicinalProductInteractionInteractantComponent 608 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 609 case -1306084975: /*effect*/ return this.effect == null ? new Base[0] : new Base[] {this.effect}; // CodeableConcept 610 case -1598467132: /*incidence*/ return this.incidence == null ? new Base[0] : new Base[] {this.incidence}; // CodeableConcept 611 case -1799980989: /*management*/ return this.management == null ? new Base[0] : new Base[] {this.management}; // CodeableConcept 612 default: return super.getProperty(hash, name, checkValid); 613 } 614 615 } 616 617 @Override 618 public Base setProperty(int hash, String name, Base value) throws FHIRException { 619 switch (hash) { 620 case -1867885268: // subject 621 this.getSubject().add(castToReference(value)); // Reference 622 return value; 623 case -1724546052: // description 624 this.description = castToString(value); // StringType 625 return value; 626 case 1844097009: // interactant 627 this.getInteractant().add((MedicinalProductInteractionInteractantComponent) value); // MedicinalProductInteractionInteractantComponent 628 return value; 629 case 3575610: // type 630 this.type = castToCodeableConcept(value); // CodeableConcept 631 return value; 632 case -1306084975: // effect 633 this.effect = castToCodeableConcept(value); // CodeableConcept 634 return value; 635 case -1598467132: // incidence 636 this.incidence = castToCodeableConcept(value); // CodeableConcept 637 return value; 638 case -1799980989: // management 639 this.management = castToCodeableConcept(value); // CodeableConcept 640 return value; 641 default: return super.setProperty(hash, name, value); 642 } 643 644 } 645 646 @Override 647 public Base setProperty(String name, Base value) throws FHIRException { 648 if (name.equals("subject")) { 649 this.getSubject().add(castToReference(value)); 650 } else if (name.equals("description")) { 651 this.description = castToString(value); // StringType 652 } else if (name.equals("interactant")) { 653 this.getInteractant().add((MedicinalProductInteractionInteractantComponent) value); 654 } else if (name.equals("type")) { 655 this.type = castToCodeableConcept(value); // CodeableConcept 656 } else if (name.equals("effect")) { 657 this.effect = castToCodeableConcept(value); // CodeableConcept 658 } else if (name.equals("incidence")) { 659 this.incidence = castToCodeableConcept(value); // CodeableConcept 660 } else if (name.equals("management")) { 661 this.management = castToCodeableConcept(value); // CodeableConcept 662 } else 663 return super.setProperty(name, value); 664 return value; 665 } 666 667 @Override 668 public Base makeProperty(int hash, String name) throws FHIRException { 669 switch (hash) { 670 case -1867885268: return addSubject(); 671 case -1724546052: return getDescriptionElement(); 672 case 1844097009: return addInteractant(); 673 case 3575610: return getType(); 674 case -1306084975: return getEffect(); 675 case -1598467132: return getIncidence(); 676 case -1799980989: return getManagement(); 677 default: return super.makeProperty(hash, name); 678 } 679 680 } 681 682 @Override 683 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 684 switch (hash) { 685 case -1867885268: /*subject*/ return new String[] {"Reference"}; 686 case -1724546052: /*description*/ return new String[] {"string"}; 687 case 1844097009: /*interactant*/ return new String[] {}; 688 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 689 case -1306084975: /*effect*/ return new String[] {"CodeableConcept"}; 690 case -1598467132: /*incidence*/ return new String[] {"CodeableConcept"}; 691 case -1799980989: /*management*/ return new String[] {"CodeableConcept"}; 692 default: return super.getTypesForProperty(hash, name); 693 } 694 695 } 696 697 @Override 698 public Base addChild(String name) throws FHIRException { 699 if (name.equals("subject")) { 700 return addSubject(); 701 } 702 else if (name.equals("description")) { 703 throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductInteraction.description"); 704 } 705 else if (name.equals("interactant")) { 706 return addInteractant(); 707 } 708 else if (name.equals("type")) { 709 this.type = new CodeableConcept(); 710 return this.type; 711 } 712 else if (name.equals("effect")) { 713 this.effect = new CodeableConcept(); 714 return this.effect; 715 } 716 else if (name.equals("incidence")) { 717 this.incidence = new CodeableConcept(); 718 return this.incidence; 719 } 720 else if (name.equals("management")) { 721 this.management = new CodeableConcept(); 722 return this.management; 723 } 724 else 725 return super.addChild(name); 726 } 727 728 public String fhirType() { 729 return "MedicinalProductInteraction"; 730 731 } 732 733 public MedicinalProductInteraction copy() { 734 MedicinalProductInteraction dst = new MedicinalProductInteraction(); 735 copyValues(dst); 736 return dst; 737 } 738 739 public void copyValues(MedicinalProductInteraction dst) { 740 super.copyValues(dst); 741 if (subject != null) { 742 dst.subject = new ArrayList<Reference>(); 743 for (Reference i : subject) 744 dst.subject.add(i.copy()); 745 }; 746 dst.description = description == null ? null : description.copy(); 747 if (interactant != null) { 748 dst.interactant = new ArrayList<MedicinalProductInteractionInteractantComponent>(); 749 for (MedicinalProductInteractionInteractantComponent i : interactant) 750 dst.interactant.add(i.copy()); 751 }; 752 dst.type = type == null ? null : type.copy(); 753 dst.effect = effect == null ? null : effect.copy(); 754 dst.incidence = incidence == null ? null : incidence.copy(); 755 dst.management = management == null ? null : management.copy(); 756 } 757 758 protected MedicinalProductInteraction typedCopy() { 759 return copy(); 760 } 761 762 @Override 763 public boolean equalsDeep(Base other_) { 764 if (!super.equalsDeep(other_)) 765 return false; 766 if (!(other_ instanceof MedicinalProductInteraction)) 767 return false; 768 MedicinalProductInteraction o = (MedicinalProductInteraction) other_; 769 return compareDeep(subject, o.subject, true) && compareDeep(description, o.description, true) && compareDeep(interactant, o.interactant, true) 770 && compareDeep(type, o.type, true) && compareDeep(effect, o.effect, true) && compareDeep(incidence, o.incidence, true) 771 && compareDeep(management, o.management, true); 772 } 773 774 @Override 775 public boolean equalsShallow(Base other_) { 776 if (!super.equalsShallow(other_)) 777 return false; 778 if (!(other_ instanceof MedicinalProductInteraction)) 779 return false; 780 MedicinalProductInteraction o = (MedicinalProductInteraction) other_; 781 return compareValues(description, o.description, true); 782 } 783 784 public boolean isEmpty() { 785 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subject, description, interactant 786 , type, effect, incidence, management); 787 } 788 789 @Override 790 public ResourceType getResourceType() { 791 return ResourceType.MedicinalProductInteraction; 792 } 793 794 /** 795 * Search parameter: <b>subject</b> 796 * <p> 797 * Description: <b>The medication for which this is an interaction</b><br> 798 * Type: <b>reference</b><br> 799 * Path: <b>MedicinalProductInteraction.subject</b><br> 800 * </p> 801 */ 802 @SearchParamDefinition(name="subject", path="MedicinalProductInteraction.subject", description="The medication for which this is an interaction", type="reference", target={Medication.class, MedicinalProduct.class, Substance.class } ) 803 public static final String SP_SUBJECT = "subject"; 804 /** 805 * <b>Fluent Client</b> search parameter constant for <b>subject</b> 806 * <p> 807 * Description: <b>The medication for which this is an interaction</b><br> 808 * Type: <b>reference</b><br> 809 * Path: <b>MedicinalProductInteraction.subject</b><br> 810 * </p> 811 */ 812 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); 813 814/** 815 * Constant for fluent queries to be used to add include statements. Specifies 816 * the path value of "<b>MedicinalProductInteraction:subject</b>". 817 */ 818 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicinalProductInteraction:subject").toLocked(); 819 820 821}