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