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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.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 * A pharmaceutical product described in terms of its composition and dose form. 047 */ 048@ResourceDef(name="MedicinalProductPharmaceutical", profile="http://hl7.org/fhir/Profile/MedicinalProductPharmaceutical") 049public class MedicinalProductPharmaceutical extends DomainResource { 050 051 @Block() 052 public static class MedicinalProductPharmaceuticalCharacteristicsComponent extends BackboneElement implements IBaseBackboneElement { 053 /** 054 * A coded characteristic. 055 */ 056 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 057 @Description(shortDefinition="A coded characteristic", formalDefinition="A coded characteristic." ) 058 protected CodeableConcept code; 059 060 /** 061 * The status of characteristic e.g. assigned or pending. 062 */ 063 @Child(name = "status", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 064 @Description(shortDefinition="The status of characteristic e.g. assigned or pending", formalDefinition="The status of characteristic e.g. assigned or pending." ) 065 protected CodeableConcept status; 066 067 private static final long serialVersionUID = 1414556635L; 068 069 /** 070 * Constructor 071 */ 072 public MedicinalProductPharmaceuticalCharacteristicsComponent() { 073 super(); 074 } 075 076 /** 077 * Constructor 078 */ 079 public MedicinalProductPharmaceuticalCharacteristicsComponent(CodeableConcept code) { 080 super(); 081 this.code = code; 082 } 083 084 /** 085 * @return {@link #code} (A coded characteristic.) 086 */ 087 public CodeableConcept getCode() { 088 if (this.code == null) 089 if (Configuration.errorOnAutoCreate()) 090 throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalCharacteristicsComponent.code"); 091 else if (Configuration.doAutoCreate()) 092 this.code = new CodeableConcept(); // cc 093 return this.code; 094 } 095 096 public boolean hasCode() { 097 return this.code != null && !this.code.isEmpty(); 098 } 099 100 /** 101 * @param value {@link #code} (A coded characteristic.) 102 */ 103 public MedicinalProductPharmaceuticalCharacteristicsComponent setCode(CodeableConcept value) { 104 this.code = value; 105 return this; 106 } 107 108 /** 109 * @return {@link #status} (The status of characteristic e.g. assigned or pending.) 110 */ 111 public CodeableConcept getStatus() { 112 if (this.status == null) 113 if (Configuration.errorOnAutoCreate()) 114 throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalCharacteristicsComponent.status"); 115 else if (Configuration.doAutoCreate()) 116 this.status = new CodeableConcept(); // cc 117 return this.status; 118 } 119 120 public boolean hasStatus() { 121 return this.status != null && !this.status.isEmpty(); 122 } 123 124 /** 125 * @param value {@link #status} (The status of characteristic e.g. assigned or pending.) 126 */ 127 public MedicinalProductPharmaceuticalCharacteristicsComponent setStatus(CodeableConcept value) { 128 this.status = value; 129 return this; 130 } 131 132 protected void listChildren(List<Property> children) { 133 super.listChildren(children); 134 children.add(new Property("code", "CodeableConcept", "A coded characteristic.", 0, 1, code)); 135 children.add(new Property("status", "CodeableConcept", "The status of characteristic e.g. assigned or pending.", 0, 1, status)); 136 } 137 138 @Override 139 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 140 switch (_hash) { 141 case 3059181: /*code*/ return new Property("code", "CodeableConcept", "A coded characteristic.", 0, 1, code); 142 case -892481550: /*status*/ return new Property("status", "CodeableConcept", "The status of characteristic e.g. assigned or pending.", 0, 1, status); 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 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 152 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept 153 default: return super.getProperty(hash, name, checkValid); 154 } 155 156 } 157 158 @Override 159 public Base setProperty(int hash, String name, Base value) throws FHIRException { 160 switch (hash) { 161 case 3059181: // code 162 this.code = castToCodeableConcept(value); // CodeableConcept 163 return value; 164 case -892481550: // status 165 this.status = castToCodeableConcept(value); // CodeableConcept 166 return value; 167 default: return super.setProperty(hash, name, value); 168 } 169 170 } 171 172 @Override 173 public Base setProperty(String name, Base value) throws FHIRException { 174 if (name.equals("code")) { 175 this.code = castToCodeableConcept(value); // CodeableConcept 176 } else if (name.equals("status")) { 177 this.status = castToCodeableConcept(value); // CodeableConcept 178 } else 179 return super.setProperty(name, value); 180 return value; 181 } 182 183 @Override 184 public Base makeProperty(int hash, String name) throws FHIRException { 185 switch (hash) { 186 case 3059181: return getCode(); 187 case -892481550: return getStatus(); 188 default: return super.makeProperty(hash, name); 189 } 190 191 } 192 193 @Override 194 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 195 switch (hash) { 196 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 197 case -892481550: /*status*/ return new String[] {"CodeableConcept"}; 198 default: return super.getTypesForProperty(hash, name); 199 } 200 201 } 202 203 @Override 204 public Base addChild(String name) throws FHIRException { 205 if (name.equals("code")) { 206 this.code = new CodeableConcept(); 207 return this.code; 208 } 209 else if (name.equals("status")) { 210 this.status = new CodeableConcept(); 211 return this.status; 212 } 213 else 214 return super.addChild(name); 215 } 216 217 public MedicinalProductPharmaceuticalCharacteristicsComponent copy() { 218 MedicinalProductPharmaceuticalCharacteristicsComponent dst = new MedicinalProductPharmaceuticalCharacteristicsComponent(); 219 copyValues(dst); 220 dst.code = code == null ? null : code.copy(); 221 dst.status = status == null ? null : status.copy(); 222 return dst; 223 } 224 225 @Override 226 public boolean equalsDeep(Base other_) { 227 if (!super.equalsDeep(other_)) 228 return false; 229 if (!(other_ instanceof MedicinalProductPharmaceuticalCharacteristicsComponent)) 230 return false; 231 MedicinalProductPharmaceuticalCharacteristicsComponent o = (MedicinalProductPharmaceuticalCharacteristicsComponent) other_; 232 return compareDeep(code, o.code, true) && compareDeep(status, o.status, true); 233 } 234 235 @Override 236 public boolean equalsShallow(Base other_) { 237 if (!super.equalsShallow(other_)) 238 return false; 239 if (!(other_ instanceof MedicinalProductPharmaceuticalCharacteristicsComponent)) 240 return false; 241 MedicinalProductPharmaceuticalCharacteristicsComponent o = (MedicinalProductPharmaceuticalCharacteristicsComponent) other_; 242 return true; 243 } 244 245 public boolean isEmpty() { 246 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, status); 247 } 248 249 public String fhirType() { 250 return "MedicinalProductPharmaceutical.characteristics"; 251 252 } 253 254 } 255 256 /** 257 * An identifier for the pharmaceutical medicinal product. 258 */ 259 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 260 @Description(shortDefinition="An identifier for the pharmaceutical medicinal product", formalDefinition="An identifier for the pharmaceutical medicinal product." ) 261 protected List<Identifier> identifier; 262 263 /** 264 * The administrable dose form, after necessary reconstitution. 265 */ 266 @Child(name = "administrableDoseForm", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 267 @Description(shortDefinition="The administrable dose form, after necessary reconstitution", formalDefinition="The administrable dose form, after necessary reconstitution." ) 268 protected CodeableConcept administrableDoseForm; 269 270 /** 271 * Todo. 272 */ 273 @Child(name = "unitOfPresentation", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 274 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 275 protected CodeableConcept unitOfPresentation; 276 277 /** 278 * The path by which the pharmaceutical product is taken into or makes contact with the body. 279 */ 280 @Child(name = "routeOfAdministration", type = {CodeableConcept.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 281 @Description(shortDefinition="The path by which the pharmaceutical product is taken into or makes contact with the body", formalDefinition="The path by which the pharmaceutical product is taken into or makes contact with the body." ) 282 protected List<CodeableConcept> routeOfAdministration; 283 284 /** 285 * Ingredient. 286 */ 287 @Child(name = "ingredient", type = {MedicinalProductIngredient.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 288 @Description(shortDefinition="Ingredient", formalDefinition="Ingredient." ) 289 protected List<Reference> ingredient; 290 /** 291 * The actual objects that are the target of the reference (Ingredient.) 292 */ 293 protected List<MedicinalProductIngredient> ingredientTarget; 294 295 296 /** 297 * Accompanying device. 298 */ 299 @Child(name = "device", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 300 @Description(shortDefinition="Accompanying device", formalDefinition="Accompanying device." ) 301 protected List<StringType> device; 302 303 /** 304 * Characteristics e.g. a products onset of action. 305 */ 306 @Child(name = "characteristics", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 307 @Description(shortDefinition="Characteristics e.g. a products onset of action", formalDefinition="Characteristics e.g. a products onset of action." ) 308 protected List<MedicinalProductPharmaceuticalCharacteristicsComponent> characteristics; 309 310 private static final long serialVersionUID = -1564698410L; 311 312 /** 313 * Constructor 314 */ 315 public MedicinalProductPharmaceutical() { 316 super(); 317 } 318 319 /** 320 * Constructor 321 */ 322 public MedicinalProductPharmaceutical(CodeableConcept administrableDoseForm) { 323 super(); 324 this.administrableDoseForm = administrableDoseForm; 325 } 326 327 /** 328 * @return {@link #identifier} (An identifier for the pharmaceutical medicinal product.) 329 */ 330 public List<Identifier> getIdentifier() { 331 if (this.identifier == null) 332 this.identifier = new ArrayList<Identifier>(); 333 return this.identifier; 334 } 335 336 /** 337 * @return Returns a reference to <code>this</code> for easy method chaining 338 */ 339 public MedicinalProductPharmaceutical setIdentifier(List<Identifier> theIdentifier) { 340 this.identifier = theIdentifier; 341 return this; 342 } 343 344 public boolean hasIdentifier() { 345 if (this.identifier == null) 346 return false; 347 for (Identifier item : this.identifier) 348 if (!item.isEmpty()) 349 return true; 350 return false; 351 } 352 353 public Identifier addIdentifier() { //3 354 Identifier t = new Identifier(); 355 if (this.identifier == null) 356 this.identifier = new ArrayList<Identifier>(); 357 this.identifier.add(t); 358 return t; 359 } 360 361 public MedicinalProductPharmaceutical addIdentifier(Identifier t) { //3 362 if (t == null) 363 return this; 364 if (this.identifier == null) 365 this.identifier = new ArrayList<Identifier>(); 366 this.identifier.add(t); 367 return this; 368 } 369 370 /** 371 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 372 */ 373 public Identifier getIdentifierFirstRep() { 374 if (getIdentifier().isEmpty()) { 375 addIdentifier(); 376 } 377 return getIdentifier().get(0); 378 } 379 380 /** 381 * @return {@link #administrableDoseForm} (The administrable dose form, after necessary reconstitution.) 382 */ 383 public CodeableConcept getAdministrableDoseForm() { 384 if (this.administrableDoseForm == null) 385 if (Configuration.errorOnAutoCreate()) 386 throw new Error("Attempt to auto-create MedicinalProductPharmaceutical.administrableDoseForm"); 387 else if (Configuration.doAutoCreate()) 388 this.administrableDoseForm = new CodeableConcept(); // cc 389 return this.administrableDoseForm; 390 } 391 392 public boolean hasAdministrableDoseForm() { 393 return this.administrableDoseForm != null && !this.administrableDoseForm.isEmpty(); 394 } 395 396 /** 397 * @param value {@link #administrableDoseForm} (The administrable dose form, after necessary reconstitution.) 398 */ 399 public MedicinalProductPharmaceutical setAdministrableDoseForm(CodeableConcept value) { 400 this.administrableDoseForm = value; 401 return this; 402 } 403 404 /** 405 * @return {@link #unitOfPresentation} (Todo.) 406 */ 407 public CodeableConcept getUnitOfPresentation() { 408 if (this.unitOfPresentation == null) 409 if (Configuration.errorOnAutoCreate()) 410 throw new Error("Attempt to auto-create MedicinalProductPharmaceutical.unitOfPresentation"); 411 else if (Configuration.doAutoCreate()) 412 this.unitOfPresentation = new CodeableConcept(); // cc 413 return this.unitOfPresentation; 414 } 415 416 public boolean hasUnitOfPresentation() { 417 return this.unitOfPresentation != null && !this.unitOfPresentation.isEmpty(); 418 } 419 420 /** 421 * @param value {@link #unitOfPresentation} (Todo.) 422 */ 423 public MedicinalProductPharmaceutical setUnitOfPresentation(CodeableConcept value) { 424 this.unitOfPresentation = value; 425 return this; 426 } 427 428 /** 429 * @return {@link #routeOfAdministration} (The path by which the pharmaceutical product is taken into or makes contact with the body.) 430 */ 431 public List<CodeableConcept> getRouteOfAdministration() { 432 if (this.routeOfAdministration == null) 433 this.routeOfAdministration = new ArrayList<CodeableConcept>(); 434 return this.routeOfAdministration; 435 } 436 437 /** 438 * @return Returns a reference to <code>this</code> for easy method chaining 439 */ 440 public MedicinalProductPharmaceutical setRouteOfAdministration(List<CodeableConcept> theRouteOfAdministration) { 441 this.routeOfAdministration = theRouteOfAdministration; 442 return this; 443 } 444 445 public boolean hasRouteOfAdministration() { 446 if (this.routeOfAdministration == null) 447 return false; 448 for (CodeableConcept item : this.routeOfAdministration) 449 if (!item.isEmpty()) 450 return true; 451 return false; 452 } 453 454 public CodeableConcept addRouteOfAdministration() { //3 455 CodeableConcept t = new CodeableConcept(); 456 if (this.routeOfAdministration == null) 457 this.routeOfAdministration = new ArrayList<CodeableConcept>(); 458 this.routeOfAdministration.add(t); 459 return t; 460 } 461 462 public MedicinalProductPharmaceutical addRouteOfAdministration(CodeableConcept t) { //3 463 if (t == null) 464 return this; 465 if (this.routeOfAdministration == null) 466 this.routeOfAdministration = new ArrayList<CodeableConcept>(); 467 this.routeOfAdministration.add(t); 468 return this; 469 } 470 471 /** 472 * @return The first repetition of repeating field {@link #routeOfAdministration}, creating it if it does not already exist 473 */ 474 public CodeableConcept getRouteOfAdministrationFirstRep() { 475 if (getRouteOfAdministration().isEmpty()) { 476 addRouteOfAdministration(); 477 } 478 return getRouteOfAdministration().get(0); 479 } 480 481 /** 482 * @return {@link #ingredient} (Ingredient.) 483 */ 484 public List<Reference> getIngredient() { 485 if (this.ingredient == null) 486 this.ingredient = new ArrayList<Reference>(); 487 return this.ingredient; 488 } 489 490 /** 491 * @return Returns a reference to <code>this</code> for easy method chaining 492 */ 493 public MedicinalProductPharmaceutical setIngredient(List<Reference> theIngredient) { 494 this.ingredient = theIngredient; 495 return this; 496 } 497 498 public boolean hasIngredient() { 499 if (this.ingredient == null) 500 return false; 501 for (Reference item : this.ingredient) 502 if (!item.isEmpty()) 503 return true; 504 return false; 505 } 506 507 public Reference addIngredient() { //3 508 Reference t = new Reference(); 509 if (this.ingredient == null) 510 this.ingredient = new ArrayList<Reference>(); 511 this.ingredient.add(t); 512 return t; 513 } 514 515 public MedicinalProductPharmaceutical addIngredient(Reference t) { //3 516 if (t == null) 517 return this; 518 if (this.ingredient == null) 519 this.ingredient = new ArrayList<Reference>(); 520 this.ingredient.add(t); 521 return this; 522 } 523 524 /** 525 * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist 526 */ 527 public Reference getIngredientFirstRep() { 528 if (getIngredient().isEmpty()) { 529 addIngredient(); 530 } 531 return getIngredient().get(0); 532 } 533 534 /** 535 * @deprecated Use Reference#setResource(IBaseResource) instead 536 */ 537 @Deprecated 538 public List<MedicinalProductIngredient> getIngredientTarget() { 539 if (this.ingredientTarget == null) 540 this.ingredientTarget = new ArrayList<MedicinalProductIngredient>(); 541 return this.ingredientTarget; 542 } 543 544 /** 545 * @deprecated Use Reference#setResource(IBaseResource) instead 546 */ 547 @Deprecated 548 public MedicinalProductIngredient addIngredientTarget() { 549 MedicinalProductIngredient r = new MedicinalProductIngredient(); 550 if (this.ingredientTarget == null) 551 this.ingredientTarget = new ArrayList<MedicinalProductIngredient>(); 552 this.ingredientTarget.add(r); 553 return r; 554 } 555 556 /** 557 * @return {@link #device} (Accompanying device.) 558 */ 559 public List<StringType> getDevice() { 560 if (this.device == null) 561 this.device = new ArrayList<StringType>(); 562 return this.device; 563 } 564 565 /** 566 * @return Returns a reference to <code>this</code> for easy method chaining 567 */ 568 public MedicinalProductPharmaceutical setDevice(List<StringType> theDevice) { 569 this.device = theDevice; 570 return this; 571 } 572 573 public boolean hasDevice() { 574 if (this.device == null) 575 return false; 576 for (StringType item : this.device) 577 if (!item.isEmpty()) 578 return true; 579 return false; 580 } 581 582 /** 583 * @return {@link #device} (Accompanying device.) 584 */ 585 public StringType addDeviceElement() {//2 586 StringType t = new StringType(); 587 if (this.device == null) 588 this.device = new ArrayList<StringType>(); 589 this.device.add(t); 590 return t; 591 } 592 593 /** 594 * @param value {@link #device} (Accompanying device.) 595 */ 596 public MedicinalProductPharmaceutical addDevice(String value) { //1 597 StringType t = new StringType(); 598 t.setValue(value); 599 if (this.device == null) 600 this.device = new ArrayList<StringType>(); 601 this.device.add(t); 602 return this; 603 } 604 605 /** 606 * @param value {@link #device} (Accompanying device.) 607 */ 608 public boolean hasDevice(String value) { 609 if (this.device == null) 610 return false; 611 for (StringType v : this.device) 612 if (v.getValue().equals(value)) // string 613 return true; 614 return false; 615 } 616 617 /** 618 * @return {@link #characteristics} (Characteristics e.g. a products onset of action.) 619 */ 620 public List<MedicinalProductPharmaceuticalCharacteristicsComponent> getCharacteristics() { 621 if (this.characteristics == null) 622 this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>(); 623 return this.characteristics; 624 } 625 626 /** 627 * @return Returns a reference to <code>this</code> for easy method chaining 628 */ 629 public MedicinalProductPharmaceutical setCharacteristics(List<MedicinalProductPharmaceuticalCharacteristicsComponent> theCharacteristics) { 630 this.characteristics = theCharacteristics; 631 return this; 632 } 633 634 public boolean hasCharacteristics() { 635 if (this.characteristics == null) 636 return false; 637 for (MedicinalProductPharmaceuticalCharacteristicsComponent item : this.characteristics) 638 if (!item.isEmpty()) 639 return true; 640 return false; 641 } 642 643 public MedicinalProductPharmaceuticalCharacteristicsComponent addCharacteristics() { //3 644 MedicinalProductPharmaceuticalCharacteristicsComponent t = new MedicinalProductPharmaceuticalCharacteristicsComponent(); 645 if (this.characteristics == null) 646 this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>(); 647 this.characteristics.add(t); 648 return t; 649 } 650 651 public MedicinalProductPharmaceutical addCharacteristics(MedicinalProductPharmaceuticalCharacteristicsComponent t) { //3 652 if (t == null) 653 return this; 654 if (this.characteristics == null) 655 this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>(); 656 this.characteristics.add(t); 657 return this; 658 } 659 660 /** 661 * @return The first repetition of repeating field {@link #characteristics}, creating it if it does not already exist 662 */ 663 public MedicinalProductPharmaceuticalCharacteristicsComponent getCharacteristicsFirstRep() { 664 if (getCharacteristics().isEmpty()) { 665 addCharacteristics(); 666 } 667 return getCharacteristics().get(0); 668 } 669 670 protected void listChildren(List<Property> children) { 671 super.listChildren(children); 672 children.add(new Property("identifier", "Identifier", "An identifier for the pharmaceutical medicinal product.", 0, java.lang.Integer.MAX_VALUE, identifier)); 673 children.add(new Property("administrableDoseForm", "CodeableConcept", "The administrable dose form, after necessary reconstitution.", 0, 1, administrableDoseForm)); 674 children.add(new Property("unitOfPresentation", "CodeableConcept", "Todo.", 0, 1, unitOfPresentation)); 675 children.add(new Property("routeOfAdministration", "CodeableConcept", "The path by which the pharmaceutical product is taken into or makes contact with the body.", 0, java.lang.Integer.MAX_VALUE, routeOfAdministration)); 676 children.add(new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0, java.lang.Integer.MAX_VALUE, ingredient)); 677 children.add(new Property("device", "string", "Accompanying device.", 0, java.lang.Integer.MAX_VALUE, device)); 678 children.add(new Property("characteristics", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, characteristics)); 679 } 680 681 @Override 682 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 683 switch (_hash) { 684 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "An identifier for the pharmaceutical medicinal product.", 0, java.lang.Integer.MAX_VALUE, identifier); 685 case 1446105202: /*administrableDoseForm*/ return new Property("administrableDoseForm", "CodeableConcept", "The administrable dose form, after necessary reconstitution.", 0, 1, administrableDoseForm); 686 case -1427765963: /*unitOfPresentation*/ return new Property("unitOfPresentation", "CodeableConcept", "Todo.", 0, 1, unitOfPresentation); 687 case 1742084734: /*routeOfAdministration*/ return new Property("routeOfAdministration", "CodeableConcept", "The path by which the pharmaceutical product is taken into or makes contact with the body.", 0, java.lang.Integer.MAX_VALUE, routeOfAdministration); 688 case -206409263: /*ingredient*/ return new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0, java.lang.Integer.MAX_VALUE, ingredient); 689 case -1335157162: /*device*/ return new Property("device", "string", "Accompanying device.", 0, java.lang.Integer.MAX_VALUE, device); 690 case -1529171400: /*characteristics*/ return new Property("characteristics", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, characteristics); 691 default: return super.getNamedProperty(_hash, _name, _checkValid); 692 } 693 694 } 695 696 @Override 697 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 698 switch (hash) { 699 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 700 case 1446105202: /*administrableDoseForm*/ return this.administrableDoseForm == null ? new Base[0] : new Base[] {this.administrableDoseForm}; // CodeableConcept 701 case -1427765963: /*unitOfPresentation*/ return this.unitOfPresentation == null ? new Base[0] : new Base[] {this.unitOfPresentation}; // CodeableConcept 702 case 1742084734: /*routeOfAdministration*/ return this.routeOfAdministration == null ? new Base[0] : this.routeOfAdministration.toArray(new Base[this.routeOfAdministration.size()]); // CodeableConcept 703 case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // Reference 704 case -1335157162: /*device*/ return this.device == null ? new Base[0] : this.device.toArray(new Base[this.device.size()]); // StringType 705 case -1529171400: /*characteristics*/ return this.characteristics == null ? new Base[0] : this.characteristics.toArray(new Base[this.characteristics.size()]); // MedicinalProductPharmaceuticalCharacteristicsComponent 706 default: return super.getProperty(hash, name, checkValid); 707 } 708 709 } 710 711 @Override 712 public Base setProperty(int hash, String name, Base value) throws FHIRException { 713 switch (hash) { 714 case -1618432855: // identifier 715 this.getIdentifier().add(castToIdentifier(value)); // Identifier 716 return value; 717 case 1446105202: // administrableDoseForm 718 this.administrableDoseForm = castToCodeableConcept(value); // CodeableConcept 719 return value; 720 case -1427765963: // unitOfPresentation 721 this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept 722 return value; 723 case 1742084734: // routeOfAdministration 724 this.getRouteOfAdministration().add(castToCodeableConcept(value)); // CodeableConcept 725 return value; 726 case -206409263: // ingredient 727 this.getIngredient().add(castToReference(value)); // Reference 728 return value; 729 case -1335157162: // device 730 this.getDevice().add(castToString(value)); // StringType 731 return value; 732 case -1529171400: // characteristics 733 this.getCharacteristics().add((MedicinalProductPharmaceuticalCharacteristicsComponent) value); // MedicinalProductPharmaceuticalCharacteristicsComponent 734 return value; 735 default: return super.setProperty(hash, name, value); 736 } 737 738 } 739 740 @Override 741 public Base setProperty(String name, Base value) throws FHIRException { 742 if (name.equals("identifier")) { 743 this.getIdentifier().add(castToIdentifier(value)); 744 } else if (name.equals("administrableDoseForm")) { 745 this.administrableDoseForm = castToCodeableConcept(value); // CodeableConcept 746 } else if (name.equals("unitOfPresentation")) { 747 this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept 748 } else if (name.equals("routeOfAdministration")) { 749 this.getRouteOfAdministration().add(castToCodeableConcept(value)); 750 } else if (name.equals("ingredient")) { 751 this.getIngredient().add(castToReference(value)); 752 } else if (name.equals("device")) { 753 this.getDevice().add(castToString(value)); 754 } else if (name.equals("characteristics")) { 755 this.getCharacteristics().add((MedicinalProductPharmaceuticalCharacteristicsComponent) value); 756 } else 757 return super.setProperty(name, value); 758 return value; 759 } 760 761 @Override 762 public Base makeProperty(int hash, String name) throws FHIRException { 763 switch (hash) { 764 case -1618432855: return addIdentifier(); 765 case 1446105202: return getAdministrableDoseForm(); 766 case -1427765963: return getUnitOfPresentation(); 767 case 1742084734: return addRouteOfAdministration(); 768 case -206409263: return addIngredient(); 769 case -1335157162: return addDeviceElement(); 770 case -1529171400: return addCharacteristics(); 771 default: return super.makeProperty(hash, name); 772 } 773 774 } 775 776 @Override 777 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 778 switch (hash) { 779 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 780 case 1446105202: /*administrableDoseForm*/ return new String[] {"CodeableConcept"}; 781 case -1427765963: /*unitOfPresentation*/ return new String[] {"CodeableConcept"}; 782 case 1742084734: /*routeOfAdministration*/ return new String[] {"CodeableConcept"}; 783 case -206409263: /*ingredient*/ return new String[] {"Reference"}; 784 case -1335157162: /*device*/ return new String[] {"string"}; 785 case -1529171400: /*characteristics*/ return new String[] {}; 786 default: return super.getTypesForProperty(hash, name); 787 } 788 789 } 790 791 @Override 792 public Base addChild(String name) throws FHIRException { 793 if (name.equals("identifier")) { 794 return addIdentifier(); 795 } 796 else if (name.equals("administrableDoseForm")) { 797 this.administrableDoseForm = new CodeableConcept(); 798 return this.administrableDoseForm; 799 } 800 else if (name.equals("unitOfPresentation")) { 801 this.unitOfPresentation = new CodeableConcept(); 802 return this.unitOfPresentation; 803 } 804 else if (name.equals("routeOfAdministration")) { 805 return addRouteOfAdministration(); 806 } 807 else if (name.equals("ingredient")) { 808 return addIngredient(); 809 } 810 else if (name.equals("device")) { 811 throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductPharmaceutical.device"); 812 } 813 else if (name.equals("characteristics")) { 814 return addCharacteristics(); 815 } 816 else 817 return super.addChild(name); 818 } 819 820 public String fhirType() { 821 return "MedicinalProductPharmaceutical"; 822 823 } 824 825 public MedicinalProductPharmaceutical copy() { 826 MedicinalProductPharmaceutical dst = new MedicinalProductPharmaceutical(); 827 copyValues(dst); 828 if (identifier != null) { 829 dst.identifier = new ArrayList<Identifier>(); 830 for (Identifier i : identifier) 831 dst.identifier.add(i.copy()); 832 }; 833 dst.administrableDoseForm = administrableDoseForm == null ? null : administrableDoseForm.copy(); 834 dst.unitOfPresentation = unitOfPresentation == null ? null : unitOfPresentation.copy(); 835 if (routeOfAdministration != null) { 836 dst.routeOfAdministration = new ArrayList<CodeableConcept>(); 837 for (CodeableConcept i : routeOfAdministration) 838 dst.routeOfAdministration.add(i.copy()); 839 }; 840 if (ingredient != null) { 841 dst.ingredient = new ArrayList<Reference>(); 842 for (Reference i : ingredient) 843 dst.ingredient.add(i.copy()); 844 }; 845 if (device != null) { 846 dst.device = new ArrayList<StringType>(); 847 for (StringType i : device) 848 dst.device.add(i.copy()); 849 }; 850 if (characteristics != null) { 851 dst.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>(); 852 for (MedicinalProductPharmaceuticalCharacteristicsComponent i : characteristics) 853 dst.characteristics.add(i.copy()); 854 }; 855 return dst; 856 } 857 858 protected MedicinalProductPharmaceutical typedCopy() { 859 return copy(); 860 } 861 862 @Override 863 public boolean equalsDeep(Base other_) { 864 if (!super.equalsDeep(other_)) 865 return false; 866 if (!(other_ instanceof MedicinalProductPharmaceutical)) 867 return false; 868 MedicinalProductPharmaceutical o = (MedicinalProductPharmaceutical) other_; 869 return compareDeep(identifier, o.identifier, true) && compareDeep(administrableDoseForm, o.administrableDoseForm, true) 870 && compareDeep(unitOfPresentation, o.unitOfPresentation, true) && compareDeep(routeOfAdministration, o.routeOfAdministration, true) 871 && compareDeep(ingredient, o.ingredient, true) && compareDeep(device, o.device, true) && compareDeep(characteristics, o.characteristics, true) 872 ; 873 } 874 875 @Override 876 public boolean equalsShallow(Base other_) { 877 if (!super.equalsShallow(other_)) 878 return false; 879 if (!(other_ instanceof MedicinalProductPharmaceutical)) 880 return false; 881 MedicinalProductPharmaceutical o = (MedicinalProductPharmaceutical) other_; 882 return compareValues(device, o.device, true); 883 } 884 885 public boolean isEmpty() { 886 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, administrableDoseForm 887 , unitOfPresentation, routeOfAdministration, ingredient, device, characteristics); 888 } 889 890 @Override 891 public ResourceType getResourceType() { 892 return ResourceType.MedicinalProductPharmaceutical; 893 } 894 895 896} 897