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