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