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 Sat, Nov 5, 2022 10:47+1100 for FHIR v5.0.0-ballot
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 request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.
052 */
053@ResourceDef(name="NutritionOrder", profile="http://hl7.org/fhir/StructureDefinition/NutritionOrder")
054public class NutritionOrder extends DomainResource {
055
056    @Block()
057    public static class NutritionOrderOralDietComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.
060         */
061        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
062        @Description(shortDefinition="Type of oral diet or diet restrictions that describe what can be consumed orally", formalDefinition="The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet." )
063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/diet-type")
064        protected List<CodeableConcept> type;
065
066        /**
067         * Schedule information for an oral diet.
068         */
069        @Child(name = "schedule", type = {}, order=2, min=0, max=1, modifier=false, summary=false)
070        @Description(shortDefinition="Scheduling information for oral diets", formalDefinition="Schedule information for an oral diet." )
071        protected NutritionOrderOralDietScheduleComponent schedule;
072
073        /**
074         * Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.
075         */
076        @Child(name = "nutrient", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
077        @Description(shortDefinition="Required  nutrient modifications", formalDefinition="Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet." )
078        protected List<NutritionOrderOralDietNutrientComponent> nutrient;
079
080        /**
081         * Class that describes any texture modifications required for the patient to safely consume various types of solid foods.
082         */
083        @Child(name = "texture", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
084        @Description(shortDefinition="Required  texture modifications", formalDefinition="Class that describes any texture modifications required for the patient to safely consume various types of solid foods." )
085        protected List<NutritionOrderOralDietTextureComponent> texture;
086
087        /**
088         * The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.
089         */
090        @Child(name = "fluidConsistencyType", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
091        @Description(shortDefinition="The required consistency of fluids and liquids provided to the patient", formalDefinition="The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient." )
092        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consistency-type")
093        protected List<CodeableConcept> fluidConsistencyType;
094
095        /**
096         * Free text or additional instructions or information pertaining to the oral diet.
097         */
098        @Child(name = "instruction", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
099        @Description(shortDefinition="Instructions or additional information about the oral diet", formalDefinition="Free text or additional instructions or information pertaining to the oral diet." )
100        protected StringType instruction;
101
102        private static final long serialVersionUID = 997920978L;
103
104    /**
105     * Constructor
106     */
107      public NutritionOrderOralDietComponent() {
108        super();
109      }
110
111        /**
112         * @return {@link #type} (The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.)
113         */
114        public List<CodeableConcept> getType() { 
115          if (this.type == null)
116            this.type = new ArrayList<CodeableConcept>();
117          return this.type;
118        }
119
120        /**
121         * @return Returns a reference to <code>this</code> for easy method chaining
122         */
123        public NutritionOrderOralDietComponent setType(List<CodeableConcept> theType) { 
124          this.type = theType;
125          return this;
126        }
127
128        public boolean hasType() { 
129          if (this.type == null)
130            return false;
131          for (CodeableConcept item : this.type)
132            if (!item.isEmpty())
133              return true;
134          return false;
135        }
136
137        public CodeableConcept addType() { //3
138          CodeableConcept t = new CodeableConcept();
139          if (this.type == null)
140            this.type = new ArrayList<CodeableConcept>();
141          this.type.add(t);
142          return t;
143        }
144
145        public NutritionOrderOralDietComponent addType(CodeableConcept t) { //3
146          if (t == null)
147            return this;
148          if (this.type == null)
149            this.type = new ArrayList<CodeableConcept>();
150          this.type.add(t);
151          return this;
152        }
153
154        /**
155         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
156         */
157        public CodeableConcept getTypeFirstRep() { 
158          if (getType().isEmpty()) {
159            addType();
160          }
161          return getType().get(0);
162        }
163
164        /**
165         * @return {@link #schedule} (Schedule information for an oral diet.)
166         */
167        public NutritionOrderOralDietScheduleComponent getSchedule() { 
168          if (this.schedule == null)
169            if (Configuration.errorOnAutoCreate())
170              throw new Error("Attempt to auto-create NutritionOrderOralDietComponent.schedule");
171            else if (Configuration.doAutoCreate())
172              this.schedule = new NutritionOrderOralDietScheduleComponent(); // cc
173          return this.schedule;
174        }
175
176        public boolean hasSchedule() { 
177          return this.schedule != null && !this.schedule.isEmpty();
178        }
179
180        /**
181         * @param value {@link #schedule} (Schedule information for an oral diet.)
182         */
183        public NutritionOrderOralDietComponent setSchedule(NutritionOrderOralDietScheduleComponent value) { 
184          this.schedule = value;
185          return this;
186        }
187
188        /**
189         * @return {@link #nutrient} (Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.)
190         */
191        public List<NutritionOrderOralDietNutrientComponent> getNutrient() { 
192          if (this.nutrient == null)
193            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
194          return this.nutrient;
195        }
196
197        /**
198         * @return Returns a reference to <code>this</code> for easy method chaining
199         */
200        public NutritionOrderOralDietComponent setNutrient(List<NutritionOrderOralDietNutrientComponent> theNutrient) { 
201          this.nutrient = theNutrient;
202          return this;
203        }
204
205        public boolean hasNutrient() { 
206          if (this.nutrient == null)
207            return false;
208          for (NutritionOrderOralDietNutrientComponent item : this.nutrient)
209            if (!item.isEmpty())
210              return true;
211          return false;
212        }
213
214        public NutritionOrderOralDietNutrientComponent addNutrient() { //3
215          NutritionOrderOralDietNutrientComponent t = new NutritionOrderOralDietNutrientComponent();
216          if (this.nutrient == null)
217            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
218          this.nutrient.add(t);
219          return t;
220        }
221
222        public NutritionOrderOralDietComponent addNutrient(NutritionOrderOralDietNutrientComponent t) { //3
223          if (t == null)
224            return this;
225          if (this.nutrient == null)
226            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
227          this.nutrient.add(t);
228          return this;
229        }
230
231        /**
232         * @return The first repetition of repeating field {@link #nutrient}, creating it if it does not already exist {3}
233         */
234        public NutritionOrderOralDietNutrientComponent getNutrientFirstRep() { 
235          if (getNutrient().isEmpty()) {
236            addNutrient();
237          }
238          return getNutrient().get(0);
239        }
240
241        /**
242         * @return {@link #texture} (Class that describes any texture modifications required for the patient to safely consume various types of solid foods.)
243         */
244        public List<NutritionOrderOralDietTextureComponent> getTexture() { 
245          if (this.texture == null)
246            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
247          return this.texture;
248        }
249
250        /**
251         * @return Returns a reference to <code>this</code> for easy method chaining
252         */
253        public NutritionOrderOralDietComponent setTexture(List<NutritionOrderOralDietTextureComponent> theTexture) { 
254          this.texture = theTexture;
255          return this;
256        }
257
258        public boolean hasTexture() { 
259          if (this.texture == null)
260            return false;
261          for (NutritionOrderOralDietTextureComponent item : this.texture)
262            if (!item.isEmpty())
263              return true;
264          return false;
265        }
266
267        public NutritionOrderOralDietTextureComponent addTexture() { //3
268          NutritionOrderOralDietTextureComponent t = new NutritionOrderOralDietTextureComponent();
269          if (this.texture == null)
270            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
271          this.texture.add(t);
272          return t;
273        }
274
275        public NutritionOrderOralDietComponent addTexture(NutritionOrderOralDietTextureComponent t) { //3
276          if (t == null)
277            return this;
278          if (this.texture == null)
279            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
280          this.texture.add(t);
281          return this;
282        }
283
284        /**
285         * @return The first repetition of repeating field {@link #texture}, creating it if it does not already exist {3}
286         */
287        public NutritionOrderOralDietTextureComponent getTextureFirstRep() { 
288          if (getTexture().isEmpty()) {
289            addTexture();
290          }
291          return getTexture().get(0);
292        }
293
294        /**
295         * @return {@link #fluidConsistencyType} (The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.)
296         */
297        public List<CodeableConcept> getFluidConsistencyType() { 
298          if (this.fluidConsistencyType == null)
299            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
300          return this.fluidConsistencyType;
301        }
302
303        /**
304         * @return Returns a reference to <code>this</code> for easy method chaining
305         */
306        public NutritionOrderOralDietComponent setFluidConsistencyType(List<CodeableConcept> theFluidConsistencyType) { 
307          this.fluidConsistencyType = theFluidConsistencyType;
308          return this;
309        }
310
311        public boolean hasFluidConsistencyType() { 
312          if (this.fluidConsistencyType == null)
313            return false;
314          for (CodeableConcept item : this.fluidConsistencyType)
315            if (!item.isEmpty())
316              return true;
317          return false;
318        }
319
320        public CodeableConcept addFluidConsistencyType() { //3
321          CodeableConcept t = new CodeableConcept();
322          if (this.fluidConsistencyType == null)
323            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
324          this.fluidConsistencyType.add(t);
325          return t;
326        }
327
328        public NutritionOrderOralDietComponent addFluidConsistencyType(CodeableConcept t) { //3
329          if (t == null)
330            return this;
331          if (this.fluidConsistencyType == null)
332            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
333          this.fluidConsistencyType.add(t);
334          return this;
335        }
336
337        /**
338         * @return The first repetition of repeating field {@link #fluidConsistencyType}, creating it if it does not already exist {3}
339         */
340        public CodeableConcept getFluidConsistencyTypeFirstRep() { 
341          if (getFluidConsistencyType().isEmpty()) {
342            addFluidConsistencyType();
343          }
344          return getFluidConsistencyType().get(0);
345        }
346
347        /**
348         * @return {@link #instruction} (Free text or additional instructions or information pertaining to the oral diet.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
349         */
350        public StringType getInstructionElement() { 
351          if (this.instruction == null)
352            if (Configuration.errorOnAutoCreate())
353              throw new Error("Attempt to auto-create NutritionOrderOralDietComponent.instruction");
354            else if (Configuration.doAutoCreate())
355              this.instruction = new StringType(); // bb
356          return this.instruction;
357        }
358
359        public boolean hasInstructionElement() { 
360          return this.instruction != null && !this.instruction.isEmpty();
361        }
362
363        public boolean hasInstruction() { 
364          return this.instruction != null && !this.instruction.isEmpty();
365        }
366
367        /**
368         * @param value {@link #instruction} (Free text or additional instructions or information pertaining to the oral diet.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
369         */
370        public NutritionOrderOralDietComponent setInstructionElement(StringType value) { 
371          this.instruction = value;
372          return this;
373        }
374
375        /**
376         * @return Free text or additional instructions or information pertaining to the oral diet.
377         */
378        public String getInstruction() { 
379          return this.instruction == null ? null : this.instruction.getValue();
380        }
381
382        /**
383         * @param value Free text or additional instructions or information pertaining to the oral diet.
384         */
385        public NutritionOrderOralDietComponent setInstruction(String value) { 
386          if (Utilities.noString(value))
387            this.instruction = null;
388          else {
389            if (this.instruction == null)
390              this.instruction = new StringType();
391            this.instruction.setValue(value);
392          }
393          return this;
394        }
395
396        protected void listChildren(List<Property> children) {
397          super.listChildren(children);
398          children.add(new Property("type", "CodeableConcept", "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0, java.lang.Integer.MAX_VALUE, type));
399          children.add(new Property("schedule", "", "Schedule information for an oral diet.", 0, 1, schedule));
400          children.add(new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient));
401          children.add(new Property("texture", "", "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.", 0, java.lang.Integer.MAX_VALUE, texture));
402          children.add(new Property("fluidConsistencyType", "CodeableConcept", "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.", 0, java.lang.Integer.MAX_VALUE, fluidConsistencyType));
403          children.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction));
404        }
405
406        @Override
407        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
408          switch (_hash) {
409          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0, java.lang.Integer.MAX_VALUE, type);
410          case -697920873: /*schedule*/  return new Property("schedule", "", "Schedule information for an oral diet.", 0, 1, schedule);
411          case -1671151641: /*nutrient*/  return new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient);
412          case -1417816805: /*texture*/  return new Property("texture", "", "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.", 0, java.lang.Integer.MAX_VALUE, texture);
413          case -525105592: /*fluidConsistencyType*/  return new Property("fluidConsistencyType", "CodeableConcept", "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.", 0, java.lang.Integer.MAX_VALUE, fluidConsistencyType);
414          case 301526158: /*instruction*/  return new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction);
415          default: return super.getNamedProperty(_hash, _name, _checkValid);
416          }
417
418        }
419
420      @Override
421      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
422        switch (hash) {
423        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
424        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // NutritionOrderOralDietScheduleComponent
425        case -1671151641: /*nutrient*/ return this.nutrient == null ? new Base[0] : this.nutrient.toArray(new Base[this.nutrient.size()]); // NutritionOrderOralDietNutrientComponent
426        case -1417816805: /*texture*/ return this.texture == null ? new Base[0] : this.texture.toArray(new Base[this.texture.size()]); // NutritionOrderOralDietTextureComponent
427        case -525105592: /*fluidConsistencyType*/ return this.fluidConsistencyType == null ? new Base[0] : this.fluidConsistencyType.toArray(new Base[this.fluidConsistencyType.size()]); // CodeableConcept
428        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
429        default: return super.getProperty(hash, name, checkValid);
430        }
431
432      }
433
434      @Override
435      public Base setProperty(int hash, String name, Base value) throws FHIRException {
436        switch (hash) {
437        case 3575610: // type
438          this.getType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
439          return value;
440        case -697920873: // schedule
441          this.schedule = (NutritionOrderOralDietScheduleComponent) value; // NutritionOrderOralDietScheduleComponent
442          return value;
443        case -1671151641: // nutrient
444          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value); // NutritionOrderOralDietNutrientComponent
445          return value;
446        case -1417816805: // texture
447          this.getTexture().add((NutritionOrderOralDietTextureComponent) value); // NutritionOrderOralDietTextureComponent
448          return value;
449        case -525105592: // fluidConsistencyType
450          this.getFluidConsistencyType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
451          return value;
452        case 301526158: // instruction
453          this.instruction = TypeConvertor.castToString(value); // StringType
454          return value;
455        default: return super.setProperty(hash, name, value);
456        }
457
458      }
459
460      @Override
461      public Base setProperty(String name, Base value) throws FHIRException {
462        if (name.equals("type")) {
463          this.getType().add(TypeConvertor.castToCodeableConcept(value));
464        } else if (name.equals("schedule")) {
465          this.schedule = (NutritionOrderOralDietScheduleComponent) value; // NutritionOrderOralDietScheduleComponent
466        } else if (name.equals("nutrient")) {
467          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value);
468        } else if (name.equals("texture")) {
469          this.getTexture().add((NutritionOrderOralDietTextureComponent) value);
470        } else if (name.equals("fluidConsistencyType")) {
471          this.getFluidConsistencyType().add(TypeConvertor.castToCodeableConcept(value));
472        } else if (name.equals("instruction")) {
473          this.instruction = TypeConvertor.castToString(value); // StringType
474        } else
475          return super.setProperty(name, value);
476        return value;
477      }
478
479      @Override
480      public Base makeProperty(int hash, String name) throws FHIRException {
481        switch (hash) {
482        case 3575610:  return addType(); 
483        case -697920873:  return getSchedule();
484        case -1671151641:  return addNutrient(); 
485        case -1417816805:  return addTexture(); 
486        case -525105592:  return addFluidConsistencyType(); 
487        case 301526158:  return getInstructionElement();
488        default: return super.makeProperty(hash, name);
489        }
490
491      }
492
493      @Override
494      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
495        switch (hash) {
496        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
497        case -697920873: /*schedule*/ return new String[] {};
498        case -1671151641: /*nutrient*/ return new String[] {};
499        case -1417816805: /*texture*/ return new String[] {};
500        case -525105592: /*fluidConsistencyType*/ return new String[] {"CodeableConcept"};
501        case 301526158: /*instruction*/ return new String[] {"string"};
502        default: return super.getTypesForProperty(hash, name);
503        }
504
505      }
506
507      @Override
508      public Base addChild(String name) throws FHIRException {
509        if (name.equals("type")) {
510          return addType();
511        }
512        else if (name.equals("schedule")) {
513          this.schedule = new NutritionOrderOralDietScheduleComponent();
514          return this.schedule;
515        }
516        else if (name.equals("nutrient")) {
517          return addNutrient();
518        }
519        else if (name.equals("texture")) {
520          return addTexture();
521        }
522        else if (name.equals("fluidConsistencyType")) {
523          return addFluidConsistencyType();
524        }
525        else if (name.equals("instruction")) {
526          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.oralDiet.instruction");
527        }
528        else
529          return super.addChild(name);
530      }
531
532      public NutritionOrderOralDietComponent copy() {
533        NutritionOrderOralDietComponent dst = new NutritionOrderOralDietComponent();
534        copyValues(dst);
535        return dst;
536      }
537
538      public void copyValues(NutritionOrderOralDietComponent dst) {
539        super.copyValues(dst);
540        if (type != null) {
541          dst.type = new ArrayList<CodeableConcept>();
542          for (CodeableConcept i : type)
543            dst.type.add(i.copy());
544        };
545        dst.schedule = schedule == null ? null : schedule.copy();
546        if (nutrient != null) {
547          dst.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
548          for (NutritionOrderOralDietNutrientComponent i : nutrient)
549            dst.nutrient.add(i.copy());
550        };
551        if (texture != null) {
552          dst.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
553          for (NutritionOrderOralDietTextureComponent i : texture)
554            dst.texture.add(i.copy());
555        };
556        if (fluidConsistencyType != null) {
557          dst.fluidConsistencyType = new ArrayList<CodeableConcept>();
558          for (CodeableConcept i : fluidConsistencyType)
559            dst.fluidConsistencyType.add(i.copy());
560        };
561        dst.instruction = instruction == null ? null : instruction.copy();
562      }
563
564      @Override
565      public boolean equalsDeep(Base other_) {
566        if (!super.equalsDeep(other_))
567          return false;
568        if (!(other_ instanceof NutritionOrderOralDietComponent))
569          return false;
570        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
571        return compareDeep(type, o.type, true) && compareDeep(schedule, o.schedule, true) && compareDeep(nutrient, o.nutrient, true)
572           && compareDeep(texture, o.texture, true) && compareDeep(fluidConsistencyType, o.fluidConsistencyType, true)
573           && compareDeep(instruction, o.instruction, true);
574      }
575
576      @Override
577      public boolean equalsShallow(Base other_) {
578        if (!super.equalsShallow(other_))
579          return false;
580        if (!(other_ instanceof NutritionOrderOralDietComponent))
581          return false;
582        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
583        return compareValues(instruction, o.instruction, true);
584      }
585
586      public boolean isEmpty() {
587        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, schedule, nutrient
588          , texture, fluidConsistencyType, instruction);
589      }
590
591  public String fhirType() {
592    return "NutritionOrder.oralDiet";
593
594  }
595
596  }
597
598    @Block()
599    public static class NutritionOrderOralDietScheduleComponent extends BackboneElement implements IBaseBackboneElement {
600        /**
601         * The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.
602         */
603        @Child(name = "timing", type = {Timing.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
604        @Description(shortDefinition="Scheduled frequency of diet", formalDefinition="The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present." )
605        protected List<Timing> timing;
606
607        /**
608         * Indicates whether the product is only taken when needed within a specific dosing schedule.
609         */
610        @Child(name = "asNeeded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
611        @Description(shortDefinition="Take 'as needed'", formalDefinition="Indicates whether the product is only taken when needed within a specific dosing schedule." )
612        protected BooleanType asNeeded;
613
614        /**
615         * Indicates whether the product is only taken based on a precondition for taking the product.
616         */
617        @Child(name = "asNeededFor", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
618        @Description(shortDefinition="Take 'as needed' for x", formalDefinition="Indicates whether the product is only taken based on a precondition for taking the product." )
619        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-as-needed-reason")
620        protected CodeableConcept asNeededFor;
621
622        private static final long serialVersionUID = -1051458478L;
623
624    /**
625     * Constructor
626     */
627      public NutritionOrderOralDietScheduleComponent() {
628        super();
629      }
630
631        /**
632         * @return {@link #timing} (The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.)
633         */
634        public List<Timing> getTiming() { 
635          if (this.timing == null)
636            this.timing = new ArrayList<Timing>();
637          return this.timing;
638        }
639
640        /**
641         * @return Returns a reference to <code>this</code> for easy method chaining
642         */
643        public NutritionOrderOralDietScheduleComponent setTiming(List<Timing> theTiming) { 
644          this.timing = theTiming;
645          return this;
646        }
647
648        public boolean hasTiming() { 
649          if (this.timing == null)
650            return false;
651          for (Timing item : this.timing)
652            if (!item.isEmpty())
653              return true;
654          return false;
655        }
656
657        public Timing addTiming() { //3
658          Timing t = new Timing();
659          if (this.timing == null)
660            this.timing = new ArrayList<Timing>();
661          this.timing.add(t);
662          return t;
663        }
664
665        public NutritionOrderOralDietScheduleComponent addTiming(Timing t) { //3
666          if (t == null)
667            return this;
668          if (this.timing == null)
669            this.timing = new ArrayList<Timing>();
670          this.timing.add(t);
671          return this;
672        }
673
674        /**
675         * @return The first repetition of repeating field {@link #timing}, creating it if it does not already exist {3}
676         */
677        public Timing getTimingFirstRep() { 
678          if (getTiming().isEmpty()) {
679            addTiming();
680          }
681          return getTiming().get(0);
682        }
683
684        /**
685         * @return {@link #asNeeded} (Indicates whether the product is only taken when needed within a specific dosing schedule.). This is the underlying object with id, value and extensions. The accessor "getAsNeeded" gives direct access to the value
686         */
687        public BooleanType getAsNeededElement() { 
688          if (this.asNeeded == null)
689            if (Configuration.errorOnAutoCreate())
690              throw new Error("Attempt to auto-create NutritionOrderOralDietScheduleComponent.asNeeded");
691            else if (Configuration.doAutoCreate())
692              this.asNeeded = new BooleanType(); // bb
693          return this.asNeeded;
694        }
695
696        public boolean hasAsNeededElement() { 
697          return this.asNeeded != null && !this.asNeeded.isEmpty();
698        }
699
700        public boolean hasAsNeeded() { 
701          return this.asNeeded != null && !this.asNeeded.isEmpty();
702        }
703
704        /**
705         * @param value {@link #asNeeded} (Indicates whether the product is only taken when needed within a specific dosing schedule.). This is the underlying object with id, value and extensions. The accessor "getAsNeeded" gives direct access to the value
706         */
707        public NutritionOrderOralDietScheduleComponent setAsNeededElement(BooleanType value) { 
708          this.asNeeded = value;
709          return this;
710        }
711
712        /**
713         * @return Indicates whether the product is only taken when needed within a specific dosing schedule.
714         */
715        public boolean getAsNeeded() { 
716          return this.asNeeded == null || this.asNeeded.isEmpty() ? false : this.asNeeded.getValue();
717        }
718
719        /**
720         * @param value Indicates whether the product is only taken when needed within a specific dosing schedule.
721         */
722        public NutritionOrderOralDietScheduleComponent setAsNeeded(boolean value) { 
723            if (this.asNeeded == null)
724              this.asNeeded = new BooleanType();
725            this.asNeeded.setValue(value);
726          return this;
727        }
728
729        /**
730         * @return {@link #asNeededFor} (Indicates whether the product is only taken based on a precondition for taking the product.)
731         */
732        public CodeableConcept getAsNeededFor() { 
733          if (this.asNeededFor == null)
734            if (Configuration.errorOnAutoCreate())
735              throw new Error("Attempt to auto-create NutritionOrderOralDietScheduleComponent.asNeededFor");
736            else if (Configuration.doAutoCreate())
737              this.asNeededFor = new CodeableConcept(); // cc
738          return this.asNeededFor;
739        }
740
741        public boolean hasAsNeededFor() { 
742          return this.asNeededFor != null && !this.asNeededFor.isEmpty();
743        }
744
745        /**
746         * @param value {@link #asNeededFor} (Indicates whether the product is only taken based on a precondition for taking the product.)
747         */
748        public NutritionOrderOralDietScheduleComponent setAsNeededFor(CodeableConcept value) { 
749          this.asNeededFor = value;
750          return this;
751        }
752
753        protected void listChildren(List<Property> children) {
754          super.listChildren(children);
755          children.add(new Property("timing", "Timing", "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, timing));
756          children.add(new Property("asNeeded", "boolean", "Indicates whether the product is only taken when needed within a specific dosing schedule.", 0, 1, asNeeded));
757          children.add(new Property("asNeededFor", "CodeableConcept", "Indicates whether the product is only taken based on a precondition for taking the product.", 0, 1, asNeededFor));
758        }
759
760        @Override
761        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
762          switch (_hash) {
763          case -873664438: /*timing*/  return new Property("timing", "Timing", "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, timing);
764          case -1432923513: /*asNeeded*/  return new Property("asNeeded", "boolean", "Indicates whether the product is only taken when needed within a specific dosing schedule.", 0, 1, asNeeded);
765          case -544350014: /*asNeededFor*/  return new Property("asNeededFor", "CodeableConcept", "Indicates whether the product is only taken based on a precondition for taking the product.", 0, 1, asNeededFor);
766          default: return super.getNamedProperty(_hash, _name, _checkValid);
767          }
768
769        }
770
771      @Override
772      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
773        switch (hash) {
774        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : this.timing.toArray(new Base[this.timing.size()]); // Timing
775        case -1432923513: /*asNeeded*/ return this.asNeeded == null ? new Base[0] : new Base[] {this.asNeeded}; // BooleanType
776        case -544350014: /*asNeededFor*/ return this.asNeededFor == null ? new Base[0] : new Base[] {this.asNeededFor}; // CodeableConcept
777        default: return super.getProperty(hash, name, checkValid);
778        }
779
780      }
781
782      @Override
783      public Base setProperty(int hash, String name, Base value) throws FHIRException {
784        switch (hash) {
785        case -873664438: // timing
786          this.getTiming().add(TypeConvertor.castToTiming(value)); // Timing
787          return value;
788        case -1432923513: // asNeeded
789          this.asNeeded = TypeConvertor.castToBoolean(value); // BooleanType
790          return value;
791        case -544350014: // asNeededFor
792          this.asNeededFor = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
793          return value;
794        default: return super.setProperty(hash, name, value);
795        }
796
797      }
798
799      @Override
800      public Base setProperty(String name, Base value) throws FHIRException {
801        if (name.equals("timing")) {
802          this.getTiming().add(TypeConvertor.castToTiming(value));
803        } else if (name.equals("asNeeded")) {
804          this.asNeeded = TypeConvertor.castToBoolean(value); // BooleanType
805        } else if (name.equals("asNeededFor")) {
806          this.asNeededFor = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
807        } else
808          return super.setProperty(name, value);
809        return value;
810      }
811
812      @Override
813      public Base makeProperty(int hash, String name) throws FHIRException {
814        switch (hash) {
815        case -873664438:  return addTiming(); 
816        case -1432923513:  return getAsNeededElement();
817        case -544350014:  return getAsNeededFor();
818        default: return super.makeProperty(hash, name);
819        }
820
821      }
822
823      @Override
824      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
825        switch (hash) {
826        case -873664438: /*timing*/ return new String[] {"Timing"};
827        case -1432923513: /*asNeeded*/ return new String[] {"boolean"};
828        case -544350014: /*asNeededFor*/ return new String[] {"CodeableConcept"};
829        default: return super.getTypesForProperty(hash, name);
830        }
831
832      }
833
834      @Override
835      public Base addChild(String name) throws FHIRException {
836        if (name.equals("timing")) {
837          return addTiming();
838        }
839        else if (name.equals("asNeeded")) {
840          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.oralDiet.schedule.asNeeded");
841        }
842        else if (name.equals("asNeededFor")) {
843          this.asNeededFor = new CodeableConcept();
844          return this.asNeededFor;
845        }
846        else
847          return super.addChild(name);
848      }
849
850      public NutritionOrderOralDietScheduleComponent copy() {
851        NutritionOrderOralDietScheduleComponent dst = new NutritionOrderOralDietScheduleComponent();
852        copyValues(dst);
853        return dst;
854      }
855
856      public void copyValues(NutritionOrderOralDietScheduleComponent dst) {
857        super.copyValues(dst);
858        if (timing != null) {
859          dst.timing = new ArrayList<Timing>();
860          for (Timing i : timing)
861            dst.timing.add(i.copy());
862        };
863        dst.asNeeded = asNeeded == null ? null : asNeeded.copy();
864        dst.asNeededFor = asNeededFor == null ? null : asNeededFor.copy();
865      }
866
867      @Override
868      public boolean equalsDeep(Base other_) {
869        if (!super.equalsDeep(other_))
870          return false;
871        if (!(other_ instanceof NutritionOrderOralDietScheduleComponent))
872          return false;
873        NutritionOrderOralDietScheduleComponent o = (NutritionOrderOralDietScheduleComponent) other_;
874        return compareDeep(timing, o.timing, true) && compareDeep(asNeeded, o.asNeeded, true) && compareDeep(asNeededFor, o.asNeededFor, true)
875          ;
876      }
877
878      @Override
879      public boolean equalsShallow(Base other_) {
880        if (!super.equalsShallow(other_))
881          return false;
882        if (!(other_ instanceof NutritionOrderOralDietScheduleComponent))
883          return false;
884        NutritionOrderOralDietScheduleComponent o = (NutritionOrderOralDietScheduleComponent) other_;
885        return compareValues(asNeeded, o.asNeeded, true);
886      }
887
888      public boolean isEmpty() {
889        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(timing, asNeeded, asNeededFor
890          );
891      }
892
893  public String fhirType() {
894    return "NutritionOrder.oralDiet.schedule";
895
896  }
897
898  }
899
900    @Block()
901    public static class NutritionOrderOralDietNutrientComponent extends BackboneElement implements IBaseBackboneElement {
902        /**
903         * The nutrient that is being modified such as carbohydrate or sodium.
904         */
905        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
906        @Description(shortDefinition="Type of nutrient that is being modified", formalDefinition="The nutrient that is being modified such as carbohydrate or sodium." )
907        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/nutrient-code")
908        protected CodeableConcept modifier;
909
910        /**
911         * The quantity of the specified nutrient to include in diet.
912         */
913        @Child(name = "amount", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
914        @Description(shortDefinition="Quantity of the specified nutrient", formalDefinition="The quantity of the specified nutrient to include in diet." )
915        protected Quantity amount;
916
917        private static final long serialVersionUID = 1042462093L;
918
919    /**
920     * Constructor
921     */
922      public NutritionOrderOralDietNutrientComponent() {
923        super();
924      }
925
926        /**
927         * @return {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
928         */
929        public CodeableConcept getModifier() { 
930          if (this.modifier == null)
931            if (Configuration.errorOnAutoCreate())
932              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.modifier");
933            else if (Configuration.doAutoCreate())
934              this.modifier = new CodeableConcept(); // cc
935          return this.modifier;
936        }
937
938        public boolean hasModifier() { 
939          return this.modifier != null && !this.modifier.isEmpty();
940        }
941
942        /**
943         * @param value {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
944         */
945        public NutritionOrderOralDietNutrientComponent setModifier(CodeableConcept value) { 
946          this.modifier = value;
947          return this;
948        }
949
950        /**
951         * @return {@link #amount} (The quantity of the specified nutrient to include in diet.)
952         */
953        public Quantity getAmount() { 
954          if (this.amount == null)
955            if (Configuration.errorOnAutoCreate())
956              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.amount");
957            else if (Configuration.doAutoCreate())
958              this.amount = new Quantity(); // cc
959          return this.amount;
960        }
961
962        public boolean hasAmount() { 
963          return this.amount != null && !this.amount.isEmpty();
964        }
965
966        /**
967         * @param value {@link #amount} (The quantity of the specified nutrient to include in diet.)
968         */
969        public NutritionOrderOralDietNutrientComponent setAmount(Quantity value) { 
970          this.amount = value;
971          return this;
972        }
973
974        protected void listChildren(List<Property> children) {
975          super.listChildren(children);
976          children.add(new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier));
977          children.add(new Property("amount", "Quantity", "The quantity of the specified nutrient to include in diet.", 0, 1, amount));
978        }
979
980        @Override
981        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
982          switch (_hash) {
983          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier);
984          case -1413853096: /*amount*/  return new Property("amount", "Quantity", "The quantity of the specified nutrient to include in diet.", 0, 1, amount);
985          default: return super.getNamedProperty(_hash, _name, _checkValid);
986          }
987
988        }
989
990      @Override
991      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
992        switch (hash) {
993        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
994        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Quantity
995        default: return super.getProperty(hash, name, checkValid);
996        }
997
998      }
999
1000      @Override
1001      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1002        switch (hash) {
1003        case -615513385: // modifier
1004          this.modifier = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1005          return value;
1006        case -1413853096: // amount
1007          this.amount = TypeConvertor.castToQuantity(value); // Quantity
1008          return value;
1009        default: return super.setProperty(hash, name, value);
1010        }
1011
1012      }
1013
1014      @Override
1015      public Base setProperty(String name, Base value) throws FHIRException {
1016        if (name.equals("modifier")) {
1017          this.modifier = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1018        } else if (name.equals("amount")) {
1019          this.amount = TypeConvertor.castToQuantity(value); // Quantity
1020        } else
1021          return super.setProperty(name, value);
1022        return value;
1023      }
1024
1025      @Override
1026      public Base makeProperty(int hash, String name) throws FHIRException {
1027        switch (hash) {
1028        case -615513385:  return getModifier();
1029        case -1413853096:  return getAmount();
1030        default: return super.makeProperty(hash, name);
1031        }
1032
1033      }
1034
1035      @Override
1036      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1037        switch (hash) {
1038        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
1039        case -1413853096: /*amount*/ return new String[] {"Quantity"};
1040        default: return super.getTypesForProperty(hash, name);
1041        }
1042
1043      }
1044
1045      @Override
1046      public Base addChild(String name) throws FHIRException {
1047        if (name.equals("modifier")) {
1048          this.modifier = new CodeableConcept();
1049          return this.modifier;
1050        }
1051        else if (name.equals("amount")) {
1052          this.amount = new Quantity();
1053          return this.amount;
1054        }
1055        else
1056          return super.addChild(name);
1057      }
1058
1059      public NutritionOrderOralDietNutrientComponent copy() {
1060        NutritionOrderOralDietNutrientComponent dst = new NutritionOrderOralDietNutrientComponent();
1061        copyValues(dst);
1062        return dst;
1063      }
1064
1065      public void copyValues(NutritionOrderOralDietNutrientComponent dst) {
1066        super.copyValues(dst);
1067        dst.modifier = modifier == null ? null : modifier.copy();
1068        dst.amount = amount == null ? null : amount.copy();
1069      }
1070
1071      @Override
1072      public boolean equalsDeep(Base other_) {
1073        if (!super.equalsDeep(other_))
1074          return false;
1075        if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
1076          return false;
1077        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
1078        return compareDeep(modifier, o.modifier, true) && compareDeep(amount, o.amount, true);
1079      }
1080
1081      @Override
1082      public boolean equalsShallow(Base other_) {
1083        if (!super.equalsShallow(other_))
1084          return false;
1085        if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
1086          return false;
1087        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
1088        return true;
1089      }
1090
1091      public boolean isEmpty() {
1092        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, amount);
1093      }
1094
1095  public String fhirType() {
1096    return "NutritionOrder.oralDiet.nutrient";
1097
1098  }
1099
1100  }
1101
1102    @Block()
1103    public static class NutritionOrderOralDietTextureComponent extends BackboneElement implements IBaseBackboneElement {
1104        /**
1105         * Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.
1106         */
1107        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1108        @Description(shortDefinition="Code to indicate how to alter the texture of the foods, e.g. pureed", formalDefinition="Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed." )
1109        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/texture-code")
1110        protected CodeableConcept modifier;
1111
1112        /**
1113         * The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.
1114         */
1115        @Child(name = "foodType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1116        @Description(shortDefinition="Concepts that are used to identify an entity that is ingested for nutritional purposes", formalDefinition="The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types." )
1117        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/modified-foodtype")
1118        protected CodeableConcept foodType;
1119
1120        private static final long serialVersionUID = -56402817L;
1121
1122    /**
1123     * Constructor
1124     */
1125      public NutritionOrderOralDietTextureComponent() {
1126        super();
1127      }
1128
1129        /**
1130         * @return {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
1131         */
1132        public CodeableConcept getModifier() { 
1133          if (this.modifier == null)
1134            if (Configuration.errorOnAutoCreate())
1135              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.modifier");
1136            else if (Configuration.doAutoCreate())
1137              this.modifier = new CodeableConcept(); // cc
1138          return this.modifier;
1139        }
1140
1141        public boolean hasModifier() { 
1142          return this.modifier != null && !this.modifier.isEmpty();
1143        }
1144
1145        /**
1146         * @param value {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
1147         */
1148        public NutritionOrderOralDietTextureComponent setModifier(CodeableConcept value) { 
1149          this.modifier = value;
1150          return this;
1151        }
1152
1153        /**
1154         * @return {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
1155         */
1156        public CodeableConcept getFoodType() { 
1157          if (this.foodType == null)
1158            if (Configuration.errorOnAutoCreate())
1159              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.foodType");
1160            else if (Configuration.doAutoCreate())
1161              this.foodType = new CodeableConcept(); // cc
1162          return this.foodType;
1163        }
1164
1165        public boolean hasFoodType() { 
1166          return this.foodType != null && !this.foodType.isEmpty();
1167        }
1168
1169        /**
1170         * @param value {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
1171         */
1172        public NutritionOrderOralDietTextureComponent setFoodType(CodeableConcept value) { 
1173          this.foodType = value;
1174          return this;
1175        }
1176
1177        protected void listChildren(List<Property> children) {
1178          super.listChildren(children);
1179          children.add(new Property("modifier", "CodeableConcept", "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.", 0, 1, modifier));
1180          children.add(new Property("foodType", "CodeableConcept", "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.", 0, 1, foodType));
1181        }
1182
1183        @Override
1184        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1185          switch (_hash) {
1186          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.", 0, 1, modifier);
1187          case 379498680: /*foodType*/  return new Property("foodType", "CodeableConcept", "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.", 0, 1, foodType);
1188          default: return super.getNamedProperty(_hash, _name, _checkValid);
1189          }
1190
1191        }
1192
1193      @Override
1194      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1195        switch (hash) {
1196        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
1197        case 379498680: /*foodType*/ return this.foodType == null ? new Base[0] : new Base[] {this.foodType}; // CodeableConcept
1198        default: return super.getProperty(hash, name, checkValid);
1199        }
1200
1201      }
1202
1203      @Override
1204      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1205        switch (hash) {
1206        case -615513385: // modifier
1207          this.modifier = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1208          return value;
1209        case 379498680: // foodType
1210          this.foodType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1211          return value;
1212        default: return super.setProperty(hash, name, value);
1213        }
1214
1215      }
1216
1217      @Override
1218      public Base setProperty(String name, Base value) throws FHIRException {
1219        if (name.equals("modifier")) {
1220          this.modifier = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1221        } else if (name.equals("foodType")) {
1222          this.foodType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1223        } else
1224          return super.setProperty(name, value);
1225        return value;
1226      }
1227
1228      @Override
1229      public Base makeProperty(int hash, String name) throws FHIRException {
1230        switch (hash) {
1231        case -615513385:  return getModifier();
1232        case 379498680:  return getFoodType();
1233        default: return super.makeProperty(hash, name);
1234        }
1235
1236      }
1237
1238      @Override
1239      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1240        switch (hash) {
1241        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
1242        case 379498680: /*foodType*/ return new String[] {"CodeableConcept"};
1243        default: return super.getTypesForProperty(hash, name);
1244        }
1245
1246      }
1247
1248      @Override
1249      public Base addChild(String name) throws FHIRException {
1250        if (name.equals("modifier")) {
1251          this.modifier = new CodeableConcept();
1252          return this.modifier;
1253        }
1254        else if (name.equals("foodType")) {
1255          this.foodType = new CodeableConcept();
1256          return this.foodType;
1257        }
1258        else
1259          return super.addChild(name);
1260      }
1261
1262      public NutritionOrderOralDietTextureComponent copy() {
1263        NutritionOrderOralDietTextureComponent dst = new NutritionOrderOralDietTextureComponent();
1264        copyValues(dst);
1265        return dst;
1266      }
1267
1268      public void copyValues(NutritionOrderOralDietTextureComponent dst) {
1269        super.copyValues(dst);
1270        dst.modifier = modifier == null ? null : modifier.copy();
1271        dst.foodType = foodType == null ? null : foodType.copy();
1272      }
1273
1274      @Override
1275      public boolean equalsDeep(Base other_) {
1276        if (!super.equalsDeep(other_))
1277          return false;
1278        if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1279          return false;
1280        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1281        return compareDeep(modifier, o.modifier, true) && compareDeep(foodType, o.foodType, true);
1282      }
1283
1284      @Override
1285      public boolean equalsShallow(Base other_) {
1286        if (!super.equalsShallow(other_))
1287          return false;
1288        if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1289          return false;
1290        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1291        return true;
1292      }
1293
1294      public boolean isEmpty() {
1295        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, foodType);
1296      }
1297
1298  public String fhirType() {
1299    return "NutritionOrder.oralDiet.texture";
1300
1301  }
1302
1303  }
1304
1305    @Block()
1306    public static class NutritionOrderSupplementComponent extends BackboneElement implements IBaseBackboneElement {
1307        /**
1308         * The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.
1309         */
1310        @Child(name = "type", type = {CodeableReference.class}, order=1, min=0, max=1, modifier=false, summary=true)
1311        @Description(shortDefinition="Type of supplement product requested", formalDefinition="The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement." )
1312        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplement-type")
1313        protected CodeableReference type;
1314
1315        /**
1316         * The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1317         */
1318        @Child(name = "productName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1319        @Description(shortDefinition="Product or brand name of the nutritional supplement", formalDefinition="The product or brand name of the nutritional supplement such as \"Acme Protein Shake\"." )
1320        protected StringType productName;
1321
1322        /**
1323         * Schedule information for a supplement.
1324         */
1325        @Child(name = "schedule", type = {}, order=3, min=0, max=1, modifier=false, summary=false)
1326        @Description(shortDefinition="Scheduling information for supplements", formalDefinition="Schedule information for a supplement." )
1327        protected NutritionOrderSupplementScheduleComponent schedule;
1328
1329        /**
1330         * The amount of the nutritional supplement to be given.
1331         */
1332        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
1333        @Description(shortDefinition="Amount of the nutritional supplement", formalDefinition="The amount of the nutritional supplement to be given." )
1334        protected Quantity quantity;
1335
1336        /**
1337         * Free text or additional instructions or information pertaining to the oral supplement.
1338         */
1339        @Child(name = "instruction", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1340        @Description(shortDefinition="Instructions or additional information about the oral supplement", formalDefinition="Free text or additional instructions or information pertaining to the oral supplement." )
1341        protected StringType instruction;
1342
1343        private static final long serialVersionUID = 1799596174L;
1344
1345    /**
1346     * Constructor
1347     */
1348      public NutritionOrderSupplementComponent() {
1349        super();
1350      }
1351
1352        /**
1353         * @return {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1354         */
1355        public CodeableReference getType() { 
1356          if (this.type == null)
1357            if (Configuration.errorOnAutoCreate())
1358              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.type");
1359            else if (Configuration.doAutoCreate())
1360              this.type = new CodeableReference(); // cc
1361          return this.type;
1362        }
1363
1364        public boolean hasType() { 
1365          return this.type != null && !this.type.isEmpty();
1366        }
1367
1368        /**
1369         * @param value {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1370         */
1371        public NutritionOrderSupplementComponent setType(CodeableReference value) { 
1372          this.type = value;
1373          return this;
1374        }
1375
1376        /**
1377         * @return {@link #productName} (The product or brand name of the nutritional supplement such as "Acme Protein Shake".). This is the underlying object with id, value and extensions. The accessor "getProductName" gives direct access to the value
1378         */
1379        public StringType getProductNameElement() { 
1380          if (this.productName == null)
1381            if (Configuration.errorOnAutoCreate())
1382              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.productName");
1383            else if (Configuration.doAutoCreate())
1384              this.productName = new StringType(); // bb
1385          return this.productName;
1386        }
1387
1388        public boolean hasProductNameElement() { 
1389          return this.productName != null && !this.productName.isEmpty();
1390        }
1391
1392        public boolean hasProductName() { 
1393          return this.productName != null && !this.productName.isEmpty();
1394        }
1395
1396        /**
1397         * @param value {@link #productName} (The product or brand name of the nutritional supplement such as "Acme Protein Shake".). This is the underlying object with id, value and extensions. The accessor "getProductName" gives direct access to the value
1398         */
1399        public NutritionOrderSupplementComponent setProductNameElement(StringType value) { 
1400          this.productName = value;
1401          return this;
1402        }
1403
1404        /**
1405         * @return The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1406         */
1407        public String getProductName() { 
1408          return this.productName == null ? null : this.productName.getValue();
1409        }
1410
1411        /**
1412         * @param value The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1413         */
1414        public NutritionOrderSupplementComponent setProductName(String value) { 
1415          if (Utilities.noString(value))
1416            this.productName = null;
1417          else {
1418            if (this.productName == null)
1419              this.productName = new StringType();
1420            this.productName.setValue(value);
1421          }
1422          return this;
1423        }
1424
1425        /**
1426         * @return {@link #schedule} (Schedule information for a supplement.)
1427         */
1428        public NutritionOrderSupplementScheduleComponent getSchedule() { 
1429          if (this.schedule == null)
1430            if (Configuration.errorOnAutoCreate())
1431              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.schedule");
1432            else if (Configuration.doAutoCreate())
1433              this.schedule = new NutritionOrderSupplementScheduleComponent(); // cc
1434          return this.schedule;
1435        }
1436
1437        public boolean hasSchedule() { 
1438          return this.schedule != null && !this.schedule.isEmpty();
1439        }
1440
1441        /**
1442         * @param value {@link #schedule} (Schedule information for a supplement.)
1443         */
1444        public NutritionOrderSupplementComponent setSchedule(NutritionOrderSupplementScheduleComponent value) { 
1445          this.schedule = value;
1446          return this;
1447        }
1448
1449        /**
1450         * @return {@link #quantity} (The amount of the nutritional supplement to be given.)
1451         */
1452        public Quantity getQuantity() { 
1453          if (this.quantity == null)
1454            if (Configuration.errorOnAutoCreate())
1455              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.quantity");
1456            else if (Configuration.doAutoCreate())
1457              this.quantity = new Quantity(); // cc
1458          return this.quantity;
1459        }
1460
1461        public boolean hasQuantity() { 
1462          return this.quantity != null && !this.quantity.isEmpty();
1463        }
1464
1465        /**
1466         * @param value {@link #quantity} (The amount of the nutritional supplement to be given.)
1467         */
1468        public NutritionOrderSupplementComponent setQuantity(Quantity value) { 
1469          this.quantity = value;
1470          return this;
1471        }
1472
1473        /**
1474         * @return {@link #instruction} (Free text or additional instructions or information pertaining to the oral supplement.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
1475         */
1476        public StringType getInstructionElement() { 
1477          if (this.instruction == null)
1478            if (Configuration.errorOnAutoCreate())
1479              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.instruction");
1480            else if (Configuration.doAutoCreate())
1481              this.instruction = new StringType(); // bb
1482          return this.instruction;
1483        }
1484
1485        public boolean hasInstructionElement() { 
1486          return this.instruction != null && !this.instruction.isEmpty();
1487        }
1488
1489        public boolean hasInstruction() { 
1490          return this.instruction != null && !this.instruction.isEmpty();
1491        }
1492
1493        /**
1494         * @param value {@link #instruction} (Free text or additional instructions or information pertaining to the oral supplement.). This is the underlying object with id, value and extensions. The accessor "getInstruction" gives direct access to the value
1495         */
1496        public NutritionOrderSupplementComponent setInstructionElement(StringType value) { 
1497          this.instruction = value;
1498          return this;
1499        }
1500
1501        /**
1502         * @return Free text or additional instructions or information pertaining to the oral supplement.
1503         */
1504        public String getInstruction() { 
1505          return this.instruction == null ? null : this.instruction.getValue();
1506        }
1507
1508        /**
1509         * @param value Free text or additional instructions or information pertaining to the oral supplement.
1510         */
1511        public NutritionOrderSupplementComponent setInstruction(String value) { 
1512          if (Utilities.noString(value))
1513            this.instruction = null;
1514          else {
1515            if (this.instruction == null)
1516              this.instruction = new StringType();
1517            this.instruction.setValue(value);
1518          }
1519          return this;
1520        }
1521
1522        protected void listChildren(List<Property> children) {
1523          super.listChildren(children);
1524          children.add(new Property("type", "CodeableReference(NutritionProduct)", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, 1, type));
1525          children.add(new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1, productName));
1526          children.add(new Property("schedule", "", "Schedule information for a supplement.", 0, 1, schedule));
1527          children.add(new Property("quantity", "Quantity", "The amount of the nutritional supplement to be given.", 0, 1, quantity));
1528          children.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction));
1529        }
1530
1531        @Override
1532        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1533          switch (_hash) {
1534          case 3575610: /*type*/  return new Property("type", "CodeableReference(NutritionProduct)", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, 1, type);
1535          case -1491817446: /*productName*/  return new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1, productName);
1536          case -697920873: /*schedule*/  return new Property("schedule", "", "Schedule information for a supplement.", 0, 1, schedule);
1537          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The amount of the nutritional supplement to be given.", 0, 1, quantity);
1538          case 301526158: /*instruction*/  return new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction);
1539          default: return super.getNamedProperty(_hash, _name, _checkValid);
1540          }
1541
1542        }
1543
1544      @Override
1545      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1546        switch (hash) {
1547        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableReference
1548        case -1491817446: /*productName*/ return this.productName == null ? new Base[0] : new Base[] {this.productName}; // StringType
1549        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // NutritionOrderSupplementScheduleComponent
1550        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1551        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
1552        default: return super.getProperty(hash, name, checkValid);
1553        }
1554
1555      }
1556
1557      @Override
1558      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1559        switch (hash) {
1560        case 3575610: // type
1561          this.type = TypeConvertor.castToCodeableReference(value); // CodeableReference
1562          return value;
1563        case -1491817446: // productName
1564          this.productName = TypeConvertor.castToString(value); // StringType
1565          return value;
1566        case -697920873: // schedule
1567          this.schedule = (NutritionOrderSupplementScheduleComponent) value; // NutritionOrderSupplementScheduleComponent
1568          return value;
1569        case -1285004149: // quantity
1570          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1571          return value;
1572        case 301526158: // instruction
1573          this.instruction = TypeConvertor.castToString(value); // StringType
1574          return value;
1575        default: return super.setProperty(hash, name, value);
1576        }
1577
1578      }
1579
1580      @Override
1581      public Base setProperty(String name, Base value) throws FHIRException {
1582        if (name.equals("type")) {
1583          this.type = TypeConvertor.castToCodeableReference(value); // CodeableReference
1584        } else if (name.equals("productName")) {
1585          this.productName = TypeConvertor.castToString(value); // StringType
1586        } else if (name.equals("schedule")) {
1587          this.schedule = (NutritionOrderSupplementScheduleComponent) value; // NutritionOrderSupplementScheduleComponent
1588        } else if (name.equals("quantity")) {
1589          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
1590        } else if (name.equals("instruction")) {
1591          this.instruction = TypeConvertor.castToString(value); // StringType
1592        } else
1593          return super.setProperty(name, value);
1594        return value;
1595      }
1596
1597      @Override
1598      public Base makeProperty(int hash, String name) throws FHIRException {
1599        switch (hash) {
1600        case 3575610:  return getType();
1601        case -1491817446:  return getProductNameElement();
1602        case -697920873:  return getSchedule();
1603        case -1285004149:  return getQuantity();
1604        case 301526158:  return getInstructionElement();
1605        default: return super.makeProperty(hash, name);
1606        }
1607
1608      }
1609
1610      @Override
1611      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1612        switch (hash) {
1613        case 3575610: /*type*/ return new String[] {"CodeableReference"};
1614        case -1491817446: /*productName*/ return new String[] {"string"};
1615        case -697920873: /*schedule*/ return new String[] {};
1616        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1617        case 301526158: /*instruction*/ return new String[] {"string"};
1618        default: return super.getTypesForProperty(hash, name);
1619        }
1620
1621      }
1622
1623      @Override
1624      public Base addChild(String name) throws FHIRException {
1625        if (name.equals("type")) {
1626          this.type = new CodeableReference();
1627          return this.type;
1628        }
1629        else if (name.equals("productName")) {
1630          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.supplement.productName");
1631        }
1632        else if (name.equals("schedule")) {
1633          this.schedule = new NutritionOrderSupplementScheduleComponent();
1634          return this.schedule;
1635        }
1636        else if (name.equals("quantity")) {
1637          this.quantity = new Quantity();
1638          return this.quantity;
1639        }
1640        else if (name.equals("instruction")) {
1641          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.supplement.instruction");
1642        }
1643        else
1644          return super.addChild(name);
1645      }
1646
1647      public NutritionOrderSupplementComponent copy() {
1648        NutritionOrderSupplementComponent dst = new NutritionOrderSupplementComponent();
1649        copyValues(dst);
1650        return dst;
1651      }
1652
1653      public void copyValues(NutritionOrderSupplementComponent dst) {
1654        super.copyValues(dst);
1655        dst.type = type == null ? null : type.copy();
1656        dst.productName = productName == null ? null : productName.copy();
1657        dst.schedule = schedule == null ? null : schedule.copy();
1658        dst.quantity = quantity == null ? null : quantity.copy();
1659        dst.instruction = instruction == null ? null : instruction.copy();
1660      }
1661
1662      @Override
1663      public boolean equalsDeep(Base other_) {
1664        if (!super.equalsDeep(other_))
1665          return false;
1666        if (!(other_ instanceof NutritionOrderSupplementComponent))
1667          return false;
1668        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
1669        return compareDeep(type, o.type, true) && compareDeep(productName, o.productName, true) && compareDeep(schedule, o.schedule, true)
1670           && compareDeep(quantity, o.quantity, true) && compareDeep(instruction, o.instruction, true);
1671      }
1672
1673      @Override
1674      public boolean equalsShallow(Base other_) {
1675        if (!super.equalsShallow(other_))
1676          return false;
1677        if (!(other_ instanceof NutritionOrderSupplementComponent))
1678          return false;
1679        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
1680        return compareValues(productName, o.productName, true) && compareValues(instruction, o.instruction, true)
1681          ;
1682      }
1683
1684      public boolean isEmpty() {
1685        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, productName, schedule
1686          , quantity, instruction);
1687      }
1688
1689  public String fhirType() {
1690    return "NutritionOrder.supplement";
1691
1692  }
1693
1694  }
1695
1696    @Block()
1697    public static class NutritionOrderSupplementScheduleComponent extends BackboneElement implements IBaseBackboneElement {
1698        /**
1699         * The time period and frequency at which the supplement should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.
1700         */
1701        @Child(name = "timing", type = {Timing.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1702        @Description(shortDefinition="Scheduled frequency of diet", formalDefinition="The time period and frequency at which the supplement should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present." )
1703        protected List<Timing> timing;
1704
1705        /**
1706         * Indicates whether the supplement is only taken when needed within a specific dosing schedule.
1707         */
1708        @Child(name = "asNeeded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1709        @Description(shortDefinition="Take 'as needed'", formalDefinition="Indicates whether the supplement is only taken when needed within a specific dosing schedule." )
1710        protected BooleanType asNeeded;
1711
1712        /**
1713         * Indicates whether the supplement is only taken based on a precondition for taking the supplement.
1714         */
1715        @Child(name = "asNeededFor", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1716        @Description(shortDefinition="Take 'as needed' for x", formalDefinition="Indicates whether the supplement is only taken based on a precondition for taking the supplement." )
1717        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-as-needed-reason")
1718        protected CodeableConcept asNeededFor;
1719
1720        private static final long serialVersionUID = -1051458478L;
1721
1722    /**
1723     * Constructor
1724     */
1725      public NutritionOrderSupplementScheduleComponent() {
1726        super();
1727      }
1728
1729        /**
1730         * @return {@link #timing} (The time period and frequency at which the supplement should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.)
1731         */
1732        public List<Timing> getTiming() { 
1733          if (this.timing == null)
1734            this.timing = new ArrayList<Timing>();
1735          return this.timing;
1736        }
1737
1738        /**
1739         * @return Returns a reference to <code>this</code> for easy method chaining
1740         */
1741        public NutritionOrderSupplementScheduleComponent setTiming(List<Timing> theTiming) { 
1742          this.timing = theTiming;
1743          return this;
1744        }
1745
1746        public boolean hasTiming() { 
1747          if (this.timing == null)
1748            return false;
1749          for (Timing item : this.timing)
1750            if (!item.isEmpty())
1751              return true;
1752          return false;
1753        }
1754
1755        public Timing addTiming() { //3
1756          Timing t = new Timing();
1757          if (this.timing == null)
1758            this.timing = new ArrayList<Timing>();
1759          this.timing.add(t);
1760          return t;
1761        }
1762
1763        public NutritionOrderSupplementScheduleComponent addTiming(Timing t) { //3
1764          if (t == null)
1765            return this;
1766          if (this.timing == null)
1767            this.timing = new ArrayList<Timing>();
1768          this.timing.add(t);
1769          return this;
1770        }
1771
1772        /**
1773         * @return The first repetition of repeating field {@link #timing}, creating it if it does not already exist {3}
1774         */
1775        public Timing getTimingFirstRep() { 
1776          if (getTiming().isEmpty()) {
1777            addTiming();
1778          }
1779          return getTiming().get(0);
1780        }
1781
1782        /**
1783         * @return {@link #asNeeded} (Indicates whether the supplement is only taken when needed within a specific dosing schedule.). This is the underlying object with id, value and extensions. The accessor "getAsNeeded" gives direct access to the value
1784         */
1785        public BooleanType getAsNeededElement() { 
1786          if (this.asNeeded == null)
1787            if (Configuration.errorOnAutoCreate())
1788              throw new Error("Attempt to auto-create NutritionOrderSupplementScheduleComponent.asNeeded");
1789            else if (Configuration.doAutoCreate())
1790              this.asNeeded = new BooleanType(); // bb
1791          return this.asNeeded;
1792        }
1793
1794        public boolean hasAsNeededElement() { 
1795          return this.asNeeded != null && !this.asNeeded.isEmpty();
1796        }
1797
1798        public boolean hasAsNeeded() { 
1799          return this.asNeeded != null && !this.asNeeded.isEmpty();
1800        }
1801
1802        /**
1803         * @param value {@link #asNeeded} (Indicates whether the supplement is only taken when needed within a specific dosing schedule.). This is the underlying object with id, value and extensions. The accessor "getAsNeeded" gives direct access to the value
1804         */
1805        public NutritionOrderSupplementScheduleComponent setAsNeededElement(BooleanType value) { 
1806          this.asNeeded = value;
1807          return this;
1808        }
1809
1810        /**
1811         * @return Indicates whether the supplement is only taken when needed within a specific dosing schedule.
1812         */
1813        public boolean getAsNeeded() { 
1814          return this.asNeeded == null || this.asNeeded.isEmpty() ? false : this.asNeeded.getValue();
1815        }
1816
1817        /**
1818         * @param value Indicates whether the supplement is only taken when needed within a specific dosing schedule.
1819         */
1820        public NutritionOrderSupplementScheduleComponent setAsNeeded(boolean value) { 
1821            if (this.asNeeded == null)
1822              this.asNeeded = new BooleanType();
1823            this.asNeeded.setValue(value);
1824          return this;
1825        }
1826
1827        /**
1828         * @return {@link #asNeededFor} (Indicates whether the supplement is only taken based on a precondition for taking the supplement.)
1829         */
1830        public CodeableConcept getAsNeededFor() { 
1831          if (this.asNeededFor == null)
1832            if (Configuration.errorOnAutoCreate())
1833              throw new Error("Attempt to auto-create NutritionOrderSupplementScheduleComponent.asNeededFor");
1834            else if (Configuration.doAutoCreate())
1835              this.asNeededFor = new CodeableConcept(); // cc
1836          return this.asNeededFor;
1837        }
1838
1839        public boolean hasAsNeededFor() { 
1840          return this.asNeededFor != null && !this.asNeededFor.isEmpty();
1841        }
1842
1843        /**
1844         * @param value {@link #asNeededFor} (Indicates whether the supplement is only taken based on a precondition for taking the supplement.)
1845         */
1846        public NutritionOrderSupplementScheduleComponent setAsNeededFor(CodeableConcept value) { 
1847          this.asNeededFor = value;
1848          return this;
1849        }
1850
1851        protected void listChildren(List<Property> children) {
1852          super.listChildren(children);
1853          children.add(new Property("timing", "Timing", "The time period and frequency at which the supplement should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, timing));
1854          children.add(new Property("asNeeded", "boolean", "Indicates whether the supplement is only taken when needed within a specific dosing schedule.", 0, 1, asNeeded));
1855          children.add(new Property("asNeededFor", "CodeableConcept", "Indicates whether the supplement is only taken based on a precondition for taking the supplement.", 0, 1, asNeededFor));
1856        }
1857
1858        @Override
1859        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1860          switch (_hash) {
1861          case -873664438: /*timing*/  return new Property("timing", "Timing", "The time period and frequency at which the supplement should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, timing);
1862          case -1432923513: /*asNeeded*/  return new Property("asNeeded", "boolean", "Indicates whether the supplement is only taken when needed within a specific dosing schedule.", 0, 1, asNeeded);
1863          case -544350014: /*asNeededFor*/  return new Property("asNeededFor", "CodeableConcept", "Indicates whether the supplement is only taken based on a precondition for taking the supplement.", 0, 1, asNeededFor);
1864          default: return super.getNamedProperty(_hash, _name, _checkValid);
1865          }
1866
1867        }
1868
1869      @Override
1870      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1871        switch (hash) {
1872        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : this.timing.toArray(new Base[this.timing.size()]); // Timing
1873        case -1432923513: /*asNeeded*/ return this.asNeeded == null ? new Base[0] : new Base[] {this.asNeeded}; // BooleanType
1874        case -544350014: /*asNeededFor*/ return this.asNeededFor == null ? new Base[0] : new Base[] {this.asNeededFor}; // CodeableConcept
1875        default: return super.getProperty(hash, name, checkValid);
1876        }
1877
1878      }
1879
1880      @Override
1881      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1882        switch (hash) {
1883        case -873664438: // timing
1884          this.getTiming().add(TypeConvertor.castToTiming(value)); // Timing
1885          return value;
1886        case -1432923513: // asNeeded
1887          this.asNeeded = TypeConvertor.castToBoolean(value); // BooleanType
1888          return value;
1889        case -544350014: // asNeededFor
1890          this.asNeededFor = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1891          return value;
1892        default: return super.setProperty(hash, name, value);
1893        }
1894
1895      }
1896
1897      @Override
1898      public Base setProperty(String name, Base value) throws FHIRException {
1899        if (name.equals("timing")) {
1900          this.getTiming().add(TypeConvertor.castToTiming(value));
1901        } else if (name.equals("asNeeded")) {
1902          this.asNeeded = TypeConvertor.castToBoolean(value); // BooleanType
1903        } else if (name.equals("asNeededFor")) {
1904          this.asNeededFor = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1905        } else
1906          return super.setProperty(name, value);
1907        return value;
1908      }
1909
1910      @Override
1911      public Base makeProperty(int hash, String name) throws FHIRException {
1912        switch (hash) {
1913        case -873664438:  return addTiming(); 
1914        case -1432923513:  return getAsNeededElement();
1915        case -544350014:  return getAsNeededFor();
1916        default: return super.makeProperty(hash, name);
1917        }
1918
1919      }
1920
1921      @Override
1922      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1923        switch (hash) {
1924        case -873664438: /*timing*/ return new String[] {"Timing"};
1925        case -1432923513: /*asNeeded*/ return new String[] {"boolean"};
1926        case -544350014: /*asNeededFor*/ return new String[] {"CodeableConcept"};
1927        default: return super.getTypesForProperty(hash, name);
1928        }
1929
1930      }
1931
1932      @Override
1933      public Base addChild(String name) throws FHIRException {
1934        if (name.equals("timing")) {
1935          return addTiming();
1936        }
1937        else if (name.equals("asNeeded")) {
1938          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.supplement.schedule.asNeeded");
1939        }
1940        else if (name.equals("asNeededFor")) {
1941          this.asNeededFor = new CodeableConcept();
1942          return this.asNeededFor;
1943        }
1944        else
1945          return super.addChild(name);
1946      }
1947
1948      public NutritionOrderSupplementScheduleComponent copy() {
1949        NutritionOrderSupplementScheduleComponent dst = new NutritionOrderSupplementScheduleComponent();
1950        copyValues(dst);
1951        return dst;
1952      }
1953
1954      public void copyValues(NutritionOrderSupplementScheduleComponent dst) {
1955        super.copyValues(dst);
1956        if (timing != null) {
1957          dst.timing = new ArrayList<Timing>();
1958          for (Timing i : timing)
1959            dst.timing.add(i.copy());
1960        };
1961        dst.asNeeded = asNeeded == null ? null : asNeeded.copy();
1962        dst.asNeededFor = asNeededFor == null ? null : asNeededFor.copy();
1963      }
1964
1965      @Override
1966      public boolean equalsDeep(Base other_) {
1967        if (!super.equalsDeep(other_))
1968          return false;
1969        if (!(other_ instanceof NutritionOrderSupplementScheduleComponent))
1970          return false;
1971        NutritionOrderSupplementScheduleComponent o = (NutritionOrderSupplementScheduleComponent) other_;
1972        return compareDeep(timing, o.timing, true) && compareDeep(asNeeded, o.asNeeded, true) && compareDeep(asNeededFor, o.asNeededFor, true)
1973          ;
1974      }
1975
1976      @Override
1977      public boolean equalsShallow(Base other_) {
1978        if (!super.equalsShallow(other_))
1979          return false;
1980        if (!(other_ instanceof NutritionOrderSupplementScheduleComponent))
1981          return false;
1982        NutritionOrderSupplementScheduleComponent o = (NutritionOrderSupplementScheduleComponent) other_;
1983        return compareValues(asNeeded, o.asNeeded, true);
1984      }
1985
1986      public boolean isEmpty() {
1987        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(timing, asNeeded, asNeededFor
1988          );
1989      }
1990
1991  public String fhirType() {
1992    return "NutritionOrder.supplement.schedule";
1993
1994  }
1995
1996  }
1997
1998    @Block()
1999    public static class NutritionOrderEnteralFormulaComponent extends BackboneElement implements IBaseBackboneElement {
2000        /**
2001         * The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.
2002         */
2003        @Child(name = "baseFormulaType", type = {CodeableReference.class}, order=1, min=0, max=1, modifier=false, summary=true)
2004        @Description(shortDefinition="Type of enteral or infant formula", formalDefinition="The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula." )
2005        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/entformula-type")
2006        protected CodeableReference baseFormulaType;
2007
2008        /**
2009         * The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
2010         */
2011        @Child(name = "baseFormulaProductName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2012        @Description(shortDefinition="Product or brand name of the enteral or infant formula", formalDefinition="The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\"." )
2013        protected StringType baseFormulaProductName;
2014
2015        /**
2016         * The intended type of device that is to be used for the administration of the enteral formula.
2017         */
2018        @Child(name = "deliveryDevice", type = {CodeableReference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2019        @Description(shortDefinition="Intended type of device for the administration", formalDefinition="The intended type of device that is to be used for the administration of the enteral formula." )
2020        protected List<CodeableReference> deliveryDevice;
2021
2022        /**
2023         * Indicates modular components to be provided in addition or mixed with the base formula.
2024         */
2025        @Child(name = "additive", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2026        @Description(shortDefinition="Components to add to the feeding", formalDefinition="Indicates modular components to be provided in addition or mixed with the base formula." )
2027        protected List<NutritionOrderEnteralFormulaAdditiveComponent> additive;
2028
2029        /**
2030         * The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.
2031         */
2032        @Child(name = "caloricDensity", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
2033        @Description(shortDefinition="Amount of energy per specified volume that is required", formalDefinition="The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL." )
2034        protected Quantity caloricDensity;
2035
2036        /**
2037         * The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.
2038         */
2039        @Child(name = "routeOfAdministration", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
2040        @Description(shortDefinition="How the formula should enter the patient's gastrointestinal tract", formalDefinition="The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube." )
2041        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/enteral-route")
2042        protected CodeableConcept routeOfAdministration;
2043
2044        /**
2045         * Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.
2046         */
2047        @Child(name = "administration", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2048        @Description(shortDefinition="Formula feeding instruction as structured data", formalDefinition="Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours." )
2049        protected List<NutritionOrderEnteralFormulaAdministrationComponent> administration;
2050
2051        /**
2052         * The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.
2053         */
2054        @Child(name = "maxVolumeToDeliver", type = {Quantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
2055        @Description(shortDefinition="Upper limit on formula volume per unit of time", formalDefinition="The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours." )
2056        protected Quantity maxVolumeToDeliver;
2057
2058        /**
2059         * Free text formula administration, feeding instructions or additional instructions or information.
2060         */
2061        @Child(name = "administrationInstruction", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
2062        @Description(shortDefinition="Formula feeding instructions expressed as text", formalDefinition="Free text formula administration, feeding instructions or additional instructions or information." )
2063        protected StringType administrationInstruction;
2064
2065        private static final long serialVersionUID = 1413967736L;
2066
2067    /**
2068     * Constructor
2069     */
2070      public NutritionOrderEnteralFormulaComponent() {
2071        super();
2072      }
2073
2074        /**
2075         * @return {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
2076         */
2077        public CodeableReference getBaseFormulaType() { 
2078          if (this.baseFormulaType == null)
2079            if (Configuration.errorOnAutoCreate())
2080              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaType");
2081            else if (Configuration.doAutoCreate())
2082              this.baseFormulaType = new CodeableReference(); // cc
2083          return this.baseFormulaType;
2084        }
2085
2086        public boolean hasBaseFormulaType() { 
2087          return this.baseFormulaType != null && !this.baseFormulaType.isEmpty();
2088        }
2089
2090        /**
2091         * @param value {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
2092         */
2093        public NutritionOrderEnteralFormulaComponent setBaseFormulaType(CodeableReference value) { 
2094          this.baseFormulaType = value;
2095          return this;
2096        }
2097
2098        /**
2099         * @return {@link #baseFormulaProductName} (The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".). This is the underlying object with id, value and extensions. The accessor "getBaseFormulaProductName" gives direct access to the value
2100         */
2101        public StringType getBaseFormulaProductNameElement() { 
2102          if (this.baseFormulaProductName == null)
2103            if (Configuration.errorOnAutoCreate())
2104              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaProductName");
2105            else if (Configuration.doAutoCreate())
2106              this.baseFormulaProductName = new StringType(); // bb
2107          return this.baseFormulaProductName;
2108        }
2109
2110        public boolean hasBaseFormulaProductNameElement() { 
2111          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
2112        }
2113
2114        public boolean hasBaseFormulaProductName() { 
2115          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
2116        }
2117
2118        /**
2119         * @param value {@link #baseFormulaProductName} (The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".). This is the underlying object with id, value and extensions. The accessor "getBaseFormulaProductName" gives direct access to the value
2120         */
2121        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductNameElement(StringType value) { 
2122          this.baseFormulaProductName = value;
2123          return this;
2124        }
2125
2126        /**
2127         * @return The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
2128         */
2129        public String getBaseFormulaProductName() { 
2130          return this.baseFormulaProductName == null ? null : this.baseFormulaProductName.getValue();
2131        }
2132
2133        /**
2134         * @param value The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
2135         */
2136        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductName(String value) { 
2137          if (Utilities.noString(value))
2138            this.baseFormulaProductName = null;
2139          else {
2140            if (this.baseFormulaProductName == null)
2141              this.baseFormulaProductName = new StringType();
2142            this.baseFormulaProductName.setValue(value);
2143          }
2144          return this;
2145        }
2146
2147        /**
2148         * @return {@link #deliveryDevice} (The intended type of device that is to be used for the administration of the enteral formula.)
2149         */
2150        public List<CodeableReference> getDeliveryDevice() { 
2151          if (this.deliveryDevice == null)
2152            this.deliveryDevice = new ArrayList<CodeableReference>();
2153          return this.deliveryDevice;
2154        }
2155
2156        /**
2157         * @return Returns a reference to <code>this</code> for easy method chaining
2158         */
2159        public NutritionOrderEnteralFormulaComponent setDeliveryDevice(List<CodeableReference> theDeliveryDevice) { 
2160          this.deliveryDevice = theDeliveryDevice;
2161          return this;
2162        }
2163
2164        public boolean hasDeliveryDevice() { 
2165          if (this.deliveryDevice == null)
2166            return false;
2167          for (CodeableReference item : this.deliveryDevice)
2168            if (!item.isEmpty())
2169              return true;
2170          return false;
2171        }
2172
2173        public CodeableReference addDeliveryDevice() { //3
2174          CodeableReference t = new CodeableReference();
2175          if (this.deliveryDevice == null)
2176            this.deliveryDevice = new ArrayList<CodeableReference>();
2177          this.deliveryDevice.add(t);
2178          return t;
2179        }
2180
2181        public NutritionOrderEnteralFormulaComponent addDeliveryDevice(CodeableReference t) { //3
2182          if (t == null)
2183            return this;
2184          if (this.deliveryDevice == null)
2185            this.deliveryDevice = new ArrayList<CodeableReference>();
2186          this.deliveryDevice.add(t);
2187          return this;
2188        }
2189
2190        /**
2191         * @return The first repetition of repeating field {@link #deliveryDevice}, creating it if it does not already exist {3}
2192         */
2193        public CodeableReference getDeliveryDeviceFirstRep() { 
2194          if (getDeliveryDevice().isEmpty()) {
2195            addDeliveryDevice();
2196          }
2197          return getDeliveryDevice().get(0);
2198        }
2199
2200        /**
2201         * @return {@link #additive} (Indicates modular components to be provided in addition or mixed with the base formula.)
2202         */
2203        public List<NutritionOrderEnteralFormulaAdditiveComponent> getAdditive() { 
2204          if (this.additive == null)
2205            this.additive = new ArrayList<NutritionOrderEnteralFormulaAdditiveComponent>();
2206          return this.additive;
2207        }
2208
2209        /**
2210         * @return Returns a reference to <code>this</code> for easy method chaining
2211         */
2212        public NutritionOrderEnteralFormulaComponent setAdditive(List<NutritionOrderEnteralFormulaAdditiveComponent> theAdditive) { 
2213          this.additive = theAdditive;
2214          return this;
2215        }
2216
2217        public boolean hasAdditive() { 
2218          if (this.additive == null)
2219            return false;
2220          for (NutritionOrderEnteralFormulaAdditiveComponent item : this.additive)
2221            if (!item.isEmpty())
2222              return true;
2223          return false;
2224        }
2225
2226        public NutritionOrderEnteralFormulaAdditiveComponent addAdditive() { //3
2227          NutritionOrderEnteralFormulaAdditiveComponent t = new NutritionOrderEnteralFormulaAdditiveComponent();
2228          if (this.additive == null)
2229            this.additive = new ArrayList<NutritionOrderEnteralFormulaAdditiveComponent>();
2230          this.additive.add(t);
2231          return t;
2232        }
2233
2234        public NutritionOrderEnteralFormulaComponent addAdditive(NutritionOrderEnteralFormulaAdditiveComponent t) { //3
2235          if (t == null)
2236            return this;
2237          if (this.additive == null)
2238            this.additive = new ArrayList<NutritionOrderEnteralFormulaAdditiveComponent>();
2239          this.additive.add(t);
2240          return this;
2241        }
2242
2243        /**
2244         * @return The first repetition of repeating field {@link #additive}, creating it if it does not already exist {3}
2245         */
2246        public NutritionOrderEnteralFormulaAdditiveComponent getAdditiveFirstRep() { 
2247          if (getAdditive().isEmpty()) {
2248            addAdditive();
2249          }
2250          return getAdditive().get(0);
2251        }
2252
2253        /**
2254         * @return {@link #caloricDensity} (The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.)
2255         */
2256        public Quantity getCaloricDensity() { 
2257          if (this.caloricDensity == null)
2258            if (Configuration.errorOnAutoCreate())
2259              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.caloricDensity");
2260            else if (Configuration.doAutoCreate())
2261              this.caloricDensity = new Quantity(); // cc
2262          return this.caloricDensity;
2263        }
2264
2265        public boolean hasCaloricDensity() { 
2266          return this.caloricDensity != null && !this.caloricDensity.isEmpty();
2267        }
2268
2269        /**
2270         * @param value {@link #caloricDensity} (The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.)
2271         */
2272        public NutritionOrderEnteralFormulaComponent setCaloricDensity(Quantity value) { 
2273          this.caloricDensity = value;
2274          return this;
2275        }
2276
2277        /**
2278         * @return {@link #routeOfAdministration} (The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.)
2279         */
2280        public CodeableConcept getRouteOfAdministration() { 
2281          if (this.routeOfAdministration == null)
2282            if (Configuration.errorOnAutoCreate())
2283              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.routeOfAdministration");
2284            else if (Configuration.doAutoCreate())
2285              this.routeOfAdministration = new CodeableConcept(); // cc
2286          return this.routeOfAdministration;
2287        }
2288
2289        public boolean hasRouteOfAdministration() { 
2290          return this.routeOfAdministration != null && !this.routeOfAdministration.isEmpty();
2291        }
2292
2293        /**
2294         * @param value {@link #routeOfAdministration} (The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.)
2295         */
2296        public NutritionOrderEnteralFormulaComponent setRouteOfAdministration(CodeableConcept value) { 
2297          this.routeOfAdministration = value;
2298          return this;
2299        }
2300
2301        /**
2302         * @return {@link #administration} (Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.)
2303         */
2304        public List<NutritionOrderEnteralFormulaAdministrationComponent> getAdministration() { 
2305          if (this.administration == null)
2306            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2307          return this.administration;
2308        }
2309
2310        /**
2311         * @return Returns a reference to <code>this</code> for easy method chaining
2312         */
2313        public NutritionOrderEnteralFormulaComponent setAdministration(List<NutritionOrderEnteralFormulaAdministrationComponent> theAdministration) { 
2314          this.administration = theAdministration;
2315          return this;
2316        }
2317
2318        public boolean hasAdministration() { 
2319          if (this.administration == null)
2320            return false;
2321          for (NutritionOrderEnteralFormulaAdministrationComponent item : this.administration)
2322            if (!item.isEmpty())
2323              return true;
2324          return false;
2325        }
2326
2327        public NutritionOrderEnteralFormulaAdministrationComponent addAdministration() { //3
2328          NutritionOrderEnteralFormulaAdministrationComponent t = new NutritionOrderEnteralFormulaAdministrationComponent();
2329          if (this.administration == null)
2330            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2331          this.administration.add(t);
2332          return t;
2333        }
2334
2335        public NutritionOrderEnteralFormulaComponent addAdministration(NutritionOrderEnteralFormulaAdministrationComponent t) { //3
2336          if (t == null)
2337            return this;
2338          if (this.administration == null)
2339            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2340          this.administration.add(t);
2341          return this;
2342        }
2343
2344        /**
2345         * @return The first repetition of repeating field {@link #administration}, creating it if it does not already exist {3}
2346         */
2347        public NutritionOrderEnteralFormulaAdministrationComponent getAdministrationFirstRep() { 
2348          if (getAdministration().isEmpty()) {
2349            addAdministration();
2350          }
2351          return getAdministration().get(0);
2352        }
2353
2354        /**
2355         * @return {@link #maxVolumeToDeliver} (The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.)
2356         */
2357        public Quantity getMaxVolumeToDeliver() { 
2358          if (this.maxVolumeToDeliver == null)
2359            if (Configuration.errorOnAutoCreate())
2360              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.maxVolumeToDeliver");
2361            else if (Configuration.doAutoCreate())
2362              this.maxVolumeToDeliver = new Quantity(); // cc
2363          return this.maxVolumeToDeliver;
2364        }
2365
2366        public boolean hasMaxVolumeToDeliver() { 
2367          return this.maxVolumeToDeliver != null && !this.maxVolumeToDeliver.isEmpty();
2368        }
2369
2370        /**
2371         * @param value {@link #maxVolumeToDeliver} (The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.)
2372         */
2373        public NutritionOrderEnteralFormulaComponent setMaxVolumeToDeliver(Quantity value) { 
2374          this.maxVolumeToDeliver = value;
2375          return this;
2376        }
2377
2378        /**
2379         * @return {@link #administrationInstruction} (Free text formula administration, feeding instructions or additional instructions or information.). This is the underlying object with id, value and extensions. The accessor "getAdministrationInstruction" gives direct access to the value
2380         */
2381        public StringType getAdministrationInstructionElement() { 
2382          if (this.administrationInstruction == null)
2383            if (Configuration.errorOnAutoCreate())
2384              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.administrationInstruction");
2385            else if (Configuration.doAutoCreate())
2386              this.administrationInstruction = new StringType(); // bb
2387          return this.administrationInstruction;
2388        }
2389
2390        public boolean hasAdministrationInstructionElement() { 
2391          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
2392        }
2393
2394        public boolean hasAdministrationInstruction() { 
2395          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
2396        }
2397
2398        /**
2399         * @param value {@link #administrationInstruction} (Free text formula administration, feeding instructions or additional instructions or information.). This is the underlying object with id, value and extensions. The accessor "getAdministrationInstruction" gives direct access to the value
2400         */
2401        public NutritionOrderEnteralFormulaComponent setAdministrationInstructionElement(StringType value) { 
2402          this.administrationInstruction = value;
2403          return this;
2404        }
2405
2406        /**
2407         * @return Free text formula administration, feeding instructions or additional instructions or information.
2408         */
2409        public String getAdministrationInstruction() { 
2410          return this.administrationInstruction == null ? null : this.administrationInstruction.getValue();
2411        }
2412
2413        /**
2414         * @param value Free text formula administration, feeding instructions or additional instructions or information.
2415         */
2416        public NutritionOrderEnteralFormulaComponent setAdministrationInstruction(String value) { 
2417          if (Utilities.noString(value))
2418            this.administrationInstruction = null;
2419          else {
2420            if (this.administrationInstruction == null)
2421              this.administrationInstruction = new StringType();
2422            this.administrationInstruction.setValue(value);
2423          }
2424          return this;
2425        }
2426
2427        protected void listChildren(List<Property> children) {
2428          super.listChildren(children);
2429          children.add(new Property("baseFormulaType", "CodeableReference(NutritionProduct)", "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.", 0, 1, baseFormulaType));
2430          children.add(new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, 1, baseFormulaProductName));
2431          children.add(new Property("deliveryDevice", "CodeableReference(DeviceDefinition)", "The intended type of device that is to be used for the administration of the enteral formula.", 0, java.lang.Integer.MAX_VALUE, deliveryDevice));
2432          children.add(new Property("additive", "", "Indicates modular components to be provided in addition or mixed with the base formula.", 0, java.lang.Integer.MAX_VALUE, additive));
2433          children.add(new Property("caloricDensity", "Quantity", "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.", 0, 1, caloricDensity));
2434          children.add(new Property("routeOfAdministration", "CodeableConcept", "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.", 0, 1, routeOfAdministration));
2435          children.add(new Property("administration", "", "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.", 0, java.lang.Integer.MAX_VALUE, administration));
2436          children.add(new Property("maxVolumeToDeliver", "Quantity", "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.", 0, 1, maxVolumeToDeliver));
2437          children.add(new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1, administrationInstruction));
2438        }
2439
2440        @Override
2441        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2442          switch (_hash) {
2443          case -138930641: /*baseFormulaType*/  return new Property("baseFormulaType", "CodeableReference(NutritionProduct)", "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.", 0, 1, baseFormulaType);
2444          case -1267705979: /*baseFormulaProductName*/  return new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, 1, baseFormulaProductName);
2445          case 2060803946: /*deliveryDevice*/  return new Property("deliveryDevice", "CodeableReference(DeviceDefinition)", "The intended type of device that is to be used for the administration of the enteral formula.", 0, java.lang.Integer.MAX_VALUE, deliveryDevice);
2446          case -1226589236: /*additive*/  return new Property("additive", "", "Indicates modular components to be provided in addition or mixed with the base formula.", 0, java.lang.Integer.MAX_VALUE, additive);
2447          case 186983261: /*caloricDensity*/  return new Property("caloricDensity", "Quantity", "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.", 0, 1, caloricDensity);
2448          case 1742084734: /*routeOfAdministration*/  return new Property("routeOfAdministration", "CodeableConcept", "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.", 0, 1, routeOfAdministration);
2449          case 1255702622: /*administration*/  return new Property("administration", "", "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.", 0, java.lang.Integer.MAX_VALUE, administration);
2450          case 2017924652: /*maxVolumeToDeliver*/  return new Property("maxVolumeToDeliver", "Quantity", "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.", 0, 1, maxVolumeToDeliver);
2451          case 427085136: /*administrationInstruction*/  return new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1, administrationInstruction);
2452          default: return super.getNamedProperty(_hash, _name, _checkValid);
2453          }
2454
2455        }
2456
2457      @Override
2458      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2459        switch (hash) {
2460        case -138930641: /*baseFormulaType*/ return this.baseFormulaType == null ? new Base[0] : new Base[] {this.baseFormulaType}; // CodeableReference
2461        case -1267705979: /*baseFormulaProductName*/ return this.baseFormulaProductName == null ? new Base[0] : new Base[] {this.baseFormulaProductName}; // StringType
2462        case 2060803946: /*deliveryDevice*/ return this.deliveryDevice == null ? new Base[0] : this.deliveryDevice.toArray(new Base[this.deliveryDevice.size()]); // CodeableReference
2463        case -1226589236: /*additive*/ return this.additive == null ? new Base[0] : this.additive.toArray(new Base[this.additive.size()]); // NutritionOrderEnteralFormulaAdditiveComponent
2464        case 186983261: /*caloricDensity*/ return this.caloricDensity == null ? new Base[0] : new Base[] {this.caloricDensity}; // Quantity
2465        case 1742084734: /*routeOfAdministration*/ return this.routeOfAdministration == null ? new Base[0] : new Base[] {this.routeOfAdministration}; // CodeableConcept
2466        case 1255702622: /*administration*/ return this.administration == null ? new Base[0] : this.administration.toArray(new Base[this.administration.size()]); // NutritionOrderEnteralFormulaAdministrationComponent
2467        case 2017924652: /*maxVolumeToDeliver*/ return this.maxVolumeToDeliver == null ? new Base[0] : new Base[] {this.maxVolumeToDeliver}; // Quantity
2468        case 427085136: /*administrationInstruction*/ return this.administrationInstruction == null ? new Base[0] : new Base[] {this.administrationInstruction}; // StringType
2469        default: return super.getProperty(hash, name, checkValid);
2470        }
2471
2472      }
2473
2474      @Override
2475      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2476        switch (hash) {
2477        case -138930641: // baseFormulaType
2478          this.baseFormulaType = TypeConvertor.castToCodeableReference(value); // CodeableReference
2479          return value;
2480        case -1267705979: // baseFormulaProductName
2481          this.baseFormulaProductName = TypeConvertor.castToString(value); // StringType
2482          return value;
2483        case 2060803946: // deliveryDevice
2484          this.getDeliveryDevice().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
2485          return value;
2486        case -1226589236: // additive
2487          this.getAdditive().add((NutritionOrderEnteralFormulaAdditiveComponent) value); // NutritionOrderEnteralFormulaAdditiveComponent
2488          return value;
2489        case 186983261: // caloricDensity
2490          this.caloricDensity = TypeConvertor.castToQuantity(value); // Quantity
2491          return value;
2492        case 1742084734: // routeOfAdministration
2493          this.routeOfAdministration = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2494          return value;
2495        case 1255702622: // administration
2496          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value); // NutritionOrderEnteralFormulaAdministrationComponent
2497          return value;
2498        case 2017924652: // maxVolumeToDeliver
2499          this.maxVolumeToDeliver = TypeConvertor.castToQuantity(value); // Quantity
2500          return value;
2501        case 427085136: // administrationInstruction
2502          this.administrationInstruction = TypeConvertor.castToString(value); // StringType
2503          return value;
2504        default: return super.setProperty(hash, name, value);
2505        }
2506
2507      }
2508
2509      @Override
2510      public Base setProperty(String name, Base value) throws FHIRException {
2511        if (name.equals("baseFormulaType")) {
2512          this.baseFormulaType = TypeConvertor.castToCodeableReference(value); // CodeableReference
2513        } else if (name.equals("baseFormulaProductName")) {
2514          this.baseFormulaProductName = TypeConvertor.castToString(value); // StringType
2515        } else if (name.equals("deliveryDevice")) {
2516          this.getDeliveryDevice().add(TypeConvertor.castToCodeableReference(value));
2517        } else if (name.equals("additive")) {
2518          this.getAdditive().add((NutritionOrderEnteralFormulaAdditiveComponent) value);
2519        } else if (name.equals("caloricDensity")) {
2520          this.caloricDensity = TypeConvertor.castToQuantity(value); // Quantity
2521        } else if (name.equals("routeOfAdministration")) {
2522          this.routeOfAdministration = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2523        } else if (name.equals("administration")) {
2524          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value);
2525        } else if (name.equals("maxVolumeToDeliver")) {
2526          this.maxVolumeToDeliver = TypeConvertor.castToQuantity(value); // Quantity
2527        } else if (name.equals("administrationInstruction")) {
2528          this.administrationInstruction = TypeConvertor.castToString(value); // StringType
2529        } else
2530          return super.setProperty(name, value);
2531        return value;
2532      }
2533
2534      @Override
2535      public Base makeProperty(int hash, String name) throws FHIRException {
2536        switch (hash) {
2537        case -138930641:  return getBaseFormulaType();
2538        case -1267705979:  return getBaseFormulaProductNameElement();
2539        case 2060803946:  return addDeliveryDevice(); 
2540        case -1226589236:  return addAdditive(); 
2541        case 186983261:  return getCaloricDensity();
2542        case 1742084734:  return getRouteOfAdministration();
2543        case 1255702622:  return addAdministration(); 
2544        case 2017924652:  return getMaxVolumeToDeliver();
2545        case 427085136:  return getAdministrationInstructionElement();
2546        default: return super.makeProperty(hash, name);
2547        }
2548
2549      }
2550
2551      @Override
2552      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2553        switch (hash) {
2554        case -138930641: /*baseFormulaType*/ return new String[] {"CodeableReference"};
2555        case -1267705979: /*baseFormulaProductName*/ return new String[] {"string"};
2556        case 2060803946: /*deliveryDevice*/ return new String[] {"CodeableReference"};
2557        case -1226589236: /*additive*/ return new String[] {};
2558        case 186983261: /*caloricDensity*/ return new String[] {"Quantity"};
2559        case 1742084734: /*routeOfAdministration*/ return new String[] {"CodeableConcept"};
2560        case 1255702622: /*administration*/ return new String[] {};
2561        case 2017924652: /*maxVolumeToDeliver*/ return new String[] {"Quantity"};
2562        case 427085136: /*administrationInstruction*/ return new String[] {"string"};
2563        default: return super.getTypesForProperty(hash, name);
2564        }
2565
2566      }
2567
2568      @Override
2569      public Base addChild(String name) throws FHIRException {
2570        if (name.equals("baseFormulaType")) {
2571          this.baseFormulaType = new CodeableReference();
2572          return this.baseFormulaType;
2573        }
2574        else if (name.equals("baseFormulaProductName")) {
2575          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.enteralFormula.baseFormulaProductName");
2576        }
2577        else if (name.equals("deliveryDevice")) {
2578          return addDeliveryDevice();
2579        }
2580        else if (name.equals("additive")) {
2581          return addAdditive();
2582        }
2583        else if (name.equals("caloricDensity")) {
2584          this.caloricDensity = new Quantity();
2585          return this.caloricDensity;
2586        }
2587        else if (name.equals("routeOfAdministration")) {
2588          this.routeOfAdministration = new CodeableConcept();
2589          return this.routeOfAdministration;
2590        }
2591        else if (name.equals("administration")) {
2592          return addAdministration();
2593        }
2594        else if (name.equals("maxVolumeToDeliver")) {
2595          this.maxVolumeToDeliver = new Quantity();
2596          return this.maxVolumeToDeliver;
2597        }
2598        else if (name.equals("administrationInstruction")) {
2599          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.enteralFormula.administrationInstruction");
2600        }
2601        else
2602          return super.addChild(name);
2603      }
2604
2605      public NutritionOrderEnteralFormulaComponent copy() {
2606        NutritionOrderEnteralFormulaComponent dst = new NutritionOrderEnteralFormulaComponent();
2607        copyValues(dst);
2608        return dst;
2609      }
2610
2611      public void copyValues(NutritionOrderEnteralFormulaComponent dst) {
2612        super.copyValues(dst);
2613        dst.baseFormulaType = baseFormulaType == null ? null : baseFormulaType.copy();
2614        dst.baseFormulaProductName = baseFormulaProductName == null ? null : baseFormulaProductName.copy();
2615        if (deliveryDevice != null) {
2616          dst.deliveryDevice = new ArrayList<CodeableReference>();
2617          for (CodeableReference i : deliveryDevice)
2618            dst.deliveryDevice.add(i.copy());
2619        };
2620        if (additive != null) {
2621          dst.additive = new ArrayList<NutritionOrderEnteralFormulaAdditiveComponent>();
2622          for (NutritionOrderEnteralFormulaAdditiveComponent i : additive)
2623            dst.additive.add(i.copy());
2624        };
2625        dst.caloricDensity = caloricDensity == null ? null : caloricDensity.copy();
2626        dst.routeOfAdministration = routeOfAdministration == null ? null : routeOfAdministration.copy();
2627        if (administration != null) {
2628          dst.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2629          for (NutritionOrderEnteralFormulaAdministrationComponent i : administration)
2630            dst.administration.add(i.copy());
2631        };
2632        dst.maxVolumeToDeliver = maxVolumeToDeliver == null ? null : maxVolumeToDeliver.copy();
2633        dst.administrationInstruction = administrationInstruction == null ? null : administrationInstruction.copy();
2634      }
2635
2636      @Override
2637      public boolean equalsDeep(Base other_) {
2638        if (!super.equalsDeep(other_))
2639          return false;
2640        if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2641          return false;
2642        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2643        return compareDeep(baseFormulaType, o.baseFormulaType, true) && compareDeep(baseFormulaProductName, o.baseFormulaProductName, true)
2644           && compareDeep(deliveryDevice, o.deliveryDevice, true) && compareDeep(additive, o.additive, true)
2645           && compareDeep(caloricDensity, o.caloricDensity, true) && compareDeep(routeOfAdministration, o.routeOfAdministration, true)
2646           && compareDeep(administration, o.administration, true) && compareDeep(maxVolumeToDeliver, o.maxVolumeToDeliver, true)
2647           && compareDeep(administrationInstruction, o.administrationInstruction, true);
2648      }
2649
2650      @Override
2651      public boolean equalsShallow(Base other_) {
2652        if (!super.equalsShallow(other_))
2653          return false;
2654        if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2655          return false;
2656        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2657        return compareValues(baseFormulaProductName, o.baseFormulaProductName, true) && compareValues(administrationInstruction, o.administrationInstruction, true)
2658          ;
2659      }
2660
2661      public boolean isEmpty() {
2662        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(baseFormulaType, baseFormulaProductName
2663          , deliveryDevice, additive, caloricDensity, routeOfAdministration, administration
2664          , maxVolumeToDeliver, administrationInstruction);
2665      }
2666
2667  public String fhirType() {
2668    return "NutritionOrder.enteralFormula";
2669
2670  }
2671
2672  }
2673
2674    @Block()
2675    public static class NutritionOrderEnteralFormulaAdditiveComponent extends BackboneElement implements IBaseBackboneElement {
2676        /**
2677         * Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.
2678         */
2679        @Child(name = "type", type = {CodeableReference.class}, order=1, min=0, max=1, modifier=false, summary=false)
2680        @Description(shortDefinition="Type of modular component to add to the feeding", formalDefinition="Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula." )
2681        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/entformula-additive")
2682        protected CodeableReference type;
2683
2684        /**
2685         * The product or brand name of the type of modular component to be added to the formula.
2686         */
2687        @Child(name = "productName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2688        @Description(shortDefinition="Product or brand name of the modular additive", formalDefinition="The product or brand name of the type of modular component to be added to the formula." )
2689        protected StringType productName;
2690
2691        /**
2692         * The amount of additive to be given in addition or to be mixed in with the base formula.
2693         */
2694        @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false)
2695        @Description(shortDefinition="Amount of additive to be given or mixed in", formalDefinition="The amount of additive to be given in addition or to be mixed in with the base formula." )
2696        protected Quantity quantity;
2697
2698        private static final long serialVersionUID = 2072791035L;
2699
2700    /**
2701     * Constructor
2702     */
2703      public NutritionOrderEnteralFormulaAdditiveComponent() {
2704        super();
2705      }
2706
2707        /**
2708         * @return {@link #type} (Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.)
2709         */
2710        public CodeableReference getType() { 
2711          if (this.type == null)
2712            if (Configuration.errorOnAutoCreate())
2713              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdditiveComponent.type");
2714            else if (Configuration.doAutoCreate())
2715              this.type = new CodeableReference(); // cc
2716          return this.type;
2717        }
2718
2719        public boolean hasType() { 
2720          return this.type != null && !this.type.isEmpty();
2721        }
2722
2723        /**
2724         * @param value {@link #type} (Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.)
2725         */
2726        public NutritionOrderEnteralFormulaAdditiveComponent setType(CodeableReference value) { 
2727          this.type = value;
2728          return this;
2729        }
2730
2731        /**
2732         * @return {@link #productName} (The product or brand name of the type of modular component to be added to the formula.). This is the underlying object with id, value and extensions. The accessor "getProductName" gives direct access to the value
2733         */
2734        public StringType getProductNameElement() { 
2735          if (this.productName == null)
2736            if (Configuration.errorOnAutoCreate())
2737              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdditiveComponent.productName");
2738            else if (Configuration.doAutoCreate())
2739              this.productName = new StringType(); // bb
2740          return this.productName;
2741        }
2742
2743        public boolean hasProductNameElement() { 
2744          return this.productName != null && !this.productName.isEmpty();
2745        }
2746
2747        public boolean hasProductName() { 
2748          return this.productName != null && !this.productName.isEmpty();
2749        }
2750
2751        /**
2752         * @param value {@link #productName} (The product or brand name of the type of modular component to be added to the formula.). This is the underlying object with id, value and extensions. The accessor "getProductName" gives direct access to the value
2753         */
2754        public NutritionOrderEnteralFormulaAdditiveComponent setProductNameElement(StringType value) { 
2755          this.productName = value;
2756          return this;
2757        }
2758
2759        /**
2760         * @return The product or brand name of the type of modular component to be added to the formula.
2761         */
2762        public String getProductName() { 
2763          return this.productName == null ? null : this.productName.getValue();
2764        }
2765
2766        /**
2767         * @param value The product or brand name of the type of modular component to be added to the formula.
2768         */
2769        public NutritionOrderEnteralFormulaAdditiveComponent setProductName(String value) { 
2770          if (Utilities.noString(value))
2771            this.productName = null;
2772          else {
2773            if (this.productName == null)
2774              this.productName = new StringType();
2775            this.productName.setValue(value);
2776          }
2777          return this;
2778        }
2779
2780        /**
2781         * @return {@link #quantity} (The amount of additive to be given in addition or to be mixed in with the base formula.)
2782         */
2783        public Quantity getQuantity() { 
2784          if (this.quantity == null)
2785            if (Configuration.errorOnAutoCreate())
2786              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdditiveComponent.quantity");
2787            else if (Configuration.doAutoCreate())
2788              this.quantity = new Quantity(); // cc
2789          return this.quantity;
2790        }
2791
2792        public boolean hasQuantity() { 
2793          return this.quantity != null && !this.quantity.isEmpty();
2794        }
2795
2796        /**
2797         * @param value {@link #quantity} (The amount of additive to be given in addition or to be mixed in with the base formula.)
2798         */
2799        public NutritionOrderEnteralFormulaAdditiveComponent setQuantity(Quantity value) { 
2800          this.quantity = value;
2801          return this;
2802        }
2803
2804        protected void listChildren(List<Property> children) {
2805          super.listChildren(children);
2806          children.add(new Property("type", "CodeableReference(NutritionProduct)", "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.", 0, 1, type));
2807          children.add(new Property("productName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, 1, productName));
2808          children.add(new Property("quantity", "Quantity", "The amount of additive to be given in addition or to be mixed in with the base formula.", 0, 1, quantity));
2809        }
2810
2811        @Override
2812        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2813          switch (_hash) {
2814          case 3575610: /*type*/  return new Property("type", "CodeableReference(NutritionProduct)", "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.", 0, 1, type);
2815          case -1491817446: /*productName*/  return new Property("productName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, 1, productName);
2816          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The amount of additive to be given in addition or to be mixed in with the base formula.", 0, 1, quantity);
2817          default: return super.getNamedProperty(_hash, _name, _checkValid);
2818          }
2819
2820        }
2821
2822      @Override
2823      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2824        switch (hash) {
2825        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableReference
2826        case -1491817446: /*productName*/ return this.productName == null ? new Base[0] : new Base[] {this.productName}; // StringType
2827        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
2828        default: return super.getProperty(hash, name, checkValid);
2829        }
2830
2831      }
2832
2833      @Override
2834      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2835        switch (hash) {
2836        case 3575610: // type
2837          this.type = TypeConvertor.castToCodeableReference(value); // CodeableReference
2838          return value;
2839        case -1491817446: // productName
2840          this.productName = TypeConvertor.castToString(value); // StringType
2841          return value;
2842        case -1285004149: // quantity
2843          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
2844          return value;
2845        default: return super.setProperty(hash, name, value);
2846        }
2847
2848      }
2849
2850      @Override
2851      public Base setProperty(String name, Base value) throws FHIRException {
2852        if (name.equals("type")) {
2853          this.type = TypeConvertor.castToCodeableReference(value); // CodeableReference
2854        } else if (name.equals("productName")) {
2855          this.productName = TypeConvertor.castToString(value); // StringType
2856        } else if (name.equals("quantity")) {
2857          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
2858        } else
2859          return super.setProperty(name, value);
2860        return value;
2861      }
2862
2863      @Override
2864      public Base makeProperty(int hash, String name) throws FHIRException {
2865        switch (hash) {
2866        case 3575610:  return getType();
2867        case -1491817446:  return getProductNameElement();
2868        case -1285004149:  return getQuantity();
2869        default: return super.makeProperty(hash, name);
2870        }
2871
2872      }
2873
2874      @Override
2875      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2876        switch (hash) {
2877        case 3575610: /*type*/ return new String[] {"CodeableReference"};
2878        case -1491817446: /*productName*/ return new String[] {"string"};
2879        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
2880        default: return super.getTypesForProperty(hash, name);
2881        }
2882
2883      }
2884
2885      @Override
2886      public Base addChild(String name) throws FHIRException {
2887        if (name.equals("type")) {
2888          this.type = new CodeableReference();
2889          return this.type;
2890        }
2891        else if (name.equals("productName")) {
2892          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.enteralFormula.additive.productName");
2893        }
2894        else if (name.equals("quantity")) {
2895          this.quantity = new Quantity();
2896          return this.quantity;
2897        }
2898        else
2899          return super.addChild(name);
2900      }
2901
2902      public NutritionOrderEnteralFormulaAdditiveComponent copy() {
2903        NutritionOrderEnteralFormulaAdditiveComponent dst = new NutritionOrderEnteralFormulaAdditiveComponent();
2904        copyValues(dst);
2905        return dst;
2906      }
2907
2908      public void copyValues(NutritionOrderEnteralFormulaAdditiveComponent dst) {
2909        super.copyValues(dst);
2910        dst.type = type == null ? null : type.copy();
2911        dst.productName = productName == null ? null : productName.copy();
2912        dst.quantity = quantity == null ? null : quantity.copy();
2913      }
2914
2915      @Override
2916      public boolean equalsDeep(Base other_) {
2917        if (!super.equalsDeep(other_))
2918          return false;
2919        if (!(other_ instanceof NutritionOrderEnteralFormulaAdditiveComponent))
2920          return false;
2921        NutritionOrderEnteralFormulaAdditiveComponent o = (NutritionOrderEnteralFormulaAdditiveComponent) other_;
2922        return compareDeep(type, o.type, true) && compareDeep(productName, o.productName, true) && compareDeep(quantity, o.quantity, true)
2923          ;
2924      }
2925
2926      @Override
2927      public boolean equalsShallow(Base other_) {
2928        if (!super.equalsShallow(other_))
2929          return false;
2930        if (!(other_ instanceof NutritionOrderEnteralFormulaAdditiveComponent))
2931          return false;
2932        NutritionOrderEnteralFormulaAdditiveComponent o = (NutritionOrderEnteralFormulaAdditiveComponent) other_;
2933        return compareValues(productName, o.productName, true);
2934      }
2935
2936      public boolean isEmpty() {
2937        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, productName, quantity
2938          );
2939      }
2940
2941  public String fhirType() {
2942    return "NutritionOrder.enteralFormula.additive";
2943
2944  }
2945
2946  }
2947
2948    @Block()
2949    public static class NutritionOrderEnteralFormulaAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
2950        /**
2951         * Schedule information for an enteral formula.
2952         */
2953        @Child(name = "schedule", type = {}, order=1, min=0, max=1, modifier=false, summary=false)
2954        @Description(shortDefinition="Scheduling information for enteral formula products", formalDefinition="Schedule information for an enteral formula." )
2955        protected NutritionOrderEnteralFormulaAdministrationScheduleComponent schedule;
2956
2957        /**
2958         * The volume of formula to provide to the patient per the specified administration schedule.
2959         */
2960        @Child(name = "quantity", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
2961        @Description(shortDefinition="The volume of formula to provide", formalDefinition="The volume of formula to provide to the patient per the specified administration schedule." )
2962        protected Quantity quantity;
2963
2964        /**
2965         * The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.
2966         */
2967        @Child(name = "rate", type = {Quantity.class, Ratio.class}, order=3, min=0, max=1, modifier=false, summary=false)
2968        @Description(shortDefinition="Speed with which the formula is provided per period of time", formalDefinition="The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule." )
2969        protected DataType rate;
2970
2971        private static final long serialVersionUID = -1648388394L;
2972
2973    /**
2974     * Constructor
2975     */
2976      public NutritionOrderEnteralFormulaAdministrationComponent() {
2977        super();
2978      }
2979
2980        /**
2981         * @return {@link #schedule} (Schedule information for an enteral formula.)
2982         */
2983        public NutritionOrderEnteralFormulaAdministrationScheduleComponent getSchedule() { 
2984          if (this.schedule == null)
2985            if (Configuration.errorOnAutoCreate())
2986              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.schedule");
2987            else if (Configuration.doAutoCreate())
2988              this.schedule = new NutritionOrderEnteralFormulaAdministrationScheduleComponent(); // cc
2989          return this.schedule;
2990        }
2991
2992        public boolean hasSchedule() { 
2993          return this.schedule != null && !this.schedule.isEmpty();
2994        }
2995
2996        /**
2997         * @param value {@link #schedule} (Schedule information for an enteral formula.)
2998         */
2999        public NutritionOrderEnteralFormulaAdministrationComponent setSchedule(NutritionOrderEnteralFormulaAdministrationScheduleComponent value) { 
3000          this.schedule = value;
3001          return this;
3002        }
3003
3004        /**
3005         * @return {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
3006         */
3007        public Quantity getQuantity() { 
3008          if (this.quantity == null)
3009            if (Configuration.errorOnAutoCreate())
3010              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.quantity");
3011            else if (Configuration.doAutoCreate())
3012              this.quantity = new Quantity(); // cc
3013          return this.quantity;
3014        }
3015
3016        public boolean hasQuantity() { 
3017          return this.quantity != null && !this.quantity.isEmpty();
3018        }
3019
3020        /**
3021         * @param value {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
3022         */
3023        public NutritionOrderEnteralFormulaAdministrationComponent setQuantity(Quantity value) { 
3024          this.quantity = value;
3025          return this;
3026        }
3027
3028        /**
3029         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
3030         */
3031        public DataType getRate() { 
3032          return this.rate;
3033        }
3034
3035        /**
3036         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
3037         */
3038        public Quantity getRateQuantity() throws FHIRException { 
3039          if (this.rate == null)
3040            this.rate = new Quantity();
3041          if (!(this.rate instanceof Quantity))
3042            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.rate.getClass().getName()+" was encountered");
3043          return (Quantity) this.rate;
3044        }
3045
3046        public boolean hasRateQuantity() { 
3047          return this != null && this.rate instanceof Quantity;
3048        }
3049
3050        /**
3051         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
3052         */
3053        public Ratio getRateRatio() throws FHIRException { 
3054          if (this.rate == null)
3055            this.rate = new Ratio();
3056          if (!(this.rate instanceof Ratio))
3057            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered");
3058          return (Ratio) this.rate;
3059        }
3060
3061        public boolean hasRateRatio() { 
3062          return this != null && this.rate instanceof Ratio;
3063        }
3064
3065        public boolean hasRate() { 
3066          return this.rate != null && !this.rate.isEmpty();
3067        }
3068
3069        /**
3070         * @param value {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
3071         */
3072        public NutritionOrderEnteralFormulaAdministrationComponent setRate(DataType value) { 
3073          if (value != null && !(value instanceof Quantity || value instanceof Ratio))
3074            throw new Error("Not the right type for NutritionOrder.enteralFormula.administration.rate[x]: "+value.fhirType());
3075          this.rate = value;
3076          return this;
3077        }
3078
3079        protected void listChildren(List<Property> children) {
3080          super.listChildren(children);
3081          children.add(new Property("schedule", "", "Schedule information for an enteral formula.", 0, 1, schedule));
3082          children.add(new Property("quantity", "Quantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1, quantity));
3083          children.add(new Property("rate[x]", "Quantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate));
3084        }
3085
3086        @Override
3087        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3088          switch (_hash) {
3089          case -697920873: /*schedule*/  return new Property("schedule", "", "Schedule information for an enteral formula.", 0, 1, schedule);
3090          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1, quantity);
3091          case 983460768: /*rate[x]*/  return new Property("rate[x]", "Quantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
3092          case 3493088: /*rate*/  return new Property("rate[x]", "Quantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
3093          case -1085459061: /*rateQuantity*/  return new Property("rate[x]", "Quantity", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
3094          case 204021515: /*rateRatio*/  return new Property("rate[x]", "Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, 1, rate);
3095          default: return super.getNamedProperty(_hash, _name, _checkValid);
3096          }
3097
3098        }
3099
3100      @Override
3101      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3102        switch (hash) {
3103        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // NutritionOrderEnteralFormulaAdministrationScheduleComponent
3104        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
3105        case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // DataType
3106        default: return super.getProperty(hash, name, checkValid);
3107        }
3108
3109      }
3110
3111      @Override
3112      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3113        switch (hash) {
3114        case -697920873: // schedule
3115          this.schedule = (NutritionOrderEnteralFormulaAdministrationScheduleComponent) value; // NutritionOrderEnteralFormulaAdministrationScheduleComponent
3116          return value;
3117        case -1285004149: // quantity
3118          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
3119          return value;
3120        case 3493088: // rate
3121          this.rate = TypeConvertor.castToType(value); // DataType
3122          return value;
3123        default: return super.setProperty(hash, name, value);
3124        }
3125
3126      }
3127
3128      @Override
3129      public Base setProperty(String name, Base value) throws FHIRException {
3130        if (name.equals("schedule")) {
3131          this.schedule = (NutritionOrderEnteralFormulaAdministrationScheduleComponent) value; // NutritionOrderEnteralFormulaAdministrationScheduleComponent
3132        } else if (name.equals("quantity")) {
3133          this.quantity = TypeConvertor.castToQuantity(value); // Quantity
3134        } else if (name.equals("rate[x]")) {
3135          this.rate = TypeConvertor.castToType(value); // DataType
3136        } else
3137          return super.setProperty(name, value);
3138        return value;
3139      }
3140
3141      @Override
3142      public Base makeProperty(int hash, String name) throws FHIRException {
3143        switch (hash) {
3144        case -697920873:  return getSchedule();
3145        case -1285004149:  return getQuantity();
3146        case 983460768:  return getRate();
3147        case 3493088:  return getRate();
3148        default: return super.makeProperty(hash, name);
3149        }
3150
3151      }
3152
3153      @Override
3154      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3155        switch (hash) {
3156        case -697920873: /*schedule*/ return new String[] {};
3157        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
3158        case 3493088: /*rate*/ return new String[] {"Quantity", "Ratio"};
3159        default: return super.getTypesForProperty(hash, name);
3160        }
3161
3162      }
3163
3164      @Override
3165      public Base addChild(String name) throws FHIRException {
3166        if (name.equals("schedule")) {
3167          this.schedule = new NutritionOrderEnteralFormulaAdministrationScheduleComponent();
3168          return this.schedule;
3169        }
3170        else if (name.equals("quantity")) {
3171          this.quantity = new Quantity();
3172          return this.quantity;
3173        }
3174        else if (name.equals("rateQuantity")) {
3175          this.rate = new Quantity();
3176          return this.rate;
3177        }
3178        else if (name.equals("rateRatio")) {
3179          this.rate = new Ratio();
3180          return this.rate;
3181        }
3182        else
3183          return super.addChild(name);
3184      }
3185
3186      public NutritionOrderEnteralFormulaAdministrationComponent copy() {
3187        NutritionOrderEnteralFormulaAdministrationComponent dst = new NutritionOrderEnteralFormulaAdministrationComponent();
3188        copyValues(dst);
3189        return dst;
3190      }
3191
3192      public void copyValues(NutritionOrderEnteralFormulaAdministrationComponent dst) {
3193        super.copyValues(dst);
3194        dst.schedule = schedule == null ? null : schedule.copy();
3195        dst.quantity = quantity == null ? null : quantity.copy();
3196        dst.rate = rate == null ? null : rate.copy();
3197      }
3198
3199      @Override
3200      public boolean equalsDeep(Base other_) {
3201        if (!super.equalsDeep(other_))
3202          return false;
3203        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
3204          return false;
3205        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
3206        return compareDeep(schedule, o.schedule, true) && compareDeep(quantity, o.quantity, true) && compareDeep(rate, o.rate, true)
3207          ;
3208      }
3209
3210      @Override
3211      public boolean equalsShallow(Base other_) {
3212        if (!super.equalsShallow(other_))
3213          return false;
3214        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
3215          return false;
3216        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
3217        return true;
3218      }
3219
3220      public boolean isEmpty() {
3221        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(schedule, quantity, rate
3222          );
3223      }
3224
3225  public String fhirType() {
3226    return "NutritionOrder.enteralFormula.administration";
3227
3228  }
3229
3230  }
3231
3232    @Block()
3233    public static class NutritionOrderEnteralFormulaAdministrationScheduleComponent extends BackboneElement implements IBaseBackboneElement {
3234        /**
3235         * The time period and frequency at which the enteral formula should be given.  The enteral formula should be given for the combination of all schedules if more than one schedule is present.
3236         */
3237        @Child(name = "timing", type = {Timing.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3238        @Description(shortDefinition="Scheduled frequency of enteral formula", formalDefinition="The time period and frequency at which the enteral formula should be given.  The enteral formula should be given for the combination of all schedules if more than one schedule is present." )
3239        protected List<Timing> timing;
3240
3241        /**
3242         * Indicates whether the enteral formula is only taken when needed within a specific dosing schedule.
3243         */
3244        @Child(name = "asNeeded", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
3245        @Description(shortDefinition="Take 'as needed'", formalDefinition="Indicates whether the enteral formula is only taken when needed within a specific dosing schedule." )
3246        protected BooleanType asNeeded;
3247
3248        /**
3249         * Indicates whether the enteral formula is only taken based on a precondition for taking the enteral formula.
3250         */
3251        @Child(name = "asNeededFor", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
3252        @Description(shortDefinition="Take 'as needed' for x", formalDefinition="Indicates whether the enteral formula is only taken based on a precondition for taking the enteral formula." )
3253        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-as-needed-reason")
3254        protected CodeableConcept asNeededFor;
3255
3256        private static final long serialVersionUID = -1051458478L;
3257
3258    /**
3259     * Constructor
3260     */
3261      public NutritionOrderEnteralFormulaAdministrationScheduleComponent() {
3262        super();
3263      }
3264
3265        /**
3266         * @return {@link #timing} (The time period and frequency at which the enteral formula should be given.  The enteral formula should be given for the combination of all schedules if more than one schedule is present.)
3267         */
3268        public List<Timing> getTiming() { 
3269          if (this.timing == null)
3270            this.timing = new ArrayList<Timing>();
3271          return this.timing;
3272        }
3273
3274        /**
3275         * @return Returns a reference to <code>this</code> for easy method chaining
3276         */
3277        public NutritionOrderEnteralFormulaAdministrationScheduleComponent setTiming(List<Timing> theTiming) { 
3278          this.timing = theTiming;
3279          return this;
3280        }
3281
3282        public boolean hasTiming() { 
3283          if (this.timing == null)
3284            return false;
3285          for (Timing item : this.timing)
3286            if (!item.isEmpty())
3287              return true;
3288          return false;
3289        }
3290
3291        public Timing addTiming() { //3
3292          Timing t = new Timing();
3293          if (this.timing == null)
3294            this.timing = new ArrayList<Timing>();
3295          this.timing.add(t);
3296          return t;
3297        }
3298
3299        public NutritionOrderEnteralFormulaAdministrationScheduleComponent addTiming(Timing t) { //3
3300          if (t == null)
3301            return this;
3302          if (this.timing == null)
3303            this.timing = new ArrayList<Timing>();
3304          this.timing.add(t);
3305          return this;
3306        }
3307
3308        /**
3309         * @return The first repetition of repeating field {@link #timing}, creating it if it does not already exist {3}
3310         */
3311        public Timing getTimingFirstRep() { 
3312          if (getTiming().isEmpty()) {
3313            addTiming();
3314          }
3315          return getTiming().get(0);
3316        }
3317
3318        /**
3319         * @return {@link #asNeeded} (Indicates whether the enteral formula is only taken when needed within a specific dosing schedule.). This is the underlying object with id, value and extensions. The accessor "getAsNeeded" gives direct access to the value
3320         */
3321        public BooleanType getAsNeededElement() { 
3322          if (this.asNeeded == null)
3323            if (Configuration.errorOnAutoCreate())
3324              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationScheduleComponent.asNeeded");
3325            else if (Configuration.doAutoCreate())
3326              this.asNeeded = new BooleanType(); // bb
3327          return this.asNeeded;
3328        }
3329
3330        public boolean hasAsNeededElement() { 
3331          return this.asNeeded != null && !this.asNeeded.isEmpty();
3332        }
3333
3334        public boolean hasAsNeeded() { 
3335          return this.asNeeded != null && !this.asNeeded.isEmpty();
3336        }
3337
3338        /**
3339         * @param value {@link #asNeeded} (Indicates whether the enteral formula is only taken when needed within a specific dosing schedule.). This is the underlying object with id, value and extensions. The accessor "getAsNeeded" gives direct access to the value
3340         */
3341        public NutritionOrderEnteralFormulaAdministrationScheduleComponent setAsNeededElement(BooleanType value) { 
3342          this.asNeeded = value;
3343          return this;
3344        }
3345
3346        /**
3347         * @return Indicates whether the enteral formula is only taken when needed within a specific dosing schedule.
3348         */
3349        public boolean getAsNeeded() { 
3350          return this.asNeeded == null || this.asNeeded.isEmpty() ? false : this.asNeeded.getValue();
3351        }
3352
3353        /**
3354         * @param value Indicates whether the enteral formula is only taken when needed within a specific dosing schedule.
3355         */
3356        public NutritionOrderEnteralFormulaAdministrationScheduleComponent setAsNeeded(boolean value) { 
3357            if (this.asNeeded == null)
3358              this.asNeeded = new BooleanType();
3359            this.asNeeded.setValue(value);
3360          return this;
3361        }
3362
3363        /**
3364         * @return {@link #asNeededFor} (Indicates whether the enteral formula is only taken based on a precondition for taking the enteral formula.)
3365         */
3366        public CodeableConcept getAsNeededFor() { 
3367          if (this.asNeededFor == null)
3368            if (Configuration.errorOnAutoCreate())
3369              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationScheduleComponent.asNeededFor");
3370            else if (Configuration.doAutoCreate())
3371              this.asNeededFor = new CodeableConcept(); // cc
3372          return this.asNeededFor;
3373        }
3374
3375        public boolean hasAsNeededFor() { 
3376          return this.asNeededFor != null && !this.asNeededFor.isEmpty();
3377        }
3378
3379        /**
3380         * @param value {@link #asNeededFor} (Indicates whether the enteral formula is only taken based on a precondition for taking the enteral formula.)
3381         */
3382        public NutritionOrderEnteralFormulaAdministrationScheduleComponent setAsNeededFor(CodeableConcept value) { 
3383          this.asNeededFor = value;
3384          return this;
3385        }
3386
3387        protected void listChildren(List<Property> children) {
3388          super.listChildren(children);
3389          children.add(new Property("timing", "Timing", "The time period and frequency at which the enteral formula should be given.  The enteral formula should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, timing));
3390          children.add(new Property("asNeeded", "boolean", "Indicates whether the enteral formula is only taken when needed within a specific dosing schedule.", 0, 1, asNeeded));
3391          children.add(new Property("asNeededFor", "CodeableConcept", "Indicates whether the enteral formula is only taken based on a precondition for taking the enteral formula.", 0, 1, asNeededFor));
3392        }
3393
3394        @Override
3395        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3396          switch (_hash) {
3397          case -873664438: /*timing*/  return new Property("timing", "Timing", "The time period and frequency at which the enteral formula should be given.  The enteral formula should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, timing);
3398          case -1432923513: /*asNeeded*/  return new Property("asNeeded", "boolean", "Indicates whether the enteral formula is only taken when needed within a specific dosing schedule.", 0, 1, asNeeded);
3399          case -544350014: /*asNeededFor*/  return new Property("asNeededFor", "CodeableConcept", "Indicates whether the enteral formula is only taken based on a precondition for taking the enteral formula.", 0, 1, asNeededFor);
3400          default: return super.getNamedProperty(_hash, _name, _checkValid);
3401          }
3402
3403        }
3404
3405      @Override
3406      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3407        switch (hash) {
3408        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : this.timing.toArray(new Base[this.timing.size()]); // Timing
3409        case -1432923513: /*asNeeded*/ return this.asNeeded == null ? new Base[0] : new Base[] {this.asNeeded}; // BooleanType
3410        case -544350014: /*asNeededFor*/ return this.asNeededFor == null ? new Base[0] : new Base[] {this.asNeededFor}; // CodeableConcept
3411        default: return super.getProperty(hash, name, checkValid);
3412        }
3413
3414      }
3415
3416      @Override
3417      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3418        switch (hash) {
3419        case -873664438: // timing
3420          this.getTiming().add(TypeConvertor.castToTiming(value)); // Timing
3421          return value;
3422        case -1432923513: // asNeeded
3423          this.asNeeded = TypeConvertor.castToBoolean(value); // BooleanType
3424          return value;
3425        case -544350014: // asNeededFor
3426          this.asNeededFor = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3427          return value;
3428        default: return super.setProperty(hash, name, value);
3429        }
3430
3431      }
3432
3433      @Override
3434      public Base setProperty(String name, Base value) throws FHIRException {
3435        if (name.equals("timing")) {
3436          this.getTiming().add(TypeConvertor.castToTiming(value));
3437        } else if (name.equals("asNeeded")) {
3438          this.asNeeded = TypeConvertor.castToBoolean(value); // BooleanType
3439        } else if (name.equals("asNeededFor")) {
3440          this.asNeededFor = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3441        } else
3442          return super.setProperty(name, value);
3443        return value;
3444      }
3445
3446      @Override
3447      public Base makeProperty(int hash, String name) throws FHIRException {
3448        switch (hash) {
3449        case -873664438:  return addTiming(); 
3450        case -1432923513:  return getAsNeededElement();
3451        case -544350014:  return getAsNeededFor();
3452        default: return super.makeProperty(hash, name);
3453        }
3454
3455      }
3456
3457      @Override
3458      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3459        switch (hash) {
3460        case -873664438: /*timing*/ return new String[] {"Timing"};
3461        case -1432923513: /*asNeeded*/ return new String[] {"boolean"};
3462        case -544350014: /*asNeededFor*/ return new String[] {"CodeableConcept"};
3463        default: return super.getTypesForProperty(hash, name);
3464        }
3465
3466      }
3467
3468      @Override
3469      public Base addChild(String name) throws FHIRException {
3470        if (name.equals("timing")) {
3471          return addTiming();
3472        }
3473        else if (name.equals("asNeeded")) {
3474          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.enteralFormula.administration.schedule.asNeeded");
3475        }
3476        else if (name.equals("asNeededFor")) {
3477          this.asNeededFor = new CodeableConcept();
3478          return this.asNeededFor;
3479        }
3480        else
3481          return super.addChild(name);
3482      }
3483
3484      public NutritionOrderEnteralFormulaAdministrationScheduleComponent copy() {
3485        NutritionOrderEnteralFormulaAdministrationScheduleComponent dst = new NutritionOrderEnteralFormulaAdministrationScheduleComponent();
3486        copyValues(dst);
3487        return dst;
3488      }
3489
3490      public void copyValues(NutritionOrderEnteralFormulaAdministrationScheduleComponent dst) {
3491        super.copyValues(dst);
3492        if (timing != null) {
3493          dst.timing = new ArrayList<Timing>();
3494          for (Timing i : timing)
3495            dst.timing.add(i.copy());
3496        };
3497        dst.asNeeded = asNeeded == null ? null : asNeeded.copy();
3498        dst.asNeededFor = asNeededFor == null ? null : asNeededFor.copy();
3499      }
3500
3501      @Override
3502      public boolean equalsDeep(Base other_) {
3503        if (!super.equalsDeep(other_))
3504          return false;
3505        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationScheduleComponent))
3506          return false;
3507        NutritionOrderEnteralFormulaAdministrationScheduleComponent o = (NutritionOrderEnteralFormulaAdministrationScheduleComponent) other_;
3508        return compareDeep(timing, o.timing, true) && compareDeep(asNeeded, o.asNeeded, true) && compareDeep(asNeededFor, o.asNeededFor, true)
3509          ;
3510      }
3511
3512      @Override
3513      public boolean equalsShallow(Base other_) {
3514        if (!super.equalsShallow(other_))
3515          return false;
3516        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationScheduleComponent))
3517          return false;
3518        NutritionOrderEnteralFormulaAdministrationScheduleComponent o = (NutritionOrderEnteralFormulaAdministrationScheduleComponent) other_;
3519        return compareValues(asNeeded, o.asNeeded, true);
3520      }
3521
3522      public boolean isEmpty() {
3523        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(timing, asNeeded, asNeededFor
3524          );
3525      }
3526
3527  public String fhirType() {
3528    return "NutritionOrder.enteralFormula.administration.schedule";
3529
3530  }
3531
3532  }
3533
3534    /**
3535     * Identifiers assigned to this order by the order sender or by the order receiver.
3536     */
3537    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3538    @Description(shortDefinition="Identifiers assigned to this order", formalDefinition="Identifiers assigned to this order by the order sender or by the order receiver." )
3539    protected List<Identifier> identifier;
3540
3541    /**
3542     * The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
3543     */
3544    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3545    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
3546    protected List<CanonicalType> instantiatesCanonical;
3547
3548    /**
3549     * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
3550     */
3551    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3552    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
3553    protected List<UriType> instantiatesUri;
3554
3555    /**
3556     * The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
3557     */
3558    @Child(name = "instantiates", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3559    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
3560    protected List<UriType> instantiates;
3561
3562    /**
3563     * A plan or request that is fulfilled in whole or in part by this nutrition order.
3564     */
3565    @Child(name = "basedOn", type = {CarePlan.class, NutritionOrder.class, ServiceRequest.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3566    @Description(shortDefinition="What this order fulfills", formalDefinition="A plan or request that is fulfilled in whole or in part by this nutrition order." )
3567    protected List<Reference> basedOn;
3568
3569    /**
3570     * The workflow status of the nutrition order/request.
3571     */
3572    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
3573    @Description(shortDefinition="draft | active | on-hold | revoked | completed | entered-in-error | unknown", formalDefinition="The workflow status of the nutrition order/request." )
3574    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
3575    protected Enumeration<RequestStatus> status;
3576
3577    /**
3578     * Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
3579     */
3580    @Child(name = "intent", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
3581    @Description(shortDefinition="proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition="Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain." )
3582    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-intent")
3583    protected Enumeration<RequestIntent> intent;
3584
3585    /**
3586     * Indicates how quickly the Nutrition Order should be addressed with respect to other        requests.
3587     */
3588    @Child(name = "priority", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=false)
3589    @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the Nutrition Order should be addressed with respect to other        requests." )
3590    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
3591    protected Enumeration<RequestPriority> priority;
3592
3593    /**
3594     * The person or set of individuals who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.
3595     */
3596    @Child(name = "subject", type = {Patient.class, Group.class}, order=8, min=1, max=1, modifier=false, summary=true)
3597    @Description(shortDefinition="Who requires the diet, formula or nutritional supplement", formalDefinition="The person or set of individuals who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding." )
3598    protected Reference subject;
3599
3600    /**
3601     * An encounter that provides additional information about the healthcare context in which this request is made.
3602     */
3603    @Child(name = "encounter", type = {Encounter.class}, order=9, min=0, max=1, modifier=false, summary=false)
3604    @Description(shortDefinition="The encounter associated with this nutrition order", formalDefinition="An encounter that provides additional information about the healthcare context in which this request is made." )
3605    protected Reference encounter;
3606
3607    /**
3608     * Information to support fulfilling (i.e. dispensing or administering) of the nutrition,        for example, patient height and weight).
3609     */
3610    @Child(name = "supportingInformation", type = {Reference.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3611    @Description(shortDefinition="Information to support fulfilling of the nutrition order", formalDefinition="Information to support fulfilling (i.e. dispensing or administering) of the nutrition,        for example, patient height and weight)." )
3612    protected List<Reference> supportingInformation;
3613
3614    /**
3615     * The date and time that this nutrition order was requested.
3616     */
3617    @Child(name = "dateTime", type = {DateTimeType.class}, order=11, min=1, max=1, modifier=false, summary=true)
3618    @Description(shortDefinition="Date and time the nutrition order was requested", formalDefinition="The date and time that this nutrition order was requested." )
3619    protected DateTimeType dateTime;
3620
3621    /**
3622     * The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.
3623     */
3624    @Child(name = "orderer", type = {Practitioner.class, PractitionerRole.class}, order=12, min=0, max=1, modifier=false, summary=true)
3625    @Description(shortDefinition="Who ordered the diet, formula or nutritional supplement", formalDefinition="The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings." )
3626    protected Reference orderer;
3627
3628    /**
3629     * The specified desired performer of the nutrition order.
3630     */
3631    @Child(name = "performer", type = {CodeableReference.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3632    @Description(shortDefinition="Who is desired to perform the administration of what is being ordered", formalDefinition="The specified desired performer of the nutrition order." )
3633    protected List<CodeableReference> performer;
3634
3635    /**
3636     * A link to a record of allergies or intolerances  which should be included in the nutrition order.
3637     */
3638    @Child(name = "allergyIntolerance", type = {AllergyIntolerance.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3639    @Description(shortDefinition="List of the patient's food and nutrition-related allergies and intolerances", formalDefinition="A link to a record of allergies or intolerances  which should be included in the nutrition order." )
3640    protected List<Reference> allergyIntolerance;
3641
3642    /**
3643     * This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.
3644     */
3645    @Child(name = "foodPreferenceModifier", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3646    @Description(shortDefinition="Order-specific modifier about the type of food that should be given", formalDefinition="This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings." )
3647    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-diet")
3648    protected List<CodeableConcept> foodPreferenceModifier;
3649
3650    /**
3651     * This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.
3652     */
3653    @Child(name = "excludeFoodModifier", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3654    @Description(shortDefinition="Order-specific modifier about the type of food that should not be given", formalDefinition="This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings." )
3655    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/food-type")
3656    protected List<CodeableConcept> excludeFoodModifier;
3657
3658    /**
3659     * This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item.
3660     */
3661    @Child(name = "outsideFoodAllowed", type = {BooleanType.class}, order=17, min=0, max=1, modifier=false, summary=false)
3662    @Description(shortDefinition="Capture when a food item is brought in by the patient and/or family", formalDefinition="This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item." )
3663    protected BooleanType outsideFoodAllowed;
3664
3665    /**
3666     * Diet given orally in contrast to enteral (tube) feeding.
3667     */
3668    @Child(name = "oralDiet", type = {}, order=18, min=0, max=1, modifier=false, summary=false)
3669    @Description(shortDefinition="Oral diet components", formalDefinition="Diet given orally in contrast to enteral (tube) feeding." )
3670    protected NutritionOrderOralDietComponent oralDiet;
3671
3672    /**
3673     * Oral nutritional products given in order to add further nutritional value to the patient's diet.
3674     */
3675    @Child(name = "supplement", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3676    @Description(shortDefinition="Supplement components", formalDefinition="Oral nutritional products given in order to add further nutritional value to the patient's diet." )
3677    protected List<NutritionOrderSupplementComponent> supplement;
3678
3679    /**
3680     * Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.
3681     */
3682    @Child(name = "enteralFormula", type = {}, order=20, min=0, max=1, modifier=false, summary=false)
3683    @Description(shortDefinition="Enteral formula components", formalDefinition="Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity." )
3684    protected NutritionOrderEnteralFormulaComponent enteralFormula;
3685
3686    /**
3687     * Comments made about the nutrition order by the requester, performer, subject or other participants.
3688     */
3689    @Child(name = "note", type = {Annotation.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3690    @Description(shortDefinition="Comments", formalDefinition="Comments made about the nutrition order by the requester, performer, subject or other participants." )
3691    protected List<Annotation> note;
3692
3693    private static final long serialVersionUID = 1579586862L;
3694
3695  /**
3696   * Constructor
3697   */
3698    public NutritionOrder() {
3699      super();
3700    }
3701
3702  /**
3703   * Constructor
3704   */
3705    public NutritionOrder(RequestStatus status, RequestIntent intent, Reference subject, Date dateTime) {
3706      super();
3707      this.setStatus(status);
3708      this.setIntent(intent);
3709      this.setSubject(subject);
3710      this.setDateTime(dateTime);
3711    }
3712
3713    /**
3714     * @return {@link #identifier} (Identifiers assigned to this order by the order sender or by the order receiver.)
3715     */
3716    public List<Identifier> getIdentifier() { 
3717      if (this.identifier == null)
3718        this.identifier = new ArrayList<Identifier>();
3719      return this.identifier;
3720    }
3721
3722    /**
3723     * @return Returns a reference to <code>this</code> for easy method chaining
3724     */
3725    public NutritionOrder setIdentifier(List<Identifier> theIdentifier) { 
3726      this.identifier = theIdentifier;
3727      return this;
3728    }
3729
3730    public boolean hasIdentifier() { 
3731      if (this.identifier == null)
3732        return false;
3733      for (Identifier item : this.identifier)
3734        if (!item.isEmpty())
3735          return true;
3736      return false;
3737    }
3738
3739    public Identifier addIdentifier() { //3
3740      Identifier t = new Identifier();
3741      if (this.identifier == null)
3742        this.identifier = new ArrayList<Identifier>();
3743      this.identifier.add(t);
3744      return t;
3745    }
3746
3747    public NutritionOrder addIdentifier(Identifier t) { //3
3748      if (t == null)
3749        return this;
3750      if (this.identifier == null)
3751        this.identifier = new ArrayList<Identifier>();
3752      this.identifier.add(t);
3753      return this;
3754    }
3755
3756    /**
3757     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
3758     */
3759    public Identifier getIdentifierFirstRep() { 
3760      if (getIdentifier().isEmpty()) {
3761        addIdentifier();
3762      }
3763      return getIdentifier().get(0);
3764    }
3765
3766    /**
3767     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3768     */
3769    public List<CanonicalType> getInstantiatesCanonical() { 
3770      if (this.instantiatesCanonical == null)
3771        this.instantiatesCanonical = new ArrayList<CanonicalType>();
3772      return this.instantiatesCanonical;
3773    }
3774
3775    /**
3776     * @return Returns a reference to <code>this</code> for easy method chaining
3777     */
3778    public NutritionOrder setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
3779      this.instantiatesCanonical = theInstantiatesCanonical;
3780      return this;
3781    }
3782
3783    public boolean hasInstantiatesCanonical() { 
3784      if (this.instantiatesCanonical == null)
3785        return false;
3786      for (CanonicalType item : this.instantiatesCanonical)
3787        if (!item.isEmpty())
3788          return true;
3789      return false;
3790    }
3791
3792    /**
3793     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3794     */
3795    public CanonicalType addInstantiatesCanonicalElement() {//2 
3796      CanonicalType t = new CanonicalType();
3797      if (this.instantiatesCanonical == null)
3798        this.instantiatesCanonical = new ArrayList<CanonicalType>();
3799      this.instantiatesCanonical.add(t);
3800      return t;
3801    }
3802
3803    /**
3804     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3805     */
3806    public NutritionOrder addInstantiatesCanonical(String value) { //1
3807      CanonicalType t = new CanonicalType();
3808      t.setValue(value);
3809      if (this.instantiatesCanonical == null)
3810        this.instantiatesCanonical = new ArrayList<CanonicalType>();
3811      this.instantiatesCanonical.add(t);
3812      return this;
3813    }
3814
3815    /**
3816     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3817     */
3818    public boolean hasInstantiatesCanonical(String value) { 
3819      if (this.instantiatesCanonical == null)
3820        return false;
3821      for (CanonicalType v : this.instantiatesCanonical)
3822        if (v.getValue().equals(value)) // canonical
3823          return true;
3824      return false;
3825    }
3826
3827    /**
3828     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3829     */
3830    public List<UriType> getInstantiatesUri() { 
3831      if (this.instantiatesUri == null)
3832        this.instantiatesUri = new ArrayList<UriType>();
3833      return this.instantiatesUri;
3834    }
3835
3836    /**
3837     * @return Returns a reference to <code>this</code> for easy method chaining
3838     */
3839    public NutritionOrder setInstantiatesUri(List<UriType> theInstantiatesUri) { 
3840      this.instantiatesUri = theInstantiatesUri;
3841      return this;
3842    }
3843
3844    public boolean hasInstantiatesUri() { 
3845      if (this.instantiatesUri == null)
3846        return false;
3847      for (UriType item : this.instantiatesUri)
3848        if (!item.isEmpty())
3849          return true;
3850      return false;
3851    }
3852
3853    /**
3854     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3855     */
3856    public UriType addInstantiatesUriElement() {//2 
3857      UriType t = new UriType();
3858      if (this.instantiatesUri == null)
3859        this.instantiatesUri = new ArrayList<UriType>();
3860      this.instantiatesUri.add(t);
3861      return t;
3862    }
3863
3864    /**
3865     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3866     */
3867    public NutritionOrder addInstantiatesUri(String value) { //1
3868      UriType t = new UriType();
3869      t.setValue(value);
3870      if (this.instantiatesUri == null)
3871        this.instantiatesUri = new ArrayList<UriType>();
3872      this.instantiatesUri.add(t);
3873      return this;
3874    }
3875
3876    /**
3877     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3878     */
3879    public boolean hasInstantiatesUri(String value) { 
3880      if (this.instantiatesUri == null)
3881        return false;
3882      for (UriType v : this.instantiatesUri)
3883        if (v.getValue().equals(value)) // uri
3884          return true;
3885      return false;
3886    }
3887
3888    /**
3889     * @return {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3890     */
3891    public List<UriType> getInstantiates() { 
3892      if (this.instantiates == null)
3893        this.instantiates = new ArrayList<UriType>();
3894      return this.instantiates;
3895    }
3896
3897    /**
3898     * @return Returns a reference to <code>this</code> for easy method chaining
3899     */
3900    public NutritionOrder setInstantiates(List<UriType> theInstantiates) { 
3901      this.instantiates = theInstantiates;
3902      return this;
3903    }
3904
3905    public boolean hasInstantiates() { 
3906      if (this.instantiates == null)
3907        return false;
3908      for (UriType item : this.instantiates)
3909        if (!item.isEmpty())
3910          return true;
3911      return false;
3912    }
3913
3914    /**
3915     * @return {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3916     */
3917    public UriType addInstantiatesElement() {//2 
3918      UriType t = new UriType();
3919      if (this.instantiates == null)
3920        this.instantiates = new ArrayList<UriType>();
3921      this.instantiates.add(t);
3922      return t;
3923    }
3924
3925    /**
3926     * @param value {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3927     */
3928    public NutritionOrder addInstantiates(String value) { //1
3929      UriType t = new UriType();
3930      t.setValue(value);
3931      if (this.instantiates == null)
3932        this.instantiates = new ArrayList<UriType>();
3933      this.instantiates.add(t);
3934      return this;
3935    }
3936
3937    /**
3938     * @param value {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3939     */
3940    public boolean hasInstantiates(String value) { 
3941      if (this.instantiates == null)
3942        return false;
3943      for (UriType v : this.instantiates)
3944        if (v.getValue().equals(value)) // uri
3945          return true;
3946      return false;
3947    }
3948
3949    /**
3950     * @return {@link #basedOn} (A plan or request that is fulfilled in whole or in part by this nutrition order.)
3951     */
3952    public List<Reference> getBasedOn() { 
3953      if (this.basedOn == null)
3954        this.basedOn = new ArrayList<Reference>();
3955      return this.basedOn;
3956    }
3957
3958    /**
3959     * @return Returns a reference to <code>this</code> for easy method chaining
3960     */
3961    public NutritionOrder setBasedOn(List<Reference> theBasedOn) { 
3962      this.basedOn = theBasedOn;
3963      return this;
3964    }
3965
3966    public boolean hasBasedOn() { 
3967      if (this.basedOn == null)
3968        return false;
3969      for (Reference item : this.basedOn)
3970        if (!item.isEmpty())
3971          return true;
3972      return false;
3973    }
3974
3975    public Reference addBasedOn() { //3
3976      Reference t = new Reference();
3977      if (this.basedOn == null)
3978        this.basedOn = new ArrayList<Reference>();
3979      this.basedOn.add(t);
3980      return t;
3981    }
3982
3983    public NutritionOrder addBasedOn(Reference t) { //3
3984      if (t == null)
3985        return this;
3986      if (this.basedOn == null)
3987        this.basedOn = new ArrayList<Reference>();
3988      this.basedOn.add(t);
3989      return this;
3990    }
3991
3992    /**
3993     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist {3}
3994     */
3995    public Reference getBasedOnFirstRep() { 
3996      if (getBasedOn().isEmpty()) {
3997        addBasedOn();
3998      }
3999      return getBasedOn().get(0);
4000    }
4001
4002    /**
4003     * @return {@link #status} (The workflow status of the nutrition order/request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4004     */
4005    public Enumeration<RequestStatus> getStatusElement() { 
4006      if (this.status == null)
4007        if (Configuration.errorOnAutoCreate())
4008          throw new Error("Attempt to auto-create NutritionOrder.status");
4009        else if (Configuration.doAutoCreate())
4010          this.status = new Enumeration<RequestStatus>(new RequestStatusEnumFactory()); // bb
4011      return this.status;
4012    }
4013
4014    public boolean hasStatusElement() { 
4015      return this.status != null && !this.status.isEmpty();
4016    }
4017
4018    public boolean hasStatus() { 
4019      return this.status != null && !this.status.isEmpty();
4020    }
4021
4022    /**
4023     * @param value {@link #status} (The workflow status of the nutrition order/request.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4024     */
4025    public NutritionOrder setStatusElement(Enumeration<RequestStatus> value) { 
4026      this.status = value;
4027      return this;
4028    }
4029
4030    /**
4031     * @return The workflow status of the nutrition order/request.
4032     */
4033    public RequestStatus getStatus() { 
4034      return this.status == null ? null : this.status.getValue();
4035    }
4036
4037    /**
4038     * @param value The workflow status of the nutrition order/request.
4039     */
4040    public NutritionOrder setStatus(RequestStatus value) { 
4041        if (this.status == null)
4042          this.status = new Enumeration<RequestStatus>(new RequestStatusEnumFactory());
4043        this.status.setValue(value);
4044      return this;
4045    }
4046
4047    /**
4048     * @return {@link #intent} (Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
4049     */
4050    public Enumeration<RequestIntent> getIntentElement() { 
4051      if (this.intent == null)
4052        if (Configuration.errorOnAutoCreate())
4053          throw new Error("Attempt to auto-create NutritionOrder.intent");
4054        else if (Configuration.doAutoCreate())
4055          this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory()); // bb
4056      return this.intent;
4057    }
4058
4059    public boolean hasIntentElement() { 
4060      return this.intent != null && !this.intent.isEmpty();
4061    }
4062
4063    public boolean hasIntent() { 
4064      return this.intent != null && !this.intent.isEmpty();
4065    }
4066
4067    /**
4068     * @param value {@link #intent} (Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
4069     */
4070    public NutritionOrder setIntentElement(Enumeration<RequestIntent> value) { 
4071      this.intent = value;
4072      return this;
4073    }
4074
4075    /**
4076     * @return Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
4077     */
4078    public RequestIntent getIntent() { 
4079      return this.intent == null ? null : this.intent.getValue();
4080    }
4081
4082    /**
4083     * @param value Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
4084     */
4085    public NutritionOrder setIntent(RequestIntent value) { 
4086        if (this.intent == null)
4087          this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory());
4088        this.intent.setValue(value);
4089      return this;
4090    }
4091
4092    /**
4093     * @return {@link #priority} (Indicates how quickly the Nutrition Order should be addressed with respect to other        requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
4094     */
4095    public Enumeration<RequestPriority> getPriorityElement() { 
4096      if (this.priority == null)
4097        if (Configuration.errorOnAutoCreate())
4098          throw new Error("Attempt to auto-create NutritionOrder.priority");
4099        else if (Configuration.doAutoCreate())
4100          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
4101      return this.priority;
4102    }
4103
4104    public boolean hasPriorityElement() { 
4105      return this.priority != null && !this.priority.isEmpty();
4106    }
4107
4108    public boolean hasPriority() { 
4109      return this.priority != null && !this.priority.isEmpty();
4110    }
4111
4112    /**
4113     * @param value {@link #priority} (Indicates how quickly the Nutrition Order should be addressed with respect to other        requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
4114     */
4115    public NutritionOrder setPriorityElement(Enumeration<RequestPriority> value) { 
4116      this.priority = value;
4117      return this;
4118    }
4119
4120    /**
4121     * @return Indicates how quickly the Nutrition Order should be addressed with respect to other        requests.
4122     */
4123    public RequestPriority getPriority() { 
4124      return this.priority == null ? null : this.priority.getValue();
4125    }
4126
4127    /**
4128     * @param value Indicates how quickly the Nutrition Order should be addressed with respect to other        requests.
4129     */
4130    public NutritionOrder setPriority(RequestPriority value) { 
4131      if (value == null)
4132        this.priority = null;
4133      else {
4134        if (this.priority == null)
4135          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
4136        this.priority.setValue(value);
4137      }
4138      return this;
4139    }
4140
4141    /**
4142     * @return {@link #subject} (The person or set of individuals who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
4143     */
4144    public Reference getSubject() { 
4145      if (this.subject == null)
4146        if (Configuration.errorOnAutoCreate())
4147          throw new Error("Attempt to auto-create NutritionOrder.subject");
4148        else if (Configuration.doAutoCreate())
4149          this.subject = new Reference(); // cc
4150      return this.subject;
4151    }
4152
4153    public boolean hasSubject() { 
4154      return this.subject != null && !this.subject.isEmpty();
4155    }
4156
4157    /**
4158     * @param value {@link #subject} (The person or set of individuals who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
4159     */
4160    public NutritionOrder setSubject(Reference value) { 
4161      this.subject = value;
4162      return this;
4163    }
4164
4165    /**
4166     * @return {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
4167     */
4168    public Reference getEncounter() { 
4169      if (this.encounter == null)
4170        if (Configuration.errorOnAutoCreate())
4171          throw new Error("Attempt to auto-create NutritionOrder.encounter");
4172        else if (Configuration.doAutoCreate())
4173          this.encounter = new Reference(); // cc
4174      return this.encounter;
4175    }
4176
4177    public boolean hasEncounter() { 
4178      return this.encounter != null && !this.encounter.isEmpty();
4179    }
4180
4181    /**
4182     * @param value {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
4183     */
4184    public NutritionOrder setEncounter(Reference value) { 
4185      this.encounter = value;
4186      return this;
4187    }
4188
4189    /**
4190     * @return {@link #supportingInformation} (Information to support fulfilling (i.e. dispensing or administering) of the nutrition,        for example, patient height and weight).)
4191     */
4192    public List<Reference> getSupportingInformation() { 
4193      if (this.supportingInformation == null)
4194        this.supportingInformation = new ArrayList<Reference>();
4195      return this.supportingInformation;
4196    }
4197
4198    /**
4199     * @return Returns a reference to <code>this</code> for easy method chaining
4200     */
4201    public NutritionOrder setSupportingInformation(List<Reference> theSupportingInformation) { 
4202      this.supportingInformation = theSupportingInformation;
4203      return this;
4204    }
4205
4206    public boolean hasSupportingInformation() { 
4207      if (this.supportingInformation == null)
4208        return false;
4209      for (Reference item : this.supportingInformation)
4210        if (!item.isEmpty())
4211          return true;
4212      return false;
4213    }
4214
4215    public Reference addSupportingInformation() { //3
4216      Reference t = new Reference();
4217      if (this.supportingInformation == null)
4218        this.supportingInformation = new ArrayList<Reference>();
4219      this.supportingInformation.add(t);
4220      return t;
4221    }
4222
4223    public NutritionOrder addSupportingInformation(Reference t) { //3
4224      if (t == null)
4225        return this;
4226      if (this.supportingInformation == null)
4227        this.supportingInformation = new ArrayList<Reference>();
4228      this.supportingInformation.add(t);
4229      return this;
4230    }
4231
4232    /**
4233     * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist {3}
4234     */
4235    public Reference getSupportingInformationFirstRep() { 
4236      if (getSupportingInformation().isEmpty()) {
4237        addSupportingInformation();
4238      }
4239      return getSupportingInformation().get(0);
4240    }
4241
4242    /**
4243     * @return {@link #dateTime} (The date and time that this nutrition order was requested.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
4244     */
4245    public DateTimeType getDateTimeElement() { 
4246      if (this.dateTime == null)
4247        if (Configuration.errorOnAutoCreate())
4248          throw new Error("Attempt to auto-create NutritionOrder.dateTime");
4249        else if (Configuration.doAutoCreate())
4250          this.dateTime = new DateTimeType(); // bb
4251      return this.dateTime;
4252    }
4253
4254    public boolean hasDateTimeElement() { 
4255      return this.dateTime != null && !this.dateTime.isEmpty();
4256    }
4257
4258    public boolean hasDateTime() { 
4259      return this.dateTime != null && !this.dateTime.isEmpty();
4260    }
4261
4262    /**
4263     * @param value {@link #dateTime} (The date and time that this nutrition order was requested.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
4264     */
4265    public NutritionOrder setDateTimeElement(DateTimeType value) { 
4266      this.dateTime = value;
4267      return this;
4268    }
4269
4270    /**
4271     * @return The date and time that this nutrition order was requested.
4272     */
4273    public Date getDateTime() { 
4274      return this.dateTime == null ? null : this.dateTime.getValue();
4275    }
4276
4277    /**
4278     * @param value The date and time that this nutrition order was requested.
4279     */
4280    public NutritionOrder setDateTime(Date value) { 
4281        if (this.dateTime == null)
4282          this.dateTime = new DateTimeType();
4283        this.dateTime.setValue(value);
4284      return this;
4285    }
4286
4287    /**
4288     * @return {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
4289     */
4290    public Reference getOrderer() { 
4291      if (this.orderer == null)
4292        if (Configuration.errorOnAutoCreate())
4293          throw new Error("Attempt to auto-create NutritionOrder.orderer");
4294        else if (Configuration.doAutoCreate())
4295          this.orderer = new Reference(); // cc
4296      return this.orderer;
4297    }
4298
4299    public boolean hasOrderer() { 
4300      return this.orderer != null && !this.orderer.isEmpty();
4301    }
4302
4303    /**
4304     * @param value {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
4305     */
4306    public NutritionOrder setOrderer(Reference value) { 
4307      this.orderer = value;
4308      return this;
4309    }
4310
4311    /**
4312     * @return {@link #performer} (The specified desired performer of the nutrition order.)
4313     */
4314    public List<CodeableReference> getPerformer() { 
4315      if (this.performer == null)
4316        this.performer = new ArrayList<CodeableReference>();
4317      return this.performer;
4318    }
4319
4320    /**
4321     * @return Returns a reference to <code>this</code> for easy method chaining
4322     */
4323    public NutritionOrder setPerformer(List<CodeableReference> thePerformer) { 
4324      this.performer = thePerformer;
4325      return this;
4326    }
4327
4328    public boolean hasPerformer() { 
4329      if (this.performer == null)
4330        return false;
4331      for (CodeableReference item : this.performer)
4332        if (!item.isEmpty())
4333          return true;
4334      return false;
4335    }
4336
4337    public CodeableReference addPerformer() { //3
4338      CodeableReference t = new CodeableReference();
4339      if (this.performer == null)
4340        this.performer = new ArrayList<CodeableReference>();
4341      this.performer.add(t);
4342      return t;
4343    }
4344
4345    public NutritionOrder addPerformer(CodeableReference t) { //3
4346      if (t == null)
4347        return this;
4348      if (this.performer == null)
4349        this.performer = new ArrayList<CodeableReference>();
4350      this.performer.add(t);
4351      return this;
4352    }
4353
4354    /**
4355     * @return The first repetition of repeating field {@link #performer}, creating it if it does not already exist {3}
4356     */
4357    public CodeableReference getPerformerFirstRep() { 
4358      if (getPerformer().isEmpty()) {
4359        addPerformer();
4360      }
4361      return getPerformer().get(0);
4362    }
4363
4364    /**
4365     * @return {@link #allergyIntolerance} (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
4366     */
4367    public List<Reference> getAllergyIntolerance() { 
4368      if (this.allergyIntolerance == null)
4369        this.allergyIntolerance = new ArrayList<Reference>();
4370      return this.allergyIntolerance;
4371    }
4372
4373    /**
4374     * @return Returns a reference to <code>this</code> for easy method chaining
4375     */
4376    public NutritionOrder setAllergyIntolerance(List<Reference> theAllergyIntolerance) { 
4377      this.allergyIntolerance = theAllergyIntolerance;
4378      return this;
4379    }
4380
4381    public boolean hasAllergyIntolerance() { 
4382      if (this.allergyIntolerance == null)
4383        return false;
4384      for (Reference item : this.allergyIntolerance)
4385        if (!item.isEmpty())
4386          return true;
4387      return false;
4388    }
4389
4390    public Reference addAllergyIntolerance() { //3
4391      Reference t = new Reference();
4392      if (this.allergyIntolerance == null)
4393        this.allergyIntolerance = new ArrayList<Reference>();
4394      this.allergyIntolerance.add(t);
4395      return t;
4396    }
4397
4398    public NutritionOrder addAllergyIntolerance(Reference t) { //3
4399      if (t == null)
4400        return this;
4401      if (this.allergyIntolerance == null)
4402        this.allergyIntolerance = new ArrayList<Reference>();
4403      this.allergyIntolerance.add(t);
4404      return this;
4405    }
4406
4407    /**
4408     * @return The first repetition of repeating field {@link #allergyIntolerance}, creating it if it does not already exist {3}
4409     */
4410    public Reference getAllergyIntoleranceFirstRep() { 
4411      if (getAllergyIntolerance().isEmpty()) {
4412        addAllergyIntolerance();
4413      }
4414      return getAllergyIntolerance().get(0);
4415    }
4416
4417    /**
4418     * @return {@link #foodPreferenceModifier} (This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.)
4419     */
4420    public List<CodeableConcept> getFoodPreferenceModifier() { 
4421      if (this.foodPreferenceModifier == null)
4422        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4423      return this.foodPreferenceModifier;
4424    }
4425
4426    /**
4427     * @return Returns a reference to <code>this</code> for easy method chaining
4428     */
4429    public NutritionOrder setFoodPreferenceModifier(List<CodeableConcept> theFoodPreferenceModifier) { 
4430      this.foodPreferenceModifier = theFoodPreferenceModifier;
4431      return this;
4432    }
4433
4434    public boolean hasFoodPreferenceModifier() { 
4435      if (this.foodPreferenceModifier == null)
4436        return false;
4437      for (CodeableConcept item : this.foodPreferenceModifier)
4438        if (!item.isEmpty())
4439          return true;
4440      return false;
4441    }
4442
4443    public CodeableConcept addFoodPreferenceModifier() { //3
4444      CodeableConcept t = new CodeableConcept();
4445      if (this.foodPreferenceModifier == null)
4446        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4447      this.foodPreferenceModifier.add(t);
4448      return t;
4449    }
4450
4451    public NutritionOrder addFoodPreferenceModifier(CodeableConcept t) { //3
4452      if (t == null)
4453        return this;
4454      if (this.foodPreferenceModifier == null)
4455        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4456      this.foodPreferenceModifier.add(t);
4457      return this;
4458    }
4459
4460    /**
4461     * @return The first repetition of repeating field {@link #foodPreferenceModifier}, creating it if it does not already exist {3}
4462     */
4463    public CodeableConcept getFoodPreferenceModifierFirstRep() { 
4464      if (getFoodPreferenceModifier().isEmpty()) {
4465        addFoodPreferenceModifier();
4466      }
4467      return getFoodPreferenceModifier().get(0);
4468    }
4469
4470    /**
4471     * @return {@link #excludeFoodModifier} (This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.)
4472     */
4473    public List<CodeableConcept> getExcludeFoodModifier() { 
4474      if (this.excludeFoodModifier == null)
4475        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
4476      return this.excludeFoodModifier;
4477    }
4478
4479    /**
4480     * @return Returns a reference to <code>this</code> for easy method chaining
4481     */
4482    public NutritionOrder setExcludeFoodModifier(List<CodeableConcept> theExcludeFoodModifier) { 
4483      this.excludeFoodModifier = theExcludeFoodModifier;
4484      return this;
4485    }
4486
4487    public boolean hasExcludeFoodModifier() { 
4488      if (this.excludeFoodModifier == null)
4489        return false;
4490      for (CodeableConcept item : this.excludeFoodModifier)
4491        if (!item.isEmpty())
4492          return true;
4493      return false;
4494    }
4495
4496    public CodeableConcept addExcludeFoodModifier() { //3
4497      CodeableConcept t = new CodeableConcept();
4498      if (this.excludeFoodModifier == null)
4499        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
4500      this.excludeFoodModifier.add(t);
4501      return t;
4502    }
4503
4504    public NutritionOrder addExcludeFoodModifier(CodeableConcept t) { //3
4505      if (t == null)
4506        return this;
4507      if (this.excludeFoodModifier == null)
4508        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
4509      this.excludeFoodModifier.add(t);
4510      return this;
4511    }
4512
4513    /**
4514     * @return The first repetition of repeating field {@link #excludeFoodModifier}, creating it if it does not already exist {3}
4515     */
4516    public CodeableConcept getExcludeFoodModifierFirstRep() { 
4517      if (getExcludeFoodModifier().isEmpty()) {
4518        addExcludeFoodModifier();
4519      }
4520      return getExcludeFoodModifier().get(0);
4521    }
4522
4523    /**
4524     * @return {@link #outsideFoodAllowed} (This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item.). This is the underlying object with id, value and extensions. The accessor "getOutsideFoodAllowed" gives direct access to the value
4525     */
4526    public BooleanType getOutsideFoodAllowedElement() { 
4527      if (this.outsideFoodAllowed == null)
4528        if (Configuration.errorOnAutoCreate())
4529          throw new Error("Attempt to auto-create NutritionOrder.outsideFoodAllowed");
4530        else if (Configuration.doAutoCreate())
4531          this.outsideFoodAllowed = new BooleanType(); // bb
4532      return this.outsideFoodAllowed;
4533    }
4534
4535    public boolean hasOutsideFoodAllowedElement() { 
4536      return this.outsideFoodAllowed != null && !this.outsideFoodAllowed.isEmpty();
4537    }
4538
4539    public boolean hasOutsideFoodAllowed() { 
4540      return this.outsideFoodAllowed != null && !this.outsideFoodAllowed.isEmpty();
4541    }
4542
4543    /**
4544     * @param value {@link #outsideFoodAllowed} (This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item.). This is the underlying object with id, value and extensions. The accessor "getOutsideFoodAllowed" gives direct access to the value
4545     */
4546    public NutritionOrder setOutsideFoodAllowedElement(BooleanType value) { 
4547      this.outsideFoodAllowed = value;
4548      return this;
4549    }
4550
4551    /**
4552     * @return This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item.
4553     */
4554    public boolean getOutsideFoodAllowed() { 
4555      return this.outsideFoodAllowed == null || this.outsideFoodAllowed.isEmpty() ? false : this.outsideFoodAllowed.getValue();
4556    }
4557
4558    /**
4559     * @param value This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item.
4560     */
4561    public NutritionOrder setOutsideFoodAllowed(boolean value) { 
4562        if (this.outsideFoodAllowed == null)
4563          this.outsideFoodAllowed = new BooleanType();
4564        this.outsideFoodAllowed.setValue(value);
4565      return this;
4566    }
4567
4568    /**
4569     * @return {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
4570     */
4571    public NutritionOrderOralDietComponent getOralDiet() { 
4572      if (this.oralDiet == null)
4573        if (Configuration.errorOnAutoCreate())
4574          throw new Error("Attempt to auto-create NutritionOrder.oralDiet");
4575        else if (Configuration.doAutoCreate())
4576          this.oralDiet = new NutritionOrderOralDietComponent(); // cc
4577      return this.oralDiet;
4578    }
4579
4580    public boolean hasOralDiet() { 
4581      return this.oralDiet != null && !this.oralDiet.isEmpty();
4582    }
4583
4584    /**
4585     * @param value {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
4586     */
4587    public NutritionOrder setOralDiet(NutritionOrderOralDietComponent value) { 
4588      this.oralDiet = value;
4589      return this;
4590    }
4591
4592    /**
4593     * @return {@link #supplement} (Oral nutritional products given in order to add further nutritional value to the patient's diet.)
4594     */
4595    public List<NutritionOrderSupplementComponent> getSupplement() { 
4596      if (this.supplement == null)
4597        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4598      return this.supplement;
4599    }
4600
4601    /**
4602     * @return Returns a reference to <code>this</code> for easy method chaining
4603     */
4604    public NutritionOrder setSupplement(List<NutritionOrderSupplementComponent> theSupplement) { 
4605      this.supplement = theSupplement;
4606      return this;
4607    }
4608
4609    public boolean hasSupplement() { 
4610      if (this.supplement == null)
4611        return false;
4612      for (NutritionOrderSupplementComponent item : this.supplement)
4613        if (!item.isEmpty())
4614          return true;
4615      return false;
4616    }
4617
4618    public NutritionOrderSupplementComponent addSupplement() { //3
4619      NutritionOrderSupplementComponent t = new NutritionOrderSupplementComponent();
4620      if (this.supplement == null)
4621        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4622      this.supplement.add(t);
4623      return t;
4624    }
4625
4626    public NutritionOrder addSupplement(NutritionOrderSupplementComponent t) { //3
4627      if (t == null)
4628        return this;
4629      if (this.supplement == null)
4630        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4631      this.supplement.add(t);
4632      return this;
4633    }
4634
4635    /**
4636     * @return The first repetition of repeating field {@link #supplement}, creating it if it does not already exist {3}
4637     */
4638    public NutritionOrderSupplementComponent getSupplementFirstRep() { 
4639      if (getSupplement().isEmpty()) {
4640        addSupplement();
4641      }
4642      return getSupplement().get(0);
4643    }
4644
4645    /**
4646     * @return {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
4647     */
4648    public NutritionOrderEnteralFormulaComponent getEnteralFormula() { 
4649      if (this.enteralFormula == null)
4650        if (Configuration.errorOnAutoCreate())
4651          throw new Error("Attempt to auto-create NutritionOrder.enteralFormula");
4652        else if (Configuration.doAutoCreate())
4653          this.enteralFormula = new NutritionOrderEnteralFormulaComponent(); // cc
4654      return this.enteralFormula;
4655    }
4656
4657    public boolean hasEnteralFormula() { 
4658      return this.enteralFormula != null && !this.enteralFormula.isEmpty();
4659    }
4660
4661    /**
4662     * @param value {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
4663     */
4664    public NutritionOrder setEnteralFormula(NutritionOrderEnteralFormulaComponent value) { 
4665      this.enteralFormula = value;
4666      return this;
4667    }
4668
4669    /**
4670     * @return {@link #note} (Comments made about the nutrition order by the requester, performer, subject or other participants.)
4671     */
4672    public List<Annotation> getNote() { 
4673      if (this.note == null)
4674        this.note = new ArrayList<Annotation>();
4675      return this.note;
4676    }
4677
4678    /**
4679     * @return Returns a reference to <code>this</code> for easy method chaining
4680     */
4681    public NutritionOrder setNote(List<Annotation> theNote) { 
4682      this.note = theNote;
4683      return this;
4684    }
4685
4686    public boolean hasNote() { 
4687      if (this.note == null)
4688        return false;
4689      for (Annotation item : this.note)
4690        if (!item.isEmpty())
4691          return true;
4692      return false;
4693    }
4694
4695    public Annotation addNote() { //3
4696      Annotation t = new Annotation();
4697      if (this.note == null)
4698        this.note = new ArrayList<Annotation>();
4699      this.note.add(t);
4700      return t;
4701    }
4702
4703    public NutritionOrder addNote(Annotation t) { //3
4704      if (t == null)
4705        return this;
4706      if (this.note == null)
4707        this.note = new ArrayList<Annotation>();
4708      this.note.add(t);
4709      return this;
4710    }
4711
4712    /**
4713     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
4714     */
4715    public Annotation getNoteFirstRep() { 
4716      if (getNote().isEmpty()) {
4717        addNote();
4718      }
4719      return getNote().get(0);
4720    }
4721
4722      protected void listChildren(List<Property> children) {
4723        super.listChildren(children);
4724        children.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the order sender or by the order receiver.", 0, java.lang.Integer.MAX_VALUE, identifier));
4725        children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
4726        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
4727        children.add(new Property("instantiates", "uri", "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiates));
4728        children.add(new Property("basedOn", "Reference(CarePlan|NutritionOrder|ServiceRequest)", "A plan or request that is fulfilled in whole or in part by this nutrition order.", 0, java.lang.Integer.MAX_VALUE, basedOn));
4729        children.add(new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status));
4730        children.add(new Property("intent", "code", "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.", 0, 1, intent));
4731        children.add(new Property("priority", "code", "Indicates how quickly the Nutrition Order should be addressed with respect to other        requests.", 0, 1, priority));
4732        children.add(new Property("subject", "Reference(Patient|Group)", "The person or set of individuals who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.", 0, 1, subject));
4733        children.add(new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, 1, encounter));
4734        children.add(new Property("supportingInformation", "Reference(Any)", "Information to support fulfilling (i.e. dispensing or administering) of the nutrition,        for example, patient height and weight).", 0, java.lang.Integer.MAX_VALUE, supportingInformation));
4735        children.add(new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, 1, dateTime));
4736        children.add(new Property("orderer", "Reference(Practitioner|PractitionerRole)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, 1, orderer));
4737        children.add(new Property("performer", "CodeableReference(CareTeam|Practitioner|PractitionerRole|RelatedPerson|Patient|Organization)", "The specified desired performer of the nutrition order.", 0, java.lang.Integer.MAX_VALUE, performer));
4738        children.add(new Property("allergyIntolerance", "Reference(AllergyIntolerance)", "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0, java.lang.Integer.MAX_VALUE, allergyIntolerance));
4739        children.add(new Property("foodPreferenceModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier));
4740        children.add(new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, excludeFoodModifier));
4741        children.add(new Property("outsideFoodAllowed", "boolean", "This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item.", 0, 1, outsideFoodAllowed));
4742        children.add(new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet));
4743        children.add(new Property("supplement", "", "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0, java.lang.Integer.MAX_VALUE, supplement));
4744        children.add(new Property("enteralFormula", "", "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.", 0, 1, enteralFormula));
4745        children.add(new Property("note", "Annotation", "Comments made about the nutrition order by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
4746      }
4747
4748      @Override
4749      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4750        switch (_hash) {
4751        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers assigned to this order by the order sender or by the order receiver.", 0, java.lang.Integer.MAX_VALUE, identifier);
4752        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
4753        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
4754        case -246883639: /*instantiates*/  return new Property("instantiates", "uri", "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiates);
4755        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(CarePlan|NutritionOrder|ServiceRequest)", "A plan or request that is fulfilled in whole or in part by this nutrition order.", 0, java.lang.Integer.MAX_VALUE, basedOn);
4756        case -892481550: /*status*/  return new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status);
4757        case -1183762788: /*intent*/  return new Property("intent", "code", "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.", 0, 1, intent);
4758        case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the Nutrition Order should be addressed with respect to other        requests.", 0, 1, priority);
4759        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The person or set of individuals who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.", 0, 1, subject);
4760        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, 1, encounter);
4761        case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "Reference(Any)", "Information to support fulfilling (i.e. dispensing or administering) of the nutrition,        for example, patient height and weight).", 0, java.lang.Integer.MAX_VALUE, supportingInformation);
4762        case 1792749467: /*dateTime*/  return new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, 1, dateTime);
4763        case -1207109509: /*orderer*/  return new Property("orderer", "Reference(Practitioner|PractitionerRole)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, 1, orderer);
4764        case 481140686: /*performer*/  return new Property("performer", "CodeableReference(CareTeam|Practitioner|PractitionerRole|RelatedPerson|Patient|Organization)", "The specified desired performer of the nutrition order.", 0, java.lang.Integer.MAX_VALUE, performer);
4765        case -120164120: /*allergyIntolerance*/  return new Property("allergyIntolerance", "Reference(AllergyIntolerance)", "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0, java.lang.Integer.MAX_VALUE, allergyIntolerance);
4766        case 659473872: /*foodPreferenceModifier*/  return new Property("foodPreferenceModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier);
4767        case 1760260175: /*excludeFoodModifier*/  return new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, excludeFoodModifier);
4768        case 833777797: /*outsideFoodAllowed*/  return new Property("outsideFoodAllowed", "boolean", "This modifier is used to convey whether a food item is allowed to be brought in by the patient and/or family.  If set to true, indicates that the receiving system does not need to supply the food item.", 0, 1, outsideFoodAllowed);
4769        case 1153521250: /*oralDiet*/  return new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet);
4770        case -711993159: /*supplement*/  return new Property("supplement", "", "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0, java.lang.Integer.MAX_VALUE, supplement);
4771        case -671083805: /*enteralFormula*/  return new Property("enteralFormula", "", "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.", 0, 1, enteralFormula);
4772        case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the nutrition order by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
4773        default: return super.getNamedProperty(_hash, _name, _checkValid);
4774        }
4775
4776      }
4777
4778      @Override
4779      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4780        switch (hash) {
4781        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4782        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
4783        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
4784        case -246883639: /*instantiates*/ return this.instantiates == null ? new Base[0] : this.instantiates.toArray(new Base[this.instantiates.size()]); // UriType
4785        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
4786        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<RequestStatus>
4787        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<RequestIntent>
4788        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
4789        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
4790        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
4791        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference
4792        case 1792749467: /*dateTime*/ return this.dateTime == null ? new Base[0] : new Base[] {this.dateTime}; // DateTimeType
4793        case -1207109509: /*orderer*/ return this.orderer == null ? new Base[0] : new Base[] {this.orderer}; // Reference
4794        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : this.performer.toArray(new Base[this.performer.size()]); // CodeableReference
4795        case -120164120: /*allergyIntolerance*/ return this.allergyIntolerance == null ? new Base[0] : this.allergyIntolerance.toArray(new Base[this.allergyIntolerance.size()]); // Reference
4796        case 659473872: /*foodPreferenceModifier*/ return this.foodPreferenceModifier == null ? new Base[0] : this.foodPreferenceModifier.toArray(new Base[this.foodPreferenceModifier.size()]); // CodeableConcept
4797        case 1760260175: /*excludeFoodModifier*/ return this.excludeFoodModifier == null ? new Base[0] : this.excludeFoodModifier.toArray(new Base[this.excludeFoodModifier.size()]); // CodeableConcept
4798        case 833777797: /*outsideFoodAllowed*/ return this.outsideFoodAllowed == null ? new Base[0] : new Base[] {this.outsideFoodAllowed}; // BooleanType
4799        case 1153521250: /*oralDiet*/ return this.oralDiet == null ? new Base[0] : new Base[] {this.oralDiet}; // NutritionOrderOralDietComponent
4800        case -711993159: /*supplement*/ return this.supplement == null ? new Base[0] : this.supplement.toArray(new Base[this.supplement.size()]); // NutritionOrderSupplementComponent
4801        case -671083805: /*enteralFormula*/ return this.enteralFormula == null ? new Base[0] : new Base[] {this.enteralFormula}; // NutritionOrderEnteralFormulaComponent
4802        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
4803        default: return super.getProperty(hash, name, checkValid);
4804        }
4805
4806      }
4807
4808      @Override
4809      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4810        switch (hash) {
4811        case -1618432855: // identifier
4812          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
4813          return value;
4814        case 8911915: // instantiatesCanonical
4815          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value)); // CanonicalType
4816          return value;
4817        case -1926393373: // instantiatesUri
4818          this.getInstantiatesUri().add(TypeConvertor.castToUri(value)); // UriType
4819          return value;
4820        case -246883639: // instantiates
4821          this.getInstantiates().add(TypeConvertor.castToUri(value)); // UriType
4822          return value;
4823        case -332612366: // basedOn
4824          this.getBasedOn().add(TypeConvertor.castToReference(value)); // Reference
4825          return value;
4826        case -892481550: // status
4827          value = new RequestStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
4828          this.status = (Enumeration) value; // Enumeration<RequestStatus>
4829          return value;
4830        case -1183762788: // intent
4831          value = new RequestIntentEnumFactory().fromType(TypeConvertor.castToCode(value));
4832          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
4833          return value;
4834        case -1165461084: // priority
4835          value = new RequestPriorityEnumFactory().fromType(TypeConvertor.castToCode(value));
4836          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
4837          return value;
4838        case -1867885268: // subject
4839          this.subject = TypeConvertor.castToReference(value); // Reference
4840          return value;
4841        case 1524132147: // encounter
4842          this.encounter = TypeConvertor.castToReference(value); // Reference
4843          return value;
4844        case -1248768647: // supportingInformation
4845          this.getSupportingInformation().add(TypeConvertor.castToReference(value)); // Reference
4846          return value;
4847        case 1792749467: // dateTime
4848          this.dateTime = TypeConvertor.castToDateTime(value); // DateTimeType
4849          return value;
4850        case -1207109509: // orderer
4851          this.orderer = TypeConvertor.castToReference(value); // Reference
4852          return value;
4853        case 481140686: // performer
4854          this.getPerformer().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference
4855          return value;
4856        case -120164120: // allergyIntolerance
4857          this.getAllergyIntolerance().add(TypeConvertor.castToReference(value)); // Reference
4858          return value;
4859        case 659473872: // foodPreferenceModifier
4860          this.getFoodPreferenceModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4861          return value;
4862        case 1760260175: // excludeFoodModifier
4863          this.getExcludeFoodModifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4864          return value;
4865        case 833777797: // outsideFoodAllowed
4866          this.outsideFoodAllowed = TypeConvertor.castToBoolean(value); // BooleanType
4867          return value;
4868        case 1153521250: // oralDiet
4869          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
4870          return value;
4871        case -711993159: // supplement
4872          this.getSupplement().add((NutritionOrderSupplementComponent) value); // NutritionOrderSupplementComponent
4873          return value;
4874        case -671083805: // enteralFormula
4875          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
4876          return value;
4877        case 3387378: // note
4878          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
4879          return value;
4880        default: return super.setProperty(hash, name, value);
4881        }
4882
4883      }
4884
4885      @Override
4886      public Base setProperty(String name, Base value) throws FHIRException {
4887        if (name.equals("identifier")) {
4888          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
4889        } else if (name.equals("instantiatesCanonical")) {
4890          this.getInstantiatesCanonical().add(TypeConvertor.castToCanonical(value));
4891        } else if (name.equals("instantiatesUri")) {
4892          this.getInstantiatesUri().add(TypeConvertor.castToUri(value));
4893        } else if (name.equals("instantiates")) {
4894          this.getInstantiates().add(TypeConvertor.castToUri(value));
4895        } else if (name.equals("basedOn")) {
4896          this.getBasedOn().add(TypeConvertor.castToReference(value));
4897        } else if (name.equals("status")) {
4898          value = new RequestStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
4899          this.status = (Enumeration) value; // Enumeration<RequestStatus>
4900        } else if (name.equals("intent")) {
4901          value = new RequestIntentEnumFactory().fromType(TypeConvertor.castToCode(value));
4902          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
4903        } else if (name.equals("priority")) {
4904          value = new RequestPriorityEnumFactory().fromType(TypeConvertor.castToCode(value));
4905          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
4906        } else if (name.equals("subject")) {
4907          this.subject = TypeConvertor.castToReference(value); // Reference
4908        } else if (name.equals("encounter")) {
4909          this.encounter = TypeConvertor.castToReference(value); // Reference
4910        } else if (name.equals("supportingInformation")) {
4911          this.getSupportingInformation().add(TypeConvertor.castToReference(value));
4912        } else if (name.equals("dateTime")) {
4913          this.dateTime = TypeConvertor.castToDateTime(value); // DateTimeType
4914        } else if (name.equals("orderer")) {
4915          this.orderer = TypeConvertor.castToReference(value); // Reference
4916        } else if (name.equals("performer")) {
4917          this.getPerformer().add(TypeConvertor.castToCodeableReference(value));
4918        } else if (name.equals("allergyIntolerance")) {
4919          this.getAllergyIntolerance().add(TypeConvertor.castToReference(value));
4920        } else if (name.equals("foodPreferenceModifier")) {
4921          this.getFoodPreferenceModifier().add(TypeConvertor.castToCodeableConcept(value));
4922        } else if (name.equals("excludeFoodModifier")) {
4923          this.getExcludeFoodModifier().add(TypeConvertor.castToCodeableConcept(value));
4924        } else if (name.equals("outsideFoodAllowed")) {
4925          this.outsideFoodAllowed = TypeConvertor.castToBoolean(value); // BooleanType
4926        } else if (name.equals("oralDiet")) {
4927          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
4928        } else if (name.equals("supplement")) {
4929          this.getSupplement().add((NutritionOrderSupplementComponent) value);
4930        } else if (name.equals("enteralFormula")) {
4931          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
4932        } else if (name.equals("note")) {
4933          this.getNote().add(TypeConvertor.castToAnnotation(value));
4934        } else
4935          return super.setProperty(name, value);
4936        return value;
4937      }
4938
4939      @Override
4940      public Base makeProperty(int hash, String name) throws FHIRException {
4941        switch (hash) {
4942        case -1618432855:  return addIdentifier(); 
4943        case 8911915:  return addInstantiatesCanonicalElement();
4944        case -1926393373:  return addInstantiatesUriElement();
4945        case -246883639:  return addInstantiatesElement();
4946        case -332612366:  return addBasedOn(); 
4947        case -892481550:  return getStatusElement();
4948        case -1183762788:  return getIntentElement();
4949        case -1165461084:  return getPriorityElement();
4950        case -1867885268:  return getSubject();
4951        case 1524132147:  return getEncounter();
4952        case -1248768647:  return addSupportingInformation(); 
4953        case 1792749467:  return getDateTimeElement();
4954        case -1207109509:  return getOrderer();
4955        case 481140686:  return addPerformer(); 
4956        case -120164120:  return addAllergyIntolerance(); 
4957        case 659473872:  return addFoodPreferenceModifier(); 
4958        case 1760260175:  return addExcludeFoodModifier(); 
4959        case 833777797:  return getOutsideFoodAllowedElement();
4960        case 1153521250:  return getOralDiet();
4961        case -711993159:  return addSupplement(); 
4962        case -671083805:  return getEnteralFormula();
4963        case 3387378:  return addNote(); 
4964        default: return super.makeProperty(hash, name);
4965        }
4966
4967      }
4968
4969      @Override
4970      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4971        switch (hash) {
4972        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4973        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
4974        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
4975        case -246883639: /*instantiates*/ return new String[] {"uri"};
4976        case -332612366: /*basedOn*/ return new String[] {"Reference"};
4977        case -892481550: /*status*/ return new String[] {"code"};
4978        case -1183762788: /*intent*/ return new String[] {"code"};
4979        case -1165461084: /*priority*/ return new String[] {"code"};
4980        case -1867885268: /*subject*/ return new String[] {"Reference"};
4981        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4982        case -1248768647: /*supportingInformation*/ return new String[] {"Reference"};
4983        case 1792749467: /*dateTime*/ return new String[] {"dateTime"};
4984        case -1207109509: /*orderer*/ return new String[] {"Reference"};
4985        case 481140686: /*performer*/ return new String[] {"CodeableReference"};
4986        case -120164120: /*allergyIntolerance*/ return new String[] {"Reference"};
4987        case 659473872: /*foodPreferenceModifier*/ return new String[] {"CodeableConcept"};
4988        case 1760260175: /*excludeFoodModifier*/ return new String[] {"CodeableConcept"};
4989        case 833777797: /*outsideFoodAllowed*/ return new String[] {"boolean"};
4990        case 1153521250: /*oralDiet*/ return new String[] {};
4991        case -711993159: /*supplement*/ return new String[] {};
4992        case -671083805: /*enteralFormula*/ return new String[] {};
4993        case 3387378: /*note*/ return new String[] {"Annotation"};
4994        default: return super.getTypesForProperty(hash, name);
4995        }
4996
4997      }
4998
4999      @Override
5000      public Base addChild(String name) throws FHIRException {
5001        if (name.equals("identifier")) {
5002          return addIdentifier();
5003        }
5004        else if (name.equals("instantiatesCanonical")) {
5005          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiatesCanonical");
5006        }
5007        else if (name.equals("instantiatesUri")) {
5008          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiatesUri");
5009        }
5010        else if (name.equals("instantiates")) {
5011          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiates");
5012        }
5013        else if (name.equals("basedOn")) {
5014          return addBasedOn();
5015        }
5016        else if (name.equals("status")) {
5017          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.status");
5018        }
5019        else if (name.equals("intent")) {
5020          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.intent");
5021        }
5022        else if (name.equals("priority")) {
5023          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.priority");
5024        }
5025        else if (name.equals("subject")) {
5026          this.subject = new Reference();
5027          return this.subject;
5028        }
5029        else if (name.equals("encounter")) {
5030          this.encounter = new Reference();
5031          return this.encounter;
5032        }
5033        else if (name.equals("supportingInformation")) {
5034          return addSupportingInformation();
5035        }
5036        else if (name.equals("dateTime")) {
5037          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.dateTime");
5038        }
5039        else if (name.equals("orderer")) {
5040          this.orderer = new Reference();
5041          return this.orderer;
5042        }
5043        else if (name.equals("performer")) {
5044          return addPerformer();
5045        }
5046        else if (name.equals("allergyIntolerance")) {
5047          return addAllergyIntolerance();
5048        }
5049        else if (name.equals("foodPreferenceModifier")) {
5050          return addFoodPreferenceModifier();
5051        }
5052        else if (name.equals("excludeFoodModifier")) {
5053          return addExcludeFoodModifier();
5054        }
5055        else if (name.equals("outsideFoodAllowed")) {
5056          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.outsideFoodAllowed");
5057        }
5058        else if (name.equals("oralDiet")) {
5059          this.oralDiet = new NutritionOrderOralDietComponent();
5060          return this.oralDiet;
5061        }
5062        else if (name.equals("supplement")) {
5063          return addSupplement();
5064        }
5065        else if (name.equals("enteralFormula")) {
5066          this.enteralFormula = new NutritionOrderEnteralFormulaComponent();
5067          return this.enteralFormula;
5068        }
5069        else if (name.equals("note")) {
5070          return addNote();
5071        }
5072        else
5073          return super.addChild(name);
5074      }
5075
5076  public String fhirType() {
5077    return "NutritionOrder";
5078
5079  }
5080
5081      public NutritionOrder copy() {
5082        NutritionOrder dst = new NutritionOrder();
5083        copyValues(dst);
5084        return dst;
5085      }
5086
5087      public void copyValues(NutritionOrder dst) {
5088        super.copyValues(dst);
5089        if (identifier != null) {
5090          dst.identifier = new ArrayList<Identifier>();
5091          for (Identifier i : identifier)
5092            dst.identifier.add(i.copy());
5093        };
5094        if (instantiatesCanonical != null) {
5095          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
5096          for (CanonicalType i : instantiatesCanonical)
5097            dst.instantiatesCanonical.add(i.copy());
5098        };
5099        if (instantiatesUri != null) {
5100          dst.instantiatesUri = new ArrayList<UriType>();
5101          for (UriType i : instantiatesUri)
5102            dst.instantiatesUri.add(i.copy());
5103        };
5104        if (instantiates != null) {
5105          dst.instantiates = new ArrayList<UriType>();
5106          for (UriType i : instantiates)
5107            dst.instantiates.add(i.copy());
5108        };
5109        if (basedOn != null) {
5110          dst.basedOn = new ArrayList<Reference>();
5111          for (Reference i : basedOn)
5112            dst.basedOn.add(i.copy());
5113        };
5114        dst.status = status == null ? null : status.copy();
5115        dst.intent = intent == null ? null : intent.copy();
5116        dst.priority = priority == null ? null : priority.copy();
5117        dst.subject = subject == null ? null : subject.copy();
5118        dst.encounter = encounter == null ? null : encounter.copy();
5119        if (supportingInformation != null) {
5120          dst.supportingInformation = new ArrayList<Reference>();
5121          for (Reference i : supportingInformation)
5122            dst.supportingInformation.add(i.copy());
5123        };
5124        dst.dateTime = dateTime == null ? null : dateTime.copy();
5125        dst.orderer = orderer == null ? null : orderer.copy();
5126        if (performer != null) {
5127          dst.performer = new ArrayList<CodeableReference>();
5128          for (CodeableReference i : performer)
5129            dst.performer.add(i.copy());
5130        };
5131        if (allergyIntolerance != null) {
5132          dst.allergyIntolerance = new ArrayList<Reference>();
5133          for (Reference i : allergyIntolerance)
5134            dst.allergyIntolerance.add(i.copy());
5135        };
5136        if (foodPreferenceModifier != null) {
5137          dst.foodPreferenceModifier = new ArrayList<CodeableConcept>();
5138          for (CodeableConcept i : foodPreferenceModifier)
5139            dst.foodPreferenceModifier.add(i.copy());
5140        };
5141        if (excludeFoodModifier != null) {
5142          dst.excludeFoodModifier = new ArrayList<CodeableConcept>();
5143          for (CodeableConcept i : excludeFoodModifier)
5144            dst.excludeFoodModifier.add(i.copy());
5145        };
5146        dst.outsideFoodAllowed = outsideFoodAllowed == null ? null : outsideFoodAllowed.copy();
5147        dst.oralDiet = oralDiet == null ? null : oralDiet.copy();
5148        if (supplement != null) {
5149          dst.supplement = new ArrayList<NutritionOrderSupplementComponent>();
5150          for (NutritionOrderSupplementComponent i : supplement)
5151            dst.supplement.add(i.copy());
5152        };
5153        dst.enteralFormula = enteralFormula == null ? null : enteralFormula.copy();
5154        if (note != null) {
5155          dst.note = new ArrayList<Annotation>();
5156          for (Annotation i : note)
5157            dst.note.add(i.copy());
5158        };
5159      }
5160
5161      protected NutritionOrder typedCopy() {
5162        return copy();
5163      }
5164
5165      @Override
5166      public boolean equalsDeep(Base other_) {
5167        if (!super.equalsDeep(other_))
5168          return false;
5169        if (!(other_ instanceof NutritionOrder))
5170          return false;
5171        NutritionOrder o = (NutritionOrder) other_;
5172        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
5173           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(instantiates, o.instantiates, true)
5174           && compareDeep(basedOn, o.basedOn, true) && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true)
5175           && compareDeep(priority, o.priority, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
5176           && compareDeep(supportingInformation, o.supportingInformation, true) && compareDeep(dateTime, o.dateTime, true)
5177           && compareDeep(orderer, o.orderer, true) && compareDeep(performer, o.performer, true) && compareDeep(allergyIntolerance, o.allergyIntolerance, true)
5178           && compareDeep(foodPreferenceModifier, o.foodPreferenceModifier, true) && compareDeep(excludeFoodModifier, o.excludeFoodModifier, true)
5179           && compareDeep(outsideFoodAllowed, o.outsideFoodAllowed, true) && compareDeep(oralDiet, o.oralDiet, true)
5180           && compareDeep(supplement, o.supplement, true) && compareDeep(enteralFormula, o.enteralFormula, true)
5181           && compareDeep(note, o.note, true);
5182      }
5183
5184      @Override
5185      public boolean equalsShallow(Base other_) {
5186        if (!super.equalsShallow(other_))
5187          return false;
5188        if (!(other_ instanceof NutritionOrder))
5189          return false;
5190        NutritionOrder o = (NutritionOrder) other_;
5191        return compareValues(instantiatesCanonical, o.instantiatesCanonical, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
5192           && compareValues(instantiates, o.instantiates, true) && compareValues(status, o.status, true) && compareValues(intent, o.intent, true)
5193           && compareValues(priority, o.priority, true) && compareValues(dateTime, o.dateTime, true) && compareValues(outsideFoodAllowed, o.outsideFoodAllowed, true)
5194          ;
5195      }
5196
5197      public boolean isEmpty() {
5198        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
5199          , instantiatesUri, instantiates, basedOn, status, intent, priority, subject, encounter
5200          , supportingInformation, dateTime, orderer, performer, allergyIntolerance, foodPreferenceModifier
5201          , excludeFoodModifier, outsideFoodAllowed, oralDiet, supplement, enteralFormula, note
5202          );
5203      }
5204
5205  @Override
5206  public ResourceType getResourceType() {
5207    return ResourceType.NutritionOrder;
5208   }
5209
5210 /**
5211   * Search parameter: <b>additive</b>
5212   * <p>
5213   * Description: <b>Type of module component to add to the feeding</b><br>
5214   * Type: <b>token</b><br>
5215   * Path: <b>NutritionOrder.enteralFormula.additive.type.concept</b><br>
5216   * </p>
5217   */
5218  @SearchParamDefinition(name="additive", path="NutritionOrder.enteralFormula.additive.type.concept", description="Type of module component to add to the feeding", type="token" )
5219  public static final String SP_ADDITIVE = "additive";
5220 /**
5221   * <b>Fluent Client</b> search parameter constant for <b>additive</b>
5222   * <p>
5223   * Description: <b>Type of module component to add to the feeding</b><br>
5224   * Type: <b>token</b><br>
5225   * Path: <b>NutritionOrder.enteralFormula.additive.type.concept</b><br>
5226   * </p>
5227   */
5228  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDITIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDITIVE);
5229
5230 /**
5231   * Search parameter: <b>datetime</b>
5232   * <p>
5233   * Description: <b>Return nutrition orders requested on this date</b><br>
5234   * Type: <b>date</b><br>
5235   * Path: <b>NutritionOrder.dateTime</b><br>
5236   * </p>
5237   */
5238  @SearchParamDefinition(name="datetime", path="NutritionOrder.dateTime", description="Return nutrition orders requested on this date", type="date" )
5239  public static final String SP_DATETIME = "datetime";
5240 /**
5241   * <b>Fluent Client</b> search parameter constant for <b>datetime</b>
5242   * <p>
5243   * Description: <b>Return nutrition orders requested on this date</b><br>
5244   * Type: <b>date</b><br>
5245   * Path: <b>NutritionOrder.dateTime</b><br>
5246   * </p>
5247   */
5248  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATETIME = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATETIME);
5249
5250 /**
5251   * Search parameter: <b>formula</b>
5252   * <p>
5253   * Description: <b>Type of enteral or infant formula</b><br>
5254   * Type: <b>token</b><br>
5255   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType.concept</b><br>
5256   * </p>
5257   */
5258  @SearchParamDefinition(name="formula", path="NutritionOrder.enteralFormula.baseFormulaType.concept", description="Type of enteral or infant formula", type="token" )
5259  public static final String SP_FORMULA = "formula";
5260 /**
5261   * <b>Fluent Client</b> search parameter constant for <b>formula</b>
5262   * <p>
5263   * Description: <b>Type of enteral or infant formula</b><br>
5264   * Type: <b>token</b><br>
5265   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType.concept</b><br>
5266   * </p>
5267   */
5268  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMULA = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORMULA);
5269
5270 /**
5271   * Search parameter: <b>oraldiet</b>
5272   * <p>
5273   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
5274   * Type: <b>token</b><br>
5275   * Path: <b>NutritionOrder.oralDiet.type</b><br>
5276   * </p>
5277   */
5278  @SearchParamDefinition(name="oraldiet", path="NutritionOrder.oralDiet.type", description="Type of diet that can be consumed orally (i.e., take via the mouth).", type="token" )
5279  public static final String SP_ORALDIET = "oraldiet";
5280 /**
5281   * <b>Fluent Client</b> search parameter constant for <b>oraldiet</b>
5282   * <p>
5283   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
5284   * Type: <b>token</b><br>
5285   * Path: <b>NutritionOrder.oralDiet.type</b><br>
5286   * </p>
5287   */
5288  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORALDIET = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ORALDIET);
5289
5290 /**
5291   * Search parameter: <b>provider</b>
5292   * <p>
5293   * Description: <b>The identity of the provider who placed the nutrition order</b><br>
5294   * Type: <b>reference</b><br>
5295   * Path: <b>NutritionOrder.orderer</b><br>
5296   * </p>
5297   */
5298  @SearchParamDefinition(name="provider", path="NutritionOrder.orderer", description="The identity of the provider who placed the nutrition order", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Practitioner") }, target={Practitioner.class, PractitionerRole.class } )
5299  public static final String SP_PROVIDER = "provider";
5300 /**
5301   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
5302   * <p>
5303   * Description: <b>The identity of the provider who placed the nutrition order</b><br>
5304   * Type: <b>reference</b><br>
5305   * Path: <b>NutritionOrder.orderer</b><br>
5306   * </p>
5307   */
5308  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
5309
5310/**
5311   * Constant for fluent queries to be used to add include statements. Specifies
5312   * the path value of "<b>NutritionOrder:provider</b>".
5313   */
5314  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("NutritionOrder:provider").toLocked();
5315
5316 /**
5317   * Search parameter: <b>status</b>
5318   * <p>
5319   * Description: <b>Status of the nutrition order.</b><br>
5320   * Type: <b>token</b><br>
5321   * Path: <b>NutritionOrder.status</b><br>
5322   * </p>
5323   */
5324  @SearchParamDefinition(name="status", path="NutritionOrder.status", description="Status of the nutrition order.", type="token" )
5325  public static final String SP_STATUS = "status";
5326 /**
5327   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5328   * <p>
5329   * Description: <b>Status of the nutrition order.</b><br>
5330   * Type: <b>token</b><br>
5331   * Path: <b>NutritionOrder.status</b><br>
5332   * </p>
5333   */
5334  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5335
5336 /**
5337   * Search parameter: <b>subject</b>
5338   * <p>
5339   * Description: <b>The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement</b><br>
5340   * Type: <b>reference</b><br>
5341   * Path: <b>NutritionOrder.subject</b><br>
5342   * </p>
5343   */
5344  @SearchParamDefinition(name="subject", path="NutritionOrder.subject", description="The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement", type="reference", target={Group.class, Patient.class } )
5345  public static final String SP_SUBJECT = "subject";
5346 /**
5347   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
5348   * <p>
5349   * Description: <b>The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement</b><br>
5350   * Type: <b>reference</b><br>
5351   * Path: <b>NutritionOrder.subject</b><br>
5352   * </p>
5353   */
5354  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
5355
5356/**
5357   * Constant for fluent queries to be used to add include statements. Specifies
5358   * the path value of "<b>NutritionOrder:subject</b>".
5359   */
5360  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("NutritionOrder:subject").toLocked();
5361
5362 /**
5363   * Search parameter: <b>supplement</b>
5364   * <p>
5365   * Description: <b>Type of supplement product requested</b><br>
5366   * Type: <b>token</b><br>
5367   * Path: <b>NutritionOrder.supplement.type.concept</b><br>
5368   * </p>
5369   */
5370  @SearchParamDefinition(name="supplement", path="NutritionOrder.supplement.type.concept", description="Type of supplement product requested", type="token" )
5371  public static final String SP_SUPPLEMENT = "supplement";
5372 /**
5373   * <b>Fluent Client</b> search parameter constant for <b>supplement</b>
5374   * <p>
5375   * Description: <b>Type of supplement product requested</b><br>
5376   * Type: <b>token</b><br>
5377   * Path: <b>NutritionOrder.supplement.type.concept</b><br>
5378   * </p>
5379   */
5380  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUPPLEMENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUPPLEMENT);
5381
5382 /**
5383   * Search parameter: <b>encounter</b>
5384   * <p>
5385   * Description: <b>Multiple Resources: 
5386
5387* [Composition](composition.html): Context of the Composition
5388* [DeviceRequest](devicerequest.html): Encounter during which request was created
5389* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
5390* [Flag](flag.html): Alert relevant during encounter
5391* [List](list.html): Context in which list created
5392* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
5393* [Observation](observation.html): Encounter related to the observation
5394* [Procedure](procedure.html): The Encounter during which this Procedure was created
5395* [RiskAssessment](riskassessment.html): Where was assessment performed?
5396* [ServiceRequest](servicerequest.html): An encounter in which this request is made
5397* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
5398</b><br>
5399   * Type: <b>reference</b><br>
5400   * Path: <b>Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter</b><br>
5401   * </p>
5402   */
5403  @SearchParamDefinition(name="encounter", path="Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter", description="Multiple Resources: \r\n\r\n* [Composition](composition.html): Context of the Composition\r\n* [DeviceRequest](devicerequest.html): Encounter during which request was created\r\n* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made\r\n* [Flag](flag.html): Alert relevant during encounter\r\n* [List](list.html): Context in which list created\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier\r\n* [Observation](observation.html): Encounter related to the observation\r\n* [Procedure](procedure.html): The Encounter during which this Procedure was created\r\n* [RiskAssessment](riskassessment.html): Where was assessment performed?\r\n* [ServiceRequest](servicerequest.html): An encounter in which this request is made\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Encounter") }, target={Encounter.class } )
5404  public static final String SP_ENCOUNTER = "encounter";
5405 /**
5406   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
5407   * <p>
5408   * Description: <b>Multiple Resources: 
5409
5410* [Composition](composition.html): Context of the Composition
5411* [DeviceRequest](devicerequest.html): Encounter during which request was created
5412* [DiagnosticReport](diagnosticreport.html): The Encounter when the order was made
5413* [Flag](flag.html): Alert relevant during encounter
5414* [List](list.html): Context in which list created
5415* [NutritionOrder](nutritionorder.html): Return nutrition orders with this encounter identifier
5416* [Observation](observation.html): Encounter related to the observation
5417* [Procedure](procedure.html): The Encounter during which this Procedure was created
5418* [RiskAssessment](riskassessment.html): Where was assessment performed?
5419* [ServiceRequest](servicerequest.html): An encounter in which this request is made
5420* [VisionPrescription](visionprescription.html): Return prescriptions with this encounter identifier
5421</b><br>
5422   * Type: <b>reference</b><br>
5423   * Path: <b>Composition.encounter | DeviceRequest.encounter | DiagnosticReport.encounter | Flag.encounter | List.encounter | NutritionOrder.encounter | Observation.encounter | Procedure.encounter | RiskAssessment.encounter | ServiceRequest.encounter | VisionPrescription.encounter</b><br>
5424   * </p>
5425   */
5426  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
5427
5428/**
5429   * Constant for fluent queries to be used to add include statements. Specifies
5430   * the path value of "<b>NutritionOrder:encounter</b>".
5431   */
5432  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("NutritionOrder:encounter").toLocked();
5433
5434 /**
5435   * Search parameter: <b>identifier</b>
5436   * <p>
5437   * Description: <b>Multiple Resources: 
5438
5439* [AllergyIntolerance](allergyintolerance.html): External ids for this item
5440* [CarePlan](careplan.html): External Ids for this plan
5441* [CareTeam](careteam.html): External Ids for this team
5442* [Composition](composition.html): Version-independent identifier for the Composition
5443* [Condition](condition.html): A unique identifier of the condition record
5444* [Consent](consent.html): Identifier for this record (external references)
5445* [DetectedIssue](detectedissue.html): Unique id for the detected issue
5446* [DeviceRequest](devicerequest.html): Business identifier for request/order
5447* [DiagnosticReport](diagnosticreport.html): An identifier for the report
5448* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
5449* [DocumentReference](documentreference.html): Identifier of the attachment binary
5450* [Encounter](encounter.html): Identifier(s) by which this encounter is known
5451* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
5452* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
5453* [Goal](goal.html): External Ids for this goal
5454* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
5455* [Immunization](immunization.html): Business identifier
5456* [List](list.html): Business identifier
5457* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
5458* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
5459* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
5460* [MedicationUsage](medicationusage.html): Return statements with this external identifier
5461* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
5462* [Observation](observation.html): The unique id for a particular observation
5463* [Procedure](procedure.html): A unique identifier for a procedure
5464* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
5465* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
5466* [SupplyDelivery](supplydelivery.html): External identifier
5467* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
5468* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
5469</b><br>
5470   * Type: <b>token</b><br>
5471   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
5472   * </p>
5473   */
5474  @SearchParamDefinition(name="identifier", path="AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): External ids for this item\r\n* [CarePlan](careplan.html): External Ids for this plan\r\n* [CareTeam](careteam.html): External Ids for this team\r\n* [Composition](composition.html): Version-independent identifier for the Composition\r\n* [Condition](condition.html): A unique identifier of the condition record\r\n* [Consent](consent.html): Identifier for this record (external references)\r\n* [DetectedIssue](detectedissue.html): Unique id for the detected issue\r\n* [DeviceRequest](devicerequest.html): Business identifier for request/order\r\n* [DiagnosticReport](diagnosticreport.html): An identifier for the report\r\n* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents\r\n* [DocumentReference](documentreference.html): Identifier of the attachment binary\r\n* [Encounter](encounter.html): Identifier(s) by which this encounter is known\r\n* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare\r\n* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier\r\n* [Goal](goal.html): External Ids for this goal\r\n* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID\r\n* [Immunization](immunization.html): Business identifier\r\n* [List](list.html): Business identifier\r\n* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier\r\n* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier\r\n* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier\r\n* [MedicationUsage](medicationusage.html): Return statements with this external identifier\r\n* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier\r\n* [Observation](observation.html): The unique id for a particular observation\r\n* [Procedure](procedure.html): A unique identifier for a procedure\r\n* [RiskAssessment](riskassessment.html): Unique identifier for the assessment\r\n* [ServiceRequest](servicerequest.html): Identifiers assigned to this order\r\n* [SupplyDelivery](supplydelivery.html): External identifier\r\n* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest\r\n* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier\r\n", type="token" )
5475  public static final String SP_IDENTIFIER = "identifier";
5476 /**
5477   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
5478   * <p>
5479   * Description: <b>Multiple Resources: 
5480
5481* [AllergyIntolerance](allergyintolerance.html): External ids for this item
5482* [CarePlan](careplan.html): External Ids for this plan
5483* [CareTeam](careteam.html): External Ids for this team
5484* [Composition](composition.html): Version-independent identifier for the Composition
5485* [Condition](condition.html): A unique identifier of the condition record
5486* [Consent](consent.html): Identifier for this record (external references)
5487* [DetectedIssue](detectedissue.html): Unique id for the detected issue
5488* [DeviceRequest](devicerequest.html): Business identifier for request/order
5489* [DiagnosticReport](diagnosticreport.html): An identifier for the report
5490* [DocumentManifest](documentmanifest.html): Unique Identifier for the set of documents
5491* [DocumentReference](documentreference.html): Identifier of the attachment binary
5492* [Encounter](encounter.html): Identifier(s) by which this encounter is known
5493* [EpisodeOfCare](episodeofcare.html): Business Identifier(s) relevant for this EpisodeOfCare
5494* [FamilyMemberHistory](familymemberhistory.html): A search by a record identifier
5495* [Goal](goal.html): External Ids for this goal
5496* [ImagingStudy](imagingstudy.html): Identifiers for the Study, such as DICOM Study Instance UID
5497* [Immunization](immunization.html): Business identifier
5498* [List](list.html): Business identifier
5499* [MedicationAdministration](medicationadministration.html): Return administrations with this external identifier
5500* [MedicationDispense](medicationdispense.html): Returns dispenses with this external identifier
5501* [MedicationRequest](medicationrequest.html): Return prescriptions with this external identifier
5502* [MedicationUsage](medicationusage.html): Return statements with this external identifier
5503* [NutritionOrder](nutritionorder.html): Return nutrition orders with this external identifier
5504* [Observation](observation.html): The unique id for a particular observation
5505* [Procedure](procedure.html): A unique identifier for a procedure
5506* [RiskAssessment](riskassessment.html): Unique identifier for the assessment
5507* [ServiceRequest](servicerequest.html): Identifiers assigned to this order
5508* [SupplyDelivery](supplydelivery.html): External identifier
5509* [SupplyRequest](supplyrequest.html): Business Identifier for SupplyRequest
5510* [VisionPrescription](visionprescription.html): Return prescriptions with this external identifier
5511</b><br>
5512   * Type: <b>token</b><br>
5513   * Path: <b>AllergyIntolerance.identifier | CarePlan.identifier | CareTeam.identifier | Composition.identifier | Condition.identifier | Consent.identifier | DetectedIssue.identifier | DeviceRequest.identifier | DiagnosticReport.identifier | DocumentManifest.masterIdentifier | DocumentManifest.identifier | DocumentReference.identifier | Encounter.identifier | EpisodeOfCare.identifier | FamilyMemberHistory.identifier | Goal.identifier | ImagingStudy.identifier | Immunization.identifier | List.identifier | MedicationAdministration.identifier | MedicationDispense.identifier | MedicationRequest.identifier | MedicationUsage.identifier | NutritionOrder.identifier | Observation.identifier | Procedure.identifier | RiskAssessment.identifier | ServiceRequest.identifier | SupplyDelivery.identifier | SupplyRequest.identifier | VisionPrescription.identifier</b><br>
5514   * </p>
5515   */
5516  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
5517
5518 /**
5519   * Search parameter: <b>patient</b>
5520   * <p>
5521   * Description: <b>Multiple Resources: 
5522
5523* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
5524* [CarePlan](careplan.html): Who the care plan is for
5525* [CareTeam](careteam.html): Who care team is for
5526* [ClinicalImpression](clinicalimpression.html): Patient assessed
5527* [Composition](composition.html): Who and/or what the composition is about
5528* [Condition](condition.html): Who has the condition?
5529* [Consent](consent.html): Who the consent applies to
5530* [DetectedIssue](detectedissue.html): Associated patient
5531* [DeviceRequest](devicerequest.html): Individual the service is ordered for
5532* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
5533* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
5534* [DocumentManifest](documentmanifest.html): The subject of the set of documents
5535* [DocumentReference](documentreference.html): Who/what is the subject of the document
5536* [Encounter](encounter.html): The patient present at the encounter
5537* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
5538* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
5539* [Flag](flag.html): The identity of a subject to list flags for
5540* [Goal](goal.html): Who this goal is intended for
5541* [ImagingStudy](imagingstudy.html): Who the study is about
5542* [Immunization](immunization.html): The patient for the vaccination record
5543* [List](list.html): If all resources have the same subject
5544* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
5545* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
5546* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
5547* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
5548* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
5549* [Observation](observation.html): The subject that the observation is about (if patient)
5550* [Procedure](procedure.html): Search by subject - a patient
5551* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
5552* [ServiceRequest](servicerequest.html): Search by subject - a patient
5553* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
5554* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
5555</b><br>
5556   * Type: <b>reference</b><br>
5557   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.subject | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
5558   * </p>
5559   */
5560  @SearchParamDefinition(name="patient", path="AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.subject | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient", description="Multiple Resources: \r\n\r\n* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for\r\n* [CarePlan](careplan.html): Who the care plan is for\r\n* [CareTeam](careteam.html): Who care team is for\r\n* [ClinicalImpression](clinicalimpression.html): Patient assessed\r\n* [Composition](composition.html): Who and/or what the composition is about\r\n* [Condition](condition.html): Who has the condition?\r\n* [Consent](consent.html): Who the consent applies to\r\n* [DetectedIssue](detectedissue.html): Associated patient\r\n* [DeviceRequest](devicerequest.html): Individual the service is ordered for\r\n* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device\r\n* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient\r\n* [DocumentManifest](documentmanifest.html): The subject of the set of documents\r\n* [DocumentReference](documentreference.html): Who/what is the subject of the document\r\n* [Encounter](encounter.html): The patient present at the encounter\r\n* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care\r\n* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for\r\n* [Flag](flag.html): The identity of a subject to list flags for\r\n* [Goal](goal.html): Who this goal is intended for\r\n* [ImagingStudy](imagingstudy.html): Who the study is about\r\n* [Immunization](immunization.html): The patient for the vaccination record\r\n* [List](list.html): If all resources have the same subject\r\n* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for\r\n* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for\r\n* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient\r\n* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.\r\n* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement\r\n* [Observation](observation.html): The subject that the observation is about (if patient)\r\n* [Procedure](procedure.html): Search by subject - a patient\r\n* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?\r\n* [ServiceRequest](servicerequest.html): Search by subject - a patient\r\n* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied\r\n* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for\r\n", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={BiologicallyDerivedProduct.class, Device.class, Group.class, Location.class, Medication.class, NutritionProduct.class, Organization.class, Patient.class, Practitioner.class, Procedure.class, Substance.class } )
5561  public static final String SP_PATIENT = "patient";
5562 /**
5563   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
5564   * <p>
5565   * Description: <b>Multiple Resources: 
5566
5567* [AllergyIntolerance](allergyintolerance.html): Who the sensitivity is for
5568* [CarePlan](careplan.html): Who the care plan is for
5569* [CareTeam](careteam.html): Who care team is for
5570* [ClinicalImpression](clinicalimpression.html): Patient assessed
5571* [Composition](composition.html): Who and/or what the composition is about
5572* [Condition](condition.html): Who has the condition?
5573* [Consent](consent.html): Who the consent applies to
5574* [DetectedIssue](detectedissue.html): Associated patient
5575* [DeviceRequest](devicerequest.html): Individual the service is ordered for
5576* [DeviceUsage](deviceusage.html): Search by patient who used / uses the device
5577* [DiagnosticReport](diagnosticreport.html): The subject of the report if a patient
5578* [DocumentManifest](documentmanifest.html): The subject of the set of documents
5579* [DocumentReference](documentreference.html): Who/what is the subject of the document
5580* [Encounter](encounter.html): The patient present at the encounter
5581* [EpisodeOfCare](episodeofcare.html): The patient who is the focus of this episode of care
5582* [FamilyMemberHistory](familymemberhistory.html): The identity of a subject to list family member history items for
5583* [Flag](flag.html): The identity of a subject to list flags for
5584* [Goal](goal.html): Who this goal is intended for
5585* [ImagingStudy](imagingstudy.html): Who the study is about
5586* [Immunization](immunization.html): The patient for the vaccination record
5587* [List](list.html): If all resources have the same subject
5588* [MedicationAdministration](medicationadministration.html): The identity of a patient to list administrations  for
5589* [MedicationDispense](medicationdispense.html): The identity of a patient to list dispenses  for
5590* [MedicationRequest](medicationrequest.html): Returns prescriptions for a specific patient
5591* [MedicationUsage](medicationusage.html): Returns statements for a specific patient.
5592* [NutritionOrder](nutritionorder.html): The identity of the individual or set of individuals who requires the diet, formula or nutritional supplement
5593* [Observation](observation.html): The subject that the observation is about (if patient)
5594* [Procedure](procedure.html): Search by subject - a patient
5595* [RiskAssessment](riskassessment.html): Who/what does assessment apply to?
5596* [ServiceRequest](servicerequest.html): Search by subject - a patient
5597* [SupplyDelivery](supplydelivery.html): Patient for whom the item is supplied
5598* [VisionPrescription](visionprescription.html): The identity of a patient to list dispenses for
5599</b><br>
5600   * Type: <b>reference</b><br>
5601   * Path: <b>AllergyIntolerance.patient | CarePlan.subject.where(resolve() is Patient) | CareTeam.subject.where(resolve() is Patient) | ClinicalImpression.subject.where(resolve() is Patient) | Composition.subject.where(resolve() is Patient) | Condition.subject.where(resolve() is Patient) | Consent.subject.where(resolve() is Patient) | DetectedIssue.subject | DeviceRequest.subject.where(resolve() is Patient) | DeviceUsage.patient | DiagnosticReport.subject.where(resolve() is Patient) | DocumentManifest.subject.where(resolve() is Patient) | DocumentReference.subject.where(resolve() is Patient) | Encounter.subject.where(resolve() is Patient) | EpisodeOfCare.patient | FamilyMemberHistory.patient | Flag.subject.where(resolve() is Patient) | Goal.subject.where(resolve() is Patient) | ImagingStudy.subject.where(resolve() is Patient) | Immunization.patient | List.subject.where(resolve() is Patient) | MedicationAdministration.subject.where(resolve() is Patient) | MedicationDispense.subject.where(resolve() is Patient) | MedicationRequest.subject.where(resolve() is Patient) | MedicationUsage.subject.where(resolve() is Patient) | NutritionOrder.subject.where(resolve() is Patient) | Observation.subject.where(resolve() is Patient) | Procedure.subject.where(resolve() is Patient) | RiskAssessment.subject.where(resolve() is Patient) | ServiceRequest.subject.where(resolve() is Patient) | SupplyDelivery.patient | VisionPrescription.patient</b><br>
5602   * </p>
5603   */
5604  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
5605
5606/**
5607   * Constant for fluent queries to be used to add include statements. Specifies
5608   * the path value of "<b>NutritionOrder:patient</b>".
5609   */
5610  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("NutritionOrder:patient").toLocked();
5611
5612
5613}
5614