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 void removeChild(String name, Base value) throws FHIRException {
333        if (name.equals("quantity")) {
334          this.quantity = null;
335        } else if (name.equals("substance[x]")) {
336          this.substance = null;
337        } else
338          super.removeChild(name, value);
339        
340      }
341
342      @Override
343      public Base makeProperty(int hash, String name) throws FHIRException {
344        switch (hash) {
345        case -1285004149:  return getQuantity();
346        case 2127194384:  return getSubstance();
347        case 530040176:  return getSubstance();
348        default: return super.makeProperty(hash, name);
349        }
350
351      }
352
353      @Override
354      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
355        switch (hash) {
356        case -1285004149: /*quantity*/ return new String[] {"Ratio"};
357        case 530040176: /*substance*/ return new String[] {"CodeableConcept", "Reference"};
358        default: return super.getTypesForProperty(hash, name);
359        }
360
361      }
362
363      @Override
364      public Base addChild(String name) throws FHIRException {
365        if (name.equals("quantity")) {
366          this.quantity = new Ratio();
367          return this.quantity;
368        }
369        else if (name.equals("substanceCodeableConcept")) {
370          this.substance = new CodeableConcept();
371          return this.substance;
372        }
373        else if (name.equals("substanceReference")) {
374          this.substance = new Reference();
375          return this.substance;
376        }
377        else
378          return super.addChild(name);
379      }
380
381      public SubstanceIngredientComponent copy() {
382        SubstanceIngredientComponent dst = new SubstanceIngredientComponent();
383        copyValues(dst);
384        return dst;
385      }
386
387      public void copyValues(SubstanceIngredientComponent dst) {
388        super.copyValues(dst);
389        dst.quantity = quantity == null ? null : quantity.copy();
390        dst.substance = substance == null ? null : substance.copy();
391      }
392
393      @Override
394      public boolean equalsDeep(Base other_) {
395        if (!super.equalsDeep(other_))
396          return false;
397        if (!(other_ instanceof SubstanceIngredientComponent))
398          return false;
399        SubstanceIngredientComponent o = (SubstanceIngredientComponent) other_;
400        return compareDeep(quantity, o.quantity, true) && compareDeep(substance, o.substance, true);
401      }
402
403      @Override
404      public boolean equalsShallow(Base other_) {
405        if (!super.equalsShallow(other_))
406          return false;
407        if (!(other_ instanceof SubstanceIngredientComponent))
408          return false;
409        SubstanceIngredientComponent o = (SubstanceIngredientComponent) other_;
410        return true;
411      }
412
413      public boolean isEmpty() {
414        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, substance);
415      }
416
417  public String fhirType() {
418    return "Substance.ingredient";
419
420  }
421
422  }
423
424    /**
425     * Unique identifier for the substance. For an instance, an identifier associated with the package/container (usually a label affixed directly).
426     */
427    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
428    @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)." )
429    protected List<Identifier> identifier;
430
431    /**
432     * A boolean to indicate if this an instance of a substance or a kind of one (a definition).
433     */
434    @Child(name = "instance", type = {BooleanType.class}, order=1, min=1, max=1, modifier=true, summary=true)
435    @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)." )
436    protected BooleanType instance;
437
438    /**
439     * A code to indicate if the substance is actively used.
440     */
441    @Child(name = "status", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true)
442    @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="A code to indicate if the substance is actively used." )
443    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-status")
444    protected Enumeration<FHIRSubstanceStatus> status;
445
446    /**
447     * A code that classifies the general type of substance.  This is used  for searching, sorting and display purposes.
448     */
449    @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
450    @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." )
451    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-category")
452    protected List<CodeableConcept> category;
453
454    /**
455     * A code (or set of codes) that identify this substance.
456     */
457    @Child(name = "code", type = {CodeableReference.class}, order=4, min=1, max=1, modifier=false, summary=true)
458    @Description(shortDefinition="What substance this is", formalDefinition="A code (or set of codes) that identify this substance." )
459    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/substance-code")
460    protected CodeableReference code;
461
462    /**
463     * A description of the substance - its appearance, handling requirements, and other usage notes.
464     */
465    @Child(name = "description", type = {MarkdownType.class}, order=5, min=0, max=1, modifier=false, summary=true)
466    @Description(shortDefinition="Textual description of the substance, comments", formalDefinition="A description of the substance - its appearance, handling requirements, and other usage notes." )
467    protected MarkdownType description;
468
469    /**
470     * When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.
471     */
472    @Child(name = "expiry", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
473    @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." )
474    protected DateTimeType expiry;
475
476    /**
477     * The amount of the substance.
478     */
479    @Child(name = "quantity", type = {Quantity.class}, order=7, min=0, max=1, modifier=false, summary=true)
480    @Description(shortDefinition="Amount of substance in the package", formalDefinition="The amount of the substance." )
481    protected Quantity quantity;
482
483    /**
484     * A substance can be composed of other substances.
485     */
486    @Child(name = "ingredient", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
487    @Description(shortDefinition="Composition information about the substance", formalDefinition="A substance can be composed of other substances." )
488    protected List<SubstanceIngredientComponent> ingredient;
489
490    private static final long serialVersionUID = -3119765L;
491
492  /**
493   * Constructor
494   */
495    public Substance() {
496      super();
497    }
498
499  /**
500   * Constructor
501   */
502    public Substance(boolean instance, CodeableReference code) {
503      super();
504      this.setInstance(instance);
505      this.setCode(code);
506    }
507
508    /**
509     * @return {@link #identifier} (Unique identifier for the substance. For an instance, an identifier associated with the package/container (usually a label affixed directly).)
510     */
511    public List<Identifier> getIdentifier() { 
512      if (this.identifier == null)
513        this.identifier = new ArrayList<Identifier>();
514      return this.identifier;
515    }
516
517    /**
518     * @return Returns a reference to <code>this</code> for easy method chaining
519     */
520    public Substance setIdentifier(List<Identifier> theIdentifier) { 
521      this.identifier = theIdentifier;
522      return this;
523    }
524
525    public boolean hasIdentifier() { 
526      if (this.identifier == null)
527        return false;
528      for (Identifier item : this.identifier)
529        if (!item.isEmpty())
530          return true;
531      return false;
532    }
533
534    public Identifier addIdentifier() { //3
535      Identifier t = new Identifier();
536      if (this.identifier == null)
537        this.identifier = new ArrayList<Identifier>();
538      this.identifier.add(t);
539      return t;
540    }
541
542    public Substance addIdentifier(Identifier t) { //3
543      if (t == null)
544        return this;
545      if (this.identifier == null)
546        this.identifier = new ArrayList<Identifier>();
547      this.identifier.add(t);
548      return this;
549    }
550
551    /**
552     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
553     */
554    public Identifier getIdentifierFirstRep() { 
555      if (getIdentifier().isEmpty()) {
556        addIdentifier();
557      }
558      return getIdentifier().get(0);
559    }
560
561    /**
562     * @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
563     */
564    public BooleanType getInstanceElement() { 
565      if (this.instance == null)
566        if (Configuration.errorOnAutoCreate())
567          throw new Error("Attempt to auto-create Substance.instance");
568        else if (Configuration.doAutoCreate())
569          this.instance = new BooleanType(); // bb
570      return this.instance;
571    }
572
573    public boolean hasInstanceElement() { 
574      return this.instance != null && !this.instance.isEmpty();
575    }
576
577    public boolean hasInstance() { 
578      return this.instance != null && !this.instance.isEmpty();
579    }
580
581    /**
582     * @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
583     */
584    public Substance setInstanceElement(BooleanType value) { 
585      this.instance = value;
586      return this;
587    }
588
589    /**
590     * @return A boolean to indicate if this an instance of a substance or a kind of one (a definition).
591     */
592    public boolean getInstance() { 
593      return this.instance == null || this.instance.isEmpty() ? false : this.instance.getValue();
594    }
595
596    /**
597     * @param value A boolean to indicate if this an instance of a substance or a kind of one (a definition).
598     */
599    public Substance setInstance(boolean value) { 
600        if (this.instance == null)
601          this.instance = new BooleanType();
602        this.instance.setValue(value);
603      return this;
604    }
605
606    /**
607     * @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
608     */
609    public Enumeration<FHIRSubstanceStatus> getStatusElement() { 
610      if (this.status == null)
611        if (Configuration.errorOnAutoCreate())
612          throw new Error("Attempt to auto-create Substance.status");
613        else if (Configuration.doAutoCreate())
614          this.status = new Enumeration<FHIRSubstanceStatus>(new FHIRSubstanceStatusEnumFactory()); // bb
615      return this.status;
616    }
617
618    public boolean hasStatusElement() { 
619      return this.status != null && !this.status.isEmpty();
620    }
621
622    public boolean hasStatus() { 
623      return this.status != null && !this.status.isEmpty();
624    }
625
626    /**
627     * @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
628     */
629    public Substance setStatusElement(Enumeration<FHIRSubstanceStatus> value) { 
630      this.status = value;
631      return this;
632    }
633
634    /**
635     * @return A code to indicate if the substance is actively used.
636     */
637    public FHIRSubstanceStatus getStatus() { 
638      return this.status == null ? null : this.status.getValue();
639    }
640
641    /**
642     * @param value A code to indicate if the substance is actively used.
643     */
644    public Substance setStatus(FHIRSubstanceStatus value) { 
645      if (value == null)
646        this.status = null;
647      else {
648        if (this.status == null)
649          this.status = new Enumeration<FHIRSubstanceStatus>(new FHIRSubstanceStatusEnumFactory());
650        this.status.setValue(value);
651      }
652      return this;
653    }
654
655    /**
656     * @return {@link #category} (A code that classifies the general type of substance.  This is used  for searching, sorting and display purposes.)
657     */
658    public List<CodeableConcept> getCategory() { 
659      if (this.category == null)
660        this.category = new ArrayList<CodeableConcept>();
661      return this.category;
662    }
663
664    /**
665     * @return Returns a reference to <code>this</code> for easy method chaining
666     */
667    public Substance setCategory(List<CodeableConcept> theCategory) { 
668      this.category = theCategory;
669      return this;
670    }
671
672    public boolean hasCategory() { 
673      if (this.category == null)
674        return false;
675      for (CodeableConcept item : this.category)
676        if (!item.isEmpty())
677          return true;
678      return false;
679    }
680
681    public CodeableConcept addCategory() { //3
682      CodeableConcept t = new CodeableConcept();
683      if (this.category == null)
684        this.category = new ArrayList<CodeableConcept>();
685      this.category.add(t);
686      return t;
687    }
688
689    public Substance addCategory(CodeableConcept t) { //3
690      if (t == null)
691        return this;
692      if (this.category == null)
693        this.category = new ArrayList<CodeableConcept>();
694      this.category.add(t);
695      return this;
696    }
697
698    /**
699     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
700     */
701    public CodeableConcept getCategoryFirstRep() { 
702      if (getCategory().isEmpty()) {
703        addCategory();
704      }
705      return getCategory().get(0);
706    }
707
708    /**
709     * @return {@link #code} (A code (or set of codes) that identify this substance.)
710     */
711    public CodeableReference getCode() { 
712      if (this.code == null)
713        if (Configuration.errorOnAutoCreate())
714          throw new Error("Attempt to auto-create Substance.code");
715        else if (Configuration.doAutoCreate())
716          this.code = new CodeableReference(); // cc
717      return this.code;
718    }
719
720    public boolean hasCode() { 
721      return this.code != null && !this.code.isEmpty();
722    }
723
724    /**
725     * @param value {@link #code} (A code (or set of codes) that identify this substance.)
726     */
727    public Substance setCode(CodeableReference value) { 
728      this.code = value;
729      return this;
730    }
731
732    /**
733     * @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
734     */
735    public MarkdownType getDescriptionElement() { 
736      if (this.description == null)
737        if (Configuration.errorOnAutoCreate())
738          throw new Error("Attempt to auto-create Substance.description");
739        else if (Configuration.doAutoCreate())
740          this.description = new MarkdownType(); // bb
741      return this.description;
742    }
743
744    public boolean hasDescriptionElement() { 
745      return this.description != null && !this.description.isEmpty();
746    }
747
748    public boolean hasDescription() { 
749      return this.description != null && !this.description.isEmpty();
750    }
751
752    /**
753     * @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
754     */
755    public Substance setDescriptionElement(MarkdownType value) { 
756      this.description = value;
757      return this;
758    }
759
760    /**
761     * @return A description of the substance - its appearance, handling requirements, and other usage notes.
762     */
763    public String getDescription() { 
764      return this.description == null ? null : this.description.getValue();
765    }
766
767    /**
768     * @param value A description of the substance - its appearance, handling requirements, and other usage notes.
769     */
770    public Substance setDescription(String value) { 
771      if (Utilities.noString(value))
772        this.description = null;
773      else {
774        if (this.description == null)
775          this.description = new MarkdownType();
776        this.description.setValue(value);
777      }
778      return this;
779    }
780
781    /**
782     * @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
783     */
784    public DateTimeType getExpiryElement() { 
785      if (this.expiry == null)
786        if (Configuration.errorOnAutoCreate())
787          throw new Error("Attempt to auto-create Substance.expiry");
788        else if (Configuration.doAutoCreate())
789          this.expiry = new DateTimeType(); // bb
790      return this.expiry;
791    }
792
793    public boolean hasExpiryElement() { 
794      return this.expiry != null && !this.expiry.isEmpty();
795    }
796
797    public boolean hasExpiry() { 
798      return this.expiry != null && !this.expiry.isEmpty();
799    }
800
801    /**
802     * @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
803     */
804    public Substance setExpiryElement(DateTimeType value) { 
805      this.expiry = value;
806      return this;
807    }
808
809    /**
810     * @return When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.
811     */
812    public Date getExpiry() { 
813      return this.expiry == null ? null : this.expiry.getValue();
814    }
815
816    /**
817     * @param value When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.
818     */
819    public Substance setExpiry(Date value) { 
820      if (value == null)
821        this.expiry = null;
822      else {
823        if (this.expiry == null)
824          this.expiry = new DateTimeType();
825        this.expiry.setValue(value);
826      }
827      return this;
828    }
829
830    /**
831     * @return {@link #quantity} (The amount of the substance.)
832     */
833    public Quantity getQuantity() { 
834      if (this.quantity == null)
835        if (Configuration.errorOnAutoCreate())
836          throw new Error("Attempt to auto-create Substance.quantity");
837        else if (Configuration.doAutoCreate())
838          this.quantity = new Quantity(); // cc
839      return this.quantity;
840    }
841
842    public boolean hasQuantity() { 
843      return this.quantity != null && !this.quantity.isEmpty();
844    }
845
846    /**
847     * @param value {@link #quantity} (The amount of the substance.)
848     */
849    public Substance setQuantity(Quantity value) { 
850      this.quantity = value;
851      return this;
852    }
853
854    /**
855     * @return {@link #ingredient} (A substance can be composed of other substances.)
856     */
857    public List<SubstanceIngredientComponent> getIngredient() { 
858      if (this.ingredient == null)
859        this.ingredient = new ArrayList<SubstanceIngredientComponent>();
860      return this.ingredient;
861    }
862
863    /**
864     * @return Returns a reference to <code>this</code> for easy method chaining
865     */
866    public Substance setIngredient(List<SubstanceIngredientComponent> theIngredient) { 
867      this.ingredient = theIngredient;
868      return this;
869    }
870
871    public boolean hasIngredient() { 
872      if (this.ingredient == null)
873        return false;
874      for (SubstanceIngredientComponent item : this.ingredient)
875        if (!item.isEmpty())
876          return true;
877      return false;
878    }
879
880    public SubstanceIngredientComponent addIngredient() { //3
881      SubstanceIngredientComponent t = new SubstanceIngredientComponent();
882      if (this.ingredient == null)
883        this.ingredient = new ArrayList<SubstanceIngredientComponent>();
884      this.ingredient.add(t);
885      return t;
886    }
887
888    public Substance addIngredient(SubstanceIngredientComponent t) { //3
889      if (t == null)
890        return this;
891      if (this.ingredient == null)
892        this.ingredient = new ArrayList<SubstanceIngredientComponent>();
893      this.ingredient.add(t);
894      return this;
895    }
896
897    /**
898     * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist {3}
899     */
900    public SubstanceIngredientComponent getIngredientFirstRep() { 
901      if (getIngredient().isEmpty()) {
902        addIngredient();
903      }
904      return getIngredient().get(0);
905    }
906
907      protected void listChildren(List<Property> children) {
908        super.listChildren(children);
909        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));
910        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));
911        children.add(new Property("status", "code", "A code to indicate if the substance is actively used.", 0, 1, status));
912        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));
913        children.add(new Property("code", "CodeableReference(SubstanceDefinition)", "A code (or set of codes) that identify this substance.", 0, 1, code));
914        children.add(new Property("description", "markdown", "A description of the substance - its appearance, handling requirements, and other usage notes.", 0, 1, description));
915        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));
916        children.add(new Property("quantity", "Quantity", "The amount of the substance.", 0, 1, quantity));
917        children.add(new Property("ingredient", "", "A substance can be composed of other substances.", 0, java.lang.Integer.MAX_VALUE, ingredient));
918      }
919
920      @Override
921      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
922        switch (_hash) {
923        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);
924        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);
925        case -892481550: /*status*/  return new Property("status", "code", "A code to indicate if the substance is actively used.", 0, 1, status);
926        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);
927        case 3059181: /*code*/  return new Property("code", "CodeableReference(SubstanceDefinition)", "A code (or set of codes) that identify this substance.", 0, 1, code);
928        case -1724546052: /*description*/  return new Property("description", "markdown", "A description of the substance - its appearance, handling requirements, and other usage notes.", 0, 1, description);
929        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);
930        case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The amount of the substance.", 0, 1, quantity);
931        case -206409263: /*ingredient*/  return new Property("ingredient", "", "A substance can be composed of other substances.", 0, java.lang.Integer.MAX_VALUE, ingredient);
932        default: return super.getNamedProperty(_hash, _name, _checkValid);
933        }
934
935      }
936
937      @Override
938      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
939        switch (hash) {
940        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
941        case 555127957: /*instance*/ return this.instance == null ? new Base[0] : new Base[] {this.instance}; // BooleanType
942        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<FHIRSubstanceStatus>
943        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
944        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableReference
945        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
946        case -1289159373: /*expiry*/ return this.expiry == null ? new Base[0] : new Base[] {this.expiry}; // DateTimeType
947        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
948        case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // SubstanceIngredientComponent
949        default: return super.getProperty(hash, name, checkValid);
950        }
951
952      }
953
954      @Override
955      public Base setProperty(int hash, String name, Base value) throws FHIRException {
956        switch (hash) {
957        case -1618432855: // identifier
958          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
959          return value;
960        case 555127957: // instance
961          this.instance = TypeConvertor.castToBoolean(value); // BooleanType
962          return value;
963        case -892481550: // status
964          value = new FHIRSubstanceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
965          this.status = (Enumeration) value; // Enumeration<FHIRSubstanceStatus>
966          return value;
967        case 50511102: // category
968          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
969          return value;
970        case 3059181: // code
971          this.code = TypeConvertor.castToCodeableReference(value); // CodeableReference
972          return value;
973        case -1724546052: // description
974          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
975          return value;
976        case -1289159373: // expiry
977          this.expiry = TypeConvertor.castToDateTime(value); // DateTimeType
978          return value;
979        case -1285004149: // quantity
980          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
981          return value;
982        case -206409263: // ingredient
983          this.getIngredient().add((SubstanceIngredientComponent) value); // SubstanceIngredientComponent
984          return value;
985        default: return super.setProperty(hash, name, value);
986        }
987
988      }
989
990      @Override
991      public Base setProperty(String name, Base value) throws FHIRException {
992        if (name.equals("identifier")) {
993          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
994        } else if (name.equals("instance")) {
995          this.instance = TypeConvertor.castToBoolean(value); // BooleanType
996        } else if (name.equals("status")) {
997          value = new FHIRSubstanceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
998          this.status = (Enumeration) value; // Enumeration<FHIRSubstanceStatus>
999        } else if (name.equals("category")) {
1000          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
1001        } else if (name.equals("code")) {
1002          this.code = TypeConvertor.castToCodeableReference(value); // CodeableReference
1003        } else if (name.equals("description")) {
1004          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
1005        } else if (name.equals("expiry")) {
1006          this.expiry = TypeConvertor.castToDateTime(value); // DateTimeType
1007        } else if (name.equals("quantity")) {
1008          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1009        } else if (name.equals("ingredient")) {
1010          this.getIngredient().add((SubstanceIngredientComponent) value);
1011        } else
1012          return super.setProperty(name, value);
1013        return value;
1014      }
1015
1016  @Override
1017  public void removeChild(String name, Base value) throws FHIRException {
1018        if (name.equals("identifier")) {
1019          this.getIdentifier().remove(value);
1020        } else if (name.equals("instance")) {
1021          this.instance = null;
1022        } else if (name.equals("status")) {
1023          value = new FHIRSubstanceStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1024          this.status = (Enumeration) value; // Enumeration<FHIRSubstanceStatus>
1025        } else if (name.equals("category")) {
1026          this.getCategory().remove(value);
1027        } else if (name.equals("code")) {
1028          this.code = null;
1029        } else if (name.equals("description")) {
1030          this.description = null;
1031        } else if (name.equals("expiry")) {
1032          this.expiry = null;
1033        } else if (name.equals("quantity")) {
1034          this.quantity = null;
1035        } else if (name.equals("ingredient")) {
1036          this.getIngredient().remove((SubstanceIngredientComponent) value);
1037        } else
1038          super.removeChild(name, value);
1039        
1040      }
1041
1042      @Override
1043      public Base makeProperty(int hash, String name) throws FHIRException {
1044        switch (hash) {
1045        case -1618432855:  return addIdentifier(); 
1046        case 555127957:  return getInstanceElement();
1047        case -892481550:  return getStatusElement();
1048        case 50511102:  return addCategory(); 
1049        case 3059181:  return getCode();
1050        case -1724546052:  return getDescriptionElement();
1051        case -1289159373:  return getExpiryElement();
1052        case -1285004149:  return getQuantity();
1053        case -206409263:  return addIngredient(); 
1054        default: return super.makeProperty(hash, name);
1055        }
1056
1057      }
1058
1059      @Override
1060      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1061        switch (hash) {
1062        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1063        case 555127957: /*instance*/ return new String[] {"boolean"};
1064        case -892481550: /*status*/ return new String[] {"code"};
1065        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
1066        case 3059181: /*code*/ return new String[] {"CodeableReference"};
1067        case -1724546052: /*description*/ return new String[] {"markdown"};
1068        case -1289159373: /*expiry*/ return new String[] {"dateTime"};
1069        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1070        case -206409263: /*ingredient*/ return new String[] {};
1071        default: return super.getTypesForProperty(hash, name);
1072        }
1073
1074      }
1075
1076      @Override
1077      public Base addChild(String name) throws FHIRException {
1078        if (name.equals("identifier")) {
1079          return addIdentifier();
1080        }
1081        else if (name.equals("instance")) {
1082          throw new FHIRException("Cannot call addChild on a singleton property Substance.instance");
1083        }
1084        else if (name.equals("status")) {
1085          throw new FHIRException("Cannot call addChild on a singleton property Substance.status");
1086        }
1087        else if (name.equals("category")) {
1088          return addCategory();
1089        }
1090        else if (name.equals("code")) {
1091          this.code = new CodeableReference();
1092          return this.code;
1093        }
1094        else if (name.equals("description")) {
1095          throw new FHIRException("Cannot call addChild on a singleton property Substance.description");
1096        }
1097        else if (name.equals("expiry")) {
1098          throw new FHIRException("Cannot call addChild on a singleton property Substance.expiry");
1099        }
1100        else if (name.equals("quantity")) {
1101          this.quantity = new Quantity();
1102          return this.quantity;
1103        }
1104        else if (name.equals("ingredient")) {
1105          return addIngredient();
1106        }
1107        else
1108          return super.addChild(name);
1109      }
1110
1111  public String fhirType() {
1112    return "Substance";
1113
1114  }
1115
1116      public Substance copy() {
1117        Substance dst = new Substance();
1118        copyValues(dst);
1119        return dst;
1120      }
1121
1122      public void copyValues(Substance dst) {
1123        super.copyValues(dst);
1124        if (identifier != null) {
1125          dst.identifier = new ArrayList<Identifier>();
1126          for (Identifier i : identifier)
1127            dst.identifier.add(i.copy());
1128        };
1129        dst.instance = instance == null ? null : instance.copy();
1130        dst.status = status == null ? null : status.copy();
1131        if (category != null) {
1132          dst.category = new ArrayList<CodeableConcept>();
1133          for (CodeableConcept i : category)
1134            dst.category.add(i.copy());
1135        };
1136        dst.code = code == null ? null : code.copy();
1137        dst.description = description == null ? null : description.copy();
1138        dst.expiry = expiry == null ? null : expiry.copy();
1139        dst.quantity = quantity == null ? null : quantity.copy();
1140        if (ingredient != null) {
1141          dst.ingredient = new ArrayList<SubstanceIngredientComponent>();
1142          for (SubstanceIngredientComponent i : ingredient)
1143            dst.ingredient.add(i.copy());
1144        };
1145      }
1146
1147      protected Substance typedCopy() {
1148        return copy();
1149      }
1150
1151      @Override
1152      public boolean equalsDeep(Base other_) {
1153        if (!super.equalsDeep(other_))
1154          return false;
1155        if (!(other_ instanceof Substance))
1156          return false;
1157        Substance o = (Substance) other_;
1158        return compareDeep(identifier, o.identifier, true) && compareDeep(instance, o.instance, true) && compareDeep(status, o.status, true)
1159           && compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(description, o.description, true)
1160           && compareDeep(expiry, o.expiry, true) && compareDeep(quantity, o.quantity, true) && compareDeep(ingredient, o.ingredient, true)
1161          ;
1162      }
1163
1164      @Override
1165      public boolean equalsShallow(Base other_) {
1166        if (!super.equalsShallow(other_))
1167          return false;
1168        if (!(other_ instanceof Substance))
1169          return false;
1170        Substance o = (Substance) other_;
1171        return compareValues(instance, o.instance, true) && compareValues(status, o.status, true) && compareValues(description, o.description, true)
1172           && compareValues(expiry, o.expiry, true);
1173      }
1174
1175      public boolean isEmpty() {
1176        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instance, status
1177          , category, code, description, expiry, quantity, ingredient);
1178      }
1179
1180  @Override
1181  public ResourceType getResourceType() {
1182    return ResourceType.Substance;
1183   }
1184
1185 /**
1186   * Search parameter: <b>category</b>
1187   * <p>
1188   * Description: <b>The category of the substance</b><br>
1189   * Type: <b>token</b><br>
1190   * Path: <b>Substance.category</b><br>
1191   * </p>
1192   */
1193  @SearchParamDefinition(name="category", path="Substance.category", description="The category of the substance", type="token" )
1194  public static final String SP_CATEGORY = "category";
1195 /**
1196   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1197   * <p>
1198   * Description: <b>The category of the substance</b><br>
1199   * Type: <b>token</b><br>
1200   * Path: <b>Substance.category</b><br>
1201   * </p>
1202   */
1203  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1204
1205 /**
1206   * Search parameter: <b>code-reference</b>
1207   * <p>
1208   * Description: <b>A reference to the defining substance</b><br>
1209   * Type: <b>reference</b><br>
1210   * Path: <b>Substance.code.reference</b><br>
1211   * </p>
1212   */
1213  @SearchParamDefinition(name="code-reference", path="Substance.code.reference", description="A reference to the defining substance", type="reference", target={SubstanceDefinition.class } )
1214  public static final String SP_CODE_REFERENCE = "code-reference";
1215 /**
1216   * <b>Fluent Client</b> search parameter constant for <b>code-reference</b>
1217   * <p>
1218   * Description: <b>A reference to the defining substance</b><br>
1219   * Type: <b>reference</b><br>
1220   * Path: <b>Substance.code.reference</b><br>
1221   * </p>
1222   */
1223  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CODE_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CODE_REFERENCE);
1224
1225/**
1226   * Constant for fluent queries to be used to add include statements. Specifies
1227   * the path value of "<b>Substance:code-reference</b>".
1228   */
1229  public static final ca.uhn.fhir.model.api.Include INCLUDE_CODE_REFERENCE = new ca.uhn.fhir.model.api.Include("Substance:code-reference").toLocked();
1230
1231 /**
1232   * Search parameter: <b>code</b>
1233   * <p>
1234   * Description: <b>The code of the substance or ingredient</b><br>
1235   * Type: <b>token</b><br>
1236   * Path: <b>Substance.code.concept | (Substance.ingredient.substance.ofType(CodeableConcept))</b><br>
1237   * </p>
1238   */
1239  @SearchParamDefinition(name="code", path="Substance.code.concept | (Substance.ingredient.substance.ofType(CodeableConcept))", description="The code of the substance or ingredient", type="token" )
1240  public static final String SP_CODE = "code";
1241 /**
1242   * <b>Fluent Client</b> search parameter constant for <b>code</b>
1243   * <p>
1244   * Description: <b>The code of the substance or ingredient</b><br>
1245   * Type: <b>token</b><br>
1246   * Path: <b>Substance.code.concept | (Substance.ingredient.substance.ofType(CodeableConcept))</b><br>
1247   * </p>
1248   */
1249  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
1250
1251 /**
1252   * Search parameter: <b>expiry</b>
1253   * <p>
1254   * Description: <b>Expiry date of package or container of substance</b><br>
1255   * Type: <b>date</b><br>
1256   * Path: <b>Substance.expiry</b><br>
1257   * </p>
1258   */
1259  @SearchParamDefinition(name="expiry", path="Substance.expiry", description="Expiry date of package or container of substance", type="date" )
1260  public static final String SP_EXPIRY = "expiry";
1261 /**
1262   * <b>Fluent Client</b> search parameter constant for <b>expiry</b>
1263   * <p>
1264   * Description: <b>Expiry date of package or container of substance</b><br>
1265   * Type: <b>date</b><br>
1266   * Path: <b>Substance.expiry</b><br>
1267   * </p>
1268   */
1269  public static final ca.uhn.fhir.rest.gclient.DateClientParam EXPIRY = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_EXPIRY);
1270
1271 /**
1272   * Search parameter: <b>identifier</b>
1273   * <p>
1274   * Description: <b>Unique identifier for the substance</b><br>
1275   * Type: <b>token</b><br>
1276   * Path: <b>Substance.identifier</b><br>
1277   * </p>
1278   */
1279  @SearchParamDefinition(name="identifier", path="Substance.identifier", description="Unique identifier for the substance", type="token" )
1280  public static final String SP_IDENTIFIER = "identifier";
1281 /**
1282   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1283   * <p>
1284   * Description: <b>Unique identifier for the substance</b><br>
1285   * Type: <b>token</b><br>
1286   * Path: <b>Substance.identifier</b><br>
1287   * </p>
1288   */
1289  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1290
1291 /**
1292   * Search parameter: <b>quantity</b>
1293   * <p>
1294   * Description: <b>Amount of substance in the package</b><br>
1295   * Type: <b>quantity</b><br>
1296   * Path: <b>Substance.quantity</b><br>
1297   * </p>
1298   */
1299  @SearchParamDefinition(name="quantity", path="Substance.quantity", description="Amount of substance in the package", type="quantity" )
1300  public static final String SP_QUANTITY = "quantity";
1301 /**
1302   * <b>Fluent Client</b> search parameter constant for <b>quantity</b>
1303   * <p>
1304   * Description: <b>Amount of substance in the package</b><br>
1305   * Type: <b>quantity</b><br>
1306   * Path: <b>Substance.quantity</b><br>
1307   * </p>
1308   */
1309  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam QUANTITY = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_QUANTITY);
1310
1311 /**
1312   * Search parameter: <b>status</b>
1313   * <p>
1314   * Description: <b>active | inactive | entered-in-error</b><br>
1315   * Type: <b>token</b><br>
1316   * Path: <b>Substance.status</b><br>
1317   * </p>
1318   */
1319  @SearchParamDefinition(name="status", path="Substance.status", description="active | inactive | entered-in-error", type="token" )
1320  public static final String SP_STATUS = "status";
1321 /**
1322   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1323   * <p>
1324   * Description: <b>active | inactive | entered-in-error</b><br>
1325   * Type: <b>token</b><br>
1326   * Path: <b>Substance.status</b><br>
1327   * </p>
1328   */
1329  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1330
1331 /**
1332   * Search parameter: <b>substance-reference</b>
1333   * <p>
1334   * Description: <b>A component of the substance</b><br>
1335   * Type: <b>reference</b><br>
1336   * Path: <b>(Substance.ingredient.substance.ofType(Reference))</b><br>
1337   * </p>
1338   */
1339  @SearchParamDefinition(name="substance-reference", path="(Substance.ingredient.substance.ofType(Reference))", description="A component of the substance", type="reference", target={Substance.class } )
1340  public static final String SP_SUBSTANCE_REFERENCE = "substance-reference";
1341 /**
1342   * <b>Fluent Client</b> search parameter constant for <b>substance-reference</b>
1343   * <p>
1344   * Description: <b>A component of the substance</b><br>
1345   * Type: <b>reference</b><br>
1346   * Path: <b>(Substance.ingredient.substance.ofType(Reference))</b><br>
1347   * </p>
1348   */
1349  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBSTANCE_REFERENCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBSTANCE_REFERENCE);
1350
1351/**
1352   * Constant for fluent queries to be used to add include statements. Specifies
1353   * the path value of "<b>Substance:substance-reference</b>".
1354   */
1355  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBSTANCE_REFERENCE = new ca.uhn.fhir.model.api.Include("Substance:substance-reference").toLocked();
1356
1357
1358}
1359