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