001package org.hl7.fhir.r4.model; 002 003 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034 035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 036 037import java.util.*; 038 039import org.hl7.fhir.utilities.Utilities; 040import ca.uhn.fhir.model.api.annotation.ResourceDef; 041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.ChildOrder; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046import org.hl7.fhir.instance.model.api.*; 047import org.hl7.fhir.exceptions.FHIRException; 048/** 049 * A homogeneous material with a definite composition. 050 */ 051@ResourceDef(name="Substance", profile="http://hl7.org/fhir/StructureDefinition/Substance") 052public class Substance extends DomainResource { 053 054 public enum FHIRSubstanceStatus { 055 /** 056 * The substance is considered for use or reference. 057 */ 058 ACTIVE, 059 /** 060 * The substance is considered for reference, but not for use. 061 */ 062 INACTIVE, 063 /** 064 * The substance was entered in error. 065 */ 066 ENTEREDINERROR, 067 /** 068 * added to help the parsers with the generic types 069 */ 070 NULL; 071 public static FHIRSubstanceStatus fromCode(String codeString) throws FHIRException { 072 if (codeString == null || "".equals(codeString)) 073 return null; 074 if ("active".equals(codeString)) 075 return ACTIVE; 076 if ("inactive".equals(codeString)) 077 return INACTIVE; 078 if ("entered-in-error".equals(codeString)) 079 return ENTEREDINERROR; 080 if (Configuration.isAcceptInvalidEnums()) 081 return null; 082 else 083 throw new FHIRException("Unknown FHIRSubstanceStatus code '"+codeString+"'"); 084 } 085 public String toCode() { 086 switch (this) { 087 case ACTIVE: return "active"; 088 case INACTIVE: return "inactive"; 089 case ENTEREDINERROR: return "entered-in-error"; 090 case NULL: return null; 091 default: return "?"; 092 } 093 } 094 public String getSystem() { 095 switch (this) { 096 case ACTIVE: return "http://hl7.org/fhir/substance-status"; 097 case INACTIVE: return "http://hl7.org/fhir/substance-status"; 098 case ENTEREDINERROR: return "http://hl7.org/fhir/substance-status"; 099 case NULL: return null; 100 default: return "?"; 101 } 102 } 103 public String getDefinition() { 104 switch (this) { 105 case ACTIVE: return "The substance is considered for use or reference."; 106 case INACTIVE: return "The substance is considered for reference, but not for use."; 107 case ENTEREDINERROR: return "The substance was entered in error."; 108 case NULL: return null; 109 default: return "?"; 110 } 111 } 112 public String getDisplay() { 113 switch (this) { 114 case ACTIVE: return "Active"; 115 case INACTIVE: return "Inactive"; 116 case ENTEREDINERROR: return "Entered in Error"; 117 case NULL: return null; 118 default: return "?"; 119 } 120 } 121 } 122 123 public static class FHIRSubstanceStatusEnumFactory implements EnumFactory<FHIRSubstanceStatus> { 124 public FHIRSubstanceStatus fromCode(String codeString) throws IllegalArgumentException { 125 if (codeString == null || "".equals(codeString)) 126 if (codeString == null || "".equals(codeString)) 127 return null; 128 if ("active".equals(codeString)) 129 return FHIRSubstanceStatus.ACTIVE; 130 if ("inactive".equals(codeString)) 131 return FHIRSubstanceStatus.INACTIVE; 132 if ("entered-in-error".equals(codeString)) 133 return FHIRSubstanceStatus.ENTEREDINERROR; 134 throw new IllegalArgumentException("Unknown FHIRSubstanceStatus code '"+codeString+"'"); 135 } 136 public Enumeration<FHIRSubstanceStatus> fromType(Base code) throws FHIRException { 137 if (code == null) 138 return null; 139 if (code.isEmpty()) 140 return new Enumeration<FHIRSubstanceStatus>(this); 141 String codeString = ((PrimitiveType) code).asStringValue(); 142 if (codeString == null || "".equals(codeString)) 143 return null; 144 if ("active".equals(codeString)) 145 return new Enumeration<FHIRSubstanceStatus>(this, FHIRSubstanceStatus.ACTIVE); 146 if ("inactive".equals(codeString)) 147 return new Enumeration<FHIRSubstanceStatus>(this, FHIRSubstanceStatus.INACTIVE); 148 if ("entered-in-error".equals(codeString)) 149 return new Enumeration<FHIRSubstanceStatus>(this, FHIRSubstanceStatus.ENTEREDINERROR); 150 throw new FHIRException("Unknown FHIRSubstanceStatus code '"+codeString+"'"); 151 } 152 public String toCode(FHIRSubstanceStatus code) { 153 if (code == FHIRSubstanceStatus.ACTIVE) 154 return "active"; 155 if (code == FHIRSubstanceStatus.INACTIVE) 156 return "inactive"; 157 if (code == FHIRSubstanceStatus.ENTEREDINERROR) 158 return "entered-in-error"; 159 return "?"; 160 } 161 public String toSystem(FHIRSubstanceStatus code) { 162 return code.getSystem(); 163 } 164 } 165 166 @Block() 167 public static class SubstanceInstanceComponent extends BackboneElement implements IBaseBackboneElement { 168 /** 169 * Identifier associated with the package/container (usually a label affixed directly). 170 */ 171 @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true) 172 @Description(shortDefinition="Identifier of the package/container", formalDefinition="Identifier associated with the package/container (usually a label affixed directly)." ) 173 protected Identifier identifier; 174 175 /** 176 * When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry. 177 */ 178 @Child(name = "expiry", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=true) 179 @Description(shortDefinition="When no longer valid to use", formalDefinition="When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry." ) 180 protected DateTimeType expiry; 181 182 /** 183 * The amount of the substance. 184 */ 185 @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true) 186 @Description(shortDefinition="Amount of substance in the package", formalDefinition="The amount of the substance." ) 187 protected Quantity quantity; 188 189 private static final long serialVersionUID = -1474380480L; 190 191 /** 192 * Constructor 193 */ 194 public SubstanceInstanceComponent() { 195 super(); 196 } 197 198 /** 199 * @return {@link #identifier} (Identifier associated with the package/container (usually a label affixed directly).) 200 */ 201 public Identifier getIdentifier() { 202 if (this.identifier == null) 203 if (Configuration.errorOnAutoCreate()) 204 throw new Error("Attempt to auto-create SubstanceInstanceComponent.identifier"); 205 else if (Configuration.doAutoCreate()) 206 this.identifier = new Identifier(); // cc 207 return this.identifier; 208 } 209 210 public boolean hasIdentifier() { 211 return this.identifier != null && !this.identifier.isEmpty(); 212 } 213 214 /** 215 * @param value {@link #identifier} (Identifier associated with the package/container (usually a label affixed directly).) 216 */ 217 public SubstanceInstanceComponent setIdentifier(Identifier value) { 218 this.identifier = value; 219 return this; 220 } 221 222 /** 223 * @return {@link #expiry} (When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.). This is the underlying object with id, value and extensions. The accessor "getExpiry" gives direct access to the value 224 */ 225 public DateTimeType getExpiryElement() { 226 if (this.expiry == null) 227 if (Configuration.errorOnAutoCreate()) 228 throw new Error("Attempt to auto-create SubstanceInstanceComponent.expiry"); 229 else if (Configuration.doAutoCreate()) 230 this.expiry = new DateTimeType(); // bb 231 return this.expiry; 232 } 233 234 public boolean hasExpiryElement() { 235 return this.expiry != null && !this.expiry.isEmpty(); 236 } 237 238 public boolean hasExpiry() { 239 return this.expiry != null && !this.expiry.isEmpty(); 240 } 241 242 /** 243 * @param value {@link #expiry} (When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.). This is the underlying object with id, value and extensions. The accessor "getExpiry" gives direct access to the value 244 */ 245 public SubstanceInstanceComponent setExpiryElement(DateTimeType value) { 246 this.expiry = value; 247 return this; 248 } 249 250 /** 251 * @return When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry. 252 */ 253 public Date getExpiry() { 254 return this.expiry == null ? null : this.expiry.getValue(); 255 } 256 257 /** 258 * @param value When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry. 259 */ 260 public SubstanceInstanceComponent setExpiry(Date value) { 261 if (value == null) 262 this.expiry = null; 263 else { 264 if (this.expiry == null) 265 this.expiry = new DateTimeType(); 266 this.expiry.setValue(value); 267 } 268 return this; 269 } 270 271 /** 272 * @return {@link #quantity} (The amount of the substance.) 273 */ 274 public Quantity getQuantity() { 275 if (this.quantity == null) 276 if (Configuration.errorOnAutoCreate()) 277 throw new Error("Attempt to auto-create SubstanceInstanceComponent.quantity"); 278 else if (Configuration.doAutoCreate()) 279 this.quantity = new Quantity(); // cc 280 return this.quantity; 281 } 282 283 public boolean hasQuantity() { 284 return this.quantity != null && !this.quantity.isEmpty(); 285 } 286 287 /** 288 * @param value {@link #quantity} (The amount of the substance.) 289 */ 290 public SubstanceInstanceComponent setQuantity(Quantity value) { 291 this.quantity = value; 292 return this; 293 } 294 295 protected void listChildren(List<Property> children) { 296 super.listChildren(children); 297 children.add(new Property("identifier", "Identifier", "Identifier associated with the package/container (usually a label affixed directly).", 0, 1, identifier)); 298 children.add(new Property("expiry", "dateTime", "When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.", 0, 1, expiry)); 299 children.add(new Property("quantity", "SimpleQuantity", "The amount of the substance.", 0, 1, quantity)); 300 } 301 302 @Override 303 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 304 switch (_hash) { 305 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Identifier associated with the package/container (usually a label affixed directly).", 0, 1, identifier); 306 case -1289159373: /*expiry*/ return new Property("expiry", "dateTime", "When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.", 0, 1, expiry); 307 case -1285004149: /*quantity*/ return new Property("quantity", "SimpleQuantity", "The amount of the substance.", 0, 1, quantity); 308 default: return super.getNamedProperty(_hash, _name, _checkValid); 309 } 310 311 } 312 313 @Override 314 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 315 switch (hash) { 316 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier 317 case -1289159373: /*expiry*/ return this.expiry == null ? new Base[0] : new Base[] {this.expiry}; // DateTimeType 318 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity 319 default: return super.getProperty(hash, name, checkValid); 320 } 321 322 } 323 324 @Override 325 public Base setProperty(int hash, String name, Base value) throws FHIRException { 326 switch (hash) { 327 case -1618432855: // identifier 328 this.identifier = castToIdentifier(value); // Identifier 329 return value; 330 case -1289159373: // expiry 331 this.expiry = castToDateTime(value); // DateTimeType 332 return value; 333 case -1285004149: // quantity 334 this.quantity = castToQuantity(value); // Quantity 335 return value; 336 default: return super.setProperty(hash, name, value); 337 } 338 339 } 340 341 @Override 342 public Base setProperty(String name, Base value) throws FHIRException { 343 if (name.equals("identifier")) { 344 this.identifier = castToIdentifier(value); // Identifier 345 } else if (name.equals("expiry")) { 346 this.expiry = castToDateTime(value); // DateTimeType 347 } else if (name.equals("quantity")) { 348 this.quantity = castToQuantity(value); // Quantity 349 } else 350 return super.setProperty(name, value); 351 return value; 352 } 353 354 @Override 355 public Base makeProperty(int hash, String name) throws FHIRException { 356 switch (hash) { 357 case -1618432855: return getIdentifier(); 358 case -1289159373: return getExpiryElement(); 359 case -1285004149: return getQuantity(); 360 default: return super.makeProperty(hash, name); 361 } 362 363 } 364 365 @Override 366 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 367 switch (hash) { 368 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 369 case -1289159373: /*expiry*/ return new String[] {"dateTime"}; 370 case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"}; 371 default: return super.getTypesForProperty(hash, name); 372 } 373 374 } 375 376 @Override 377 public Base addChild(String name) throws FHIRException { 378 if (name.equals("identifier")) { 379 this.identifier = new Identifier(); 380 return this.identifier; 381 } 382 else if (name.equals("expiry")) { 383 throw new FHIRException("Cannot call addChild on a primitive type Substance.expiry"); 384 } 385 else if (name.equals("quantity")) { 386 this.quantity = new Quantity(); 387 return this.quantity; 388 } 389 else 390 return super.addChild(name); 391 } 392 393 public SubstanceInstanceComponent copy() { 394 SubstanceInstanceComponent dst = new SubstanceInstanceComponent(); 395 copyValues(dst); 396 return dst; 397 } 398 399 public void copyValues(SubstanceInstanceComponent dst) { 400 super.copyValues(dst); 401 dst.identifier = identifier == null ? null : identifier.copy(); 402 dst.expiry = expiry == null ? null : expiry.copy(); 403 dst.quantity = quantity == null ? null : quantity.copy(); 404 } 405 406 @Override 407 public boolean equalsDeep(Base other_) { 408 if (!super.equalsDeep(other_)) 409 return false; 410 if (!(other_ instanceof SubstanceInstanceComponent)) 411 return false; 412 SubstanceInstanceComponent o = (SubstanceInstanceComponent) other_; 413 return compareDeep(identifier, o.identifier, true) && compareDeep(expiry, o.expiry, true) && compareDeep(quantity, o.quantity, true) 414 ; 415 } 416 417 @Override 418 public boolean equalsShallow(Base other_) { 419 if (!super.equalsShallow(other_)) 420 return false; 421 if (!(other_ instanceof SubstanceInstanceComponent)) 422 return false; 423 SubstanceInstanceComponent o = (SubstanceInstanceComponent) other_; 424 return compareValues(expiry, o.expiry, true); 425 } 426 427 public boolean isEmpty() { 428 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, expiry, quantity 429 ); 430 } 431 432 public String fhirType() { 433 return "Substance.instance"; 434 435 } 436 437 } 438 439 @Block() 440 public static class SubstanceIngredientComponent extends BackboneElement implements IBaseBackboneElement { 441 /** 442 * The amount of the ingredient in the substance - a concentration ratio. 443 */ 444 @Child(name = "quantity", type = {Ratio.class}, order=1, min=0, max=1, modifier=false, summary=true) 445 @Description(shortDefinition="Optional amount (concentration)", formalDefinition="The amount of the ingredient in the substance - a concentration ratio." ) 446 protected Ratio quantity; 447 448 /** 449 * Another substance that is a component of this substance. 450 */ 451 @Child(name = "substance", type = {CodeableConcept.class, Substance.class}, order=2, min=1, max=1, modifier=false, summary=true) 452 @Description(shortDefinition="A component of the substance", formalDefinition="Another substance that is a component of this substance." ) 453 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-code") 454 protected Type substance; 455 456 private static final long serialVersionUID = -469805322L; 457 458 /** 459 * Constructor 460 */ 461 public SubstanceIngredientComponent() { 462 super(); 463 } 464 465 /** 466 * Constructor 467 */ 468 public SubstanceIngredientComponent(Type substance) { 469 super(); 470 this.substance = substance; 471 } 472 473 /** 474 * @return {@link #quantity} (The amount of the ingredient in the substance - a concentration ratio.) 475 */ 476 public Ratio getQuantity() { 477 if (this.quantity == null) 478 if (Configuration.errorOnAutoCreate()) 479 throw new Error("Attempt to auto-create SubstanceIngredientComponent.quantity"); 480 else if (Configuration.doAutoCreate()) 481 this.quantity = new Ratio(); // cc 482 return this.quantity; 483 } 484 485 public boolean hasQuantity() { 486 return this.quantity != null && !this.quantity.isEmpty(); 487 } 488 489 /** 490 * @param value {@link #quantity} (The amount of the ingredient in the substance - a concentration ratio.) 491 */ 492 public SubstanceIngredientComponent setQuantity(Ratio value) { 493 this.quantity = value; 494 return this; 495 } 496 497 /** 498 * @return {@link #substance} (Another substance that is a component of this substance.) 499 */ 500 public Type getSubstance() { 501 return this.substance; 502 } 503 504 /** 505 * @return {@link #substance} (Another substance that is a component of this substance.) 506 */ 507 public CodeableConcept getSubstanceCodeableConcept() throws FHIRException { 508 if (this.substance == null) 509 this.substance = new CodeableConcept(); 510 if (!(this.substance instanceof CodeableConcept)) 511 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.substance.getClass().getName()+" was encountered"); 512 return (CodeableConcept) this.substance; 513 } 514 515 public boolean hasSubstanceCodeableConcept() { 516 return this != null && this.substance instanceof CodeableConcept; 517 } 518 519 /** 520 * @return {@link #substance} (Another substance that is a component of this substance.) 521 */ 522 public Reference getSubstanceReference() throws FHIRException { 523 if (this.substance == null) 524 this.substance = new Reference(); 525 if (!(this.substance instanceof Reference)) 526 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.substance.getClass().getName()+" was encountered"); 527 return (Reference) this.substance; 528 } 529 530 public boolean hasSubstanceReference() { 531 return this != null && this.substance instanceof Reference; 532 } 533 534 public boolean hasSubstance() { 535 return this.substance != null && !this.substance.isEmpty(); 536 } 537 538 /** 539 * @param value {@link #substance} (Another substance that is a component of this substance.) 540 */ 541 public SubstanceIngredientComponent setSubstance(Type value) { 542 if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) 543 throw new Error("Not the right type for Substance.ingredient.substance[x]: "+value.fhirType()); 544 this.substance = value; 545 return this; 546 } 547 548 protected void listChildren(List<Property> children) { 549 super.listChildren(children); 550 children.add(new Property("quantity", "Ratio", "The amount of the ingredient in the substance - a concentration ratio.", 0, 1, quantity)); 551 children.add(new Property("substance[x]", "CodeableConcept|Reference(Substance)", "Another substance that is a component of this substance.", 0, 1, substance)); 552 } 553 554 @Override 555 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 556 switch (_hash) { 557 case -1285004149: /*quantity*/ return new Property("quantity", "Ratio", "The amount of the ingredient in the substance - a concentration ratio.", 0, 1, quantity); 558 case 2127194384: /*substance[x]*/ return new Property("substance[x]", "CodeableConcept|Reference(Substance)", "Another substance that is a component of this substance.", 0, 1, substance); 559 case 530040176: /*substance*/ return new Property("substance[x]", "CodeableConcept|Reference(Substance)", "Another substance that is a component of this substance.", 0, 1, substance); 560 case -1974119407: /*substanceCodeableConcept*/ return new Property("substance[x]", "CodeableConcept|Reference(Substance)", "Another substance that is a component of this substance.", 0, 1, substance); 561 case 516208571: /*substanceReference*/ return new Property("substance[x]", "CodeableConcept|Reference(Substance)", "Another substance that is a component of this substance.", 0, 1, substance); 562 default: return super.getNamedProperty(_hash, _name, _checkValid); 563 } 564 565 } 566 567 @Override 568 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 569 switch (hash) { 570 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Ratio 571 case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // Type 572 default: return super.getProperty(hash, name, checkValid); 573 } 574 575 } 576 577 @Override 578 public Base setProperty(int hash, String name, Base value) throws FHIRException { 579 switch (hash) { 580 case -1285004149: // quantity 581 this.quantity = castToRatio(value); // Ratio 582 return value; 583 case 530040176: // substance 584 this.substance = castToType(value); // Type 585 return value; 586 default: return super.setProperty(hash, name, value); 587 } 588 589 } 590 591 @Override 592 public Base setProperty(String name, Base value) throws FHIRException { 593 if (name.equals("quantity")) { 594 this.quantity = castToRatio(value); // Ratio 595 } else if (name.equals("substance[x]")) { 596 this.substance = castToType(value); // Type 597 } else 598 return super.setProperty(name, value); 599 return value; 600 } 601 602 @Override 603 public Base makeProperty(int hash, String name) throws FHIRException { 604 switch (hash) { 605 case -1285004149: return getQuantity(); 606 case 2127194384: return getSubstance(); 607 case 530040176: return getSubstance(); 608 default: return super.makeProperty(hash, name); 609 } 610 611 } 612 613 @Override 614 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 615 switch (hash) { 616 case -1285004149: /*quantity*/ return new String[] {"Ratio"}; 617 case 530040176: /*substance*/ return new String[] {"CodeableConcept", "Reference"}; 618 default: return super.getTypesForProperty(hash, name); 619 } 620 621 } 622 623 @Override 624 public Base addChild(String name) throws FHIRException { 625 if (name.equals("quantity")) { 626 this.quantity = new Ratio(); 627 return this.quantity; 628 } 629 else if (name.equals("substanceCodeableConcept")) { 630 this.substance = new CodeableConcept(); 631 return this.substance; 632 } 633 else if (name.equals("substanceReference")) { 634 this.substance = new Reference(); 635 return this.substance; 636 } 637 else 638 return super.addChild(name); 639 } 640 641 public SubstanceIngredientComponent copy() { 642 SubstanceIngredientComponent dst = new SubstanceIngredientComponent(); 643 copyValues(dst); 644 return dst; 645 } 646 647 public void copyValues(SubstanceIngredientComponent dst) { 648 super.copyValues(dst); 649 dst.quantity = quantity == null ? null : quantity.copy(); 650 dst.substance = substance == null ? null : substance.copy(); 651 } 652 653 @Override 654 public boolean equalsDeep(Base other_) { 655 if (!super.equalsDeep(other_)) 656 return false; 657 if (!(other_ instanceof SubstanceIngredientComponent)) 658 return false; 659 SubstanceIngredientComponent o = (SubstanceIngredientComponent) other_; 660 return compareDeep(quantity, o.quantity, true) && compareDeep(substance, o.substance, true); 661 } 662 663 @Override 664 public boolean equalsShallow(Base other_) { 665 if (!super.equalsShallow(other_)) 666 return false; 667 if (!(other_ instanceof SubstanceIngredientComponent)) 668 return false; 669 SubstanceIngredientComponent o = (SubstanceIngredientComponent) other_; 670 return true; 671 } 672 673 public boolean isEmpty() { 674 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, substance); 675 } 676 677 public String fhirType() { 678 return "Substance.ingredient"; 679 680 } 681 682 } 683 684 /** 685 * Unique identifier for the substance. 686 */ 687 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 688 @Description(shortDefinition="Unique identifier", formalDefinition="Unique identifier for the substance." ) 689 protected List<Identifier> identifier; 690 691 /** 692 * A code to indicate if the substance is actively used. 693 */ 694 @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true) 695 @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="A code to indicate if the substance is actively used." ) 696 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-status") 697 protected Enumeration<FHIRSubstanceStatus> status; 698 699 /** 700 * A code that classifies the general type of substance. This is used for searching, sorting and display purposes. 701 */ 702 @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 703 @Description(shortDefinition="What class/type of substance this is", formalDefinition="A code that classifies the general type of substance. This is used for searching, sorting and display purposes." ) 704 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-category") 705 protected List<CodeableConcept> category; 706 707 /** 708 * A code (or set of codes) that identify this substance. 709 */ 710 @Child(name = "code", type = {CodeableConcept.class}, order=3, min=1, max=1, modifier=false, summary=true) 711 @Description(shortDefinition="What substance this is", formalDefinition="A code (or set of codes) that identify this substance." ) 712 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-code") 713 protected CodeableConcept code; 714 715 /** 716 * A description of the substance - its appearance, handling requirements, and other usage notes. 717 */ 718 @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true) 719 @Description(shortDefinition="Textual description of the substance, comments", formalDefinition="A description of the substance - its appearance, handling requirements, and other usage notes." ) 720 protected StringType description; 721 722 /** 723 * Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance. 724 */ 725 @Child(name = "instance", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 726 @Description(shortDefinition="If this describes a specific package/container of the substance", formalDefinition="Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance." ) 727 protected List<SubstanceInstanceComponent> instance; 728 729 /** 730 * A substance can be composed of other substances. 731 */ 732 @Child(name = "ingredient", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 733 @Description(shortDefinition="Composition information about the substance", formalDefinition="A substance can be composed of other substances." ) 734 protected List<SubstanceIngredientComponent> ingredient; 735 736 private static final long serialVersionUID = -1467626602L; 737 738 /** 739 * Constructor 740 */ 741 public Substance() { 742 super(); 743 } 744 745 /** 746 * Constructor 747 */ 748 public Substance(CodeableConcept code) { 749 super(); 750 this.code = code; 751 } 752 753 /** 754 * @return {@link #identifier} (Unique identifier for the substance.) 755 */ 756 public List<Identifier> getIdentifier() { 757 if (this.identifier == null) 758 this.identifier = new ArrayList<Identifier>(); 759 return this.identifier; 760 } 761 762 /** 763 * @return Returns a reference to <code>this</code> for easy method chaining 764 */ 765 public Substance setIdentifier(List<Identifier> theIdentifier) { 766 this.identifier = theIdentifier; 767 return this; 768 } 769 770 public boolean hasIdentifier() { 771 if (this.identifier == null) 772 return false; 773 for (Identifier item : this.identifier) 774 if (!item.isEmpty()) 775 return true; 776 return false; 777 } 778 779 public Identifier addIdentifier() { //3 780 Identifier t = new Identifier(); 781 if (this.identifier == null) 782 this.identifier = new ArrayList<Identifier>(); 783 this.identifier.add(t); 784 return t; 785 } 786 787 public Substance addIdentifier(Identifier t) { //3 788 if (t == null) 789 return this; 790 if (this.identifier == null) 791 this.identifier = new ArrayList<Identifier>(); 792 this.identifier.add(t); 793 return this; 794 } 795 796 /** 797 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist 798 */ 799 public Identifier getIdentifierFirstRep() { 800 if (getIdentifier().isEmpty()) { 801 addIdentifier(); 802 } 803 return getIdentifier().get(0); 804 } 805 806 /** 807 * @return {@link #status} (A code to indicate if the substance is actively used.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 808 */ 809 public Enumeration<FHIRSubstanceStatus> getStatusElement() { 810 if (this.status == null) 811 if (Configuration.errorOnAutoCreate()) 812 throw new Error("Attempt to auto-create Substance.status"); 813 else if (Configuration.doAutoCreate()) 814 this.status = new Enumeration<FHIRSubstanceStatus>(new FHIRSubstanceStatusEnumFactory()); // bb 815 return this.status; 816 } 817 818 public boolean hasStatusElement() { 819 return this.status != null && !this.status.isEmpty(); 820 } 821 822 public boolean hasStatus() { 823 return this.status != null && !this.status.isEmpty(); 824 } 825 826 /** 827 * @param value {@link #status} (A code to indicate if the substance is actively used.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 828 */ 829 public Substance setStatusElement(Enumeration<FHIRSubstanceStatus> value) { 830 this.status = value; 831 return this; 832 } 833 834 /** 835 * @return A code to indicate if the substance is actively used. 836 */ 837 public FHIRSubstanceStatus getStatus() { 838 return this.status == null ? null : this.status.getValue(); 839 } 840 841 /** 842 * @param value A code to indicate if the substance is actively used. 843 */ 844 public Substance setStatus(FHIRSubstanceStatus value) { 845 if (value == null) 846 this.status = null; 847 else { 848 if (this.status == null) 849 this.status = new Enumeration<FHIRSubstanceStatus>(new FHIRSubstanceStatusEnumFactory()); 850 this.status.setValue(value); 851 } 852 return this; 853 } 854 855 /** 856 * @return {@link #category} (A code that classifies the general type of substance. This is used for searching, sorting and display purposes.) 857 */ 858 public List<CodeableConcept> getCategory() { 859 if (this.category == null) 860 this.category = new ArrayList<CodeableConcept>(); 861 return this.category; 862 } 863 864 /** 865 * @return Returns a reference to <code>this</code> for easy method chaining 866 */ 867 public Substance setCategory(List<CodeableConcept> theCategory) { 868 this.category = theCategory; 869 return this; 870 } 871 872 public boolean hasCategory() { 873 if (this.category == null) 874 return false; 875 for (CodeableConcept item : this.category) 876 if (!item.isEmpty()) 877 return true; 878 return false; 879 } 880 881 public CodeableConcept addCategory() { //3 882 CodeableConcept t = new CodeableConcept(); 883 if (this.category == null) 884 this.category = new ArrayList<CodeableConcept>(); 885 this.category.add(t); 886 return t; 887 } 888 889 public Substance addCategory(CodeableConcept t) { //3 890 if (t == null) 891 return this; 892 if (this.category == null) 893 this.category = new ArrayList<CodeableConcept>(); 894 this.category.add(t); 895 return this; 896 } 897 898 /** 899 * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist 900 */ 901 public CodeableConcept getCategoryFirstRep() { 902 if (getCategory().isEmpty()) { 903 addCategory(); 904 } 905 return getCategory().get(0); 906 } 907 908 /** 909 * @return {@link #code} (A code (or set of codes) that identify this substance.) 910 */ 911 public CodeableConcept getCode() { 912 if (this.code == null) 913 if (Configuration.errorOnAutoCreate()) 914 throw new Error("Attempt to auto-create Substance.code"); 915 else if (Configuration.doAutoCreate()) 916 this.code = new CodeableConcept(); // cc 917 return this.code; 918 } 919 920 public boolean hasCode() { 921 return this.code != null && !this.code.isEmpty(); 922 } 923 924 /** 925 * @param value {@link #code} (A code (or set of codes) that identify this substance.) 926 */ 927 public Substance setCode(CodeableConcept value) { 928 this.code = value; 929 return this; 930 } 931 932 /** 933 * @return {@link #description} (A description of the substance - its appearance, handling requirements, and other usage notes.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 934 */ 935 public StringType getDescriptionElement() { 936 if (this.description == null) 937 if (Configuration.errorOnAutoCreate()) 938 throw new Error("Attempt to auto-create Substance.description"); 939 else if (Configuration.doAutoCreate()) 940 this.description = new StringType(); // bb 941 return this.description; 942 } 943 944 public boolean hasDescriptionElement() { 945 return this.description != null && !this.description.isEmpty(); 946 } 947 948 public boolean hasDescription() { 949 return this.description != null && !this.description.isEmpty(); 950 } 951 952 /** 953 * @param value {@link #description} (A description of the substance - its appearance, handling requirements, and other usage notes.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 954 */ 955 public Substance setDescriptionElement(StringType value) { 956 this.description = value; 957 return this; 958 } 959 960 /** 961 * @return A description of the substance - its appearance, handling requirements, and other usage notes. 962 */ 963 public String getDescription() { 964 return this.description == null ? null : this.description.getValue(); 965 } 966 967 /** 968 * @param value A description of the substance - its appearance, handling requirements, and other usage notes. 969 */ 970 public Substance setDescription(String value) { 971 if (Utilities.noString(value)) 972 this.description = null; 973 else { 974 if (this.description == null) 975 this.description = new StringType(); 976 this.description.setValue(value); 977 } 978 return this; 979 } 980 981 /** 982 * @return {@link #instance} (Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance.) 983 */ 984 public List<SubstanceInstanceComponent> getInstance() { 985 if (this.instance == null) 986 this.instance = new ArrayList<SubstanceInstanceComponent>(); 987 return this.instance; 988 } 989 990 /** 991 * @return Returns a reference to <code>this</code> for easy method chaining 992 */ 993 public Substance setInstance(List<SubstanceInstanceComponent> theInstance) { 994 this.instance = theInstance; 995 return this; 996 } 997 998 public boolean hasInstance() { 999 if (this.instance == null) 1000 return false; 1001 for (SubstanceInstanceComponent item : this.instance) 1002 if (!item.isEmpty()) 1003 return true; 1004 return false; 1005 } 1006 1007 public SubstanceInstanceComponent addInstance() { //3 1008 SubstanceInstanceComponent t = new SubstanceInstanceComponent(); 1009 if (this.instance == null) 1010 this.instance = new ArrayList<SubstanceInstanceComponent>(); 1011 this.instance.add(t); 1012 return t; 1013 } 1014 1015 public Substance addInstance(SubstanceInstanceComponent t) { //3 1016 if (t == null) 1017 return this; 1018 if (this.instance == null) 1019 this.instance = new ArrayList<SubstanceInstanceComponent>(); 1020 this.instance.add(t); 1021 return this; 1022 } 1023 1024 /** 1025 * @return The first repetition of repeating field {@link #instance}, creating it if it does not already exist 1026 */ 1027 public SubstanceInstanceComponent getInstanceFirstRep() { 1028 if (getInstance().isEmpty()) { 1029 addInstance(); 1030 } 1031 return getInstance().get(0); 1032 } 1033 1034 /** 1035 * @return {@link #ingredient} (A substance can be composed of other substances.) 1036 */ 1037 public List<SubstanceIngredientComponent> getIngredient() { 1038 if (this.ingredient == null) 1039 this.ingredient = new ArrayList<SubstanceIngredientComponent>(); 1040 return this.ingredient; 1041 } 1042 1043 /** 1044 * @return Returns a reference to <code>this</code> for easy method chaining 1045 */ 1046 public Substance setIngredient(List<SubstanceIngredientComponent> theIngredient) { 1047 this.ingredient = theIngredient; 1048 return this; 1049 } 1050 1051 public boolean hasIngredient() { 1052 if (this.ingredient == null) 1053 return false; 1054 for (SubstanceIngredientComponent item : this.ingredient) 1055 if (!item.isEmpty()) 1056 return true; 1057 return false; 1058 } 1059 1060 public SubstanceIngredientComponent addIngredient() { //3 1061 SubstanceIngredientComponent t = new SubstanceIngredientComponent(); 1062 if (this.ingredient == null) 1063 this.ingredient = new ArrayList<SubstanceIngredientComponent>(); 1064 this.ingredient.add(t); 1065 return t; 1066 } 1067 1068 public Substance addIngredient(SubstanceIngredientComponent t) { //3 1069 if (t == null) 1070 return this; 1071 if (this.ingredient == null) 1072 this.ingredient = new ArrayList<SubstanceIngredientComponent>(); 1073 this.ingredient.add(t); 1074 return this; 1075 } 1076 1077 /** 1078 * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist 1079 */ 1080 public SubstanceIngredientComponent getIngredientFirstRep() { 1081 if (getIngredient().isEmpty()) { 1082 addIngredient(); 1083 } 1084 return getIngredient().get(0); 1085 } 1086 1087 protected void listChildren(List<Property> children) { 1088 super.listChildren(children); 1089 children.add(new Property("identifier", "Identifier", "Unique identifier for the substance.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1090 children.add(new Property("status", "code", "A code to indicate if the substance is actively used.", 0, 1, status)); 1091 children.add(new Property("category", "CodeableConcept", "A code that classifies the general type of substance. This is used for searching, sorting and display purposes.", 0, java.lang.Integer.MAX_VALUE, category)); 1092 children.add(new Property("code", "CodeableConcept", "A code (or set of codes) that identify this substance.", 0, 1, code)); 1093 children.add(new Property("description", "string", "A description of the substance - its appearance, handling requirements, and other usage notes.", 0, 1, description)); 1094 children.add(new Property("instance", "", "Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance.", 0, java.lang.Integer.MAX_VALUE, instance)); 1095 children.add(new Property("ingredient", "", "A substance can be composed of other substances.", 0, java.lang.Integer.MAX_VALUE, ingredient)); 1096 } 1097 1098 @Override 1099 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1100 switch (_hash) { 1101 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Unique identifier for the substance.", 0, java.lang.Integer.MAX_VALUE, identifier); 1102 case -892481550: /*status*/ return new Property("status", "code", "A code to indicate if the substance is actively used.", 0, 1, status); 1103 case 50511102: /*category*/ return new Property("category", "CodeableConcept", "A code that classifies the general type of substance. This is used for searching, sorting and display purposes.", 0, java.lang.Integer.MAX_VALUE, category); 1104 case 3059181: /*code*/ return new Property("code", "CodeableConcept", "A code (or set of codes) that identify this substance.", 0, 1, code); 1105 case -1724546052: /*description*/ return new Property("description", "string", "A description of the substance - its appearance, handling requirements, and other usage notes.", 0, 1, description); 1106 case 555127957: /*instance*/ return new Property("instance", "", "Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance.", 0, java.lang.Integer.MAX_VALUE, instance); 1107 case -206409263: /*ingredient*/ return new Property("ingredient", "", "A substance can be composed of other substances.", 0, java.lang.Integer.MAX_VALUE, ingredient); 1108 default: return super.getNamedProperty(_hash, _name, _checkValid); 1109 } 1110 1111 } 1112 1113 @Override 1114 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1115 switch (hash) { 1116 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1117 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FHIRSubstanceStatus> 1118 case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept 1119 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 1120 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 1121 case 555127957: /*instance*/ return this.instance == null ? new Base[0] : this.instance.toArray(new Base[this.instance.size()]); // SubstanceInstanceComponent 1122 case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // SubstanceIngredientComponent 1123 default: return super.getProperty(hash, name, checkValid); 1124 } 1125 1126 } 1127 1128 @Override 1129 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1130 switch (hash) { 1131 case -1618432855: // identifier 1132 this.getIdentifier().add(castToIdentifier(value)); // Identifier 1133 return value; 1134 case -892481550: // status 1135 value = new FHIRSubstanceStatusEnumFactory().fromType(castToCode(value)); 1136 this.status = (Enumeration) value; // Enumeration<FHIRSubstanceStatus> 1137 return value; 1138 case 50511102: // category 1139 this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept 1140 return value; 1141 case 3059181: // code 1142 this.code = castToCodeableConcept(value); // CodeableConcept 1143 return value; 1144 case -1724546052: // description 1145 this.description = castToString(value); // StringType 1146 return value; 1147 case 555127957: // instance 1148 this.getInstance().add((SubstanceInstanceComponent) value); // SubstanceInstanceComponent 1149 return value; 1150 case -206409263: // ingredient 1151 this.getIngredient().add((SubstanceIngredientComponent) value); // SubstanceIngredientComponent 1152 return value; 1153 default: return super.setProperty(hash, name, value); 1154 } 1155 1156 } 1157 1158 @Override 1159 public Base setProperty(String name, Base value) throws FHIRException { 1160 if (name.equals("identifier")) { 1161 this.getIdentifier().add(castToIdentifier(value)); 1162 } else if (name.equals("status")) { 1163 value = new FHIRSubstanceStatusEnumFactory().fromType(castToCode(value)); 1164 this.status = (Enumeration) value; // Enumeration<FHIRSubstanceStatus> 1165 } else if (name.equals("category")) { 1166 this.getCategory().add(castToCodeableConcept(value)); 1167 } else if (name.equals("code")) { 1168 this.code = castToCodeableConcept(value); // CodeableConcept 1169 } else if (name.equals("description")) { 1170 this.description = castToString(value); // StringType 1171 } else if (name.equals("instance")) { 1172 this.getInstance().add((SubstanceInstanceComponent) value); 1173 } else if (name.equals("ingredient")) { 1174 this.getIngredient().add((SubstanceIngredientComponent) value); 1175 } else 1176 return super.setProperty(name, value); 1177 return value; 1178 } 1179 1180 @Override 1181 public Base makeProperty(int hash, String name) throws FHIRException { 1182 switch (hash) { 1183 case -1618432855: return addIdentifier(); 1184 case -892481550: return getStatusElement(); 1185 case 50511102: return addCategory(); 1186 case 3059181: return getCode(); 1187 case -1724546052: return getDescriptionElement(); 1188 case 555127957: return addInstance(); 1189 case -206409263: return addIngredient(); 1190 default: return super.makeProperty(hash, name); 1191 } 1192 1193 } 1194 1195 @Override 1196 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1197 switch (hash) { 1198 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1199 case -892481550: /*status*/ return new String[] {"code"}; 1200 case 50511102: /*category*/ return new String[] {"CodeableConcept"}; 1201 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 1202 case -1724546052: /*description*/ return new String[] {"string"}; 1203 case 555127957: /*instance*/ return new String[] {}; 1204 case -206409263: /*ingredient*/ return new String[] {}; 1205 default: return super.getTypesForProperty(hash, name); 1206 } 1207 1208 } 1209 1210 @Override 1211 public Base addChild(String name) throws FHIRException { 1212 if (name.equals("identifier")) { 1213 return addIdentifier(); 1214 } 1215 else if (name.equals("status")) { 1216 throw new FHIRException("Cannot call addChild on a primitive type Substance.status"); 1217 } 1218 else if (name.equals("category")) { 1219 return addCategory(); 1220 } 1221 else if (name.equals("code")) { 1222 this.code = new CodeableConcept(); 1223 return this.code; 1224 } 1225 else if (name.equals("description")) { 1226 throw new FHIRException("Cannot call addChild on a primitive type Substance.description"); 1227 } 1228 else if (name.equals("instance")) { 1229 return addInstance(); 1230 } 1231 else if (name.equals("ingredient")) { 1232 return addIngredient(); 1233 } 1234 else 1235 return super.addChild(name); 1236 } 1237 1238 public String fhirType() { 1239 return "Substance"; 1240 1241 } 1242 1243 public Substance copy() { 1244 Substance dst = new Substance(); 1245 copyValues(dst); 1246 return dst; 1247 } 1248 1249 public void copyValues(Substance dst) { 1250 super.copyValues(dst); 1251 if (identifier != null) { 1252 dst.identifier = new ArrayList<Identifier>(); 1253 for (Identifier i : identifier) 1254 dst.identifier.add(i.copy()); 1255 }; 1256 dst.status = status == null ? null : status.copy(); 1257 if (category != null) { 1258 dst.category = new ArrayList<CodeableConcept>(); 1259 for (CodeableConcept i : category) 1260 dst.category.add(i.copy()); 1261 }; 1262 dst.code = code == null ? null : code.copy(); 1263 dst.description = description == null ? null : description.copy(); 1264 if (instance != null) { 1265 dst.instance = new ArrayList<SubstanceInstanceComponent>(); 1266 for (SubstanceInstanceComponent i : instance) 1267 dst.instance.add(i.copy()); 1268 }; 1269 if (ingredient != null) { 1270 dst.ingredient = new ArrayList<SubstanceIngredientComponent>(); 1271 for (SubstanceIngredientComponent i : ingredient) 1272 dst.ingredient.add(i.copy()); 1273 }; 1274 } 1275 1276 protected Substance typedCopy() { 1277 return copy(); 1278 } 1279 1280 @Override 1281 public boolean equalsDeep(Base other_) { 1282 if (!super.equalsDeep(other_)) 1283 return false; 1284 if (!(other_ instanceof Substance)) 1285 return false; 1286 Substance o = (Substance) other_; 1287 return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true) 1288 && compareDeep(code, o.code, true) && compareDeep(description, o.description, true) && compareDeep(instance, o.instance, true) 1289 && compareDeep(ingredient, o.ingredient, true); 1290 } 1291 1292 @Override 1293 public boolean equalsShallow(Base other_) { 1294 if (!super.equalsShallow(other_)) 1295 return false; 1296 if (!(other_ instanceof Substance)) 1297 return false; 1298 Substance o = (Substance) other_; 1299 return compareValues(status, o.status, true) && compareValues(description, o.description, true); 1300 } 1301 1302 public boolean isEmpty() { 1303 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, category 1304 , code, description, instance, ingredient); 1305 } 1306 1307 @Override 1308 public ResourceType getResourceType() { 1309 return ResourceType.Substance; 1310 } 1311 1312 /** 1313 * Search parameter: <b>identifier</b> 1314 * <p> 1315 * Description: <b>Unique identifier for the substance</b><br> 1316 * Type: <b>token</b><br> 1317 * Path: <b>Substance.identifier</b><br> 1318 * </p> 1319 */ 1320 @SearchParamDefinition(name="identifier", path="Substance.identifier", description="Unique identifier for the substance", type="token" ) 1321 public static final String SP_IDENTIFIER = "identifier"; 1322 /** 1323 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 1324 * <p> 1325 * Description: <b>Unique identifier for the substance</b><br> 1326 * Type: <b>token</b><br> 1327 * Path: <b>Substance.identifier</b><br> 1328 * </p> 1329 */ 1330 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 1331 1332 /** 1333 * Search parameter: <b>container-identifier</b> 1334 * <p> 1335 * Description: <b>Identifier of the package/container</b><br> 1336 * Type: <b>token</b><br> 1337 * Path: <b>Substance.instance.identifier</b><br> 1338 * </p> 1339 */ 1340 @SearchParamDefinition(name="container-identifier", path="Substance.instance.identifier", description="Identifier of the package/container", type="token" ) 1341 public static final String SP_CONTAINER_IDENTIFIER = "container-identifier"; 1342 /** 1343 * <b>Fluent Client</b> search parameter constant for <b>container-identifier</b> 1344 * <p> 1345 * Description: <b>Identifier of the package/container</b><br> 1346 * Type: <b>token</b><br> 1347 * Path: <b>Substance.instance.identifier</b><br> 1348 * </p> 1349 */ 1350 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTAINER_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTAINER_IDENTIFIER); 1351 1352 /** 1353 * Search parameter: <b>code</b> 1354 * <p> 1355 * Description: <b>The code of the substance or ingredient</b><br> 1356 * Type: <b>token</b><br> 1357 * Path: <b>Substance.code, Substance.ingredient.substanceCodeableConcept</b><br> 1358 * </p> 1359 */ 1360 @SearchParamDefinition(name="code", path="Substance.code | (Substance.ingredient.substance as CodeableConcept)", description="The code of the substance or ingredient", type="token" ) 1361 public static final String SP_CODE = "code"; 1362 /** 1363 * <b>Fluent Client</b> search parameter constant for <b>code</b> 1364 * <p> 1365 * Description: <b>The code of the substance or ingredient</b><br> 1366 * Type: <b>token</b><br> 1367 * Path: <b>Substance.code, Substance.ingredient.substanceCodeableConcept</b><br> 1368 * </p> 1369 */ 1370 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 1371 1372 /** 1373 * Search parameter: <b>quantity</b> 1374 * <p> 1375 * Description: <b>Amount of substance in the package</b><br> 1376 * Type: <b>quantity</b><br> 1377 * Path: <b>Substance.instance.quantity</b><br> 1378 * </p> 1379 */ 1380 @SearchParamDefinition(name="quantity", path="Substance.instance.quantity", description="Amount of substance in the package", type="quantity" ) 1381 public static final String SP_QUANTITY = "quantity"; 1382 /** 1383 * <b>Fluent Client</b> search parameter constant for <b>quantity</b> 1384 * <p> 1385 * Description: <b>Amount of substance in the package</b><br> 1386 * Type: <b>quantity</b><br> 1387 * Path: <b>Substance.instance.quantity</b><br> 1388 * </p> 1389 */ 1390 public static final ca.uhn.fhir.rest.gclient.QuantityClientParam QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_QUANTITY); 1391 1392 /** 1393 * Search parameter: <b>substance-reference</b> 1394 * <p> 1395 * Description: <b>A component of the substance</b><br> 1396 * Type: <b>reference</b><br> 1397 * Path: <b>Substance.ingredient.substanceReference</b><br> 1398 * </p> 1399 */ 1400 @SearchParamDefinition(name="substance-reference", path="(Substance.ingredient.substance as Reference)", description="A component of the substance", type="reference", target={Substance.class } ) 1401 public static final String SP_SUBSTANCE_REFERENCE = "substance-reference"; 1402 /** 1403 * <b>Fluent Client</b> search parameter constant for <b>substance-reference</b> 1404 * <p> 1405 * Description: <b>A component of the substance</b><br> 1406 * Type: <b>reference</b><br> 1407 * Path: <b>Substance.ingredient.substanceReference</b><br> 1408 * </p> 1409 */ 1410 public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSTANCE_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSTANCE_REFERENCE); 1411 1412/** 1413 * Constant for fluent queries to be used to add include statements. Specifies 1414 * the path value of "<b>Substance:substance-reference</b>". 1415 */ 1416 public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSTANCE_REFERENCE = new ca.uhn.fhir.model.api.Include("Substance:substance-reference").toLocked(); 1417 1418 /** 1419 * Search parameter: <b>expiry</b> 1420 * <p> 1421 * Description: <b>Expiry date of package or container of substance</b><br> 1422 * Type: <b>date</b><br> 1423 * Path: <b>Substance.instance.expiry</b><br> 1424 * </p> 1425 */ 1426 @SearchParamDefinition(name="expiry", path="Substance.instance.expiry", description="Expiry date of package or container of substance", type="date" ) 1427 public static final String SP_EXPIRY = "expiry"; 1428 /** 1429 * <b>Fluent Client</b> search parameter constant for <b>expiry</b> 1430 * <p> 1431 * Description: <b>Expiry date of package or container of substance</b><br> 1432 * Type: <b>date</b><br> 1433 * Path: <b>Substance.instance.expiry</b><br> 1434 * </p> 1435 */ 1436 public static final ca.uhn.fhir.rest.gclient.DateClientParam EXPIRY = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EXPIRY); 1437 1438 /** 1439 * Search parameter: <b>category</b> 1440 * <p> 1441 * Description: <b>The category of the substance</b><br> 1442 * Type: <b>token</b><br> 1443 * Path: <b>Substance.category</b><br> 1444 * </p> 1445 */ 1446 @SearchParamDefinition(name="category", path="Substance.category", description="The category of the substance", type="token" ) 1447 public static final String SP_CATEGORY = "category"; 1448 /** 1449 * <b>Fluent Client</b> search parameter constant for <b>category</b> 1450 * <p> 1451 * Description: <b>The category of the substance</b><br> 1452 * Type: <b>token</b><br> 1453 * Path: <b>Substance.category</b><br> 1454 * </p> 1455 */ 1456 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY); 1457 1458 /** 1459 * Search parameter: <b>status</b> 1460 * <p> 1461 * Description: <b>active | inactive | entered-in-error</b><br> 1462 * Type: <b>token</b><br> 1463 * Path: <b>Substance.status</b><br> 1464 * </p> 1465 */ 1466 @SearchParamDefinition(name="status", path="Substance.status", description="active | inactive | entered-in-error", type="token" ) 1467 public static final String SP_STATUS = "status"; 1468 /** 1469 * <b>Fluent Client</b> search parameter constant for <b>status</b> 1470 * <p> 1471 * Description: <b>active | inactive | entered-in-error</b><br> 1472 * Type: <b>token</b><br> 1473 * Path: <b>Substance.status</b><br> 1474 * </p> 1475 */ 1476 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 1477 1478 1479}