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