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