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