001package org.hl7.fhir.r5.model; 002 003 004/* 005 * #%L 006 * org.hl7.fhir.r5 007 * %% 008 * Copyright (C) 2014 - 2019 Health Level 7 009 * %% 010 * Licensed under the Apache License, Version 2.0 (the \"License\"); 011 * you may not use this file except in compliance with the License. 012 * You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, software 017 * distributed under the License is distributed on an \"AS IS\" BASIS, 018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 019 * See the License for the specific language governing permissions and 020 * limitations under the License. 021 * #L% 022 */ 023 024/* 025 Copyright (c) 2011+, HL7, Inc. 026 All rights reserved. 027 028 Redistribution and use in source and binary forms, with or without modification, \ 029 are permitted provided that the following conditions are met: 030 031 * Redistributions of source code must retain the above copyright notice, this \ 032 list of conditions and the following disclaimer. 033 * Redistributions in binary form must reproduce the above copyright notice, \ 034 this list of conditions and the following disclaimer in the documentation \ 035 and/or other materials provided with the distribution. 036 * Neither the name of HL7 nor the names of its contributors may be used to 037 endorse or promote products derived from this software without specific 038 prior written permission. 039 040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 041 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 042 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 043 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 044 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 045 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 046 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 047 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 048 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 049 POSSIBILITY OF SUCH DAMAGE. 050 */ 051 052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent 053 054import java.util.ArrayList; 055import java.util.Date; 056import java.util.List; 057import org.hl7.fhir.r5.model.Enumerations.*; 058import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 059import org.hl7.fhir.exceptions.FHIRException; 060import org.hl7.fhir.instance.model.api.ICompositeType; 061import ca.uhn.fhir.model.api.annotation.ResourceDef; 062import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 063import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 064import ca.uhn.fhir.model.api.annotation.Child; 065import ca.uhn.fhir.model.api.annotation.ChildOrder; 066import ca.uhn.fhir.model.api.annotation.Description; 067import ca.uhn.fhir.model.api.annotation.Block; 068 069/** 070 * The definition and characteristics of a medicinal manufactured item, such as a tablet or capsule, as contained in a packaged medicinal product. 071 */ 072@ResourceDef(name="ManufacturedItemDefinition", profile="http://hl7.org/fhir/StructureDefinition/ManufacturedItemDefinition") 073public class ManufacturedItemDefinition extends DomainResource { 074 075 @Block() 076 public static class ManufacturedItemDefinitionCharacteristicComponent extends BackboneElement implements IBaseBackboneElement { 077 /** 078 * A code expressing the type of characteristic. 079 */ 080 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 081 @Description(shortDefinition="A code expressing the type of characteristic", formalDefinition="A code expressing the type of characteristic." ) 082 protected CodeableConcept code; 083 084 /** 085 * A value for the characteristic. 086 */ 087 @Child(name = "value", type = {Coding.class, Quantity.class, StringType.class, DateType.class, BooleanType.class, Attachment.class}, order=2, min=0, max=1, modifier=false, summary=true) 088 @Description(shortDefinition="A value for the characteristic", formalDefinition="A value for the characteristic." ) 089 protected DataType value; 090 091 private static final long serialVersionUID = -1950789033L; 092 093 /** 094 * Constructor 095 */ 096 public ManufacturedItemDefinitionCharacteristicComponent() { 097 super(); 098 } 099 100 /** 101 * Constructor 102 */ 103 public ManufacturedItemDefinitionCharacteristicComponent(CodeableConcept code) { 104 super(); 105 this.setCode(code); 106 } 107 108 /** 109 * @return {@link #code} (A code expressing the type of characteristic.) 110 */ 111 public CodeableConcept getCode() { 112 if (this.code == null) 113 if (Configuration.errorOnAutoCreate()) 114 throw new Error("Attempt to auto-create ManufacturedItemDefinitionCharacteristicComponent.code"); 115 else if (Configuration.doAutoCreate()) 116 this.code = new CodeableConcept(); // cc 117 return this.code; 118 } 119 120 public boolean hasCode() { 121 return this.code != null && !this.code.isEmpty(); 122 } 123 124 /** 125 * @param value {@link #code} (A code expressing the type of characteristic.) 126 */ 127 public ManufacturedItemDefinitionCharacteristicComponent setCode(CodeableConcept value) { 128 this.code = value; 129 return this; 130 } 131 132 /** 133 * @return {@link #value} (A value for the characteristic.) 134 */ 135 public DataType getValue() { 136 return this.value; 137 } 138 139 /** 140 * @return {@link #value} (A value for the characteristic.) 141 */ 142 public Coding getValueCoding() throws FHIRException { 143 if (this.value == null) 144 this.value = new Coding(); 145 if (!(this.value instanceof Coding)) 146 throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered"); 147 return (Coding) this.value; 148 } 149 150 public boolean hasValueCoding() { 151 return this != null && this.value instanceof Coding; 152 } 153 154 /** 155 * @return {@link #value} (A value for the characteristic.) 156 */ 157 public Quantity getValueQuantity() throws FHIRException { 158 if (this.value == null) 159 this.value = new Quantity(); 160 if (!(this.value instanceof Quantity)) 161 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered"); 162 return (Quantity) this.value; 163 } 164 165 public boolean hasValueQuantity() { 166 return this != null && this.value instanceof Quantity; 167 } 168 169 /** 170 * @return {@link #value} (A value for the characteristic.) 171 */ 172 public StringType getValueStringType() throws FHIRException { 173 if (this.value == null) 174 this.value = new StringType(); 175 if (!(this.value instanceof StringType)) 176 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered"); 177 return (StringType) this.value; 178 } 179 180 public boolean hasValueStringType() { 181 return this != null && this.value instanceof StringType; 182 } 183 184 /** 185 * @return {@link #value} (A value for the characteristic.) 186 */ 187 public DateType getValueDateType() throws FHIRException { 188 if (this.value == null) 189 this.value = new DateType(); 190 if (!(this.value instanceof DateType)) 191 throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered"); 192 return (DateType) this.value; 193 } 194 195 public boolean hasValueDateType() { 196 return this != null && this.value instanceof DateType; 197 } 198 199 /** 200 * @return {@link #value} (A value for the characteristic.) 201 */ 202 public BooleanType getValueBooleanType() throws FHIRException { 203 if (this.value == null) 204 this.value = new BooleanType(); 205 if (!(this.value instanceof BooleanType)) 206 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered"); 207 return (BooleanType) this.value; 208 } 209 210 public boolean hasValueBooleanType() { 211 return this != null && this.value instanceof BooleanType; 212 } 213 214 /** 215 * @return {@link #value} (A value for the characteristic.) 216 */ 217 public Attachment getValueAttachment() throws FHIRException { 218 if (this.value == null) 219 this.value = new Attachment(); 220 if (!(this.value instanceof Attachment)) 221 throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered"); 222 return (Attachment) this.value; 223 } 224 225 public boolean hasValueAttachment() { 226 return this != null && this.value instanceof Attachment; 227 } 228 229 public boolean hasValue() { 230 return this.value != null && !this.value.isEmpty(); 231 } 232 233 /** 234 * @param value {@link #value} (A value for the characteristic.) 235 */ 236 public ManufacturedItemDefinitionCharacteristicComponent setValue(DataType value) { 237 if (value != null && !(value instanceof Coding || value instanceof Quantity || value instanceof StringType || value instanceof DateType || value instanceof BooleanType || value instanceof Attachment)) 238 throw new Error("Not the right type for ManufacturedItemDefinition.characteristic.value[x]: "+value.fhirType()); 239 this.value = value; 240 return this; 241 } 242 243 protected void listChildren(List<Property> children) { 244 super.listChildren(children); 245 children.add(new Property("code", "CodeableConcept", "A code expressing the type of characteristic.", 0, 1, code)); 246 children.add(new Property("value[x]", "Coding|Quantity|string|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value)); 247 } 248 249 @Override 250 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 251 switch (_hash) { 252 case 3059181: /*code*/ return new Property("code", "CodeableConcept", "A code expressing the type of characteristic.", 0, 1, code); 253 case -1410166417: /*value[x]*/ return new Property("value[x]", "Coding|Quantity|string|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value); 254 case 111972721: /*value*/ return new Property("value[x]", "Coding|Quantity|string|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value); 255 case -1887705029: /*valueCoding*/ return new Property("value[x]", "Coding", "A value for the characteristic.", 0, 1, value); 256 case -2029823716: /*valueQuantity*/ return new Property("value[x]", "Quantity", "A value for the characteristic.", 0, 1, value); 257 case -1424603934: /*valueString*/ return new Property("value[x]", "string", "A value for the characteristic.", 0, 1, value); 258 case -766192449: /*valueDate*/ return new Property("value[x]", "date", "A value for the characteristic.", 0, 1, value); 259 case 733421943: /*valueBoolean*/ return new Property("value[x]", "boolean", "A value for the characteristic.", 0, 1, value); 260 case -475566732: /*valueAttachment*/ return new Property("value[x]", "Attachment", "A value for the characteristic.", 0, 1, value); 261 default: return super.getNamedProperty(_hash, _name, _checkValid); 262 } 263 264 } 265 266 @Override 267 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 268 switch (hash) { 269 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 270 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType 271 default: return super.getProperty(hash, name, checkValid); 272 } 273 274 } 275 276 @Override 277 public Base setProperty(int hash, String name, Base value) throws FHIRException { 278 switch (hash) { 279 case 3059181: // code 280 this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 281 return value; 282 case 111972721: // value 283 this.value = TypeConvertor.castToType(value); // DataType 284 return value; 285 default: return super.setProperty(hash, name, value); 286 } 287 288 } 289 290 @Override 291 public Base setProperty(String name, Base value) throws FHIRException { 292 if (name.equals("code")) { 293 this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 294 } else if (name.equals("value[x]")) { 295 this.value = TypeConvertor.castToType(value); // DataType 296 } else 297 return super.setProperty(name, value); 298 return value; 299 } 300 301 @Override 302 public Base makeProperty(int hash, String name) throws FHIRException { 303 switch (hash) { 304 case 3059181: return getCode(); 305 case -1410166417: return getValue(); 306 case 111972721: return getValue(); 307 default: return super.makeProperty(hash, name); 308 } 309 310 } 311 312 @Override 313 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 314 switch (hash) { 315 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 316 case 111972721: /*value*/ return new String[] {"Coding", "Quantity", "string", "date", "boolean", "Attachment"}; 317 default: return super.getTypesForProperty(hash, name); 318 } 319 320 } 321 322 @Override 323 public Base addChild(String name) throws FHIRException { 324 if (name.equals("code")) { 325 this.code = new CodeableConcept(); 326 return this.code; 327 } 328 else if (name.equals("valueCoding")) { 329 this.value = new Coding(); 330 return this.value; 331 } 332 else if (name.equals("valueQuantity")) { 333 this.value = new Quantity(); 334 return this.value; 335 } 336 else if (name.equals("valueString")) { 337 this.value = new StringType(); 338 return this.value; 339 } 340 else if (name.equals("valueDate")) { 341 this.value = new DateType(); 342 return this.value; 343 } 344 else if (name.equals("valueBoolean")) { 345 this.value = new BooleanType(); 346 return this.value; 347 } 348 else if (name.equals("valueAttachment")) { 349 this.value = new Attachment(); 350 return this.value; 351 } 352 else 353 return super.addChild(name); 354 } 355 356 public ManufacturedItemDefinitionCharacteristicComponent copy() { 357 ManufacturedItemDefinitionCharacteristicComponent dst = new ManufacturedItemDefinitionCharacteristicComponent(); 358 copyValues(dst); 359 return dst; 360 } 361 362 public void copyValues(ManufacturedItemDefinitionCharacteristicComponent dst) { 363 super.copyValues(dst); 364 dst.code = code == null ? null : code.copy(); 365 dst.value = value == null ? null : value.copy(); 366 } 367 368 @Override 369 public boolean equalsDeep(Base other_) { 370 if (!super.equalsDeep(other_)) 371 return false; 372 if (!(other_ instanceof ManufacturedItemDefinitionCharacteristicComponent)) 373 return false; 374 ManufacturedItemDefinitionCharacteristicComponent o = (ManufacturedItemDefinitionCharacteristicComponent) other_; 375 return compareDeep(code, o.code, true) && compareDeep(value, o.value, true); 376 } 377 378 @Override 379 public boolean equalsShallow(Base other_) { 380 if (!super.equalsShallow(other_)) 381 return false; 382 if (!(other_ instanceof ManufacturedItemDefinitionCharacteristicComponent)) 383 return false; 384 ManufacturedItemDefinitionCharacteristicComponent o = (ManufacturedItemDefinitionCharacteristicComponent) other_; 385 return true; 386 } 387 388 public boolean isEmpty() { 389 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, value); 390 } 391 392 public String fhirType() { 393 return "ManufacturedItemDefinition.characteristic"; 394 395 } 396 397 } 398 399 /** 400 * Unique identifier. 401 */ 402 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 403 @Description(shortDefinition="Unique identifier", formalDefinition="Unique identifier." ) 404 protected List<Identifier> identifier; 405 406 /** 407 * Dose form as manufactured and before any transformation into the pharmaceutical product. 408 */ 409 @Child(name = "manufacturedDoseForm", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true) 410 @Description(shortDefinition="Dose form as manufactured and before any transformation into the pharmaceutical product", formalDefinition="Dose form as manufactured and before any transformation into the pharmaceutical product." ) 411 protected CodeableConcept manufacturedDoseForm; 412 413 /** 414 * The “real world” units in which the quantity of the manufactured item is described. 415 */ 416 @Child(name = "unitOfPresentation", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 417 @Description(shortDefinition="The “real world” units in which the quantity of the manufactured item is described", formalDefinition="The “real world” units in which the quantity of the manufactured item is described." ) 418 protected CodeableConcept unitOfPresentation; 419 420 /** 421 * Manufacturer of the item (Note that this should be named "manufacturer" but it currently causes technical issues). 422 */ 423 @Child(name = "manufacturer", type = {Organization.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 424 @Description(shortDefinition="Manufacturer of the item (Note that this should be named \"manufacturer\" but it currently causes technical issues)", formalDefinition="Manufacturer of the item (Note that this should be named \"manufacturer\" but it currently causes technical issues)." ) 425 protected List<Reference> manufacturer; 426 427 /** 428 * The ingredients that make up this manufactured item. 429 */ 430 @Child(name = "ingredient", type = {Ingredient.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 431 @Description(shortDefinition="The ingredients that make up this manufactured item", formalDefinition="The ingredients that make up this manufactured item." ) 432 protected List<Reference> ingredient; 433 434 /** 435 * General characteristics of this item. 436 */ 437 @Child(name = "characteristic", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 438 @Description(shortDefinition="General characteristics of this item", formalDefinition="General characteristics of this item." ) 439 protected List<ManufacturedItemDefinitionCharacteristicComponent> characteristic; 440 441 private static final long serialVersionUID = -2112474361L; 442 443 /** 444 * Constructor 445 */ 446 public ManufacturedItemDefinition() { 447 super(); 448 } 449 450 /** 451 * Constructor 452 */ 453 public ManufacturedItemDefinition(CodeableConcept manufacturedDoseForm) { 454 super(); 455 this.setManufacturedDoseForm(manufacturedDoseForm); 456 } 457 458 /** 459 * @return {@link #identifier} (Unique identifier.) 460 */ 461 public List<Identifier> getIdentifier() { 462 if (this.identifier == null) 463 this.identifier = new ArrayList<Identifier>(); 464 return this.identifier; 465 } 466 467 /** 468 * @return Returns a reference to <code>this</code> for easy method chaining 469 */ 470 public ManufacturedItemDefinition setIdentifier(List<Identifier> theIdentifier) { 471 this.identifier = theIdentifier; 472 return this; 473 } 474 475 public boolean hasIdentifier() { 476 if (this.identifier == null) 477 return false; 478 for (Identifier item : this.identifier) 479 if (!item.isEmpty()) 480 return true; 481 return false; 482 } 483 484 public Identifier addIdentifier() { //3 485 Identifier t = new Identifier(); 486 if (this.identifier == null) 487 this.identifier = new ArrayList<Identifier>(); 488 this.identifier.add(t); 489 return t; 490 } 491 492 public ManufacturedItemDefinition addIdentifier(Identifier t) { //3 493 if (t == null) 494 return this; 495 if (this.identifier == null) 496 this.identifier = new ArrayList<Identifier>(); 497 this.identifier.add(t); 498 return this; 499 } 500 501 /** 502 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3} 503 */ 504 public Identifier getIdentifierFirstRep() { 505 if (getIdentifier().isEmpty()) { 506 addIdentifier(); 507 } 508 return getIdentifier().get(0); 509 } 510 511 /** 512 * @return {@link #manufacturedDoseForm} (Dose form as manufactured and before any transformation into the pharmaceutical product.) 513 */ 514 public CodeableConcept getManufacturedDoseForm() { 515 if (this.manufacturedDoseForm == null) 516 if (Configuration.errorOnAutoCreate()) 517 throw new Error("Attempt to auto-create ManufacturedItemDefinition.manufacturedDoseForm"); 518 else if (Configuration.doAutoCreate()) 519 this.manufacturedDoseForm = new CodeableConcept(); // cc 520 return this.manufacturedDoseForm; 521 } 522 523 public boolean hasManufacturedDoseForm() { 524 return this.manufacturedDoseForm != null && !this.manufacturedDoseForm.isEmpty(); 525 } 526 527 /** 528 * @param value {@link #manufacturedDoseForm} (Dose form as manufactured and before any transformation into the pharmaceutical product.) 529 */ 530 public ManufacturedItemDefinition setManufacturedDoseForm(CodeableConcept value) { 531 this.manufacturedDoseForm = value; 532 return this; 533 } 534 535 /** 536 * @return {@link #unitOfPresentation} (The “real world” units in which the quantity of the manufactured item is described.) 537 */ 538 public CodeableConcept getUnitOfPresentation() { 539 if (this.unitOfPresentation == null) 540 if (Configuration.errorOnAutoCreate()) 541 throw new Error("Attempt to auto-create ManufacturedItemDefinition.unitOfPresentation"); 542 else if (Configuration.doAutoCreate()) 543 this.unitOfPresentation = new CodeableConcept(); // cc 544 return this.unitOfPresentation; 545 } 546 547 public boolean hasUnitOfPresentation() { 548 return this.unitOfPresentation != null && !this.unitOfPresentation.isEmpty(); 549 } 550 551 /** 552 * @param value {@link #unitOfPresentation} (The “real world” units in which the quantity of the manufactured item is described.) 553 */ 554 public ManufacturedItemDefinition setUnitOfPresentation(CodeableConcept value) { 555 this.unitOfPresentation = value; 556 return this; 557 } 558 559 /** 560 * @return {@link #manufacturer} (Manufacturer of the item (Note that this should be named "manufacturer" but it currently causes technical issues).) 561 */ 562 public List<Reference> getManufacturer() { 563 if (this.manufacturer == null) 564 this.manufacturer = new ArrayList<Reference>(); 565 return this.manufacturer; 566 } 567 568 /** 569 * @return Returns a reference to <code>this</code> for easy method chaining 570 */ 571 public ManufacturedItemDefinition setManufacturer(List<Reference> theManufacturer) { 572 this.manufacturer = theManufacturer; 573 return this; 574 } 575 576 public boolean hasManufacturer() { 577 if (this.manufacturer == null) 578 return false; 579 for (Reference item : this.manufacturer) 580 if (!item.isEmpty()) 581 return true; 582 return false; 583 } 584 585 public Reference addManufacturer() { //3 586 Reference t = new Reference(); 587 if (this.manufacturer == null) 588 this.manufacturer = new ArrayList<Reference>(); 589 this.manufacturer.add(t); 590 return t; 591 } 592 593 public ManufacturedItemDefinition addManufacturer(Reference t) { //3 594 if (t == null) 595 return this; 596 if (this.manufacturer == null) 597 this.manufacturer = new ArrayList<Reference>(); 598 this.manufacturer.add(t); 599 return this; 600 } 601 602 /** 603 * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist {3} 604 */ 605 public Reference getManufacturerFirstRep() { 606 if (getManufacturer().isEmpty()) { 607 addManufacturer(); 608 } 609 return getManufacturer().get(0); 610 } 611 612 /** 613 * @return {@link #ingredient} (The ingredients that make up this manufactured item.) 614 */ 615 public List<Reference> getIngredient() { 616 if (this.ingredient == null) 617 this.ingredient = new ArrayList<Reference>(); 618 return this.ingredient; 619 } 620 621 /** 622 * @return Returns a reference to <code>this</code> for easy method chaining 623 */ 624 public ManufacturedItemDefinition setIngredient(List<Reference> theIngredient) { 625 this.ingredient = theIngredient; 626 return this; 627 } 628 629 public boolean hasIngredient() { 630 if (this.ingredient == null) 631 return false; 632 for (Reference item : this.ingredient) 633 if (!item.isEmpty()) 634 return true; 635 return false; 636 } 637 638 public Reference addIngredient() { //3 639 Reference t = new Reference(); 640 if (this.ingredient == null) 641 this.ingredient = new ArrayList<Reference>(); 642 this.ingredient.add(t); 643 return t; 644 } 645 646 public ManufacturedItemDefinition addIngredient(Reference t) { //3 647 if (t == null) 648 return this; 649 if (this.ingredient == null) 650 this.ingredient = new ArrayList<Reference>(); 651 this.ingredient.add(t); 652 return this; 653 } 654 655 /** 656 * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist {3} 657 */ 658 public Reference getIngredientFirstRep() { 659 if (getIngredient().isEmpty()) { 660 addIngredient(); 661 } 662 return getIngredient().get(0); 663 } 664 665 /** 666 * @return {@link #characteristic} (General characteristics of this item.) 667 */ 668 public List<ManufacturedItemDefinitionCharacteristicComponent> getCharacteristic() { 669 if (this.characteristic == null) 670 this.characteristic = new ArrayList<ManufacturedItemDefinitionCharacteristicComponent>(); 671 return this.characteristic; 672 } 673 674 /** 675 * @return Returns a reference to <code>this</code> for easy method chaining 676 */ 677 public ManufacturedItemDefinition setCharacteristic(List<ManufacturedItemDefinitionCharacteristicComponent> theCharacteristic) { 678 this.characteristic = theCharacteristic; 679 return this; 680 } 681 682 public boolean hasCharacteristic() { 683 if (this.characteristic == null) 684 return false; 685 for (ManufacturedItemDefinitionCharacteristicComponent item : this.characteristic) 686 if (!item.isEmpty()) 687 return true; 688 return false; 689 } 690 691 public ManufacturedItemDefinitionCharacteristicComponent addCharacteristic() { //3 692 ManufacturedItemDefinitionCharacteristicComponent t = new ManufacturedItemDefinitionCharacteristicComponent(); 693 if (this.characteristic == null) 694 this.characteristic = new ArrayList<ManufacturedItemDefinitionCharacteristicComponent>(); 695 this.characteristic.add(t); 696 return t; 697 } 698 699 public ManufacturedItemDefinition addCharacteristic(ManufacturedItemDefinitionCharacteristicComponent t) { //3 700 if (t == null) 701 return this; 702 if (this.characteristic == null) 703 this.characteristic = new ArrayList<ManufacturedItemDefinitionCharacteristicComponent>(); 704 this.characteristic.add(t); 705 return this; 706 } 707 708 /** 709 * @return The first repetition of repeating field {@link #characteristic}, creating it if it does not already exist {3} 710 */ 711 public ManufacturedItemDefinitionCharacteristicComponent getCharacteristicFirstRep() { 712 if (getCharacteristic().isEmpty()) { 713 addCharacteristic(); 714 } 715 return getCharacteristic().get(0); 716 } 717 718 protected void listChildren(List<Property> children) { 719 super.listChildren(children); 720 children.add(new Property("identifier", "Identifier", "Unique identifier.", 0, java.lang.Integer.MAX_VALUE, identifier)); 721 children.add(new Property("manufacturedDoseForm", "CodeableConcept", "Dose form as manufactured and before any transformation into the pharmaceutical product.", 0, 1, manufacturedDoseForm)); 722 children.add(new Property("unitOfPresentation", "CodeableConcept", "The “real world” units in which the quantity of the manufactured item is described.", 0, 1, unitOfPresentation)); 723 children.add(new Property("manufacturer", "Reference(Organization)", "Manufacturer of the item (Note that this should be named \"manufacturer\" but it currently causes technical issues).", 0, java.lang.Integer.MAX_VALUE, manufacturer)); 724 children.add(new Property("ingredient", "Reference(Ingredient)", "The ingredients that make up this manufactured item.", 0, java.lang.Integer.MAX_VALUE, ingredient)); 725 children.add(new Property("characteristic", "", "General characteristics of this item.", 0, java.lang.Integer.MAX_VALUE, characteristic)); 726 } 727 728 @Override 729 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 730 switch (_hash) { 731 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Unique identifier.", 0, java.lang.Integer.MAX_VALUE, identifier); 732 case -1451400348: /*manufacturedDoseForm*/ return new Property("manufacturedDoseForm", "CodeableConcept", "Dose form as manufactured and before any transformation into the pharmaceutical product.", 0, 1, manufacturedDoseForm); 733 case -1427765963: /*unitOfPresentation*/ return new Property("unitOfPresentation", "CodeableConcept", "The “real world” units in which the quantity of the manufactured item is described.", 0, 1, unitOfPresentation); 734 case -1969347631: /*manufacturer*/ return new Property("manufacturer", "Reference(Organization)", "Manufacturer of the item (Note that this should be named \"manufacturer\" but it currently causes technical issues).", 0, java.lang.Integer.MAX_VALUE, manufacturer); 735 case -206409263: /*ingredient*/ return new Property("ingredient", "Reference(Ingredient)", "The ingredients that make up this manufactured item.", 0, java.lang.Integer.MAX_VALUE, ingredient); 736 case 366313883: /*characteristic*/ return new Property("characteristic", "", "General characteristics of this item.", 0, java.lang.Integer.MAX_VALUE, characteristic); 737 default: return super.getNamedProperty(_hash, _name, _checkValid); 738 } 739 740 } 741 742 @Override 743 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 744 switch (hash) { 745 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 746 case -1451400348: /*manufacturedDoseForm*/ return this.manufacturedDoseForm == null ? new Base[0] : new Base[] {this.manufacturedDoseForm}; // CodeableConcept 747 case -1427765963: /*unitOfPresentation*/ return this.unitOfPresentation == null ? new Base[0] : new Base[] {this.unitOfPresentation}; // CodeableConcept 748 case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference 749 case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // Reference 750 case 366313883: /*characteristic*/ return this.characteristic == null ? new Base[0] : this.characteristic.toArray(new Base[this.characteristic.size()]); // ManufacturedItemDefinitionCharacteristicComponent 751 default: return super.getProperty(hash, name, checkValid); 752 } 753 754 } 755 756 @Override 757 public Base setProperty(int hash, String name, Base value) throws FHIRException { 758 switch (hash) { 759 case -1618432855: // identifier 760 this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier 761 return value; 762 case -1451400348: // manufacturedDoseForm 763 this.manufacturedDoseForm = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 764 return value; 765 case -1427765963: // unitOfPresentation 766 this.unitOfPresentation = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 767 return value; 768 case -1969347631: // manufacturer 769 this.getManufacturer().add(TypeConvertor.castToReference(value)); // Reference 770 return value; 771 case -206409263: // ingredient 772 this.getIngredient().add(TypeConvertor.castToReference(value)); // Reference 773 return value; 774 case 366313883: // characteristic 775 this.getCharacteristic().add((ManufacturedItemDefinitionCharacteristicComponent) value); // ManufacturedItemDefinitionCharacteristicComponent 776 return value; 777 default: return super.setProperty(hash, name, value); 778 } 779 780 } 781 782 @Override 783 public Base setProperty(String name, Base value) throws FHIRException { 784 if (name.equals("identifier")) { 785 this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); 786 } else if (name.equals("manufacturedDoseForm")) { 787 this.manufacturedDoseForm = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 788 } else if (name.equals("unitOfPresentation")) { 789 this.unitOfPresentation = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 790 } else if (name.equals("manufacturer")) { 791 this.getManufacturer().add(TypeConvertor.castToReference(value)); 792 } else if (name.equals("ingredient")) { 793 this.getIngredient().add(TypeConvertor.castToReference(value)); 794 } else if (name.equals("characteristic")) { 795 this.getCharacteristic().add((ManufacturedItemDefinitionCharacteristicComponent) value); 796 } else 797 return super.setProperty(name, value); 798 return value; 799 } 800 801 @Override 802 public Base makeProperty(int hash, String name) throws FHIRException { 803 switch (hash) { 804 case -1618432855: return addIdentifier(); 805 case -1451400348: return getManufacturedDoseForm(); 806 case -1427765963: return getUnitOfPresentation(); 807 case -1969347631: return addManufacturer(); 808 case -206409263: return addIngredient(); 809 case 366313883: return addCharacteristic(); 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 -1618432855: /*identifier*/ return new String[] {"Identifier"}; 819 case -1451400348: /*manufacturedDoseForm*/ return new String[] {"CodeableConcept"}; 820 case -1427765963: /*unitOfPresentation*/ return new String[] {"CodeableConcept"}; 821 case -1969347631: /*manufacturer*/ return new String[] {"Reference"}; 822 case -206409263: /*ingredient*/ return new String[] {"Reference"}; 823 case 366313883: /*characteristic*/ return new String[] {}; 824 default: return super.getTypesForProperty(hash, name); 825 } 826 827 } 828 829 @Override 830 public Base addChild(String name) throws FHIRException { 831 if (name.equals("identifier")) { 832 return addIdentifier(); 833 } 834 else if (name.equals("manufacturedDoseForm")) { 835 this.manufacturedDoseForm = new CodeableConcept(); 836 return this.manufacturedDoseForm; 837 } 838 else if (name.equals("unitOfPresentation")) { 839 this.unitOfPresentation = new CodeableConcept(); 840 return this.unitOfPresentation; 841 } 842 else if (name.equals("manufacturer")) { 843 return addManufacturer(); 844 } 845 else if (name.equals("ingredient")) { 846 return addIngredient(); 847 } 848 else if (name.equals("characteristic")) { 849 return addCharacteristic(); 850 } 851 else 852 return super.addChild(name); 853 } 854 855 public String fhirType() { 856 return "ManufacturedItemDefinition"; 857 858 } 859 860 public ManufacturedItemDefinition copy() { 861 ManufacturedItemDefinition dst = new ManufacturedItemDefinition(); 862 copyValues(dst); 863 return dst; 864 } 865 866 public void copyValues(ManufacturedItemDefinition dst) { 867 super.copyValues(dst); 868 if (identifier != null) { 869 dst.identifier = new ArrayList<Identifier>(); 870 for (Identifier i : identifier) 871 dst.identifier.add(i.copy()); 872 }; 873 dst.manufacturedDoseForm = manufacturedDoseForm == null ? null : manufacturedDoseForm.copy(); 874 dst.unitOfPresentation = unitOfPresentation == null ? null : unitOfPresentation.copy(); 875 if (manufacturer != null) { 876 dst.manufacturer = new ArrayList<Reference>(); 877 for (Reference i : manufacturer) 878 dst.manufacturer.add(i.copy()); 879 }; 880 if (ingredient != null) { 881 dst.ingredient = new ArrayList<Reference>(); 882 for (Reference i : ingredient) 883 dst.ingredient.add(i.copy()); 884 }; 885 if (characteristic != null) { 886 dst.characteristic = new ArrayList<ManufacturedItemDefinitionCharacteristicComponent>(); 887 for (ManufacturedItemDefinitionCharacteristicComponent i : characteristic) 888 dst.characteristic.add(i.copy()); 889 }; 890 } 891 892 protected ManufacturedItemDefinition typedCopy() { 893 return copy(); 894 } 895 896 @Override 897 public boolean equalsDeep(Base other_) { 898 if (!super.equalsDeep(other_)) 899 return false; 900 if (!(other_ instanceof ManufacturedItemDefinition)) 901 return false; 902 ManufacturedItemDefinition o = (ManufacturedItemDefinition) other_; 903 return compareDeep(identifier, o.identifier, true) && compareDeep(manufacturedDoseForm, o.manufacturedDoseForm, true) 904 && compareDeep(unitOfPresentation, o.unitOfPresentation, true) && compareDeep(manufacturer, o.manufacturer, true) 905 && compareDeep(ingredient, o.ingredient, true) && compareDeep(characteristic, o.characteristic, true) 906 ; 907 } 908 909 @Override 910 public boolean equalsShallow(Base other_) { 911 if (!super.equalsShallow(other_)) 912 return false; 913 if (!(other_ instanceof ManufacturedItemDefinition)) 914 return false; 915 ManufacturedItemDefinition o = (ManufacturedItemDefinition) other_; 916 return true; 917 } 918 919 public boolean isEmpty() { 920 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, manufacturedDoseForm 921 , unitOfPresentation, manufacturer, ingredient, characteristic); 922 } 923 924 @Override 925 public ResourceType getResourceType() { 926 return ResourceType.ManufacturedItemDefinition; 927 } 928 929 /** 930 * Search parameter: <b>dose-form</b> 931 * <p> 932 * Description: <b>Dose form as manufactured and before any transformation into the pharmaceutical product</b><br> 933 * Type: <b>token</b><br> 934 * Path: <b>ManufacturedItemDefinition.manufacturedDoseForm</b><br> 935 * </p> 936 */ 937 @SearchParamDefinition(name="dose-form", path="ManufacturedItemDefinition.manufacturedDoseForm", description="Dose form as manufactured and before any transformation into the pharmaceutical product", type="token" ) 938 public static final String SP_DOSE_FORM = "dose-form"; 939 /** 940 * <b>Fluent Client</b> search parameter constant for <b>dose-form</b> 941 * <p> 942 * Description: <b>Dose form as manufactured and before any transformation into the pharmaceutical product</b><br> 943 * Type: <b>token</b><br> 944 * Path: <b>ManufacturedItemDefinition.manufacturedDoseForm</b><br> 945 * </p> 946 */ 947 public static final ca.uhn.fhir.rest.gclient.TokenClientParam DOSE_FORM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DOSE_FORM); 948 949 /** 950 * Search parameter: <b>identifier</b> 951 * <p> 952 * Description: <b>Unique identifier</b><br> 953 * Type: <b>token</b><br> 954 * Path: <b>ManufacturedItemDefinition.identifier</b><br> 955 * </p> 956 */ 957 @SearchParamDefinition(name="identifier", path="ManufacturedItemDefinition.identifier", description="Unique identifier", type="token" ) 958 public static final String SP_IDENTIFIER = "identifier"; 959 /** 960 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 961 * <p> 962 * Description: <b>Unique identifier</b><br> 963 * Type: <b>token</b><br> 964 * Path: <b>ManufacturedItemDefinition.identifier</b><br> 965 * </p> 966 */ 967 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 968 969 970} 971