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