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 * An ingredient of a manufactured item or pharmaceutical product. 050 */ 051@ResourceDef(name="MedicinalProductIngredient", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductIngredient") 052public class MedicinalProductIngredient extends DomainResource { 053 054 @Block() 055 public static class MedicinalProductIngredientSpecifiedSubstanceComponent extends BackboneElement implements IBaseBackboneElement { 056 /** 057 * The specified substance. 058 */ 059 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 060 @Description(shortDefinition="The specified substance", formalDefinition="The specified substance." ) 061 protected CodeableConcept code; 062 063 /** 064 * The group of specified substance, e.g. group 1 to 4. 065 */ 066 @Child(name = "group", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true) 067 @Description(shortDefinition="The group of specified substance, e.g. group 1 to 4", formalDefinition="The group of specified substance, e.g. group 1 to 4." ) 068 protected CodeableConcept group; 069 070 /** 071 * Confidentiality level of the specified substance as the ingredient. 072 */ 073 @Child(name = "confidentiality", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 074 @Description(shortDefinition="Confidentiality level of the specified substance as the ingredient", formalDefinition="Confidentiality level of the specified substance as the ingredient." ) 075 protected CodeableConcept confidentiality; 076 077 /** 078 * Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product. 079 */ 080 @Child(name = "strength", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 081 @Description(shortDefinition="Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product", formalDefinition="Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product." ) 082 protected List<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent> strength; 083 084 private static final long serialVersionUID = -272590200L; 085 086 /** 087 * Constructor 088 */ 089 public MedicinalProductIngredientSpecifiedSubstanceComponent() { 090 super(); 091 } 092 093 /** 094 * Constructor 095 */ 096 public MedicinalProductIngredientSpecifiedSubstanceComponent(CodeableConcept code, CodeableConcept group) { 097 super(); 098 this.code = code; 099 this.group = group; 100 } 101 102 /** 103 * @return {@link #code} (The specified substance.) 104 */ 105 public CodeableConcept getCode() { 106 if (this.code == null) 107 if (Configuration.errorOnAutoCreate()) 108 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceComponent.code"); 109 else if (Configuration.doAutoCreate()) 110 this.code = new CodeableConcept(); // cc 111 return this.code; 112 } 113 114 public boolean hasCode() { 115 return this.code != null && !this.code.isEmpty(); 116 } 117 118 /** 119 * @param value {@link #code} (The specified substance.) 120 */ 121 public MedicinalProductIngredientSpecifiedSubstanceComponent setCode(CodeableConcept value) { 122 this.code = value; 123 return this; 124 } 125 126 /** 127 * @return {@link #group} (The group of specified substance, e.g. group 1 to 4.) 128 */ 129 public CodeableConcept getGroup() { 130 if (this.group == null) 131 if (Configuration.errorOnAutoCreate()) 132 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceComponent.group"); 133 else if (Configuration.doAutoCreate()) 134 this.group = new CodeableConcept(); // cc 135 return this.group; 136 } 137 138 public boolean hasGroup() { 139 return this.group != null && !this.group.isEmpty(); 140 } 141 142 /** 143 * @param value {@link #group} (The group of specified substance, e.g. group 1 to 4.) 144 */ 145 public MedicinalProductIngredientSpecifiedSubstanceComponent setGroup(CodeableConcept value) { 146 this.group = value; 147 return this; 148 } 149 150 /** 151 * @return {@link #confidentiality} (Confidentiality level of the specified substance as the ingredient.) 152 */ 153 public CodeableConcept getConfidentiality() { 154 if (this.confidentiality == null) 155 if (Configuration.errorOnAutoCreate()) 156 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceComponent.confidentiality"); 157 else if (Configuration.doAutoCreate()) 158 this.confidentiality = new CodeableConcept(); // cc 159 return this.confidentiality; 160 } 161 162 public boolean hasConfidentiality() { 163 return this.confidentiality != null && !this.confidentiality.isEmpty(); 164 } 165 166 /** 167 * @param value {@link #confidentiality} (Confidentiality level of the specified substance as the ingredient.) 168 */ 169 public MedicinalProductIngredientSpecifiedSubstanceComponent setConfidentiality(CodeableConcept value) { 170 this.confidentiality = value; 171 return this; 172 } 173 174 /** 175 * @return {@link #strength} (Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product.) 176 */ 177 public List<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent> getStrength() { 178 if (this.strength == null) 179 this.strength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent>(); 180 return this.strength; 181 } 182 183 /** 184 * @return Returns a reference to <code>this</code> for easy method chaining 185 */ 186 public MedicinalProductIngredientSpecifiedSubstanceComponent setStrength(List<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent> theStrength) { 187 this.strength = theStrength; 188 return this; 189 } 190 191 public boolean hasStrength() { 192 if (this.strength == null) 193 return false; 194 for (MedicinalProductIngredientSpecifiedSubstanceStrengthComponent item : this.strength) 195 if (!item.isEmpty()) 196 return true; 197 return false; 198 } 199 200 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent addStrength() { //3 201 MedicinalProductIngredientSpecifiedSubstanceStrengthComponent t = new MedicinalProductIngredientSpecifiedSubstanceStrengthComponent(); 202 if (this.strength == null) 203 this.strength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent>(); 204 this.strength.add(t); 205 return t; 206 } 207 208 public MedicinalProductIngredientSpecifiedSubstanceComponent addStrength(MedicinalProductIngredientSpecifiedSubstanceStrengthComponent t) { //3 209 if (t == null) 210 return this; 211 if (this.strength == null) 212 this.strength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent>(); 213 this.strength.add(t); 214 return this; 215 } 216 217 /** 218 * @return The first repetition of repeating field {@link #strength}, creating it if it does not already exist 219 */ 220 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent getStrengthFirstRep() { 221 if (getStrength().isEmpty()) { 222 addStrength(); 223 } 224 return getStrength().get(0); 225 } 226 227 protected void listChildren(List<Property> children) { 228 super.listChildren(children); 229 children.add(new Property("code", "CodeableConcept", "The specified substance.", 0, 1, code)); 230 children.add(new Property("group", "CodeableConcept", "The group of specified substance, e.g. group 1 to 4.", 0, 1, group)); 231 children.add(new Property("confidentiality", "CodeableConcept", "Confidentiality level of the specified substance as the ingredient.", 0, 1, confidentiality)); 232 children.add(new Property("strength", "", "Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product.", 0, java.lang.Integer.MAX_VALUE, strength)); 233 } 234 235 @Override 236 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 237 switch (_hash) { 238 case 3059181: /*code*/ return new Property("code", "CodeableConcept", "The specified substance.", 0, 1, code); 239 case 98629247: /*group*/ return new Property("group", "CodeableConcept", "The group of specified substance, e.g. group 1 to 4.", 0, 1, group); 240 case -1923018202: /*confidentiality*/ return new Property("confidentiality", "CodeableConcept", "Confidentiality level of the specified substance as the ingredient.", 0, 1, confidentiality); 241 case 1791316033: /*strength*/ return new Property("strength", "", "Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product.", 0, java.lang.Integer.MAX_VALUE, strength); 242 default: return super.getNamedProperty(_hash, _name, _checkValid); 243 } 244 245 } 246 247 @Override 248 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 249 switch (hash) { 250 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 251 case 98629247: /*group*/ return this.group == null ? new Base[0] : new Base[] {this.group}; // CodeableConcept 252 case -1923018202: /*confidentiality*/ return this.confidentiality == null ? new Base[0] : new Base[] {this.confidentiality}; // CodeableConcept 253 case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : this.strength.toArray(new Base[this.strength.size()]); // MedicinalProductIngredientSpecifiedSubstanceStrengthComponent 254 default: return super.getProperty(hash, name, checkValid); 255 } 256 257 } 258 259 @Override 260 public Base setProperty(int hash, String name, Base value) throws FHIRException { 261 switch (hash) { 262 case 3059181: // code 263 this.code = castToCodeableConcept(value); // CodeableConcept 264 return value; 265 case 98629247: // group 266 this.group = castToCodeableConcept(value); // CodeableConcept 267 return value; 268 case -1923018202: // confidentiality 269 this.confidentiality = castToCodeableConcept(value); // CodeableConcept 270 return value; 271 case 1791316033: // strength 272 this.getStrength().add((MedicinalProductIngredientSpecifiedSubstanceStrengthComponent) value); // MedicinalProductIngredientSpecifiedSubstanceStrengthComponent 273 return value; 274 default: return super.setProperty(hash, name, value); 275 } 276 277 } 278 279 @Override 280 public Base setProperty(String name, Base value) throws FHIRException { 281 if (name.equals("code")) { 282 this.code = castToCodeableConcept(value); // CodeableConcept 283 } else if (name.equals("group")) { 284 this.group = castToCodeableConcept(value); // CodeableConcept 285 } else if (name.equals("confidentiality")) { 286 this.confidentiality = castToCodeableConcept(value); // CodeableConcept 287 } else if (name.equals("strength")) { 288 this.getStrength().add((MedicinalProductIngredientSpecifiedSubstanceStrengthComponent) value); 289 } else 290 return super.setProperty(name, value); 291 return value; 292 } 293 294 @Override 295 public Base makeProperty(int hash, String name) throws FHIRException { 296 switch (hash) { 297 case 3059181: return getCode(); 298 case 98629247: return getGroup(); 299 case -1923018202: return getConfidentiality(); 300 case 1791316033: return addStrength(); 301 default: return super.makeProperty(hash, name); 302 } 303 304 } 305 306 @Override 307 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 308 switch (hash) { 309 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 310 case 98629247: /*group*/ return new String[] {"CodeableConcept"}; 311 case -1923018202: /*confidentiality*/ return new String[] {"CodeableConcept"}; 312 case 1791316033: /*strength*/ return new String[] {}; 313 default: return super.getTypesForProperty(hash, name); 314 } 315 316 } 317 318 @Override 319 public Base addChild(String name) throws FHIRException { 320 if (name.equals("code")) { 321 this.code = new CodeableConcept(); 322 return this.code; 323 } 324 else if (name.equals("group")) { 325 this.group = new CodeableConcept(); 326 return this.group; 327 } 328 else if (name.equals("confidentiality")) { 329 this.confidentiality = new CodeableConcept(); 330 return this.confidentiality; 331 } 332 else if (name.equals("strength")) { 333 return addStrength(); 334 } 335 else 336 return super.addChild(name); 337 } 338 339 public MedicinalProductIngredientSpecifiedSubstanceComponent copy() { 340 MedicinalProductIngredientSpecifiedSubstanceComponent dst = new MedicinalProductIngredientSpecifiedSubstanceComponent(); 341 copyValues(dst); 342 return dst; 343 } 344 345 public void copyValues(MedicinalProductIngredientSpecifiedSubstanceComponent dst) { 346 super.copyValues(dst); 347 dst.code = code == null ? null : code.copy(); 348 dst.group = group == null ? null : group.copy(); 349 dst.confidentiality = confidentiality == null ? null : confidentiality.copy(); 350 if (strength != null) { 351 dst.strength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent>(); 352 for (MedicinalProductIngredientSpecifiedSubstanceStrengthComponent i : strength) 353 dst.strength.add(i.copy()); 354 }; 355 } 356 357 @Override 358 public boolean equalsDeep(Base other_) { 359 if (!super.equalsDeep(other_)) 360 return false; 361 if (!(other_ instanceof MedicinalProductIngredientSpecifiedSubstanceComponent)) 362 return false; 363 MedicinalProductIngredientSpecifiedSubstanceComponent o = (MedicinalProductIngredientSpecifiedSubstanceComponent) other_; 364 return compareDeep(code, o.code, true) && compareDeep(group, o.group, true) && compareDeep(confidentiality, o.confidentiality, true) 365 && compareDeep(strength, o.strength, true); 366 } 367 368 @Override 369 public boolean equalsShallow(Base other_) { 370 if (!super.equalsShallow(other_)) 371 return false; 372 if (!(other_ instanceof MedicinalProductIngredientSpecifiedSubstanceComponent)) 373 return false; 374 MedicinalProductIngredientSpecifiedSubstanceComponent o = (MedicinalProductIngredientSpecifiedSubstanceComponent) other_; 375 return true; 376 } 377 378 public boolean isEmpty() { 379 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, group, confidentiality 380 , strength); 381 } 382 383 public String fhirType() { 384 return "MedicinalProductIngredient.specifiedSubstance"; 385 386 } 387 388 } 389 390 @Block() 391 public static class MedicinalProductIngredientSpecifiedSubstanceStrengthComponent extends BackboneElement implements IBaseBackboneElement { 392 /** 393 * The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item. 394 */ 395 @Child(name = "presentation", type = {Ratio.class}, order=1, min=1, max=1, modifier=false, summary=true) 396 @Description(shortDefinition="The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item", formalDefinition="The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item." ) 397 protected Ratio presentation; 398 399 /** 400 * A lower limit for the quantity of substance in the unit of presentation. For use when there is a range of strengths, this is the lower limit, with the presentation attribute becoming the upper limit. 401 */ 402 @Child(name = "presentationLowLimit", type = {Ratio.class}, order=2, min=0, max=1, modifier=true, summary=true) 403 @Description(shortDefinition="A lower limit for the quantity of substance in the unit of presentation. For use when there is a range of strengths, this is the lower limit, with the presentation attribute becoming the upper limit", formalDefinition="A lower limit for the quantity of substance in the unit of presentation. For use when there is a range of strengths, this is the lower limit, with the presentation attribute becoming the upper limit." ) 404 protected Ratio presentationLowLimit; 405 406 /** 407 * The strength per unitary volume (or mass). 408 */ 409 @Child(name = "concentration", type = {Ratio.class}, order=3, min=0, max=1, modifier=false, summary=true) 410 @Description(shortDefinition="The strength per unitary volume (or mass)", formalDefinition="The strength per unitary volume (or mass)." ) 411 protected Ratio concentration; 412 413 /** 414 * A lower limit for the strength per unitary volume (or mass), for when there is a range. The concentration attribute then becomes the upper limit. 415 */ 416 @Child(name = "concentrationLowLimit", type = {Ratio.class}, order=4, min=0, max=1, modifier=true, summary=true) 417 @Description(shortDefinition="A lower limit for the strength per unitary volume (or mass), for when there is a range. The concentration attribute then becomes the upper limit", formalDefinition="A lower limit for the strength per unitary volume (or mass), for when there is a range. The concentration attribute then becomes the upper limit." ) 418 protected Ratio concentrationLowLimit; 419 420 /** 421 * For when strength is measured at a particular point or distance. 422 */ 423 @Child(name = "measurementPoint", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true) 424 @Description(shortDefinition="For when strength is measured at a particular point or distance", formalDefinition="For when strength is measured at a particular point or distance." ) 425 protected StringType measurementPoint; 426 427 /** 428 * The country or countries for which the strength range applies. 429 */ 430 @Child(name = "country", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 431 @Description(shortDefinition="The country or countries for which the strength range applies", formalDefinition="The country or countries for which the strength range applies." ) 432 protected List<CodeableConcept> country; 433 434 /** 435 * Strength expressed in terms of a reference substance. 436 */ 437 @Child(name = "referenceStrength", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 438 @Description(shortDefinition="Strength expressed in terms of a reference substance", formalDefinition="Strength expressed in terms of a reference substance." ) 439 protected List<MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent> referenceStrength; 440 441 private static final long serialVersionUID = 1981438822L; 442 443 /** 444 * Constructor 445 */ 446 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent() { 447 super(); 448 } 449 450 /** 451 * Constructor 452 */ 453 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent(Ratio presentation) { 454 super(); 455 this.presentation = presentation; 456 } 457 458 /** 459 * @return {@link #presentation} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item.) 460 */ 461 public Ratio getPresentation() { 462 if (this.presentation == null) 463 if (Configuration.errorOnAutoCreate()) 464 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthComponent.presentation"); 465 else if (Configuration.doAutoCreate()) 466 this.presentation = new Ratio(); // cc 467 return this.presentation; 468 } 469 470 public boolean hasPresentation() { 471 return this.presentation != null && !this.presentation.isEmpty(); 472 } 473 474 /** 475 * @param value {@link #presentation} (The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item.) 476 */ 477 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent setPresentation(Ratio value) { 478 this.presentation = value; 479 return this; 480 } 481 482 /** 483 * @return {@link #presentationLowLimit} (A lower limit for the quantity of substance in the unit of presentation. For use when there is a range of strengths, this is the lower limit, with the presentation attribute becoming the upper limit.) 484 */ 485 public Ratio getPresentationLowLimit() { 486 if (this.presentationLowLimit == null) 487 if (Configuration.errorOnAutoCreate()) 488 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthComponent.presentationLowLimit"); 489 else if (Configuration.doAutoCreate()) 490 this.presentationLowLimit = new Ratio(); // cc 491 return this.presentationLowLimit; 492 } 493 494 public boolean hasPresentationLowLimit() { 495 return this.presentationLowLimit != null && !this.presentationLowLimit.isEmpty(); 496 } 497 498 /** 499 * @param value {@link #presentationLowLimit} (A lower limit for the quantity of substance in the unit of presentation. For use when there is a range of strengths, this is the lower limit, with the presentation attribute becoming the upper limit.) 500 */ 501 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent setPresentationLowLimit(Ratio value) { 502 this.presentationLowLimit = value; 503 return this; 504 } 505 506 /** 507 * @return {@link #concentration} (The strength per unitary volume (or mass).) 508 */ 509 public Ratio getConcentration() { 510 if (this.concentration == null) 511 if (Configuration.errorOnAutoCreate()) 512 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthComponent.concentration"); 513 else if (Configuration.doAutoCreate()) 514 this.concentration = new Ratio(); // cc 515 return this.concentration; 516 } 517 518 public boolean hasConcentration() { 519 return this.concentration != null && !this.concentration.isEmpty(); 520 } 521 522 /** 523 * @param value {@link #concentration} (The strength per unitary volume (or mass).) 524 */ 525 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent setConcentration(Ratio value) { 526 this.concentration = value; 527 return this; 528 } 529 530 /** 531 * @return {@link #concentrationLowLimit} (A lower limit for the strength per unitary volume (or mass), for when there is a range. The concentration attribute then becomes the upper limit.) 532 */ 533 public Ratio getConcentrationLowLimit() { 534 if (this.concentrationLowLimit == null) 535 if (Configuration.errorOnAutoCreate()) 536 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthComponent.concentrationLowLimit"); 537 else if (Configuration.doAutoCreate()) 538 this.concentrationLowLimit = new Ratio(); // cc 539 return this.concentrationLowLimit; 540 } 541 542 public boolean hasConcentrationLowLimit() { 543 return this.concentrationLowLimit != null && !this.concentrationLowLimit.isEmpty(); 544 } 545 546 /** 547 * @param value {@link #concentrationLowLimit} (A lower limit for the strength per unitary volume (or mass), for when there is a range. The concentration attribute then becomes the upper limit.) 548 */ 549 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent setConcentrationLowLimit(Ratio value) { 550 this.concentrationLowLimit = value; 551 return this; 552 } 553 554 /** 555 * @return {@link #measurementPoint} (For when strength is measured at a particular point or distance.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPoint" gives direct access to the value 556 */ 557 public StringType getMeasurementPointElement() { 558 if (this.measurementPoint == null) 559 if (Configuration.errorOnAutoCreate()) 560 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthComponent.measurementPoint"); 561 else if (Configuration.doAutoCreate()) 562 this.measurementPoint = new StringType(); // bb 563 return this.measurementPoint; 564 } 565 566 public boolean hasMeasurementPointElement() { 567 return this.measurementPoint != null && !this.measurementPoint.isEmpty(); 568 } 569 570 public boolean hasMeasurementPoint() { 571 return this.measurementPoint != null && !this.measurementPoint.isEmpty(); 572 } 573 574 /** 575 * @param value {@link #measurementPoint} (For when strength is measured at a particular point or distance.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPoint" gives direct access to the value 576 */ 577 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent setMeasurementPointElement(StringType value) { 578 this.measurementPoint = value; 579 return this; 580 } 581 582 /** 583 * @return For when strength is measured at a particular point or distance. 584 */ 585 public String getMeasurementPoint() { 586 return this.measurementPoint == null ? null : this.measurementPoint.getValue(); 587 } 588 589 /** 590 * @param value For when strength is measured at a particular point or distance. 591 */ 592 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent setMeasurementPoint(String value) { 593 if (Utilities.noString(value)) 594 this.measurementPoint = null; 595 else { 596 if (this.measurementPoint == null) 597 this.measurementPoint = new StringType(); 598 this.measurementPoint.setValue(value); 599 } 600 return this; 601 } 602 603 /** 604 * @return {@link #country} (The country or countries for which the strength range applies.) 605 */ 606 public List<CodeableConcept> getCountry() { 607 if (this.country == null) 608 this.country = new ArrayList<CodeableConcept>(); 609 return this.country; 610 } 611 612 /** 613 * @return Returns a reference to <code>this</code> for easy method chaining 614 */ 615 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent setCountry(List<CodeableConcept> theCountry) { 616 this.country = theCountry; 617 return this; 618 } 619 620 public boolean hasCountry() { 621 if (this.country == null) 622 return false; 623 for (CodeableConcept item : this.country) 624 if (!item.isEmpty()) 625 return true; 626 return false; 627 } 628 629 public CodeableConcept addCountry() { //3 630 CodeableConcept t = new CodeableConcept(); 631 if (this.country == null) 632 this.country = new ArrayList<CodeableConcept>(); 633 this.country.add(t); 634 return t; 635 } 636 637 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent addCountry(CodeableConcept t) { //3 638 if (t == null) 639 return this; 640 if (this.country == null) 641 this.country = new ArrayList<CodeableConcept>(); 642 this.country.add(t); 643 return this; 644 } 645 646 /** 647 * @return The first repetition of repeating field {@link #country}, creating it if it does not already exist 648 */ 649 public CodeableConcept getCountryFirstRep() { 650 if (getCountry().isEmpty()) { 651 addCountry(); 652 } 653 return getCountry().get(0); 654 } 655 656 /** 657 * @return {@link #referenceStrength} (Strength expressed in terms of a reference substance.) 658 */ 659 public List<MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent> getReferenceStrength() { 660 if (this.referenceStrength == null) 661 this.referenceStrength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent>(); 662 return this.referenceStrength; 663 } 664 665 /** 666 * @return Returns a reference to <code>this</code> for easy method chaining 667 */ 668 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent setReferenceStrength(List<MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent> theReferenceStrength) { 669 this.referenceStrength = theReferenceStrength; 670 return this; 671 } 672 673 public boolean hasReferenceStrength() { 674 if (this.referenceStrength == null) 675 return false; 676 for (MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent item : this.referenceStrength) 677 if (!item.isEmpty()) 678 return true; 679 return false; 680 } 681 682 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent addReferenceStrength() { //3 683 MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent t = new MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(); 684 if (this.referenceStrength == null) 685 this.referenceStrength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent>(); 686 this.referenceStrength.add(t); 687 return t; 688 } 689 690 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent addReferenceStrength(MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent t) { //3 691 if (t == null) 692 return this; 693 if (this.referenceStrength == null) 694 this.referenceStrength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent>(); 695 this.referenceStrength.add(t); 696 return this; 697 } 698 699 /** 700 * @return The first repetition of repeating field {@link #referenceStrength}, creating it if it does not already exist 701 */ 702 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent getReferenceStrengthFirstRep() { 703 if (getReferenceStrength().isEmpty()) { 704 addReferenceStrength(); 705 } 706 return getReferenceStrength().get(0); 707 } 708 709 protected void listChildren(List<Property> children) { 710 super.listChildren(children); 711 children.add(new Property("presentation", "Ratio", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item.", 0, 1, presentation)); 712 children.add(new Property("presentationLowLimit", "Ratio", "A lower limit for the quantity of substance in the unit of presentation. For use when there is a range of strengths, this is the lower limit, with the presentation attribute becoming the upper limit.", 0, 1, presentationLowLimit)); 713 children.add(new Property("concentration", "Ratio", "The strength per unitary volume (or mass).", 0, 1, concentration)); 714 children.add(new Property("concentrationLowLimit", "Ratio", "A lower limit for the strength per unitary volume (or mass), for when there is a range. The concentration attribute then becomes the upper limit.", 0, 1, concentrationLowLimit)); 715 children.add(new Property("measurementPoint", "string", "For when strength is measured at a particular point or distance.", 0, 1, measurementPoint)); 716 children.add(new Property("country", "CodeableConcept", "The country or countries for which the strength range applies.", 0, java.lang.Integer.MAX_VALUE, country)); 717 children.add(new Property("referenceStrength", "", "Strength expressed in terms of a reference substance.", 0, java.lang.Integer.MAX_VALUE, referenceStrength)); 718 } 719 720 @Override 721 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 722 switch (_hash) { 723 case 696975130: /*presentation*/ return new Property("presentation", "Ratio", "The quantity of substance in the unit of presentation, or in the volume (or mass) of the single pharmaceutical product or manufactured item.", 0, 1, presentation); 724 case -819112447: /*presentationLowLimit*/ return new Property("presentationLowLimit", "Ratio", "A lower limit for the quantity of substance in the unit of presentation. For use when there is a range of strengths, this is the lower limit, with the presentation attribute becoming the upper limit.", 0, 1, presentationLowLimit); 725 case -410557331: /*concentration*/ return new Property("concentration", "Ratio", "The strength per unitary volume (or mass).", 0, 1, concentration); 726 case -484132780: /*concentrationLowLimit*/ return new Property("concentrationLowLimit", "Ratio", "A lower limit for the strength per unitary volume (or mass), for when there is a range. The concentration attribute then becomes the upper limit.", 0, 1, concentrationLowLimit); 727 case 235437876: /*measurementPoint*/ return new Property("measurementPoint", "string", "For when strength is measured at a particular point or distance.", 0, 1, measurementPoint); 728 case 957831062: /*country*/ return new Property("country", "CodeableConcept", "The country or countries for which the strength range applies.", 0, java.lang.Integer.MAX_VALUE, country); 729 case 1943566508: /*referenceStrength*/ return new Property("referenceStrength", "", "Strength expressed in terms of a reference substance.", 0, java.lang.Integer.MAX_VALUE, referenceStrength); 730 default: return super.getNamedProperty(_hash, _name, _checkValid); 731 } 732 733 } 734 735 @Override 736 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 737 switch (hash) { 738 case 696975130: /*presentation*/ return this.presentation == null ? new Base[0] : new Base[] {this.presentation}; // Ratio 739 case -819112447: /*presentationLowLimit*/ return this.presentationLowLimit == null ? new Base[0] : new Base[] {this.presentationLowLimit}; // Ratio 740 case -410557331: /*concentration*/ return this.concentration == null ? new Base[0] : new Base[] {this.concentration}; // Ratio 741 case -484132780: /*concentrationLowLimit*/ return this.concentrationLowLimit == null ? new Base[0] : new Base[] {this.concentrationLowLimit}; // Ratio 742 case 235437876: /*measurementPoint*/ return this.measurementPoint == null ? new Base[0] : new Base[] {this.measurementPoint}; // StringType 743 case 957831062: /*country*/ return this.country == null ? new Base[0] : this.country.toArray(new Base[this.country.size()]); // CodeableConcept 744 case 1943566508: /*referenceStrength*/ return this.referenceStrength == null ? new Base[0] : this.referenceStrength.toArray(new Base[this.referenceStrength.size()]); // MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent 745 default: return super.getProperty(hash, name, checkValid); 746 } 747 748 } 749 750 @Override 751 public Base setProperty(int hash, String name, Base value) throws FHIRException { 752 switch (hash) { 753 case 696975130: // presentation 754 this.presentation = castToRatio(value); // Ratio 755 return value; 756 case -819112447: // presentationLowLimit 757 this.presentationLowLimit = castToRatio(value); // Ratio 758 return value; 759 case -410557331: // concentration 760 this.concentration = castToRatio(value); // Ratio 761 return value; 762 case -484132780: // concentrationLowLimit 763 this.concentrationLowLimit = castToRatio(value); // Ratio 764 return value; 765 case 235437876: // measurementPoint 766 this.measurementPoint = castToString(value); // StringType 767 return value; 768 case 957831062: // country 769 this.getCountry().add(castToCodeableConcept(value)); // CodeableConcept 770 return value; 771 case 1943566508: // referenceStrength 772 this.getReferenceStrength().add((MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent) value); // MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent 773 return value; 774 default: return super.setProperty(hash, name, value); 775 } 776 777 } 778 779 @Override 780 public Base setProperty(String name, Base value) throws FHIRException { 781 if (name.equals("presentation")) { 782 this.presentation = castToRatio(value); // Ratio 783 } else if (name.equals("presentationLowLimit")) { 784 this.presentationLowLimit = castToRatio(value); // Ratio 785 } else if (name.equals("concentration")) { 786 this.concentration = castToRatio(value); // Ratio 787 } else if (name.equals("concentrationLowLimit")) { 788 this.concentrationLowLimit = castToRatio(value); // Ratio 789 } else if (name.equals("measurementPoint")) { 790 this.measurementPoint = castToString(value); // StringType 791 } else if (name.equals("country")) { 792 this.getCountry().add(castToCodeableConcept(value)); 793 } else if (name.equals("referenceStrength")) { 794 this.getReferenceStrength().add((MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent) value); 795 } else 796 return super.setProperty(name, value); 797 return value; 798 } 799 800 @Override 801 public Base makeProperty(int hash, String name) throws FHIRException { 802 switch (hash) { 803 case 696975130: return getPresentation(); 804 case -819112447: return getPresentationLowLimit(); 805 case -410557331: return getConcentration(); 806 case -484132780: return getConcentrationLowLimit(); 807 case 235437876: return getMeasurementPointElement(); 808 case 957831062: return addCountry(); 809 case 1943566508: return addReferenceStrength(); 810 default: return super.makeProperty(hash, name); 811 } 812 813 } 814 815 @Override 816 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 817 switch (hash) { 818 case 696975130: /*presentation*/ return new String[] {"Ratio"}; 819 case -819112447: /*presentationLowLimit*/ return new String[] {"Ratio"}; 820 case -410557331: /*concentration*/ return new String[] {"Ratio"}; 821 case -484132780: /*concentrationLowLimit*/ return new String[] {"Ratio"}; 822 case 235437876: /*measurementPoint*/ return new String[] {"string"}; 823 case 957831062: /*country*/ return new String[] {"CodeableConcept"}; 824 case 1943566508: /*referenceStrength*/ return new String[] {}; 825 default: return super.getTypesForProperty(hash, name); 826 } 827 828 } 829 830 @Override 831 public Base addChild(String name) throws FHIRException { 832 if (name.equals("presentation")) { 833 this.presentation = new Ratio(); 834 return this.presentation; 835 } 836 else if (name.equals("presentationLowLimit")) { 837 this.presentationLowLimit = new Ratio(); 838 return this.presentationLowLimit; 839 } 840 else if (name.equals("concentration")) { 841 this.concentration = new Ratio(); 842 return this.concentration; 843 } 844 else if (name.equals("concentrationLowLimit")) { 845 this.concentrationLowLimit = new Ratio(); 846 return this.concentrationLowLimit; 847 } 848 else if (name.equals("measurementPoint")) { 849 throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductIngredient.measurementPoint"); 850 } 851 else if (name.equals("country")) { 852 return addCountry(); 853 } 854 else if (name.equals("referenceStrength")) { 855 return addReferenceStrength(); 856 } 857 else 858 return super.addChild(name); 859 } 860 861 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent copy() { 862 MedicinalProductIngredientSpecifiedSubstanceStrengthComponent dst = new MedicinalProductIngredientSpecifiedSubstanceStrengthComponent(); 863 copyValues(dst); 864 return dst; 865 } 866 867 public void copyValues(MedicinalProductIngredientSpecifiedSubstanceStrengthComponent dst) { 868 super.copyValues(dst); 869 dst.presentation = presentation == null ? null : presentation.copy(); 870 dst.presentationLowLimit = presentationLowLimit == null ? null : presentationLowLimit.copy(); 871 dst.concentration = concentration == null ? null : concentration.copy(); 872 dst.concentrationLowLimit = concentrationLowLimit == null ? null : concentrationLowLimit.copy(); 873 dst.measurementPoint = measurementPoint == null ? null : measurementPoint.copy(); 874 if (country != null) { 875 dst.country = new ArrayList<CodeableConcept>(); 876 for (CodeableConcept i : country) 877 dst.country.add(i.copy()); 878 }; 879 if (referenceStrength != null) { 880 dst.referenceStrength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent>(); 881 for (MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent i : referenceStrength) 882 dst.referenceStrength.add(i.copy()); 883 }; 884 } 885 886 @Override 887 public boolean equalsDeep(Base other_) { 888 if (!super.equalsDeep(other_)) 889 return false; 890 if (!(other_ instanceof MedicinalProductIngredientSpecifiedSubstanceStrengthComponent)) 891 return false; 892 MedicinalProductIngredientSpecifiedSubstanceStrengthComponent o = (MedicinalProductIngredientSpecifiedSubstanceStrengthComponent) other_; 893 return compareDeep(presentation, o.presentation, true) && compareDeep(presentationLowLimit, o.presentationLowLimit, true) 894 && compareDeep(concentration, o.concentration, true) && compareDeep(concentrationLowLimit, o.concentrationLowLimit, true) 895 && compareDeep(measurementPoint, o.measurementPoint, true) && compareDeep(country, o.country, true) 896 && compareDeep(referenceStrength, o.referenceStrength, true); 897 } 898 899 @Override 900 public boolean equalsShallow(Base other_) { 901 if (!super.equalsShallow(other_)) 902 return false; 903 if (!(other_ instanceof MedicinalProductIngredientSpecifiedSubstanceStrengthComponent)) 904 return false; 905 MedicinalProductIngredientSpecifiedSubstanceStrengthComponent o = (MedicinalProductIngredientSpecifiedSubstanceStrengthComponent) other_; 906 return compareValues(measurementPoint, o.measurementPoint, true); 907 } 908 909 public boolean isEmpty() { 910 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(presentation, presentationLowLimit 911 , concentration, concentrationLowLimit, measurementPoint, country, referenceStrength 912 ); 913 } 914 915 public String fhirType() { 916 return "MedicinalProductIngredient.specifiedSubstance.strength"; 917 918 } 919 920 } 921 922 @Block() 923 public static class MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent extends BackboneElement implements IBaseBackboneElement { 924 /** 925 * Relevant reference substance. 926 */ 927 @Child(name = "substance", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 928 @Description(shortDefinition="Relevant reference substance", formalDefinition="Relevant reference substance." ) 929 protected CodeableConcept substance; 930 931 /** 932 * Strength expressed in terms of a reference substance. 933 */ 934 @Child(name = "strength", type = {Ratio.class}, order=2, min=1, max=1, modifier=false, summary=true) 935 @Description(shortDefinition="Strength expressed in terms of a reference substance", formalDefinition="Strength expressed in terms of a reference substance." ) 936 protected Ratio strength; 937 938 /** 939 * Strength expressed in terms of a reference substance. 940 */ 941 @Child(name = "strengthLowLimit", type = {Ratio.class}, order=3, min=0, max=1, modifier=false, summary=true) 942 @Description(shortDefinition="Strength expressed in terms of a reference substance", formalDefinition="Strength expressed in terms of a reference substance." ) 943 protected Ratio strengthLowLimit; 944 945 /** 946 * For when strength is measured at a particular point or distance. 947 */ 948 @Child(name = "measurementPoint", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true) 949 @Description(shortDefinition="For when strength is measured at a particular point or distance", formalDefinition="For when strength is measured at a particular point or distance." ) 950 protected StringType measurementPoint; 951 952 /** 953 * The country or countries for which the strength range applies. 954 */ 955 @Child(name = "country", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 956 @Description(shortDefinition="The country or countries for which the strength range applies", formalDefinition="The country or countries for which the strength range applies." ) 957 protected List<CodeableConcept> country; 958 959 private static final long serialVersionUID = -839485716L; 960 961 /** 962 * Constructor 963 */ 964 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent() { 965 super(); 966 } 967 968 /** 969 * Constructor 970 */ 971 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(Ratio strength) { 972 super(); 973 this.strength = strength; 974 } 975 976 /** 977 * @return {@link #substance} (Relevant reference substance.) 978 */ 979 public CodeableConcept getSubstance() { 980 if (this.substance == null) 981 if (Configuration.errorOnAutoCreate()) 982 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent.substance"); 983 else if (Configuration.doAutoCreate()) 984 this.substance = new CodeableConcept(); // cc 985 return this.substance; 986 } 987 988 public boolean hasSubstance() { 989 return this.substance != null && !this.substance.isEmpty(); 990 } 991 992 /** 993 * @param value {@link #substance} (Relevant reference substance.) 994 */ 995 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent setSubstance(CodeableConcept value) { 996 this.substance = value; 997 return this; 998 } 999 1000 /** 1001 * @return {@link #strength} (Strength expressed in terms of a reference substance.) 1002 */ 1003 public Ratio getStrength() { 1004 if (this.strength == null) 1005 if (Configuration.errorOnAutoCreate()) 1006 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent.strength"); 1007 else if (Configuration.doAutoCreate()) 1008 this.strength = new Ratio(); // cc 1009 return this.strength; 1010 } 1011 1012 public boolean hasStrength() { 1013 return this.strength != null && !this.strength.isEmpty(); 1014 } 1015 1016 /** 1017 * @param value {@link #strength} (Strength expressed in terms of a reference substance.) 1018 */ 1019 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent setStrength(Ratio value) { 1020 this.strength = value; 1021 return this; 1022 } 1023 1024 /** 1025 * @return {@link #strengthLowLimit} (Strength expressed in terms of a reference substance.) 1026 */ 1027 public Ratio getStrengthLowLimit() { 1028 if (this.strengthLowLimit == null) 1029 if (Configuration.errorOnAutoCreate()) 1030 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent.strengthLowLimit"); 1031 else if (Configuration.doAutoCreate()) 1032 this.strengthLowLimit = new Ratio(); // cc 1033 return this.strengthLowLimit; 1034 } 1035 1036 public boolean hasStrengthLowLimit() { 1037 return this.strengthLowLimit != null && !this.strengthLowLimit.isEmpty(); 1038 } 1039 1040 /** 1041 * @param value {@link #strengthLowLimit} (Strength expressed in terms of a reference substance.) 1042 */ 1043 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent setStrengthLowLimit(Ratio value) { 1044 this.strengthLowLimit = value; 1045 return this; 1046 } 1047 1048 /** 1049 * @return {@link #measurementPoint} (For when strength is measured at a particular point or distance.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPoint" gives direct access to the value 1050 */ 1051 public StringType getMeasurementPointElement() { 1052 if (this.measurementPoint == null) 1053 if (Configuration.errorOnAutoCreate()) 1054 throw new Error("Attempt to auto-create MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent.measurementPoint"); 1055 else if (Configuration.doAutoCreate()) 1056 this.measurementPoint = new StringType(); // bb 1057 return this.measurementPoint; 1058 } 1059 1060 public boolean hasMeasurementPointElement() { 1061 return this.measurementPoint != null && !this.measurementPoint.isEmpty(); 1062 } 1063 1064 public boolean hasMeasurementPoint() { 1065 return this.measurementPoint != null && !this.measurementPoint.isEmpty(); 1066 } 1067 1068 /** 1069 * @param value {@link #measurementPoint} (For when strength is measured at a particular point or distance.). This is the underlying object with id, value and extensions. The accessor "getMeasurementPoint" gives direct access to the value 1070 */ 1071 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent setMeasurementPointElement(StringType value) { 1072 this.measurementPoint = value; 1073 return this; 1074 } 1075 1076 /** 1077 * @return For when strength is measured at a particular point or distance. 1078 */ 1079 public String getMeasurementPoint() { 1080 return this.measurementPoint == null ? null : this.measurementPoint.getValue(); 1081 } 1082 1083 /** 1084 * @param value For when strength is measured at a particular point or distance. 1085 */ 1086 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent setMeasurementPoint(String value) { 1087 if (Utilities.noString(value)) 1088 this.measurementPoint = null; 1089 else { 1090 if (this.measurementPoint == null) 1091 this.measurementPoint = new StringType(); 1092 this.measurementPoint.setValue(value); 1093 } 1094 return this; 1095 } 1096 1097 /** 1098 * @return {@link #country} (The country or countries for which the strength range applies.) 1099 */ 1100 public List<CodeableConcept> getCountry() { 1101 if (this.country == null) 1102 this.country = new ArrayList<CodeableConcept>(); 1103 return this.country; 1104 } 1105 1106 /** 1107 * @return Returns a reference to <code>this</code> for easy method chaining 1108 */ 1109 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent setCountry(List<CodeableConcept> theCountry) { 1110 this.country = theCountry; 1111 return this; 1112 } 1113 1114 public boolean hasCountry() { 1115 if (this.country == null) 1116 return false; 1117 for (CodeableConcept item : this.country) 1118 if (!item.isEmpty()) 1119 return true; 1120 return false; 1121 } 1122 1123 public CodeableConcept addCountry() { //3 1124 CodeableConcept t = new CodeableConcept(); 1125 if (this.country == null) 1126 this.country = new ArrayList<CodeableConcept>(); 1127 this.country.add(t); 1128 return t; 1129 } 1130 1131 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent addCountry(CodeableConcept t) { //3 1132 if (t == null) 1133 return this; 1134 if (this.country == null) 1135 this.country = new ArrayList<CodeableConcept>(); 1136 this.country.add(t); 1137 return this; 1138 } 1139 1140 /** 1141 * @return The first repetition of repeating field {@link #country}, creating it if it does not already exist 1142 */ 1143 public CodeableConcept getCountryFirstRep() { 1144 if (getCountry().isEmpty()) { 1145 addCountry(); 1146 } 1147 return getCountry().get(0); 1148 } 1149 1150 protected void listChildren(List<Property> children) { 1151 super.listChildren(children); 1152 children.add(new Property("substance", "CodeableConcept", "Relevant reference substance.", 0, 1, substance)); 1153 children.add(new Property("strength", "Ratio", "Strength expressed in terms of a reference substance.", 0, 1, strength)); 1154 children.add(new Property("strengthLowLimit", "Ratio", "Strength expressed in terms of a reference substance.", 0, 1, strengthLowLimit)); 1155 children.add(new Property("measurementPoint", "string", "For when strength is measured at a particular point or distance.", 0, 1, measurementPoint)); 1156 children.add(new Property("country", "CodeableConcept", "The country or countries for which the strength range applies.", 0, java.lang.Integer.MAX_VALUE, country)); 1157 } 1158 1159 @Override 1160 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1161 switch (_hash) { 1162 case 530040176: /*substance*/ return new Property("substance", "CodeableConcept", "Relevant reference substance.", 0, 1, substance); 1163 case 1791316033: /*strength*/ return new Property("strength", "Ratio", "Strength expressed in terms of a reference substance.", 0, 1, strength); 1164 case 1945341992: /*strengthLowLimit*/ return new Property("strengthLowLimit", "Ratio", "Strength expressed in terms of a reference substance.", 0, 1, strengthLowLimit); 1165 case 235437876: /*measurementPoint*/ return new Property("measurementPoint", "string", "For when strength is measured at a particular point or distance.", 0, 1, measurementPoint); 1166 case 957831062: /*country*/ return new Property("country", "CodeableConcept", "The country or countries for which the strength range applies.", 0, java.lang.Integer.MAX_VALUE, country); 1167 default: return super.getNamedProperty(_hash, _name, _checkValid); 1168 } 1169 1170 } 1171 1172 @Override 1173 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1174 switch (hash) { 1175 case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // CodeableConcept 1176 case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // Ratio 1177 case 1945341992: /*strengthLowLimit*/ return this.strengthLowLimit == null ? new Base[0] : new Base[] {this.strengthLowLimit}; // Ratio 1178 case 235437876: /*measurementPoint*/ return this.measurementPoint == null ? new Base[0] : new Base[] {this.measurementPoint}; // StringType 1179 case 957831062: /*country*/ return this.country == null ? new Base[0] : this.country.toArray(new Base[this.country.size()]); // CodeableConcept 1180 default: return super.getProperty(hash, name, checkValid); 1181 } 1182 1183 } 1184 1185 @Override 1186 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1187 switch (hash) { 1188 case 530040176: // substance 1189 this.substance = castToCodeableConcept(value); // CodeableConcept 1190 return value; 1191 case 1791316033: // strength 1192 this.strength = castToRatio(value); // Ratio 1193 return value; 1194 case 1945341992: // strengthLowLimit 1195 this.strengthLowLimit = castToRatio(value); // Ratio 1196 return value; 1197 case 235437876: // measurementPoint 1198 this.measurementPoint = castToString(value); // StringType 1199 return value; 1200 case 957831062: // country 1201 this.getCountry().add(castToCodeableConcept(value)); // CodeableConcept 1202 return value; 1203 default: return super.setProperty(hash, name, value); 1204 } 1205 1206 } 1207 1208 @Override 1209 public Base setProperty(String name, Base value) throws FHIRException { 1210 if (name.equals("substance")) { 1211 this.substance = castToCodeableConcept(value); // CodeableConcept 1212 } else if (name.equals("strength")) { 1213 this.strength = castToRatio(value); // Ratio 1214 } else if (name.equals("strengthLowLimit")) { 1215 this.strengthLowLimit = castToRatio(value); // Ratio 1216 } else if (name.equals("measurementPoint")) { 1217 this.measurementPoint = castToString(value); // StringType 1218 } else if (name.equals("country")) { 1219 this.getCountry().add(castToCodeableConcept(value)); 1220 } else 1221 return super.setProperty(name, value); 1222 return value; 1223 } 1224 1225 @Override 1226 public Base makeProperty(int hash, String name) throws FHIRException { 1227 switch (hash) { 1228 case 530040176: return getSubstance(); 1229 case 1791316033: return getStrength(); 1230 case 1945341992: return getStrengthLowLimit(); 1231 case 235437876: return getMeasurementPointElement(); 1232 case 957831062: return addCountry(); 1233 default: return super.makeProperty(hash, name); 1234 } 1235 1236 } 1237 1238 @Override 1239 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1240 switch (hash) { 1241 case 530040176: /*substance*/ return new String[] {"CodeableConcept"}; 1242 case 1791316033: /*strength*/ return new String[] {"Ratio"}; 1243 case 1945341992: /*strengthLowLimit*/ return new String[] {"Ratio"}; 1244 case 235437876: /*measurementPoint*/ return new String[] {"string"}; 1245 case 957831062: /*country*/ return new String[] {"CodeableConcept"}; 1246 default: return super.getTypesForProperty(hash, name); 1247 } 1248 1249 } 1250 1251 @Override 1252 public Base addChild(String name) throws FHIRException { 1253 if (name.equals("substance")) { 1254 this.substance = new CodeableConcept(); 1255 return this.substance; 1256 } 1257 else if (name.equals("strength")) { 1258 this.strength = new Ratio(); 1259 return this.strength; 1260 } 1261 else if (name.equals("strengthLowLimit")) { 1262 this.strengthLowLimit = new Ratio(); 1263 return this.strengthLowLimit; 1264 } 1265 else if (name.equals("measurementPoint")) { 1266 throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductIngredient.measurementPoint"); 1267 } 1268 else if (name.equals("country")) { 1269 return addCountry(); 1270 } 1271 else 1272 return super.addChild(name); 1273 } 1274 1275 public MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent copy() { 1276 MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent dst = new MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(); 1277 copyValues(dst); 1278 return dst; 1279 } 1280 1281 public void copyValues(MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent dst) { 1282 super.copyValues(dst); 1283 dst.substance = substance == null ? null : substance.copy(); 1284 dst.strength = strength == null ? null : strength.copy(); 1285 dst.strengthLowLimit = strengthLowLimit == null ? null : strengthLowLimit.copy(); 1286 dst.measurementPoint = measurementPoint == null ? null : measurementPoint.copy(); 1287 if (country != null) { 1288 dst.country = new ArrayList<CodeableConcept>(); 1289 for (CodeableConcept i : country) 1290 dst.country.add(i.copy()); 1291 }; 1292 } 1293 1294 @Override 1295 public boolean equalsDeep(Base other_) { 1296 if (!super.equalsDeep(other_)) 1297 return false; 1298 if (!(other_ instanceof MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent)) 1299 return false; 1300 MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent o = (MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent) other_; 1301 return compareDeep(substance, o.substance, true) && compareDeep(strength, o.strength, true) && compareDeep(strengthLowLimit, o.strengthLowLimit, true) 1302 && compareDeep(measurementPoint, o.measurementPoint, true) && compareDeep(country, o.country, true) 1303 ; 1304 } 1305 1306 @Override 1307 public boolean equalsShallow(Base other_) { 1308 if (!super.equalsShallow(other_)) 1309 return false; 1310 if (!(other_ instanceof MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent)) 1311 return false; 1312 MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent o = (MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent) other_; 1313 return compareValues(measurementPoint, o.measurementPoint, true); 1314 } 1315 1316 public boolean isEmpty() { 1317 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(substance, strength, strengthLowLimit 1318 , measurementPoint, country); 1319 } 1320 1321 public String fhirType() { 1322 return "MedicinalProductIngredient.specifiedSubstance.strength.referenceStrength"; 1323 1324 } 1325 1326 } 1327 1328 @Block() 1329 public static class MedicinalProductIngredientSubstanceComponent extends BackboneElement implements IBaseBackboneElement { 1330 /** 1331 * The ingredient substance. 1332 */ 1333 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 1334 @Description(shortDefinition="The ingredient substance", formalDefinition="The ingredient substance." ) 1335 protected CodeableConcept code; 1336 1337 /** 1338 * Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product. 1339 */ 1340 @Child(name = "strength", type = {MedicinalProductIngredientSpecifiedSubstanceStrengthComponent.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1341 @Description(shortDefinition="Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product", formalDefinition="Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product." ) 1342 protected List<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent> strength; 1343 1344 private static final long serialVersionUID = 1325868149L; 1345 1346 /** 1347 * Constructor 1348 */ 1349 public MedicinalProductIngredientSubstanceComponent() { 1350 super(); 1351 } 1352 1353 /** 1354 * Constructor 1355 */ 1356 public MedicinalProductIngredientSubstanceComponent(CodeableConcept code) { 1357 super(); 1358 this.code = code; 1359 } 1360 1361 /** 1362 * @return {@link #code} (The ingredient substance.) 1363 */ 1364 public CodeableConcept getCode() { 1365 if (this.code == null) 1366 if (Configuration.errorOnAutoCreate()) 1367 throw new Error("Attempt to auto-create MedicinalProductIngredientSubstanceComponent.code"); 1368 else if (Configuration.doAutoCreate()) 1369 this.code = new CodeableConcept(); // cc 1370 return this.code; 1371 } 1372 1373 public boolean hasCode() { 1374 return this.code != null && !this.code.isEmpty(); 1375 } 1376 1377 /** 1378 * @param value {@link #code} (The ingredient substance.) 1379 */ 1380 public MedicinalProductIngredientSubstanceComponent setCode(CodeableConcept value) { 1381 this.code = value; 1382 return this; 1383 } 1384 1385 /** 1386 * @return {@link #strength} (Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product.) 1387 */ 1388 public List<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent> getStrength() { 1389 if (this.strength == null) 1390 this.strength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent>(); 1391 return this.strength; 1392 } 1393 1394 /** 1395 * @return Returns a reference to <code>this</code> for easy method chaining 1396 */ 1397 public MedicinalProductIngredientSubstanceComponent setStrength(List<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent> theStrength) { 1398 this.strength = theStrength; 1399 return this; 1400 } 1401 1402 public boolean hasStrength() { 1403 if (this.strength == null) 1404 return false; 1405 for (MedicinalProductIngredientSpecifiedSubstanceStrengthComponent item : this.strength) 1406 if (!item.isEmpty()) 1407 return true; 1408 return false; 1409 } 1410 1411 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent addStrength() { //3 1412 MedicinalProductIngredientSpecifiedSubstanceStrengthComponent t = new MedicinalProductIngredientSpecifiedSubstanceStrengthComponent(); 1413 if (this.strength == null) 1414 this.strength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent>(); 1415 this.strength.add(t); 1416 return t; 1417 } 1418 1419 public MedicinalProductIngredientSubstanceComponent addStrength(MedicinalProductIngredientSpecifiedSubstanceStrengthComponent t) { //3 1420 if (t == null) 1421 return this; 1422 if (this.strength == null) 1423 this.strength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent>(); 1424 this.strength.add(t); 1425 return this; 1426 } 1427 1428 /** 1429 * @return The first repetition of repeating field {@link #strength}, creating it if it does not already exist 1430 */ 1431 public MedicinalProductIngredientSpecifiedSubstanceStrengthComponent getStrengthFirstRep() { 1432 if (getStrength().isEmpty()) { 1433 addStrength(); 1434 } 1435 return getStrength().get(0); 1436 } 1437 1438 protected void listChildren(List<Property> children) { 1439 super.listChildren(children); 1440 children.add(new Property("code", "CodeableConcept", "The ingredient substance.", 0, 1, code)); 1441 children.add(new Property("strength", "@MedicinalProductIngredient.specifiedSubstance.strength", "Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product.", 0, java.lang.Integer.MAX_VALUE, strength)); 1442 } 1443 1444 @Override 1445 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1446 switch (_hash) { 1447 case 3059181: /*code*/ return new Property("code", "CodeableConcept", "The ingredient substance.", 0, 1, code); 1448 case 1791316033: /*strength*/ return new Property("strength", "@MedicinalProductIngredient.specifiedSubstance.strength", "Quantity of the substance or specified substance present in the manufactured item or pharmaceutical product.", 0, java.lang.Integer.MAX_VALUE, strength); 1449 default: return super.getNamedProperty(_hash, _name, _checkValid); 1450 } 1451 1452 } 1453 1454 @Override 1455 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1456 switch (hash) { 1457 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 1458 case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : this.strength.toArray(new Base[this.strength.size()]); // MedicinalProductIngredientSpecifiedSubstanceStrengthComponent 1459 default: return super.getProperty(hash, name, checkValid); 1460 } 1461 1462 } 1463 1464 @Override 1465 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1466 switch (hash) { 1467 case 3059181: // code 1468 this.code = castToCodeableConcept(value); // CodeableConcept 1469 return value; 1470 case 1791316033: // strength 1471 this.getStrength().add((MedicinalProductIngredientSpecifiedSubstanceStrengthComponent) value); // MedicinalProductIngredientSpecifiedSubstanceStrengthComponent 1472 return value; 1473 default: return super.setProperty(hash, name, value); 1474 } 1475 1476 } 1477 1478 @Override 1479 public Base setProperty(String name, Base value) throws FHIRException { 1480 if (name.equals("code")) { 1481 this.code = castToCodeableConcept(value); // CodeableConcept 1482 } else if (name.equals("strength")) { 1483 this.getStrength().add((MedicinalProductIngredientSpecifiedSubstanceStrengthComponent) value); 1484 } else 1485 return super.setProperty(name, value); 1486 return value; 1487 } 1488 1489 @Override 1490 public Base makeProperty(int hash, String name) throws FHIRException { 1491 switch (hash) { 1492 case 3059181: return getCode(); 1493 case 1791316033: return addStrength(); 1494 default: return super.makeProperty(hash, name); 1495 } 1496 1497 } 1498 1499 @Override 1500 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1501 switch (hash) { 1502 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 1503 case 1791316033: /*strength*/ return new String[] {"@MedicinalProductIngredient.specifiedSubstance.strength"}; 1504 default: return super.getTypesForProperty(hash, name); 1505 } 1506 1507 } 1508 1509 @Override 1510 public Base addChild(String name) throws FHIRException { 1511 if (name.equals("code")) { 1512 this.code = new CodeableConcept(); 1513 return this.code; 1514 } 1515 else if (name.equals("strength")) { 1516 return addStrength(); 1517 } 1518 else 1519 return super.addChild(name); 1520 } 1521 1522 public MedicinalProductIngredientSubstanceComponent copy() { 1523 MedicinalProductIngredientSubstanceComponent dst = new MedicinalProductIngredientSubstanceComponent(); 1524 copyValues(dst); 1525 return dst; 1526 } 1527 1528 public void copyValues(MedicinalProductIngredientSubstanceComponent dst) { 1529 super.copyValues(dst); 1530 dst.code = code == null ? null : code.copy(); 1531 if (strength != null) { 1532 dst.strength = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceStrengthComponent>(); 1533 for (MedicinalProductIngredientSpecifiedSubstanceStrengthComponent i : strength) 1534 dst.strength.add(i.copy()); 1535 }; 1536 } 1537 1538 @Override 1539 public boolean equalsDeep(Base other_) { 1540 if (!super.equalsDeep(other_)) 1541 return false; 1542 if (!(other_ instanceof MedicinalProductIngredientSubstanceComponent)) 1543 return false; 1544 MedicinalProductIngredientSubstanceComponent o = (MedicinalProductIngredientSubstanceComponent) other_; 1545 return compareDeep(code, o.code, true) && compareDeep(strength, o.strength, true); 1546 } 1547 1548 @Override 1549 public boolean equalsShallow(Base other_) { 1550 if (!super.equalsShallow(other_)) 1551 return false; 1552 if (!(other_ instanceof MedicinalProductIngredientSubstanceComponent)) 1553 return false; 1554 MedicinalProductIngredientSubstanceComponent o = (MedicinalProductIngredientSubstanceComponent) other_; 1555 return true; 1556 } 1557 1558 public boolean isEmpty() { 1559 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, strength); 1560 } 1561 1562 public String fhirType() { 1563 return "MedicinalProductIngredient.substance"; 1564 1565 } 1566 1567 } 1568 1569 /** 1570 * The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. 1571 */ 1572 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true) 1573 @Description(shortDefinition="Identifier for the ingredient", formalDefinition="The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate." ) 1574 protected Identifier identifier; 1575 1576 /** 1577 * Ingredient role e.g. Active ingredient, excipient. 1578 */ 1579 @Child(name = "role", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 1580 @Description(shortDefinition="Ingredient role e.g. Active ingredient, excipient", formalDefinition="Ingredient role e.g. Active ingredient, excipient." ) 1581 protected CodeableConcept role; 1582 1583 /** 1584 * If the ingredient is a known or suspected allergen. 1585 */ 1586 @Child(name = "allergenicIndicator", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=true) 1587 @Description(shortDefinition="If the ingredient is a known or suspected allergen", formalDefinition="If the ingredient is a known or suspected allergen." ) 1588 protected BooleanType allergenicIndicator; 1589 1590 /** 1591 * Manufacturer of this Ingredient. 1592 */ 1593 @Child(name = "manufacturer", type = {Organization.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1594 @Description(shortDefinition="Manufacturer of this Ingredient", formalDefinition="Manufacturer of this Ingredient." ) 1595 protected List<Reference> manufacturer; 1596 /** 1597 * The actual objects that are the target of the reference (Manufacturer of this Ingredient.) 1598 */ 1599 protected List<Organization> manufacturerTarget; 1600 1601 1602 /** 1603 * A specified substance that comprises this ingredient. 1604 */ 1605 @Child(name = "specifiedSubstance", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1606 @Description(shortDefinition="A specified substance that comprises this ingredient", formalDefinition="A specified substance that comprises this ingredient." ) 1607 protected List<MedicinalProductIngredientSpecifiedSubstanceComponent> specifiedSubstance; 1608 1609 /** 1610 * The ingredient substance. 1611 */ 1612 @Child(name = "substance", type = {}, order=5, min=0, max=1, modifier=false, summary=true) 1613 @Description(shortDefinition="The ingredient substance", formalDefinition="The ingredient substance." ) 1614 protected MedicinalProductIngredientSubstanceComponent substance; 1615 1616 private static final long serialVersionUID = -1454686641L; 1617 1618 /** 1619 * Constructor 1620 */ 1621 public MedicinalProductIngredient() { 1622 super(); 1623 } 1624 1625 /** 1626 * Constructor 1627 */ 1628 public MedicinalProductIngredient(CodeableConcept role) { 1629 super(); 1630 this.role = role; 1631 } 1632 1633 /** 1634 * @return {@link #identifier} (The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.) 1635 */ 1636 public Identifier getIdentifier() { 1637 if (this.identifier == null) 1638 if (Configuration.errorOnAutoCreate()) 1639 throw new Error("Attempt to auto-create MedicinalProductIngredient.identifier"); 1640 else if (Configuration.doAutoCreate()) 1641 this.identifier = new Identifier(); // cc 1642 return this.identifier; 1643 } 1644 1645 public boolean hasIdentifier() { 1646 return this.identifier != null && !this.identifier.isEmpty(); 1647 } 1648 1649 /** 1650 * @param value {@link #identifier} (The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.) 1651 */ 1652 public MedicinalProductIngredient setIdentifier(Identifier value) { 1653 this.identifier = value; 1654 return this; 1655 } 1656 1657 /** 1658 * @return {@link #role} (Ingredient role e.g. Active ingredient, excipient.) 1659 */ 1660 public CodeableConcept getRole() { 1661 if (this.role == null) 1662 if (Configuration.errorOnAutoCreate()) 1663 throw new Error("Attempt to auto-create MedicinalProductIngredient.role"); 1664 else if (Configuration.doAutoCreate()) 1665 this.role = new CodeableConcept(); // cc 1666 return this.role; 1667 } 1668 1669 public boolean hasRole() { 1670 return this.role != null && !this.role.isEmpty(); 1671 } 1672 1673 /** 1674 * @param value {@link #role} (Ingredient role e.g. Active ingredient, excipient.) 1675 */ 1676 public MedicinalProductIngredient setRole(CodeableConcept value) { 1677 this.role = value; 1678 return this; 1679 } 1680 1681 /** 1682 * @return {@link #allergenicIndicator} (If the ingredient is a known or suspected allergen.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value 1683 */ 1684 public BooleanType getAllergenicIndicatorElement() { 1685 if (this.allergenicIndicator == null) 1686 if (Configuration.errorOnAutoCreate()) 1687 throw new Error("Attempt to auto-create MedicinalProductIngredient.allergenicIndicator"); 1688 else if (Configuration.doAutoCreate()) 1689 this.allergenicIndicator = new BooleanType(); // bb 1690 return this.allergenicIndicator; 1691 } 1692 1693 public boolean hasAllergenicIndicatorElement() { 1694 return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty(); 1695 } 1696 1697 public boolean hasAllergenicIndicator() { 1698 return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty(); 1699 } 1700 1701 /** 1702 * @param value {@link #allergenicIndicator} (If the ingredient is a known or suspected allergen.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value 1703 */ 1704 public MedicinalProductIngredient setAllergenicIndicatorElement(BooleanType value) { 1705 this.allergenicIndicator = value; 1706 return this; 1707 } 1708 1709 /** 1710 * @return If the ingredient is a known or suspected allergen. 1711 */ 1712 public boolean getAllergenicIndicator() { 1713 return this.allergenicIndicator == null || this.allergenicIndicator.isEmpty() ? false : this.allergenicIndicator.getValue(); 1714 } 1715 1716 /** 1717 * @param value If the ingredient is a known or suspected allergen. 1718 */ 1719 public MedicinalProductIngredient setAllergenicIndicator(boolean value) { 1720 if (this.allergenicIndicator == null) 1721 this.allergenicIndicator = new BooleanType(); 1722 this.allergenicIndicator.setValue(value); 1723 return this; 1724 } 1725 1726 /** 1727 * @return {@link #manufacturer} (Manufacturer of this Ingredient.) 1728 */ 1729 public List<Reference> getManufacturer() { 1730 if (this.manufacturer == null) 1731 this.manufacturer = new ArrayList<Reference>(); 1732 return this.manufacturer; 1733 } 1734 1735 /** 1736 * @return Returns a reference to <code>this</code> for easy method chaining 1737 */ 1738 public MedicinalProductIngredient setManufacturer(List<Reference> theManufacturer) { 1739 this.manufacturer = theManufacturer; 1740 return this; 1741 } 1742 1743 public boolean hasManufacturer() { 1744 if (this.manufacturer == null) 1745 return false; 1746 for (Reference item : this.manufacturer) 1747 if (!item.isEmpty()) 1748 return true; 1749 return false; 1750 } 1751 1752 public Reference addManufacturer() { //3 1753 Reference t = new Reference(); 1754 if (this.manufacturer == null) 1755 this.manufacturer = new ArrayList<Reference>(); 1756 this.manufacturer.add(t); 1757 return t; 1758 } 1759 1760 public MedicinalProductIngredient addManufacturer(Reference t) { //3 1761 if (t == null) 1762 return this; 1763 if (this.manufacturer == null) 1764 this.manufacturer = new ArrayList<Reference>(); 1765 this.manufacturer.add(t); 1766 return this; 1767 } 1768 1769 /** 1770 * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist 1771 */ 1772 public Reference getManufacturerFirstRep() { 1773 if (getManufacturer().isEmpty()) { 1774 addManufacturer(); 1775 } 1776 return getManufacturer().get(0); 1777 } 1778 1779 /** 1780 * @deprecated Use Reference#setResource(IBaseResource) instead 1781 */ 1782 @Deprecated 1783 public List<Organization> getManufacturerTarget() { 1784 if (this.manufacturerTarget == null) 1785 this.manufacturerTarget = new ArrayList<Organization>(); 1786 return this.manufacturerTarget; 1787 } 1788 1789 /** 1790 * @deprecated Use Reference#setResource(IBaseResource) instead 1791 */ 1792 @Deprecated 1793 public Organization addManufacturerTarget() { 1794 Organization r = new Organization(); 1795 if (this.manufacturerTarget == null) 1796 this.manufacturerTarget = new ArrayList<Organization>(); 1797 this.manufacturerTarget.add(r); 1798 return r; 1799 } 1800 1801 /** 1802 * @return {@link #specifiedSubstance} (A specified substance that comprises this ingredient.) 1803 */ 1804 public List<MedicinalProductIngredientSpecifiedSubstanceComponent> getSpecifiedSubstance() { 1805 if (this.specifiedSubstance == null) 1806 this.specifiedSubstance = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceComponent>(); 1807 return this.specifiedSubstance; 1808 } 1809 1810 /** 1811 * @return Returns a reference to <code>this</code> for easy method chaining 1812 */ 1813 public MedicinalProductIngredient setSpecifiedSubstance(List<MedicinalProductIngredientSpecifiedSubstanceComponent> theSpecifiedSubstance) { 1814 this.specifiedSubstance = theSpecifiedSubstance; 1815 return this; 1816 } 1817 1818 public boolean hasSpecifiedSubstance() { 1819 if (this.specifiedSubstance == null) 1820 return false; 1821 for (MedicinalProductIngredientSpecifiedSubstanceComponent item : this.specifiedSubstance) 1822 if (!item.isEmpty()) 1823 return true; 1824 return false; 1825 } 1826 1827 public MedicinalProductIngredientSpecifiedSubstanceComponent addSpecifiedSubstance() { //3 1828 MedicinalProductIngredientSpecifiedSubstanceComponent t = new MedicinalProductIngredientSpecifiedSubstanceComponent(); 1829 if (this.specifiedSubstance == null) 1830 this.specifiedSubstance = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceComponent>(); 1831 this.specifiedSubstance.add(t); 1832 return t; 1833 } 1834 1835 public MedicinalProductIngredient addSpecifiedSubstance(MedicinalProductIngredientSpecifiedSubstanceComponent t) { //3 1836 if (t == null) 1837 return this; 1838 if (this.specifiedSubstance == null) 1839 this.specifiedSubstance = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceComponent>(); 1840 this.specifiedSubstance.add(t); 1841 return this; 1842 } 1843 1844 /** 1845 * @return The first repetition of repeating field {@link #specifiedSubstance}, creating it if it does not already exist 1846 */ 1847 public MedicinalProductIngredientSpecifiedSubstanceComponent getSpecifiedSubstanceFirstRep() { 1848 if (getSpecifiedSubstance().isEmpty()) { 1849 addSpecifiedSubstance(); 1850 } 1851 return getSpecifiedSubstance().get(0); 1852 } 1853 1854 /** 1855 * @return {@link #substance} (The ingredient substance.) 1856 */ 1857 public MedicinalProductIngredientSubstanceComponent getSubstance() { 1858 if (this.substance == null) 1859 if (Configuration.errorOnAutoCreate()) 1860 throw new Error("Attempt to auto-create MedicinalProductIngredient.substance"); 1861 else if (Configuration.doAutoCreate()) 1862 this.substance = new MedicinalProductIngredientSubstanceComponent(); // cc 1863 return this.substance; 1864 } 1865 1866 public boolean hasSubstance() { 1867 return this.substance != null && !this.substance.isEmpty(); 1868 } 1869 1870 /** 1871 * @param value {@link #substance} (The ingredient substance.) 1872 */ 1873 public MedicinalProductIngredient setSubstance(MedicinalProductIngredientSubstanceComponent value) { 1874 this.substance = value; 1875 return this; 1876 } 1877 1878 protected void listChildren(List<Property> children) { 1879 super.listChildren(children); 1880 children.add(new Property("identifier", "Identifier", "The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.", 0, 1, identifier)); 1881 children.add(new Property("role", "CodeableConcept", "Ingredient role e.g. Active ingredient, excipient.", 0, 1, role)); 1882 children.add(new Property("allergenicIndicator", "boolean", "If the ingredient is a known or suspected allergen.", 0, 1, allergenicIndicator)); 1883 children.add(new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Ingredient.", 0, java.lang.Integer.MAX_VALUE, manufacturer)); 1884 children.add(new Property("specifiedSubstance", "", "A specified substance that comprises this ingredient.", 0, java.lang.Integer.MAX_VALUE, specifiedSubstance)); 1885 children.add(new Property("substance", "", "The ingredient substance.", 0, 1, substance)); 1886 } 1887 1888 @Override 1889 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1890 switch (_hash) { 1891 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "The identifier(s) of this Ingredient that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.", 0, 1, identifier); 1892 case 3506294: /*role*/ return new Property("role", "CodeableConcept", "Ingredient role e.g. Active ingredient, excipient.", 0, 1, role); 1893 case 75406931: /*allergenicIndicator*/ return new Property("allergenicIndicator", "boolean", "If the ingredient is a known or suspected allergen.", 0, 1, allergenicIndicator); 1894 case -1969347631: /*manufacturer*/ return new Property("manufacturer", "Reference(Organization)", "Manufacturer of this Ingredient.", 0, java.lang.Integer.MAX_VALUE, manufacturer); 1895 case -331477600: /*specifiedSubstance*/ return new Property("specifiedSubstance", "", "A specified substance that comprises this ingredient.", 0, java.lang.Integer.MAX_VALUE, specifiedSubstance); 1896 case 530040176: /*substance*/ return new Property("substance", "", "The ingredient substance.", 0, 1, substance); 1897 default: return super.getNamedProperty(_hash, _name, _checkValid); 1898 } 1899 1900 } 1901 1902 @Override 1903 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1904 switch (hash) { 1905 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier 1906 case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept 1907 case 75406931: /*allergenicIndicator*/ return this.allergenicIndicator == null ? new Base[0] : new Base[] {this.allergenicIndicator}; // BooleanType 1908 case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference 1909 case -331477600: /*specifiedSubstance*/ return this.specifiedSubstance == null ? new Base[0] : this.specifiedSubstance.toArray(new Base[this.specifiedSubstance.size()]); // MedicinalProductIngredientSpecifiedSubstanceComponent 1910 case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // MedicinalProductIngredientSubstanceComponent 1911 default: return super.getProperty(hash, name, checkValid); 1912 } 1913 1914 } 1915 1916 @Override 1917 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1918 switch (hash) { 1919 case -1618432855: // identifier 1920 this.identifier = castToIdentifier(value); // Identifier 1921 return value; 1922 case 3506294: // role 1923 this.role = castToCodeableConcept(value); // CodeableConcept 1924 return value; 1925 case 75406931: // allergenicIndicator 1926 this.allergenicIndicator = castToBoolean(value); // BooleanType 1927 return value; 1928 case -1969347631: // manufacturer 1929 this.getManufacturer().add(castToReference(value)); // Reference 1930 return value; 1931 case -331477600: // specifiedSubstance 1932 this.getSpecifiedSubstance().add((MedicinalProductIngredientSpecifiedSubstanceComponent) value); // MedicinalProductIngredientSpecifiedSubstanceComponent 1933 return value; 1934 case 530040176: // substance 1935 this.substance = (MedicinalProductIngredientSubstanceComponent) value; // MedicinalProductIngredientSubstanceComponent 1936 return value; 1937 default: return super.setProperty(hash, name, value); 1938 } 1939 1940 } 1941 1942 @Override 1943 public Base setProperty(String name, Base value) throws FHIRException { 1944 if (name.equals("identifier")) { 1945 this.identifier = castToIdentifier(value); // Identifier 1946 } else if (name.equals("role")) { 1947 this.role = castToCodeableConcept(value); // CodeableConcept 1948 } else if (name.equals("allergenicIndicator")) { 1949 this.allergenicIndicator = castToBoolean(value); // BooleanType 1950 } else if (name.equals("manufacturer")) { 1951 this.getManufacturer().add(castToReference(value)); 1952 } else if (name.equals("specifiedSubstance")) { 1953 this.getSpecifiedSubstance().add((MedicinalProductIngredientSpecifiedSubstanceComponent) value); 1954 } else if (name.equals("substance")) { 1955 this.substance = (MedicinalProductIngredientSubstanceComponent) value; // MedicinalProductIngredientSubstanceComponent 1956 } else 1957 return super.setProperty(name, value); 1958 return value; 1959 } 1960 1961 @Override 1962 public Base makeProperty(int hash, String name) throws FHIRException { 1963 switch (hash) { 1964 case -1618432855: return getIdentifier(); 1965 case 3506294: return getRole(); 1966 case 75406931: return getAllergenicIndicatorElement(); 1967 case -1969347631: return addManufacturer(); 1968 case -331477600: return addSpecifiedSubstance(); 1969 case 530040176: return getSubstance(); 1970 default: return super.makeProperty(hash, name); 1971 } 1972 1973 } 1974 1975 @Override 1976 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1977 switch (hash) { 1978 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1979 case 3506294: /*role*/ return new String[] {"CodeableConcept"}; 1980 case 75406931: /*allergenicIndicator*/ return new String[] {"boolean"}; 1981 case -1969347631: /*manufacturer*/ return new String[] {"Reference"}; 1982 case -331477600: /*specifiedSubstance*/ return new String[] {}; 1983 case 530040176: /*substance*/ return new String[] {}; 1984 default: return super.getTypesForProperty(hash, name); 1985 } 1986 1987 } 1988 1989 @Override 1990 public Base addChild(String name) throws FHIRException { 1991 if (name.equals("identifier")) { 1992 this.identifier = new Identifier(); 1993 return this.identifier; 1994 } 1995 else if (name.equals("role")) { 1996 this.role = new CodeableConcept(); 1997 return this.role; 1998 } 1999 else if (name.equals("allergenicIndicator")) { 2000 throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductIngredient.allergenicIndicator"); 2001 } 2002 else if (name.equals("manufacturer")) { 2003 return addManufacturer(); 2004 } 2005 else if (name.equals("specifiedSubstance")) { 2006 return addSpecifiedSubstance(); 2007 } 2008 else if (name.equals("substance")) { 2009 this.substance = new MedicinalProductIngredientSubstanceComponent(); 2010 return this.substance; 2011 } 2012 else 2013 return super.addChild(name); 2014 } 2015 2016 public String fhirType() { 2017 return "MedicinalProductIngredient"; 2018 2019 } 2020 2021 public MedicinalProductIngredient copy() { 2022 MedicinalProductIngredient dst = new MedicinalProductIngredient(); 2023 copyValues(dst); 2024 return dst; 2025 } 2026 2027 public void copyValues(MedicinalProductIngredient dst) { 2028 super.copyValues(dst); 2029 dst.identifier = identifier == null ? null : identifier.copy(); 2030 dst.role = role == null ? null : role.copy(); 2031 dst.allergenicIndicator = allergenicIndicator == null ? null : allergenicIndicator.copy(); 2032 if (manufacturer != null) { 2033 dst.manufacturer = new ArrayList<Reference>(); 2034 for (Reference i : manufacturer) 2035 dst.manufacturer.add(i.copy()); 2036 }; 2037 if (specifiedSubstance != null) { 2038 dst.specifiedSubstance = new ArrayList<MedicinalProductIngredientSpecifiedSubstanceComponent>(); 2039 for (MedicinalProductIngredientSpecifiedSubstanceComponent i : specifiedSubstance) 2040 dst.specifiedSubstance.add(i.copy()); 2041 }; 2042 dst.substance = substance == null ? null : substance.copy(); 2043 } 2044 2045 protected MedicinalProductIngredient typedCopy() { 2046 return copy(); 2047 } 2048 2049 @Override 2050 public boolean equalsDeep(Base other_) { 2051 if (!super.equalsDeep(other_)) 2052 return false; 2053 if (!(other_ instanceof MedicinalProductIngredient)) 2054 return false; 2055 MedicinalProductIngredient o = (MedicinalProductIngredient) other_; 2056 return compareDeep(identifier, o.identifier, true) && compareDeep(role, o.role, true) && compareDeep(allergenicIndicator, o.allergenicIndicator, true) 2057 && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(specifiedSubstance, o.specifiedSubstance, true) 2058 && compareDeep(substance, o.substance, true); 2059 } 2060 2061 @Override 2062 public boolean equalsShallow(Base other_) { 2063 if (!super.equalsShallow(other_)) 2064 return false; 2065 if (!(other_ instanceof MedicinalProductIngredient)) 2066 return false; 2067 MedicinalProductIngredient o = (MedicinalProductIngredient) other_; 2068 return compareValues(allergenicIndicator, o.allergenicIndicator, true); 2069 } 2070 2071 public boolean isEmpty() { 2072 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, role, allergenicIndicator 2073 , manufacturer, specifiedSubstance, substance); 2074 } 2075 2076 @Override 2077 public ResourceType getResourceType() { 2078 return ResourceType.MedicinalProductIngredient; 2079 } 2080 2081 2082}