001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
042import org.hl7.fhir.utilities.Utilities;
043
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049/**
050 * A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.
051 */
052@ResourceDef(name="NutritionOrder", profile="http://hl7.org/fhir/Profile/NutritionOrder")
053public class NutritionOrder extends DomainResource {
054
055    public enum NutritionOrderStatus {
056        /**
057         * The request has been proposed.
058         */
059        PROPOSED, 
060        /**
061         * The request is in preliminary form prior to being sent.
062         */
063        DRAFT, 
064        /**
065         * The request has been planned.
066         */
067        PLANNED, 
068        /**
069         * The request has been placed.
070         */
071        REQUESTED, 
072        /**
073         * The request is 'actionable', but not all actions that are implied by it have occurred yet.
074         */
075        ACTIVE, 
076        /**
077         * Actions implied by the request have been temporarily halted, but are expected to continue later. May also be called "suspended".
078         */
079        ONHOLD, 
080        /**
081         * All actions that are implied by the order have occurred and no continuation is planned (this will rarely be made explicit).
082         */
083        COMPLETED, 
084        /**
085         * The request has been withdrawn and is no longer actionable.
086         */
087        CANCELLED, 
088        /**
089         * The request was entered in error and voided.
090         */
091        ENTEREDINERROR, 
092        /**
093         * added to help the parsers
094         */
095        NULL;
096        public static NutritionOrderStatus fromCode(String codeString) throws FHIRException {
097            if (codeString == null || "".equals(codeString))
098                return null;
099        if ("proposed".equals(codeString))
100          return PROPOSED;
101        if ("draft".equals(codeString))
102          return DRAFT;
103        if ("planned".equals(codeString))
104          return PLANNED;
105        if ("requested".equals(codeString))
106          return REQUESTED;
107        if ("active".equals(codeString))
108          return ACTIVE;
109        if ("on-hold".equals(codeString))
110          return ONHOLD;
111        if ("completed".equals(codeString))
112          return COMPLETED;
113        if ("cancelled".equals(codeString))
114          return CANCELLED;
115        if ("entered-in-error".equals(codeString))
116          return ENTEREDINERROR;
117        throw new FHIRException("Unknown NutritionOrderStatus code '"+codeString+"'");
118        }
119        public String toCode() {
120          switch (this) {
121            case PROPOSED: return "proposed";
122            case DRAFT: return "draft";
123            case PLANNED: return "planned";
124            case REQUESTED: return "requested";
125            case ACTIVE: return "active";
126            case ONHOLD: return "on-hold";
127            case COMPLETED: return "completed";
128            case CANCELLED: return "cancelled";
129            case ENTEREDINERROR: return "entered-in-error";
130            case NULL: return null;
131            default: return "?";
132          }
133        }
134        public String getSystem() {
135          switch (this) {
136            case PROPOSED: return "http://hl7.org/fhir/nutrition-order-status";
137            case DRAFT: return "http://hl7.org/fhir/nutrition-order-status";
138            case PLANNED: return "http://hl7.org/fhir/nutrition-order-status";
139            case REQUESTED: return "http://hl7.org/fhir/nutrition-order-status";
140            case ACTIVE: return "http://hl7.org/fhir/nutrition-order-status";
141            case ONHOLD: return "http://hl7.org/fhir/nutrition-order-status";
142            case COMPLETED: return "http://hl7.org/fhir/nutrition-order-status";
143            case CANCELLED: return "http://hl7.org/fhir/nutrition-order-status";
144            case ENTEREDINERROR: return "http://hl7.org/fhir/nutrition-order-status";
145            case NULL: return null;
146            default: return "?";
147          }
148        }
149        public String getDefinition() {
150          switch (this) {
151            case PROPOSED: return "The request has been proposed.";
152            case DRAFT: return "The request is in preliminary form prior to being sent.";
153            case PLANNED: return "The request has been planned.";
154            case REQUESTED: return "The request has been placed.";
155            case ACTIVE: return "The request is 'actionable', but not all actions that are implied by it have occurred yet.";
156            case ONHOLD: return "Actions implied by the request have been temporarily halted, but are expected to continue later. May also be called \"suspended\".";
157            case COMPLETED: return "All actions that are implied by the order have occurred and no continuation is planned (this will rarely be made explicit).";
158            case CANCELLED: return "The request has been withdrawn and is no longer actionable.";
159            case ENTEREDINERROR: return "The request was entered in error and voided.";
160            case NULL: return null;
161            default: return "?";
162          }
163        }
164        public String getDisplay() {
165          switch (this) {
166            case PROPOSED: return "Proposed";
167            case DRAFT: return "Draft";
168            case PLANNED: return "Planned";
169            case REQUESTED: return "Requested";
170            case ACTIVE: return "Active";
171            case ONHOLD: return "On-Hold";
172            case COMPLETED: return "Completed";
173            case CANCELLED: return "Cancelled";
174            case ENTEREDINERROR: return "Entered in Error";
175            case NULL: return null;
176            default: return "?";
177          }
178        }
179    }
180
181  public static class NutritionOrderStatusEnumFactory implements EnumFactory<NutritionOrderStatus> {
182    public NutritionOrderStatus fromCode(String codeString) throws IllegalArgumentException {
183      if (codeString == null || "".equals(codeString))
184            if (codeString == null || "".equals(codeString))
185                return null;
186        if ("proposed".equals(codeString))
187          return NutritionOrderStatus.PROPOSED;
188        if ("draft".equals(codeString))
189          return NutritionOrderStatus.DRAFT;
190        if ("planned".equals(codeString))
191          return NutritionOrderStatus.PLANNED;
192        if ("requested".equals(codeString))
193          return NutritionOrderStatus.REQUESTED;
194        if ("active".equals(codeString))
195          return NutritionOrderStatus.ACTIVE;
196        if ("on-hold".equals(codeString))
197          return NutritionOrderStatus.ONHOLD;
198        if ("completed".equals(codeString))
199          return NutritionOrderStatus.COMPLETED;
200        if ("cancelled".equals(codeString))
201          return NutritionOrderStatus.CANCELLED;
202        if ("entered-in-error".equals(codeString))
203          return NutritionOrderStatus.ENTEREDINERROR;
204        throw new IllegalArgumentException("Unknown NutritionOrderStatus code '"+codeString+"'");
205        }
206        public Enumeration<NutritionOrderStatus> fromType(Base code) throws FHIRException {
207          if (code == null || code.isEmpty())
208            return null;
209          String codeString = ((PrimitiveType) code).asStringValue();
210          if (codeString == null || "".equals(codeString))
211            return null;
212        if ("proposed".equals(codeString))
213          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.PROPOSED);
214        if ("draft".equals(codeString))
215          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.DRAFT);
216        if ("planned".equals(codeString))
217          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.PLANNED);
218        if ("requested".equals(codeString))
219          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.REQUESTED);
220        if ("active".equals(codeString))
221          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ACTIVE);
222        if ("on-hold".equals(codeString))
223          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ONHOLD);
224        if ("completed".equals(codeString))
225          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.COMPLETED);
226        if ("cancelled".equals(codeString))
227          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.CANCELLED);
228        if ("entered-in-error".equals(codeString))
229          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ENTEREDINERROR);
230        throw new FHIRException("Unknown NutritionOrderStatus code '"+codeString+"'");
231        }
232    public String toCode(NutritionOrderStatus code) {
233      if (code == NutritionOrderStatus.PROPOSED)
234        return "proposed";
235      if (code == NutritionOrderStatus.DRAFT)
236        return "draft";
237      if (code == NutritionOrderStatus.PLANNED)
238        return "planned";
239      if (code == NutritionOrderStatus.REQUESTED)
240        return "requested";
241      if (code == NutritionOrderStatus.ACTIVE)
242        return "active";
243      if (code == NutritionOrderStatus.ONHOLD)
244        return "on-hold";
245      if (code == NutritionOrderStatus.COMPLETED)
246        return "completed";
247      if (code == NutritionOrderStatus.CANCELLED)
248        return "cancelled";
249      if (code == NutritionOrderStatus.ENTEREDINERROR)
250        return "entered-in-error";
251      return "?";
252      }
253    public String toSystem(NutritionOrderStatus code) {
254      return code.getSystem();
255      }
256    }
257
258    @Block()
259    public static class NutritionOrderOralDietComponent extends BackboneElement implements IBaseBackboneElement {
260        /**
261         * The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.
262         */
263        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
264        @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." )
265        protected List<CodeableConcept> type;
266
267        /**
268         * The time period and frequency at which the diet should be given.
269         */
270        @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
271        @Description(shortDefinition="Scheduled frequency of diet", formalDefinition="The time period and frequency at which the diet should be given." )
272        protected List<Timing> schedule;
273
274        /**
275         * Class that defines the quantity and type of nutrient modifications required for the oral diet.
276         */
277        @Child(name = "nutrient", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
278        @Description(shortDefinition="Required  nutrient modifications", formalDefinition="Class that defines the quantity and type of nutrient modifications required for the oral diet." )
279        protected List<NutritionOrderOralDietNutrientComponent> nutrient;
280
281        /**
282         * Class that describes any texture modifications required for the patient to safely consume various types of solid foods.
283         */
284        @Child(name = "texture", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
285        @Description(shortDefinition="Required  texture modifications", formalDefinition="Class that describes any texture modifications required for the patient to safely consume various types of solid foods." )
286        protected List<NutritionOrderOralDietTextureComponent> texture;
287
288        /**
289         * The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.
290         */
291        @Child(name = "fluidConsistencyType", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
292        @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." )
293        protected List<CodeableConcept> fluidConsistencyType;
294
295        /**
296         * Free text or additional instructions or information pertaining to the oral diet.
297         */
298        @Child(name = "instruction", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
299        @Description(shortDefinition="Instructions or additional information about the oral diet", formalDefinition="Free text or additional instructions or information pertaining to the oral diet." )
300        protected StringType instruction;
301
302        private static final long serialVersionUID = 973058412L;
303
304    /**
305     * Constructor
306     */
307      public NutritionOrderOralDietComponent() {
308        super();
309      }
310
311        /**
312         * @return {@link #type} (The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.)
313         */
314        public List<CodeableConcept> getType() { 
315          if (this.type == null)
316            this.type = new ArrayList<CodeableConcept>();
317          return this.type;
318        }
319
320        public boolean hasType() { 
321          if (this.type == null)
322            return false;
323          for (CodeableConcept item : this.type)
324            if (!item.isEmpty())
325              return true;
326          return false;
327        }
328
329        /**
330         * @return {@link #type} (The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.)
331         */
332    // syntactic sugar
333        public CodeableConcept addType() { //3
334          CodeableConcept t = new CodeableConcept();
335          if (this.type == null)
336            this.type = new ArrayList<CodeableConcept>();
337          this.type.add(t);
338          return t;
339        }
340
341    // syntactic sugar
342        public NutritionOrderOralDietComponent addType(CodeableConcept t) { //3
343          if (t == null)
344            return this;
345          if (this.type == null)
346            this.type = new ArrayList<CodeableConcept>();
347          this.type.add(t);
348          return this;
349        }
350
351        /**
352         * @return {@link #schedule} (The time period and frequency at which the diet should be given.)
353         */
354        public List<Timing> getSchedule() { 
355          if (this.schedule == null)
356            this.schedule = new ArrayList<Timing>();
357          return this.schedule;
358        }
359
360        public boolean hasSchedule() { 
361          if (this.schedule == null)
362            return false;
363          for (Timing item : this.schedule)
364            if (!item.isEmpty())
365              return true;
366          return false;
367        }
368
369        /**
370         * @return {@link #schedule} (The time period and frequency at which the diet should be given.)
371         */
372    // syntactic sugar
373        public Timing addSchedule() { //3
374          Timing t = new Timing();
375          if (this.schedule == null)
376            this.schedule = new ArrayList<Timing>();
377          this.schedule.add(t);
378          return t;
379        }
380
381    // syntactic sugar
382        public NutritionOrderOralDietComponent addSchedule(Timing t) { //3
383          if (t == null)
384            return this;
385          if (this.schedule == null)
386            this.schedule = new ArrayList<Timing>();
387          this.schedule.add(t);
388          return this;
389        }
390
391        /**
392         * @return {@link #nutrient} (Class that defines the quantity and type of nutrient modifications required for the oral diet.)
393         */
394        public List<NutritionOrderOralDietNutrientComponent> getNutrient() { 
395          if (this.nutrient == null)
396            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
397          return this.nutrient;
398        }
399
400        public boolean hasNutrient() { 
401          if (this.nutrient == null)
402            return false;
403          for (NutritionOrderOralDietNutrientComponent item : this.nutrient)
404            if (!item.isEmpty())
405              return true;
406          return false;
407        }
408
409        /**
410         * @return {@link #nutrient} (Class that defines the quantity and type of nutrient modifications required for the oral diet.)
411         */
412    // syntactic sugar
413        public NutritionOrderOralDietNutrientComponent addNutrient() { //3
414          NutritionOrderOralDietNutrientComponent t = new NutritionOrderOralDietNutrientComponent();
415          if (this.nutrient == null)
416            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
417          this.nutrient.add(t);
418          return t;
419        }
420
421    // syntactic sugar
422        public NutritionOrderOralDietComponent addNutrient(NutritionOrderOralDietNutrientComponent t) { //3
423          if (t == null)
424            return this;
425          if (this.nutrient == null)
426            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
427          this.nutrient.add(t);
428          return this;
429        }
430
431        /**
432         * @return {@link #texture} (Class that describes any texture modifications required for the patient to safely consume various types of solid foods.)
433         */
434        public List<NutritionOrderOralDietTextureComponent> getTexture() { 
435          if (this.texture == null)
436            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
437          return this.texture;
438        }
439
440        public boolean hasTexture() { 
441          if (this.texture == null)
442            return false;
443          for (NutritionOrderOralDietTextureComponent item : this.texture)
444            if (!item.isEmpty())
445              return true;
446          return false;
447        }
448
449        /**
450         * @return {@link #texture} (Class that describes any texture modifications required for the patient to safely consume various types of solid foods.)
451         */
452    // syntactic sugar
453        public NutritionOrderOralDietTextureComponent addTexture() { //3
454          NutritionOrderOralDietTextureComponent t = new NutritionOrderOralDietTextureComponent();
455          if (this.texture == null)
456            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
457          this.texture.add(t);
458          return t;
459        }
460
461    // syntactic sugar
462        public NutritionOrderOralDietComponent addTexture(NutritionOrderOralDietTextureComponent t) { //3
463          if (t == null)
464            return this;
465          if (this.texture == null)
466            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
467          this.texture.add(t);
468          return this;
469        }
470
471        /**
472         * @return {@link #fluidConsistencyType} (The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.)
473         */
474        public List<CodeableConcept> getFluidConsistencyType() { 
475          if (this.fluidConsistencyType == null)
476            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
477          return this.fluidConsistencyType;
478        }
479
480        public boolean hasFluidConsistencyType() { 
481          if (this.fluidConsistencyType == null)
482            return false;
483          for (CodeableConcept item : this.fluidConsistencyType)
484            if (!item.isEmpty())
485              return true;
486          return false;
487        }
488
489        /**
490         * @return {@link #fluidConsistencyType} (The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.)
491         */
492    // syntactic sugar
493        public CodeableConcept addFluidConsistencyType() { //3
494          CodeableConcept t = new CodeableConcept();
495          if (this.fluidConsistencyType == null)
496            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
497          this.fluidConsistencyType.add(t);
498          return t;
499        }
500
501    // syntactic sugar
502        public NutritionOrderOralDietComponent addFluidConsistencyType(CodeableConcept t) { //3
503          if (t == null)
504            return this;
505          if (this.fluidConsistencyType == null)
506            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
507          this.fluidConsistencyType.add(t);
508          return this;
509        }
510
511        /**
512         * @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
513         */
514        public StringType getInstructionElement() { 
515          if (this.instruction == null)
516            if (Configuration.errorOnAutoCreate())
517              throw new Error("Attempt to auto-create NutritionOrderOralDietComponent.instruction");
518            else if (Configuration.doAutoCreate())
519              this.instruction = new StringType(); // bb
520          return this.instruction;
521        }
522
523        public boolean hasInstructionElement() { 
524          return this.instruction != null && !this.instruction.isEmpty();
525        }
526
527        public boolean hasInstruction() { 
528          return this.instruction != null && !this.instruction.isEmpty();
529        }
530
531        /**
532         * @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
533         */
534        public NutritionOrderOralDietComponent setInstructionElement(StringType value) { 
535          this.instruction = value;
536          return this;
537        }
538
539        /**
540         * @return Free text or additional instructions or information pertaining to the oral diet.
541         */
542        public String getInstruction() { 
543          return this.instruction == null ? null : this.instruction.getValue();
544        }
545
546        /**
547         * @param value Free text or additional instructions or information pertaining to the oral diet.
548         */
549        public NutritionOrderOralDietComponent setInstruction(String value) { 
550          if (Utilities.noString(value))
551            this.instruction = null;
552          else {
553            if (this.instruction == null)
554              this.instruction = new StringType();
555            this.instruction.setValue(value);
556          }
557          return this;
558        }
559
560        protected void listChildren(List<Property> childrenList) {
561          super.listChildren(childrenList);
562          childrenList.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));
563          childrenList.add(new Property("schedule", "Timing", "The time period and frequency at which the diet should be given.", 0, java.lang.Integer.MAX_VALUE, schedule));
564          childrenList.add(new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient));
565          childrenList.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));
566          childrenList.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));
567          childrenList.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, java.lang.Integer.MAX_VALUE, instruction));
568        }
569
570      @Override
571      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
572        switch (hash) {
573        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
574        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
575        case -1671151641: /*nutrient*/ return this.nutrient == null ? new Base[0] : this.nutrient.toArray(new Base[this.nutrient.size()]); // NutritionOrderOralDietNutrientComponent
576        case -1417816805: /*texture*/ return this.texture == null ? new Base[0] : this.texture.toArray(new Base[this.texture.size()]); // NutritionOrderOralDietTextureComponent
577        case -525105592: /*fluidConsistencyType*/ return this.fluidConsistencyType == null ? new Base[0] : this.fluidConsistencyType.toArray(new Base[this.fluidConsistencyType.size()]); // CodeableConcept
578        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
579        default: return super.getProperty(hash, name, checkValid);
580        }
581
582      }
583
584      @Override
585      public void setProperty(int hash, String name, Base value) throws FHIRException {
586        switch (hash) {
587        case 3575610: // type
588          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
589          break;
590        case -697920873: // schedule
591          this.getSchedule().add(castToTiming(value)); // Timing
592          break;
593        case -1671151641: // nutrient
594          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value); // NutritionOrderOralDietNutrientComponent
595          break;
596        case -1417816805: // texture
597          this.getTexture().add((NutritionOrderOralDietTextureComponent) value); // NutritionOrderOralDietTextureComponent
598          break;
599        case -525105592: // fluidConsistencyType
600          this.getFluidConsistencyType().add(castToCodeableConcept(value)); // CodeableConcept
601          break;
602        case 301526158: // instruction
603          this.instruction = castToString(value); // StringType
604          break;
605        default: super.setProperty(hash, name, value);
606        }
607
608      }
609
610      @Override
611      public void setProperty(String name, Base value) throws FHIRException {
612        if (name.equals("type"))
613          this.getType().add(castToCodeableConcept(value));
614        else if (name.equals("schedule"))
615          this.getSchedule().add(castToTiming(value));
616        else if (name.equals("nutrient"))
617          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value);
618        else if (name.equals("texture"))
619          this.getTexture().add((NutritionOrderOralDietTextureComponent) value);
620        else if (name.equals("fluidConsistencyType"))
621          this.getFluidConsistencyType().add(castToCodeableConcept(value));
622        else if (name.equals("instruction"))
623          this.instruction = castToString(value); // StringType
624        else
625          super.setProperty(name, value);
626      }
627
628      @Override
629      public Base makeProperty(int hash, String name) throws FHIRException {
630        switch (hash) {
631        case 3575610:  return addType(); // CodeableConcept
632        case -697920873:  return addSchedule(); // Timing
633        case -1671151641:  return addNutrient(); // NutritionOrderOralDietNutrientComponent
634        case -1417816805:  return addTexture(); // NutritionOrderOralDietTextureComponent
635        case -525105592:  return addFluidConsistencyType(); // CodeableConcept
636        case 301526158: throw new FHIRException("Cannot make property instruction as it is not a complex type"); // StringType
637        default: return super.makeProperty(hash, name);
638        }
639
640      }
641
642      @Override
643      public Base addChild(String name) throws FHIRException {
644        if (name.equals("type")) {
645          return addType();
646        }
647        else if (name.equals("schedule")) {
648          return addSchedule();
649        }
650        else if (name.equals("nutrient")) {
651          return addNutrient();
652        }
653        else if (name.equals("texture")) {
654          return addTexture();
655        }
656        else if (name.equals("fluidConsistencyType")) {
657          return addFluidConsistencyType();
658        }
659        else if (name.equals("instruction")) {
660          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instruction");
661        }
662        else
663          return super.addChild(name);
664      }
665
666      public NutritionOrderOralDietComponent copy() {
667        NutritionOrderOralDietComponent dst = new NutritionOrderOralDietComponent();
668        copyValues(dst);
669        if (type != null) {
670          dst.type = new ArrayList<CodeableConcept>();
671          for (CodeableConcept i : type)
672            dst.type.add(i.copy());
673        };
674        if (schedule != null) {
675          dst.schedule = new ArrayList<Timing>();
676          for (Timing i : schedule)
677            dst.schedule.add(i.copy());
678        };
679        if (nutrient != null) {
680          dst.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
681          for (NutritionOrderOralDietNutrientComponent i : nutrient)
682            dst.nutrient.add(i.copy());
683        };
684        if (texture != null) {
685          dst.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
686          for (NutritionOrderOralDietTextureComponent i : texture)
687            dst.texture.add(i.copy());
688        };
689        if (fluidConsistencyType != null) {
690          dst.fluidConsistencyType = new ArrayList<CodeableConcept>();
691          for (CodeableConcept i : fluidConsistencyType)
692            dst.fluidConsistencyType.add(i.copy());
693        };
694        dst.instruction = instruction == null ? null : instruction.copy();
695        return dst;
696      }
697
698      @Override
699      public boolean equalsDeep(Base other) {
700        if (!super.equalsDeep(other))
701          return false;
702        if (!(other instanceof NutritionOrderOralDietComponent))
703          return false;
704        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other;
705        return compareDeep(type, o.type, true) && compareDeep(schedule, o.schedule, true) && compareDeep(nutrient, o.nutrient, true)
706           && compareDeep(texture, o.texture, true) && compareDeep(fluidConsistencyType, o.fluidConsistencyType, true)
707           && compareDeep(instruction, o.instruction, true);
708      }
709
710      @Override
711      public boolean equalsShallow(Base other) {
712        if (!super.equalsShallow(other))
713          return false;
714        if (!(other instanceof NutritionOrderOralDietComponent))
715          return false;
716        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other;
717        return compareValues(instruction, o.instruction, true);
718      }
719
720      public boolean isEmpty() {
721        return super.isEmpty() && (type == null || type.isEmpty()) && (schedule == null || schedule.isEmpty())
722           && (nutrient == null || nutrient.isEmpty()) && (texture == null || texture.isEmpty()) && (fluidConsistencyType == null || fluidConsistencyType.isEmpty())
723           && (instruction == null || instruction.isEmpty());
724      }
725
726  public String fhirType() {
727    return "NutritionOrder.oralDiet";
728
729  }
730
731  }
732
733    @Block()
734    public static class NutritionOrderOralDietNutrientComponent extends BackboneElement implements IBaseBackboneElement {
735        /**
736         * The nutrient that is being modified such as carbohydrate or sodium.
737         */
738        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
739        @Description(shortDefinition="Type of nutrient that is being modified", formalDefinition="The nutrient that is being modified such as carbohydrate or sodium." )
740        protected CodeableConcept modifier;
741
742        /**
743         * The quantity of the specified nutrient to include in diet.
744         */
745        @Child(name = "amount", type = {SimpleQuantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
746        @Description(shortDefinition="Quantity of the specified nutrient", formalDefinition="The quantity of the specified nutrient to include in diet." )
747        protected SimpleQuantity amount;
748
749        private static final long serialVersionUID = 465107295L;
750
751    /**
752     * Constructor
753     */
754      public NutritionOrderOralDietNutrientComponent() {
755        super();
756      }
757
758        /**
759         * @return {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
760         */
761        public CodeableConcept getModifier() { 
762          if (this.modifier == null)
763            if (Configuration.errorOnAutoCreate())
764              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.modifier");
765            else if (Configuration.doAutoCreate())
766              this.modifier = new CodeableConcept(); // cc
767          return this.modifier;
768        }
769
770        public boolean hasModifier() { 
771          return this.modifier != null && !this.modifier.isEmpty();
772        }
773
774        /**
775         * @param value {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
776         */
777        public NutritionOrderOralDietNutrientComponent setModifier(CodeableConcept value) { 
778          this.modifier = value;
779          return this;
780        }
781
782        /**
783         * @return {@link #amount} (The quantity of the specified nutrient to include in diet.)
784         */
785        public SimpleQuantity getAmount() { 
786          if (this.amount == null)
787            if (Configuration.errorOnAutoCreate())
788              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.amount");
789            else if (Configuration.doAutoCreate())
790              this.amount = new SimpleQuantity(); // cc
791          return this.amount;
792        }
793
794        public boolean hasAmount() { 
795          return this.amount != null && !this.amount.isEmpty();
796        }
797
798        /**
799         * @param value {@link #amount} (The quantity of the specified nutrient to include in diet.)
800         */
801        public NutritionOrderOralDietNutrientComponent setAmount(SimpleQuantity value) { 
802          this.amount = value;
803          return this;
804        }
805
806        protected void listChildren(List<Property> childrenList) {
807          super.listChildren(childrenList);
808          childrenList.add(new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, java.lang.Integer.MAX_VALUE, modifier));
809          childrenList.add(new Property("amount", "SimpleQuantity", "The quantity of the specified nutrient to include in diet.", 0, java.lang.Integer.MAX_VALUE, amount));
810        }
811
812      @Override
813      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
814        switch (hash) {
815        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
816        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // SimpleQuantity
817        default: return super.getProperty(hash, name, checkValid);
818        }
819
820      }
821
822      @Override
823      public void setProperty(int hash, String name, Base value) throws FHIRException {
824        switch (hash) {
825        case -615513385: // modifier
826          this.modifier = castToCodeableConcept(value); // CodeableConcept
827          break;
828        case -1413853096: // amount
829          this.amount = castToSimpleQuantity(value); // SimpleQuantity
830          break;
831        default: super.setProperty(hash, name, value);
832        }
833
834      }
835
836      @Override
837      public void setProperty(String name, Base value) throws FHIRException {
838        if (name.equals("modifier"))
839          this.modifier = castToCodeableConcept(value); // CodeableConcept
840        else if (name.equals("amount"))
841          this.amount = castToSimpleQuantity(value); // SimpleQuantity
842        else
843          super.setProperty(name, value);
844      }
845
846      @Override
847      public Base makeProperty(int hash, String name) throws FHIRException {
848        switch (hash) {
849        case -615513385:  return getModifier(); // CodeableConcept
850        case -1413853096:  return getAmount(); // SimpleQuantity
851        default: return super.makeProperty(hash, name);
852        }
853
854      }
855
856      @Override
857      public Base addChild(String name) throws FHIRException {
858        if (name.equals("modifier")) {
859          this.modifier = new CodeableConcept();
860          return this.modifier;
861        }
862        else if (name.equals("amount")) {
863          this.amount = new SimpleQuantity();
864          return this.amount;
865        }
866        else
867          return super.addChild(name);
868      }
869
870      public NutritionOrderOralDietNutrientComponent copy() {
871        NutritionOrderOralDietNutrientComponent dst = new NutritionOrderOralDietNutrientComponent();
872        copyValues(dst);
873        dst.modifier = modifier == null ? null : modifier.copy();
874        dst.amount = amount == null ? null : amount.copy();
875        return dst;
876      }
877
878      @Override
879      public boolean equalsDeep(Base other) {
880        if (!super.equalsDeep(other))
881          return false;
882        if (!(other instanceof NutritionOrderOralDietNutrientComponent))
883          return false;
884        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other;
885        return compareDeep(modifier, o.modifier, true) && compareDeep(amount, o.amount, true);
886      }
887
888      @Override
889      public boolean equalsShallow(Base other) {
890        if (!super.equalsShallow(other))
891          return false;
892        if (!(other instanceof NutritionOrderOralDietNutrientComponent))
893          return false;
894        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other;
895        return true;
896      }
897
898      public boolean isEmpty() {
899        return super.isEmpty() && (modifier == null || modifier.isEmpty()) && (amount == null || amount.isEmpty())
900          ;
901      }
902
903  public String fhirType() {
904    return "NutritionOrder.oralDiet.nutrient";
905
906  }
907
908  }
909
910    @Block()
911    public static class NutritionOrderOralDietTextureComponent extends BackboneElement implements IBaseBackboneElement {
912        /**
913         * Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.
914         */
915        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
916        @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." )
917        protected CodeableConcept modifier;
918
919        /**
920         * The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.
921         */
922        @Child(name = "foodType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
923        @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." )
924        protected CodeableConcept foodType;
925
926        private static final long serialVersionUID = -56402817L;
927
928    /**
929     * Constructor
930     */
931      public NutritionOrderOralDietTextureComponent() {
932        super();
933      }
934
935        /**
936         * @return {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
937         */
938        public CodeableConcept getModifier() { 
939          if (this.modifier == null)
940            if (Configuration.errorOnAutoCreate())
941              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.modifier");
942            else if (Configuration.doAutoCreate())
943              this.modifier = new CodeableConcept(); // cc
944          return this.modifier;
945        }
946
947        public boolean hasModifier() { 
948          return this.modifier != null && !this.modifier.isEmpty();
949        }
950
951        /**
952         * @param value {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
953         */
954        public NutritionOrderOralDietTextureComponent setModifier(CodeableConcept value) { 
955          this.modifier = value;
956          return this;
957        }
958
959        /**
960         * @return {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
961         */
962        public CodeableConcept getFoodType() { 
963          if (this.foodType == null)
964            if (Configuration.errorOnAutoCreate())
965              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.foodType");
966            else if (Configuration.doAutoCreate())
967              this.foodType = new CodeableConcept(); // cc
968          return this.foodType;
969        }
970
971        public boolean hasFoodType() { 
972          return this.foodType != null && !this.foodType.isEmpty();
973        }
974
975        /**
976         * @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.)
977         */
978        public NutritionOrderOralDietTextureComponent setFoodType(CodeableConcept value) { 
979          this.foodType = value;
980          return this;
981        }
982
983        protected void listChildren(List<Property> childrenList) {
984          super.listChildren(childrenList);
985          childrenList.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, java.lang.Integer.MAX_VALUE, modifier));
986          childrenList.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, java.lang.Integer.MAX_VALUE, foodType));
987        }
988
989      @Override
990      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
991        switch (hash) {
992        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
993        case 379498680: /*foodType*/ return this.foodType == null ? new Base[0] : new Base[] {this.foodType}; // CodeableConcept
994        default: return super.getProperty(hash, name, checkValid);
995        }
996
997      }
998
999      @Override
1000      public void setProperty(int hash, String name, Base value) throws FHIRException {
1001        switch (hash) {
1002        case -615513385: // modifier
1003          this.modifier = castToCodeableConcept(value); // CodeableConcept
1004          break;
1005        case 379498680: // foodType
1006          this.foodType = castToCodeableConcept(value); // CodeableConcept
1007          break;
1008        default: super.setProperty(hash, name, value);
1009        }
1010
1011      }
1012
1013      @Override
1014      public void setProperty(String name, Base value) throws FHIRException {
1015        if (name.equals("modifier"))
1016          this.modifier = castToCodeableConcept(value); // CodeableConcept
1017        else if (name.equals("foodType"))
1018          this.foodType = castToCodeableConcept(value); // CodeableConcept
1019        else
1020          super.setProperty(name, value);
1021      }
1022
1023      @Override
1024      public Base makeProperty(int hash, String name) throws FHIRException {
1025        switch (hash) {
1026        case -615513385:  return getModifier(); // CodeableConcept
1027        case 379498680:  return getFoodType(); // CodeableConcept
1028        default: return super.makeProperty(hash, name);
1029        }
1030
1031      }
1032
1033      @Override
1034      public Base addChild(String name) throws FHIRException {
1035        if (name.equals("modifier")) {
1036          this.modifier = new CodeableConcept();
1037          return this.modifier;
1038        }
1039        else if (name.equals("foodType")) {
1040          this.foodType = new CodeableConcept();
1041          return this.foodType;
1042        }
1043        else
1044          return super.addChild(name);
1045      }
1046
1047      public NutritionOrderOralDietTextureComponent copy() {
1048        NutritionOrderOralDietTextureComponent dst = new NutritionOrderOralDietTextureComponent();
1049        copyValues(dst);
1050        dst.modifier = modifier == null ? null : modifier.copy();
1051        dst.foodType = foodType == null ? null : foodType.copy();
1052        return dst;
1053      }
1054
1055      @Override
1056      public boolean equalsDeep(Base other) {
1057        if (!super.equalsDeep(other))
1058          return false;
1059        if (!(other instanceof NutritionOrderOralDietTextureComponent))
1060          return false;
1061        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other;
1062        return compareDeep(modifier, o.modifier, true) && compareDeep(foodType, o.foodType, true);
1063      }
1064
1065      @Override
1066      public boolean equalsShallow(Base other) {
1067        if (!super.equalsShallow(other))
1068          return false;
1069        if (!(other instanceof NutritionOrderOralDietTextureComponent))
1070          return false;
1071        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other;
1072        return true;
1073      }
1074
1075      public boolean isEmpty() {
1076        return super.isEmpty() && (modifier == null || modifier.isEmpty()) && (foodType == null || foodType.isEmpty())
1077          ;
1078      }
1079
1080  public String fhirType() {
1081    return "NutritionOrder.oralDiet.texture";
1082
1083  }
1084
1085  }
1086
1087    @Block()
1088    public static class NutritionOrderSupplementComponent extends BackboneElement implements IBaseBackboneElement {
1089        /**
1090         * The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.
1091         */
1092        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1093        @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." )
1094        protected CodeableConcept type;
1095
1096        /**
1097         * The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1098         */
1099        @Child(name = "productName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1100        @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\"." )
1101        protected StringType productName;
1102
1103        /**
1104         * The time period and frequency at which the supplement(s) should be given.
1105         */
1106        @Child(name = "schedule", type = {Timing.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1107        @Description(shortDefinition="Scheduled frequency of supplement", formalDefinition="The time period and frequency at which the supplement(s) should be given." )
1108        protected List<Timing> schedule;
1109
1110        /**
1111         * The amount of the nutritional supplement to be given.
1112         */
1113        @Child(name = "quantity", type = {SimpleQuantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
1114        @Description(shortDefinition="Amount of the nutritional supplement", formalDefinition="The amount of the nutritional supplement to be given." )
1115        protected SimpleQuantity quantity;
1116
1117        /**
1118         * Free text or additional instructions or information pertaining to the oral supplement.
1119         */
1120        @Child(name = "instruction", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1121        @Description(shortDefinition="Instructions or additional information about the oral supplement", formalDefinition="Free text or additional instructions or information pertaining to the oral supplement." )
1122        protected StringType instruction;
1123
1124        private static final long serialVersionUID = 297545236L;
1125
1126    /**
1127     * Constructor
1128     */
1129      public NutritionOrderSupplementComponent() {
1130        super();
1131      }
1132
1133        /**
1134         * @return {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1135         */
1136        public CodeableConcept getType() { 
1137          if (this.type == null)
1138            if (Configuration.errorOnAutoCreate())
1139              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.type");
1140            else if (Configuration.doAutoCreate())
1141              this.type = new CodeableConcept(); // cc
1142          return this.type;
1143        }
1144
1145        public boolean hasType() { 
1146          return this.type != null && !this.type.isEmpty();
1147        }
1148
1149        /**
1150         * @param value {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1151         */
1152        public NutritionOrderSupplementComponent setType(CodeableConcept value) { 
1153          this.type = value;
1154          return this;
1155        }
1156
1157        /**
1158         * @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
1159         */
1160        public StringType getProductNameElement() { 
1161          if (this.productName == null)
1162            if (Configuration.errorOnAutoCreate())
1163              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.productName");
1164            else if (Configuration.doAutoCreate())
1165              this.productName = new StringType(); // bb
1166          return this.productName;
1167        }
1168
1169        public boolean hasProductNameElement() { 
1170          return this.productName != null && !this.productName.isEmpty();
1171        }
1172
1173        public boolean hasProductName() { 
1174          return this.productName != null && !this.productName.isEmpty();
1175        }
1176
1177        /**
1178         * @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
1179         */
1180        public NutritionOrderSupplementComponent setProductNameElement(StringType value) { 
1181          this.productName = value;
1182          return this;
1183        }
1184
1185        /**
1186         * @return The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1187         */
1188        public String getProductName() { 
1189          return this.productName == null ? null : this.productName.getValue();
1190        }
1191
1192        /**
1193         * @param value The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1194         */
1195        public NutritionOrderSupplementComponent setProductName(String value) { 
1196          if (Utilities.noString(value))
1197            this.productName = null;
1198          else {
1199            if (this.productName == null)
1200              this.productName = new StringType();
1201            this.productName.setValue(value);
1202          }
1203          return this;
1204        }
1205
1206        /**
1207         * @return {@link #schedule} (The time period and frequency at which the supplement(s) should be given.)
1208         */
1209        public List<Timing> getSchedule() { 
1210          if (this.schedule == null)
1211            this.schedule = new ArrayList<Timing>();
1212          return this.schedule;
1213        }
1214
1215        public boolean hasSchedule() { 
1216          if (this.schedule == null)
1217            return false;
1218          for (Timing item : this.schedule)
1219            if (!item.isEmpty())
1220              return true;
1221          return false;
1222        }
1223
1224        /**
1225         * @return {@link #schedule} (The time period and frequency at which the supplement(s) should be given.)
1226         */
1227    // syntactic sugar
1228        public Timing addSchedule() { //3
1229          Timing t = new Timing();
1230          if (this.schedule == null)
1231            this.schedule = new ArrayList<Timing>();
1232          this.schedule.add(t);
1233          return t;
1234        }
1235
1236    // syntactic sugar
1237        public NutritionOrderSupplementComponent addSchedule(Timing t) { //3
1238          if (t == null)
1239            return this;
1240          if (this.schedule == null)
1241            this.schedule = new ArrayList<Timing>();
1242          this.schedule.add(t);
1243          return this;
1244        }
1245
1246        /**
1247         * @return {@link #quantity} (The amount of the nutritional supplement to be given.)
1248         */
1249        public SimpleQuantity getQuantity() { 
1250          if (this.quantity == null)
1251            if (Configuration.errorOnAutoCreate())
1252              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.quantity");
1253            else if (Configuration.doAutoCreate())
1254              this.quantity = new SimpleQuantity(); // cc
1255          return this.quantity;
1256        }
1257
1258        public boolean hasQuantity() { 
1259          return this.quantity != null && !this.quantity.isEmpty();
1260        }
1261
1262        /**
1263         * @param value {@link #quantity} (The amount of the nutritional supplement to be given.)
1264         */
1265        public NutritionOrderSupplementComponent setQuantity(SimpleQuantity value) { 
1266          this.quantity = value;
1267          return this;
1268        }
1269
1270        /**
1271         * @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
1272         */
1273        public StringType getInstructionElement() { 
1274          if (this.instruction == null)
1275            if (Configuration.errorOnAutoCreate())
1276              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.instruction");
1277            else if (Configuration.doAutoCreate())
1278              this.instruction = new StringType(); // bb
1279          return this.instruction;
1280        }
1281
1282        public boolean hasInstructionElement() { 
1283          return this.instruction != null && !this.instruction.isEmpty();
1284        }
1285
1286        public boolean hasInstruction() { 
1287          return this.instruction != null && !this.instruction.isEmpty();
1288        }
1289
1290        /**
1291         * @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
1292         */
1293        public NutritionOrderSupplementComponent setInstructionElement(StringType value) { 
1294          this.instruction = value;
1295          return this;
1296        }
1297
1298        /**
1299         * @return Free text or additional instructions or information pertaining to the oral supplement.
1300         */
1301        public String getInstruction() { 
1302          return this.instruction == null ? null : this.instruction.getValue();
1303        }
1304
1305        /**
1306         * @param value Free text or additional instructions or information pertaining to the oral supplement.
1307         */
1308        public NutritionOrderSupplementComponent setInstruction(String value) { 
1309          if (Utilities.noString(value))
1310            this.instruction = null;
1311          else {
1312            if (this.instruction == null)
1313              this.instruction = new StringType();
1314            this.instruction.setValue(value);
1315          }
1316          return this;
1317        }
1318
1319        protected void listChildren(List<Property> childrenList) {
1320          super.listChildren(childrenList);
1321          childrenList.add(new Property("type", "CodeableConcept", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, java.lang.Integer.MAX_VALUE, type));
1322          childrenList.add(new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, java.lang.Integer.MAX_VALUE, productName));
1323          childrenList.add(new Property("schedule", "Timing", "The time period and frequency at which the supplement(s) should be given.", 0, java.lang.Integer.MAX_VALUE, schedule));
1324          childrenList.add(new Property("quantity", "SimpleQuantity", "The amount of the nutritional supplement to be given.", 0, java.lang.Integer.MAX_VALUE, quantity));
1325          childrenList.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, java.lang.Integer.MAX_VALUE, instruction));
1326        }
1327
1328      @Override
1329      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1330        switch (hash) {
1331        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1332        case -1491817446: /*productName*/ return this.productName == null ? new Base[0] : new Base[] {this.productName}; // StringType
1333        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
1334        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
1335        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
1336        default: return super.getProperty(hash, name, checkValid);
1337        }
1338
1339      }
1340
1341      @Override
1342      public void setProperty(int hash, String name, Base value) throws FHIRException {
1343        switch (hash) {
1344        case 3575610: // type
1345          this.type = castToCodeableConcept(value); // CodeableConcept
1346          break;
1347        case -1491817446: // productName
1348          this.productName = castToString(value); // StringType
1349          break;
1350        case -697920873: // schedule
1351          this.getSchedule().add(castToTiming(value)); // Timing
1352          break;
1353        case -1285004149: // quantity
1354          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
1355          break;
1356        case 301526158: // instruction
1357          this.instruction = castToString(value); // StringType
1358          break;
1359        default: super.setProperty(hash, name, value);
1360        }
1361
1362      }
1363
1364      @Override
1365      public void setProperty(String name, Base value) throws FHIRException {
1366        if (name.equals("type"))
1367          this.type = castToCodeableConcept(value); // CodeableConcept
1368        else if (name.equals("productName"))
1369          this.productName = castToString(value); // StringType
1370        else if (name.equals("schedule"))
1371          this.getSchedule().add(castToTiming(value));
1372        else if (name.equals("quantity"))
1373          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
1374        else if (name.equals("instruction"))
1375          this.instruction = castToString(value); // StringType
1376        else
1377          super.setProperty(name, value);
1378      }
1379
1380      @Override
1381      public Base makeProperty(int hash, String name) throws FHIRException {
1382        switch (hash) {
1383        case 3575610:  return getType(); // CodeableConcept
1384        case -1491817446: throw new FHIRException("Cannot make property productName as it is not a complex type"); // StringType
1385        case -697920873:  return addSchedule(); // Timing
1386        case -1285004149:  return getQuantity(); // SimpleQuantity
1387        case 301526158: throw new FHIRException("Cannot make property instruction as it is not a complex type"); // StringType
1388        default: return super.makeProperty(hash, name);
1389        }
1390
1391      }
1392
1393      @Override
1394      public Base addChild(String name) throws FHIRException {
1395        if (name.equals("type")) {
1396          this.type = new CodeableConcept();
1397          return this.type;
1398        }
1399        else if (name.equals("productName")) {
1400          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.productName");
1401        }
1402        else if (name.equals("schedule")) {
1403          return addSchedule();
1404        }
1405        else if (name.equals("quantity")) {
1406          this.quantity = new SimpleQuantity();
1407          return this.quantity;
1408        }
1409        else if (name.equals("instruction")) {
1410          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instruction");
1411        }
1412        else
1413          return super.addChild(name);
1414      }
1415
1416      public NutritionOrderSupplementComponent copy() {
1417        NutritionOrderSupplementComponent dst = new NutritionOrderSupplementComponent();
1418        copyValues(dst);
1419        dst.type = type == null ? null : type.copy();
1420        dst.productName = productName == null ? null : productName.copy();
1421        if (schedule != null) {
1422          dst.schedule = new ArrayList<Timing>();
1423          for (Timing i : schedule)
1424            dst.schedule.add(i.copy());
1425        };
1426        dst.quantity = quantity == null ? null : quantity.copy();
1427        dst.instruction = instruction == null ? null : instruction.copy();
1428        return dst;
1429      }
1430
1431      @Override
1432      public boolean equalsDeep(Base other) {
1433        if (!super.equalsDeep(other))
1434          return false;
1435        if (!(other instanceof NutritionOrderSupplementComponent))
1436          return false;
1437        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other;
1438        return compareDeep(type, o.type, true) && compareDeep(productName, o.productName, true) && compareDeep(schedule, o.schedule, true)
1439           && compareDeep(quantity, o.quantity, true) && compareDeep(instruction, o.instruction, true);
1440      }
1441
1442      @Override
1443      public boolean equalsShallow(Base other) {
1444        if (!super.equalsShallow(other))
1445          return false;
1446        if (!(other instanceof NutritionOrderSupplementComponent))
1447          return false;
1448        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other;
1449        return compareValues(productName, o.productName, true) && compareValues(instruction, o.instruction, true)
1450          ;
1451      }
1452
1453      public boolean isEmpty() {
1454        return super.isEmpty() && (type == null || type.isEmpty()) && (productName == null || productName.isEmpty())
1455           && (schedule == null || schedule.isEmpty()) && (quantity == null || quantity.isEmpty()) && (instruction == null || instruction.isEmpty())
1456          ;
1457      }
1458
1459  public String fhirType() {
1460    return "NutritionOrder.supplement";
1461
1462  }
1463
1464  }
1465
1466    @Block()
1467    public static class NutritionOrderEnteralFormulaComponent extends BackboneElement implements IBaseBackboneElement {
1468        /**
1469         * The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.
1470         */
1471        @Child(name = "baseFormulaType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1472        @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." )
1473        protected CodeableConcept baseFormulaType;
1474
1475        /**
1476         * The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1477         */
1478        @Child(name = "baseFormulaProductName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1479        @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\"." )
1480        protected StringType baseFormulaProductName;
1481
1482        /**
1483         * 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.
1484         */
1485        @Child(name = "additiveType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1486        @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." )
1487        protected CodeableConcept additiveType;
1488
1489        /**
1490         * The product or brand name of the type of modular component to be added to the formula.
1491         */
1492        @Child(name = "additiveProductName", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1493        @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." )
1494        protected StringType additiveProductName;
1495
1496        /**
1497         * 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.
1498         */
1499        @Child(name = "caloricDensity", type = {SimpleQuantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
1500        @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." )
1501        protected SimpleQuantity caloricDensity;
1502
1503        /**
1504         * The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.
1505         */
1506        @Child(name = "routeofAdministration", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1507        @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." )
1508        protected CodeableConcept routeofAdministration;
1509
1510        /**
1511         * 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.
1512         */
1513        @Child(name = "administration", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1514        @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." )
1515        protected List<NutritionOrderEnteralFormulaAdministrationComponent> administration;
1516
1517        /**
1518         * 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.
1519         */
1520        @Child(name = "maxVolumeToDeliver", type = {SimpleQuantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
1521        @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." )
1522        protected SimpleQuantity maxVolumeToDeliver;
1523
1524        /**
1525         * Free text formula administration, feeding instructions or additional instructions or information.
1526         */
1527        @Child(name = "administrationInstruction", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1528        @Description(shortDefinition="Formula feeding instructions expressed as text", formalDefinition="Free text formula administration, feeding instructions or additional instructions or information." )
1529        protected StringType administrationInstruction;
1530
1531        private static final long serialVersionUID = 292116061L;
1532
1533    /**
1534     * Constructor
1535     */
1536      public NutritionOrderEnteralFormulaComponent() {
1537        super();
1538      }
1539
1540        /**
1541         * @return {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
1542         */
1543        public CodeableConcept getBaseFormulaType() { 
1544          if (this.baseFormulaType == null)
1545            if (Configuration.errorOnAutoCreate())
1546              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaType");
1547            else if (Configuration.doAutoCreate())
1548              this.baseFormulaType = new CodeableConcept(); // cc
1549          return this.baseFormulaType;
1550        }
1551
1552        public boolean hasBaseFormulaType() { 
1553          return this.baseFormulaType != null && !this.baseFormulaType.isEmpty();
1554        }
1555
1556        /**
1557         * @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.)
1558         */
1559        public NutritionOrderEnteralFormulaComponent setBaseFormulaType(CodeableConcept value) { 
1560          this.baseFormulaType = value;
1561          return this;
1562        }
1563
1564        /**
1565         * @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
1566         */
1567        public StringType getBaseFormulaProductNameElement() { 
1568          if (this.baseFormulaProductName == null)
1569            if (Configuration.errorOnAutoCreate())
1570              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaProductName");
1571            else if (Configuration.doAutoCreate())
1572              this.baseFormulaProductName = new StringType(); // bb
1573          return this.baseFormulaProductName;
1574        }
1575
1576        public boolean hasBaseFormulaProductNameElement() { 
1577          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1578        }
1579
1580        public boolean hasBaseFormulaProductName() { 
1581          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1582        }
1583
1584        /**
1585         * @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
1586         */
1587        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductNameElement(StringType value) { 
1588          this.baseFormulaProductName = value;
1589          return this;
1590        }
1591
1592        /**
1593         * @return The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1594         */
1595        public String getBaseFormulaProductName() { 
1596          return this.baseFormulaProductName == null ? null : this.baseFormulaProductName.getValue();
1597        }
1598
1599        /**
1600         * @param value The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1601         */
1602        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductName(String value) { 
1603          if (Utilities.noString(value))
1604            this.baseFormulaProductName = null;
1605          else {
1606            if (this.baseFormulaProductName == null)
1607              this.baseFormulaProductName = new StringType();
1608            this.baseFormulaProductName.setValue(value);
1609          }
1610          return this;
1611        }
1612
1613        /**
1614         * @return {@link #additiveType} (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.)
1615         */
1616        public CodeableConcept getAdditiveType() { 
1617          if (this.additiveType == null)
1618            if (Configuration.errorOnAutoCreate())
1619              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveType");
1620            else if (Configuration.doAutoCreate())
1621              this.additiveType = new CodeableConcept(); // cc
1622          return this.additiveType;
1623        }
1624
1625        public boolean hasAdditiveType() { 
1626          return this.additiveType != null && !this.additiveType.isEmpty();
1627        }
1628
1629        /**
1630         * @param value {@link #additiveType} (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.)
1631         */
1632        public NutritionOrderEnteralFormulaComponent setAdditiveType(CodeableConcept value) { 
1633          this.additiveType = value;
1634          return this;
1635        }
1636
1637        /**
1638         * @return {@link #additiveProductName} (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 "getAdditiveProductName" gives direct access to the value
1639         */
1640        public StringType getAdditiveProductNameElement() { 
1641          if (this.additiveProductName == null)
1642            if (Configuration.errorOnAutoCreate())
1643              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveProductName");
1644            else if (Configuration.doAutoCreate())
1645              this.additiveProductName = new StringType(); // bb
1646          return this.additiveProductName;
1647        }
1648
1649        public boolean hasAdditiveProductNameElement() { 
1650          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
1651        }
1652
1653        public boolean hasAdditiveProductName() { 
1654          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
1655        }
1656
1657        /**
1658         * @param value {@link #additiveProductName} (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 "getAdditiveProductName" gives direct access to the value
1659         */
1660        public NutritionOrderEnteralFormulaComponent setAdditiveProductNameElement(StringType value) { 
1661          this.additiveProductName = value;
1662          return this;
1663        }
1664
1665        /**
1666         * @return The product or brand name of the type of modular component to be added to the formula.
1667         */
1668        public String getAdditiveProductName() { 
1669          return this.additiveProductName == null ? null : this.additiveProductName.getValue();
1670        }
1671
1672        /**
1673         * @param value The product or brand name of the type of modular component to be added to the formula.
1674         */
1675        public NutritionOrderEnteralFormulaComponent setAdditiveProductName(String value) { 
1676          if (Utilities.noString(value))
1677            this.additiveProductName = null;
1678          else {
1679            if (this.additiveProductName == null)
1680              this.additiveProductName = new StringType();
1681            this.additiveProductName.setValue(value);
1682          }
1683          return this;
1684        }
1685
1686        /**
1687         * @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.)
1688         */
1689        public SimpleQuantity getCaloricDensity() { 
1690          if (this.caloricDensity == null)
1691            if (Configuration.errorOnAutoCreate())
1692              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.caloricDensity");
1693            else if (Configuration.doAutoCreate())
1694              this.caloricDensity = new SimpleQuantity(); // cc
1695          return this.caloricDensity;
1696        }
1697
1698        public boolean hasCaloricDensity() { 
1699          return this.caloricDensity != null && !this.caloricDensity.isEmpty();
1700        }
1701
1702        /**
1703         * @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.)
1704         */
1705        public NutritionOrderEnteralFormulaComponent setCaloricDensity(SimpleQuantity value) { 
1706          this.caloricDensity = value;
1707          return this;
1708        }
1709
1710        /**
1711         * @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.)
1712         */
1713        public CodeableConcept getRouteofAdministration() { 
1714          if (this.routeofAdministration == null)
1715            if (Configuration.errorOnAutoCreate())
1716              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.routeofAdministration");
1717            else if (Configuration.doAutoCreate())
1718              this.routeofAdministration = new CodeableConcept(); // cc
1719          return this.routeofAdministration;
1720        }
1721
1722        public boolean hasRouteofAdministration() { 
1723          return this.routeofAdministration != null && !this.routeofAdministration.isEmpty();
1724        }
1725
1726        /**
1727         * @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.)
1728         */
1729        public NutritionOrderEnteralFormulaComponent setRouteofAdministration(CodeableConcept value) { 
1730          this.routeofAdministration = value;
1731          return this;
1732        }
1733
1734        /**
1735         * @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.)
1736         */
1737        public List<NutritionOrderEnteralFormulaAdministrationComponent> getAdministration() { 
1738          if (this.administration == null)
1739            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1740          return this.administration;
1741        }
1742
1743        public boolean hasAdministration() { 
1744          if (this.administration == null)
1745            return false;
1746          for (NutritionOrderEnteralFormulaAdministrationComponent item : this.administration)
1747            if (!item.isEmpty())
1748              return true;
1749          return false;
1750        }
1751
1752        /**
1753         * @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.)
1754         */
1755    // syntactic sugar
1756        public NutritionOrderEnteralFormulaAdministrationComponent addAdministration() { //3
1757          NutritionOrderEnteralFormulaAdministrationComponent t = new NutritionOrderEnteralFormulaAdministrationComponent();
1758          if (this.administration == null)
1759            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1760          this.administration.add(t);
1761          return t;
1762        }
1763
1764    // syntactic sugar
1765        public NutritionOrderEnteralFormulaComponent addAdministration(NutritionOrderEnteralFormulaAdministrationComponent t) { //3
1766          if (t == null)
1767            return this;
1768          if (this.administration == null)
1769            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
1770          this.administration.add(t);
1771          return this;
1772        }
1773
1774        /**
1775         * @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.)
1776         */
1777        public SimpleQuantity getMaxVolumeToDeliver() { 
1778          if (this.maxVolumeToDeliver == null)
1779            if (Configuration.errorOnAutoCreate())
1780              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.maxVolumeToDeliver");
1781            else if (Configuration.doAutoCreate())
1782              this.maxVolumeToDeliver = new SimpleQuantity(); // cc
1783          return this.maxVolumeToDeliver;
1784        }
1785
1786        public boolean hasMaxVolumeToDeliver() { 
1787          return this.maxVolumeToDeliver != null && !this.maxVolumeToDeliver.isEmpty();
1788        }
1789
1790        /**
1791         * @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.)
1792         */
1793        public NutritionOrderEnteralFormulaComponent setMaxVolumeToDeliver(SimpleQuantity value) { 
1794          this.maxVolumeToDeliver = value;
1795          return this;
1796        }
1797
1798        /**
1799         * @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
1800         */
1801        public StringType getAdministrationInstructionElement() { 
1802          if (this.administrationInstruction == null)
1803            if (Configuration.errorOnAutoCreate())
1804              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.administrationInstruction");
1805            else if (Configuration.doAutoCreate())
1806              this.administrationInstruction = new StringType(); // bb
1807          return this.administrationInstruction;
1808        }
1809
1810        public boolean hasAdministrationInstructionElement() { 
1811          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
1812        }
1813
1814        public boolean hasAdministrationInstruction() { 
1815          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
1816        }
1817
1818        /**
1819         * @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
1820         */
1821        public NutritionOrderEnteralFormulaComponent setAdministrationInstructionElement(StringType value) { 
1822          this.administrationInstruction = value;
1823          return this;
1824        }
1825
1826        /**
1827         * @return Free text formula administration, feeding instructions or additional instructions or information.
1828         */
1829        public String getAdministrationInstruction() { 
1830          return this.administrationInstruction == null ? null : this.administrationInstruction.getValue();
1831        }
1832
1833        /**
1834         * @param value Free text formula administration, feeding instructions or additional instructions or information.
1835         */
1836        public NutritionOrderEnteralFormulaComponent setAdministrationInstruction(String value) { 
1837          if (Utilities.noString(value))
1838            this.administrationInstruction = null;
1839          else {
1840            if (this.administrationInstruction == null)
1841              this.administrationInstruction = new StringType();
1842            this.administrationInstruction.setValue(value);
1843          }
1844          return this;
1845        }
1846
1847        protected void listChildren(List<Property> childrenList) {
1848          super.listChildren(childrenList);
1849          childrenList.add(new Property("baseFormulaType", "CodeableConcept", "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.", 0, java.lang.Integer.MAX_VALUE, baseFormulaType));
1850          childrenList.add(new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, java.lang.Integer.MAX_VALUE, baseFormulaProductName));
1851          childrenList.add(new Property("additiveType", "CodeableConcept", "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, java.lang.Integer.MAX_VALUE, additiveType));
1852          childrenList.add(new Property("additiveProductName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, java.lang.Integer.MAX_VALUE, additiveProductName));
1853          childrenList.add(new Property("caloricDensity", "SimpleQuantity", "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, java.lang.Integer.MAX_VALUE, caloricDensity));
1854          childrenList.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, java.lang.Integer.MAX_VALUE, routeofAdministration));
1855          childrenList.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));
1856          childrenList.add(new Property("maxVolumeToDeliver", "SimpleQuantity", "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, java.lang.Integer.MAX_VALUE, maxVolumeToDeliver));
1857          childrenList.add(new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, java.lang.Integer.MAX_VALUE, administrationInstruction));
1858        }
1859
1860      @Override
1861      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1862        switch (hash) {
1863        case -138930641: /*baseFormulaType*/ return this.baseFormulaType == null ? new Base[0] : new Base[] {this.baseFormulaType}; // CodeableConcept
1864        case -1267705979: /*baseFormulaProductName*/ return this.baseFormulaProductName == null ? new Base[0] : new Base[] {this.baseFormulaProductName}; // StringType
1865        case -470746842: /*additiveType*/ return this.additiveType == null ? new Base[0] : new Base[] {this.additiveType}; // CodeableConcept
1866        case 488079534: /*additiveProductName*/ return this.additiveProductName == null ? new Base[0] : new Base[] {this.additiveProductName}; // StringType
1867        case 186983261: /*caloricDensity*/ return this.caloricDensity == null ? new Base[0] : new Base[] {this.caloricDensity}; // SimpleQuantity
1868        case -1710107042: /*routeofAdministration*/ return this.routeofAdministration == null ? new Base[0] : new Base[] {this.routeofAdministration}; // CodeableConcept
1869        case 1255702622: /*administration*/ return this.administration == null ? new Base[0] : this.administration.toArray(new Base[this.administration.size()]); // NutritionOrderEnteralFormulaAdministrationComponent
1870        case 2017924652: /*maxVolumeToDeliver*/ return this.maxVolumeToDeliver == null ? new Base[0] : new Base[] {this.maxVolumeToDeliver}; // SimpleQuantity
1871        case 427085136: /*administrationInstruction*/ return this.administrationInstruction == null ? new Base[0] : new Base[] {this.administrationInstruction}; // StringType
1872        default: return super.getProperty(hash, name, checkValid);
1873        }
1874
1875      }
1876
1877      @Override
1878      public void setProperty(int hash, String name, Base value) throws FHIRException {
1879        switch (hash) {
1880        case -138930641: // baseFormulaType
1881          this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
1882          break;
1883        case -1267705979: // baseFormulaProductName
1884          this.baseFormulaProductName = castToString(value); // StringType
1885          break;
1886        case -470746842: // additiveType
1887          this.additiveType = castToCodeableConcept(value); // CodeableConcept
1888          break;
1889        case 488079534: // additiveProductName
1890          this.additiveProductName = castToString(value); // StringType
1891          break;
1892        case 186983261: // caloricDensity
1893          this.caloricDensity = castToSimpleQuantity(value); // SimpleQuantity
1894          break;
1895        case -1710107042: // routeofAdministration
1896          this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
1897          break;
1898        case 1255702622: // administration
1899          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value); // NutritionOrderEnteralFormulaAdministrationComponent
1900          break;
1901        case 2017924652: // maxVolumeToDeliver
1902          this.maxVolumeToDeliver = castToSimpleQuantity(value); // SimpleQuantity
1903          break;
1904        case 427085136: // administrationInstruction
1905          this.administrationInstruction = castToString(value); // StringType
1906          break;
1907        default: super.setProperty(hash, name, value);
1908        }
1909
1910      }
1911
1912      @Override
1913      public void setProperty(String name, Base value) throws FHIRException {
1914        if (name.equals("baseFormulaType"))
1915          this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
1916        else if (name.equals("baseFormulaProductName"))
1917          this.baseFormulaProductName = castToString(value); // StringType
1918        else if (name.equals("additiveType"))
1919          this.additiveType = castToCodeableConcept(value); // CodeableConcept
1920        else if (name.equals("additiveProductName"))
1921          this.additiveProductName = castToString(value); // StringType
1922        else if (name.equals("caloricDensity"))
1923          this.caloricDensity = castToSimpleQuantity(value); // SimpleQuantity
1924        else if (name.equals("routeofAdministration"))
1925          this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
1926        else if (name.equals("administration"))
1927          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value);
1928        else if (name.equals("maxVolumeToDeliver"))
1929          this.maxVolumeToDeliver = castToSimpleQuantity(value); // SimpleQuantity
1930        else if (name.equals("administrationInstruction"))
1931          this.administrationInstruction = castToString(value); // StringType
1932        else
1933          super.setProperty(name, value);
1934      }
1935
1936      @Override
1937      public Base makeProperty(int hash, String name) throws FHIRException {
1938        switch (hash) {
1939        case -138930641:  return getBaseFormulaType(); // CodeableConcept
1940        case -1267705979: throw new FHIRException("Cannot make property baseFormulaProductName as it is not a complex type"); // StringType
1941        case -470746842:  return getAdditiveType(); // CodeableConcept
1942        case 488079534: throw new FHIRException("Cannot make property additiveProductName as it is not a complex type"); // StringType
1943        case 186983261:  return getCaloricDensity(); // SimpleQuantity
1944        case -1710107042:  return getRouteofAdministration(); // CodeableConcept
1945        case 1255702622:  return addAdministration(); // NutritionOrderEnteralFormulaAdministrationComponent
1946        case 2017924652:  return getMaxVolumeToDeliver(); // SimpleQuantity
1947        case 427085136: throw new FHIRException("Cannot make property administrationInstruction as it is not a complex type"); // StringType
1948        default: return super.makeProperty(hash, name);
1949        }
1950
1951      }
1952
1953      @Override
1954      public Base addChild(String name) throws FHIRException {
1955        if (name.equals("baseFormulaType")) {
1956          this.baseFormulaType = new CodeableConcept();
1957          return this.baseFormulaType;
1958        }
1959        else if (name.equals("baseFormulaProductName")) {
1960          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.baseFormulaProductName");
1961        }
1962        else if (name.equals("additiveType")) {
1963          this.additiveType = new CodeableConcept();
1964          return this.additiveType;
1965        }
1966        else if (name.equals("additiveProductName")) {
1967          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.additiveProductName");
1968        }
1969        else if (name.equals("caloricDensity")) {
1970          this.caloricDensity = new SimpleQuantity();
1971          return this.caloricDensity;
1972        }
1973        else if (name.equals("routeofAdministration")) {
1974          this.routeofAdministration = new CodeableConcept();
1975          return this.routeofAdministration;
1976        }
1977        else if (name.equals("administration")) {
1978          return addAdministration();
1979        }
1980        else if (name.equals("maxVolumeToDeliver")) {
1981          this.maxVolumeToDeliver = new SimpleQuantity();
1982          return this.maxVolumeToDeliver;
1983        }
1984        else if (name.equals("administrationInstruction")) {
1985          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.administrationInstruction");
1986        }
1987        else
1988          return super.addChild(name);
1989      }
1990
1991      public NutritionOrderEnteralFormulaComponent copy() {
1992        NutritionOrderEnteralFormulaComponent dst = new NutritionOrderEnteralFormulaComponent();
1993        copyValues(dst);
1994        dst.baseFormulaType = baseFormulaType == null ? null : baseFormulaType.copy();
1995        dst.baseFormulaProductName = baseFormulaProductName == null ? null : baseFormulaProductName.copy();
1996        dst.additiveType = additiveType == null ? null : additiveType.copy();
1997        dst.additiveProductName = additiveProductName == null ? null : additiveProductName.copy();
1998        dst.caloricDensity = caloricDensity == null ? null : caloricDensity.copy();
1999        dst.routeofAdministration = routeofAdministration == null ? null : routeofAdministration.copy();
2000        if (administration != null) {
2001          dst.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2002          for (NutritionOrderEnteralFormulaAdministrationComponent i : administration)
2003            dst.administration.add(i.copy());
2004        };
2005        dst.maxVolumeToDeliver = maxVolumeToDeliver == null ? null : maxVolumeToDeliver.copy();
2006        dst.administrationInstruction = administrationInstruction == null ? null : administrationInstruction.copy();
2007        return dst;
2008      }
2009
2010      @Override
2011      public boolean equalsDeep(Base other) {
2012        if (!super.equalsDeep(other))
2013          return false;
2014        if (!(other instanceof NutritionOrderEnteralFormulaComponent))
2015          return false;
2016        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other;
2017        return compareDeep(baseFormulaType, o.baseFormulaType, true) && compareDeep(baseFormulaProductName, o.baseFormulaProductName, true)
2018           && compareDeep(additiveType, o.additiveType, true) && compareDeep(additiveProductName, o.additiveProductName, true)
2019           && compareDeep(caloricDensity, o.caloricDensity, true) && compareDeep(routeofAdministration, o.routeofAdministration, true)
2020           && compareDeep(administration, o.administration, true) && compareDeep(maxVolumeToDeliver, o.maxVolumeToDeliver, true)
2021           && compareDeep(administrationInstruction, o.administrationInstruction, true);
2022      }
2023
2024      @Override
2025      public boolean equalsShallow(Base other) {
2026        if (!super.equalsShallow(other))
2027          return false;
2028        if (!(other instanceof NutritionOrderEnteralFormulaComponent))
2029          return false;
2030        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other;
2031        return compareValues(baseFormulaProductName, o.baseFormulaProductName, true) && compareValues(additiveProductName, o.additiveProductName, true)
2032           && compareValues(administrationInstruction, o.administrationInstruction, true);
2033      }
2034
2035      public boolean isEmpty() {
2036        return super.isEmpty() && (baseFormulaType == null || baseFormulaType.isEmpty()) && (baseFormulaProductName == null || baseFormulaProductName.isEmpty())
2037           && (additiveType == null || additiveType.isEmpty()) && (additiveProductName == null || additiveProductName.isEmpty())
2038           && (caloricDensity == null || caloricDensity.isEmpty()) && (routeofAdministration == null || routeofAdministration.isEmpty())
2039           && (administration == null || administration.isEmpty()) && (maxVolumeToDeliver == null || maxVolumeToDeliver.isEmpty())
2040           && (administrationInstruction == null || administrationInstruction.isEmpty());
2041      }
2042
2043  public String fhirType() {
2044    return "NutritionOrder.enteralFormula";
2045
2046  }
2047
2048  }
2049
2050    @Block()
2051    public static class NutritionOrderEnteralFormulaAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
2052        /**
2053         * The time period and frequency at which the enteral formula should be delivered to the patient.
2054         */
2055        @Child(name = "schedule", type = {Timing.class}, order=1, min=0, max=1, modifier=false, summary=false)
2056        @Description(shortDefinition="Scheduled frequency of enteral feeding", formalDefinition="The time period and frequency at which the enteral formula should be delivered to the patient." )
2057        protected Timing schedule;
2058
2059        /**
2060         * The volume of formula to provide to the patient per the specified administration schedule.
2061         */
2062        @Child(name = "quantity", type = {SimpleQuantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
2063        @Description(shortDefinition="The volume of formula to provide", formalDefinition="The volume of formula to provide to the patient per the specified administration schedule." )
2064        protected SimpleQuantity quantity;
2065
2066        /**
2067         * The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.
2068         */
2069        @Child(name = "rate", type = {SimpleQuantity.class, Ratio.class}, order=3, min=0, max=1, modifier=false, summary=false)
2070        @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." )
2071        protected Type rate;
2072
2073        private static final long serialVersionUID = 1895031997L;
2074
2075    /**
2076     * Constructor
2077     */
2078      public NutritionOrderEnteralFormulaAdministrationComponent() {
2079        super();
2080      }
2081
2082        /**
2083         * @return {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2084         */
2085        public Timing getSchedule() { 
2086          if (this.schedule == null)
2087            if (Configuration.errorOnAutoCreate())
2088              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.schedule");
2089            else if (Configuration.doAutoCreate())
2090              this.schedule = new Timing(); // cc
2091          return this.schedule;
2092        }
2093
2094        public boolean hasSchedule() { 
2095          return this.schedule != null && !this.schedule.isEmpty();
2096        }
2097
2098        /**
2099         * @param value {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2100         */
2101        public NutritionOrderEnteralFormulaAdministrationComponent setSchedule(Timing value) { 
2102          this.schedule = value;
2103          return this;
2104        }
2105
2106        /**
2107         * @return {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2108         */
2109        public SimpleQuantity getQuantity() { 
2110          if (this.quantity == null)
2111            if (Configuration.errorOnAutoCreate())
2112              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.quantity");
2113            else if (Configuration.doAutoCreate())
2114              this.quantity = new SimpleQuantity(); // cc
2115          return this.quantity;
2116        }
2117
2118        public boolean hasQuantity() { 
2119          return this.quantity != null && !this.quantity.isEmpty();
2120        }
2121
2122        /**
2123         * @param value {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2124         */
2125        public NutritionOrderEnteralFormulaAdministrationComponent setQuantity(SimpleQuantity value) { 
2126          this.quantity = value;
2127          return this;
2128        }
2129
2130        /**
2131         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2132         */
2133        public Type getRate() { 
2134          return this.rate;
2135        }
2136
2137        /**
2138         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2139         */
2140        public SimpleQuantity getRateSimpleQuantity() throws FHIRException { 
2141          if (!(this.rate instanceof SimpleQuantity))
2142            throw new FHIRException("Type mismatch: the type SimpleQuantity was expected, but "+this.rate.getClass().getName()+" was encountered");
2143          return (SimpleQuantity) this.rate;
2144        }
2145
2146        public boolean hasRateSimpleQuantity() { 
2147          return this.rate instanceof SimpleQuantity;
2148        }
2149
2150        /**
2151         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2152         */
2153        public Ratio getRateRatio() throws FHIRException { 
2154          if (!(this.rate instanceof Ratio))
2155            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered");
2156          return (Ratio) this.rate;
2157        }
2158
2159        public boolean hasRateRatio() { 
2160          return this.rate instanceof Ratio;
2161        }
2162
2163        public boolean hasRate() { 
2164          return this.rate != null && !this.rate.isEmpty();
2165        }
2166
2167        /**
2168         * @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.)
2169         */
2170        public NutritionOrderEnteralFormulaAdministrationComponent setRate(Type value) { 
2171          this.rate = value;
2172          return this;
2173        }
2174
2175        protected void listChildren(List<Property> childrenList) {
2176          super.listChildren(childrenList);
2177          childrenList.add(new Property("schedule", "Timing", "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, java.lang.Integer.MAX_VALUE, schedule));
2178          childrenList.add(new Property("quantity", "SimpleQuantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, java.lang.Integer.MAX_VALUE, quantity));
2179          childrenList.add(new Property("rate[x]", "SimpleQuantity|Ratio", "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.", 0, java.lang.Integer.MAX_VALUE, rate));
2180        }
2181
2182      @Override
2183      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2184        switch (hash) {
2185        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // Timing
2186        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // SimpleQuantity
2187        case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // Type
2188        default: return super.getProperty(hash, name, checkValid);
2189        }
2190
2191      }
2192
2193      @Override
2194      public void setProperty(int hash, String name, Base value) throws FHIRException {
2195        switch (hash) {
2196        case -697920873: // schedule
2197          this.schedule = castToTiming(value); // Timing
2198          break;
2199        case -1285004149: // quantity
2200          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2201          break;
2202        case 3493088: // rate
2203          this.rate = (Type) value; // Type
2204          break;
2205        default: super.setProperty(hash, name, value);
2206        }
2207
2208      }
2209
2210      @Override
2211      public void setProperty(String name, Base value) throws FHIRException {
2212        if (name.equals("schedule"))
2213          this.schedule = castToTiming(value); // Timing
2214        else if (name.equals("quantity"))
2215          this.quantity = castToSimpleQuantity(value); // SimpleQuantity
2216        else if (name.equals("rate[x]"))
2217          this.rate = (Type) value; // Type
2218        else
2219          super.setProperty(name, value);
2220      }
2221
2222      @Override
2223      public Base makeProperty(int hash, String name) throws FHIRException {
2224        switch (hash) {
2225        case -697920873:  return getSchedule(); // Timing
2226        case -1285004149:  return getQuantity(); // SimpleQuantity
2227        case 983460768:  return getRate(); // Type
2228        default: return super.makeProperty(hash, name);
2229        }
2230
2231      }
2232
2233      @Override
2234      public Base addChild(String name) throws FHIRException {
2235        if (name.equals("schedule")) {
2236          this.schedule = new Timing();
2237          return this.schedule;
2238        }
2239        else if (name.equals("quantity")) {
2240          this.quantity = new SimpleQuantity();
2241          return this.quantity;
2242        }
2243        else if (name.equals("rateSimpleQuantity")) {
2244          this.rate = new SimpleQuantity();
2245          return this.rate;
2246        }
2247        else if (name.equals("rateRatio")) {
2248          this.rate = new Ratio();
2249          return this.rate;
2250        }
2251        else
2252          return super.addChild(name);
2253      }
2254
2255      public NutritionOrderEnteralFormulaAdministrationComponent copy() {
2256        NutritionOrderEnteralFormulaAdministrationComponent dst = new NutritionOrderEnteralFormulaAdministrationComponent();
2257        copyValues(dst);
2258        dst.schedule = schedule == null ? null : schedule.copy();
2259        dst.quantity = quantity == null ? null : quantity.copy();
2260        dst.rate = rate == null ? null : rate.copy();
2261        return dst;
2262      }
2263
2264      @Override
2265      public boolean equalsDeep(Base other) {
2266        if (!super.equalsDeep(other))
2267          return false;
2268        if (!(other instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2269          return false;
2270        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other;
2271        return compareDeep(schedule, o.schedule, true) && compareDeep(quantity, o.quantity, true) && compareDeep(rate, o.rate, true)
2272          ;
2273      }
2274
2275      @Override
2276      public boolean equalsShallow(Base other) {
2277        if (!super.equalsShallow(other))
2278          return false;
2279        if (!(other instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2280          return false;
2281        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other;
2282        return true;
2283      }
2284
2285      public boolean isEmpty() {
2286        return super.isEmpty() && (schedule == null || schedule.isEmpty()) && (quantity == null || quantity.isEmpty())
2287           && (rate == null || rate.isEmpty());
2288      }
2289
2290  public String fhirType() {
2291    return "NutritionOrder.enteralFormula.administration";
2292
2293  }
2294
2295  }
2296
2297    /**
2298     * Identifiers assigned to this order by the order sender or by the order receiver.
2299     */
2300    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2301    @Description(shortDefinition="Identifiers assigned to this order", formalDefinition="Identifiers assigned to this order by the order sender or by the order receiver." )
2302    protected List<Identifier> identifier;
2303
2304    /**
2305     * The workflow status of the nutrition order/request.
2306     */
2307    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
2308    @Description(shortDefinition="proposed | draft | planned | requested | active | on-hold | completed | cancelled | entered-in-error", formalDefinition="The workflow status of the nutrition order/request." )
2309    protected Enumeration<NutritionOrderStatus> status;
2310
2311    /**
2312     * The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.
2313     */
2314    @Child(name = "patient", type = {Patient.class}, order=2, min=1, max=1, modifier=false, summary=true)
2315    @Description(shortDefinition="The person who requires the diet, formula or nutritional supplement", formalDefinition="The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding." )
2316    protected Reference patient;
2317
2318    /**
2319     * The actual object that is the target of the reference (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2320     */
2321    protected Patient patientTarget;
2322
2323    /**
2324     * An encounter that provides additional information about the healthcare context in which this request is made.
2325     */
2326    @Child(name = "encounter", type = {Encounter.class}, order=3, min=0, max=1, modifier=false, summary=false)
2327    @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." )
2328    protected Reference encounter;
2329
2330    /**
2331     * The actual object that is the target of the reference (An encounter that provides additional information about the healthcare context in which this request is made.)
2332     */
2333    protected Encounter encounterTarget;
2334
2335    /**
2336     * The date and time that this nutrition order was requested.
2337     */
2338    @Child(name = "dateTime", type = {DateTimeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
2339    @Description(shortDefinition="Date and time the nutrition order was requested", formalDefinition="The date and time that this nutrition order was requested." )
2340    protected DateTimeType dateTime;
2341
2342    /**
2343     * The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.
2344     */
2345    @Child(name = "orderer", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true)
2346    @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." )
2347    protected Reference orderer;
2348
2349    /**
2350     * The actual object that is the target of the reference (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2351     */
2352    protected Practitioner ordererTarget;
2353
2354    /**
2355     * A link to a record of allergies or intolerances  which should be included in the nutrition order.
2356     */
2357    @Child(name = "allergyIntolerance", type = {AllergyIntolerance.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2358    @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." )
2359    protected List<Reference> allergyIntolerance;
2360    /**
2361     * The actual objects that are the target of the reference (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2362     */
2363    protected List<AllergyIntolerance> allergyIntoleranceTarget;
2364
2365
2366    /**
2367     * 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.
2368     */
2369    @Child(name = "foodPreferenceModifier", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2370    @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." )
2371    protected List<CodeableConcept> foodPreferenceModifier;
2372
2373    /**
2374     * This modifier is used to convey order-specific modifiers about the type of food 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.
2375     */
2376    @Child(name = "excludeFoodModifier", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2377    @Description(shortDefinition="Order-specific modifier about the type of food that should not be given", formalDefinition="This modifier is used to convey order-specific modifiers about the type of food 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." )
2378    protected List<CodeableConcept> excludeFoodModifier;
2379
2380    /**
2381     * Diet given orally in contrast to enteral (tube) feeding.
2382     */
2383    @Child(name = "oralDiet", type = {}, order=9, min=0, max=1, modifier=false, summary=false)
2384    @Description(shortDefinition="Oral diet components", formalDefinition="Diet given orally in contrast to enteral (tube) feeding." )
2385    protected NutritionOrderOralDietComponent oralDiet;
2386
2387    /**
2388     * Oral nutritional products given in order to add further nutritional value to the patient's diet.
2389     */
2390    @Child(name = "supplement", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2391    @Description(shortDefinition="Supplement components", formalDefinition="Oral nutritional products given in order to add further nutritional value to the patient's diet." )
2392    protected List<NutritionOrderSupplementComponent> supplement;
2393
2394    /**
2395     * Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.
2396     */
2397    @Child(name = "enteralFormula", type = {}, order=11, min=0, max=1, modifier=false, summary=false)
2398    @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." )
2399    protected NutritionOrderEnteralFormulaComponent enteralFormula;
2400
2401    private static final long serialVersionUID = 1429947433L;
2402
2403  /**
2404   * Constructor
2405   */
2406    public NutritionOrder() {
2407      super();
2408    }
2409
2410  /**
2411   * Constructor
2412   */
2413    public NutritionOrder(Reference patient, DateTimeType dateTime) {
2414      super();
2415      this.patient = patient;
2416      this.dateTime = dateTime;
2417    }
2418
2419    /**
2420     * @return {@link #identifier} (Identifiers assigned to this order by the order sender or by the order receiver.)
2421     */
2422    public List<Identifier> getIdentifier() { 
2423      if (this.identifier == null)
2424        this.identifier = new ArrayList<Identifier>();
2425      return this.identifier;
2426    }
2427
2428    public boolean hasIdentifier() { 
2429      if (this.identifier == null)
2430        return false;
2431      for (Identifier item : this.identifier)
2432        if (!item.isEmpty())
2433          return true;
2434      return false;
2435    }
2436
2437    /**
2438     * @return {@link #identifier} (Identifiers assigned to this order by the order sender or by the order receiver.)
2439     */
2440    // syntactic sugar
2441    public Identifier addIdentifier() { //3
2442      Identifier t = new Identifier();
2443      if (this.identifier == null)
2444        this.identifier = new ArrayList<Identifier>();
2445      this.identifier.add(t);
2446      return t;
2447    }
2448
2449    // syntactic sugar
2450    public NutritionOrder addIdentifier(Identifier t) { //3
2451      if (t == null)
2452        return this;
2453      if (this.identifier == null)
2454        this.identifier = new ArrayList<Identifier>();
2455      this.identifier.add(t);
2456      return this;
2457    }
2458
2459    /**
2460     * @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
2461     */
2462    public Enumeration<NutritionOrderStatus> getStatusElement() { 
2463      if (this.status == null)
2464        if (Configuration.errorOnAutoCreate())
2465          throw new Error("Attempt to auto-create NutritionOrder.status");
2466        else if (Configuration.doAutoCreate())
2467          this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory()); // bb
2468      return this.status;
2469    }
2470
2471    public boolean hasStatusElement() { 
2472      return this.status != null && !this.status.isEmpty();
2473    }
2474
2475    public boolean hasStatus() { 
2476      return this.status != null && !this.status.isEmpty();
2477    }
2478
2479    /**
2480     * @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
2481     */
2482    public NutritionOrder setStatusElement(Enumeration<NutritionOrderStatus> value) { 
2483      this.status = value;
2484      return this;
2485    }
2486
2487    /**
2488     * @return The workflow status of the nutrition order/request.
2489     */
2490    public NutritionOrderStatus getStatus() { 
2491      return this.status == null ? null : this.status.getValue();
2492    }
2493
2494    /**
2495     * @param value The workflow status of the nutrition order/request.
2496     */
2497    public NutritionOrder setStatus(NutritionOrderStatus value) { 
2498      if (value == null)
2499        this.status = null;
2500      else {
2501        if (this.status == null)
2502          this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory());
2503        this.status.setValue(value);
2504      }
2505      return this;
2506    }
2507
2508    /**
2509     * @return {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2510     */
2511    public Reference getPatient() { 
2512      if (this.patient == null)
2513        if (Configuration.errorOnAutoCreate())
2514          throw new Error("Attempt to auto-create NutritionOrder.patient");
2515        else if (Configuration.doAutoCreate())
2516          this.patient = new Reference(); // cc
2517      return this.patient;
2518    }
2519
2520    public boolean hasPatient() { 
2521      return this.patient != null && !this.patient.isEmpty();
2522    }
2523
2524    /**
2525     * @param value {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2526     */
2527    public NutritionOrder setPatient(Reference value) { 
2528      this.patient = value;
2529      return this;
2530    }
2531
2532    /**
2533     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2534     */
2535    public Patient getPatientTarget() { 
2536      if (this.patientTarget == null)
2537        if (Configuration.errorOnAutoCreate())
2538          throw new Error("Attempt to auto-create NutritionOrder.patient");
2539        else if (Configuration.doAutoCreate())
2540          this.patientTarget = new Patient(); // aa
2541      return this.patientTarget;
2542    }
2543
2544    /**
2545     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
2546     */
2547    public NutritionOrder setPatientTarget(Patient value) { 
2548      this.patientTarget = value;
2549      return this;
2550    }
2551
2552    /**
2553     * @return {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
2554     */
2555    public Reference getEncounter() { 
2556      if (this.encounter == null)
2557        if (Configuration.errorOnAutoCreate())
2558          throw new Error("Attempt to auto-create NutritionOrder.encounter");
2559        else if (Configuration.doAutoCreate())
2560          this.encounter = new Reference(); // cc
2561      return this.encounter;
2562    }
2563
2564    public boolean hasEncounter() { 
2565      return this.encounter != null && !this.encounter.isEmpty();
2566    }
2567
2568    /**
2569     * @param value {@link #encounter} (An encounter that provides additional information about the healthcare context in which this request is made.)
2570     */
2571    public NutritionOrder setEncounter(Reference value) { 
2572      this.encounter = value;
2573      return this;
2574    }
2575
2576    /**
2577     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (An encounter that provides additional information about the healthcare context in which this request is made.)
2578     */
2579    public Encounter getEncounterTarget() { 
2580      if (this.encounterTarget == null)
2581        if (Configuration.errorOnAutoCreate())
2582          throw new Error("Attempt to auto-create NutritionOrder.encounter");
2583        else if (Configuration.doAutoCreate())
2584          this.encounterTarget = new Encounter(); // aa
2585      return this.encounterTarget;
2586    }
2587
2588    /**
2589     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (An encounter that provides additional information about the healthcare context in which this request is made.)
2590     */
2591    public NutritionOrder setEncounterTarget(Encounter value) { 
2592      this.encounterTarget = value;
2593      return this;
2594    }
2595
2596    /**
2597     * @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
2598     */
2599    public DateTimeType getDateTimeElement() { 
2600      if (this.dateTime == null)
2601        if (Configuration.errorOnAutoCreate())
2602          throw new Error("Attempt to auto-create NutritionOrder.dateTime");
2603        else if (Configuration.doAutoCreate())
2604          this.dateTime = new DateTimeType(); // bb
2605      return this.dateTime;
2606    }
2607
2608    public boolean hasDateTimeElement() { 
2609      return this.dateTime != null && !this.dateTime.isEmpty();
2610    }
2611
2612    public boolean hasDateTime() { 
2613      return this.dateTime != null && !this.dateTime.isEmpty();
2614    }
2615
2616    /**
2617     * @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
2618     */
2619    public NutritionOrder setDateTimeElement(DateTimeType value) { 
2620      this.dateTime = value;
2621      return this;
2622    }
2623
2624    /**
2625     * @return The date and time that this nutrition order was requested.
2626     */
2627    public Date getDateTime() { 
2628      return this.dateTime == null ? null : this.dateTime.getValue();
2629    }
2630
2631    /**
2632     * @param value The date and time that this nutrition order was requested.
2633     */
2634    public NutritionOrder setDateTime(Date value) { 
2635        if (this.dateTime == null)
2636          this.dateTime = new DateTimeType();
2637        this.dateTime.setValue(value);
2638      return this;
2639    }
2640
2641    /**
2642     * @return {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2643     */
2644    public Reference getOrderer() { 
2645      if (this.orderer == null)
2646        if (Configuration.errorOnAutoCreate())
2647          throw new Error("Attempt to auto-create NutritionOrder.orderer");
2648        else if (Configuration.doAutoCreate())
2649          this.orderer = new Reference(); // cc
2650      return this.orderer;
2651    }
2652
2653    public boolean hasOrderer() { 
2654      return this.orderer != null && !this.orderer.isEmpty();
2655    }
2656
2657    /**
2658     * @param value {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2659     */
2660    public NutritionOrder setOrderer(Reference value) { 
2661      this.orderer = value;
2662      return this;
2663    }
2664
2665    /**
2666     * @return {@link #orderer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2667     */
2668    public Practitioner getOrdererTarget() { 
2669      if (this.ordererTarget == null)
2670        if (Configuration.errorOnAutoCreate())
2671          throw new Error("Attempt to auto-create NutritionOrder.orderer");
2672        else if (Configuration.doAutoCreate())
2673          this.ordererTarget = new Practitioner(); // aa
2674      return this.ordererTarget;
2675    }
2676
2677    /**
2678     * @param value {@link #orderer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
2679     */
2680    public NutritionOrder setOrdererTarget(Practitioner value) { 
2681      this.ordererTarget = value;
2682      return this;
2683    }
2684
2685    /**
2686     * @return {@link #allergyIntolerance} (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2687     */
2688    public List<Reference> getAllergyIntolerance() { 
2689      if (this.allergyIntolerance == null)
2690        this.allergyIntolerance = new ArrayList<Reference>();
2691      return this.allergyIntolerance;
2692    }
2693
2694    public boolean hasAllergyIntolerance() { 
2695      if (this.allergyIntolerance == null)
2696        return false;
2697      for (Reference item : this.allergyIntolerance)
2698        if (!item.isEmpty())
2699          return true;
2700      return false;
2701    }
2702
2703    /**
2704     * @return {@link #allergyIntolerance} (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2705     */
2706    // syntactic sugar
2707    public Reference addAllergyIntolerance() { //3
2708      Reference t = new Reference();
2709      if (this.allergyIntolerance == null)
2710        this.allergyIntolerance = new ArrayList<Reference>();
2711      this.allergyIntolerance.add(t);
2712      return t;
2713    }
2714
2715    // syntactic sugar
2716    public NutritionOrder addAllergyIntolerance(Reference t) { //3
2717      if (t == null)
2718        return this;
2719      if (this.allergyIntolerance == null)
2720        this.allergyIntolerance = new ArrayList<Reference>();
2721      this.allergyIntolerance.add(t);
2722      return this;
2723    }
2724
2725    /**
2726     * @return {@link #allergyIntolerance} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2727     */
2728    public List<AllergyIntolerance> getAllergyIntoleranceTarget() { 
2729      if (this.allergyIntoleranceTarget == null)
2730        this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
2731      return this.allergyIntoleranceTarget;
2732    }
2733
2734    // syntactic sugar
2735    /**
2736     * @return {@link #allergyIntolerance} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. A link to a record of allergies or intolerances  which should be included in the nutrition order.)
2737     */
2738    public AllergyIntolerance addAllergyIntoleranceTarget() { 
2739      AllergyIntolerance r = new AllergyIntolerance();
2740      if (this.allergyIntoleranceTarget == null)
2741        this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
2742      this.allergyIntoleranceTarget.add(r);
2743      return r;
2744    }
2745
2746    /**
2747     * @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.)
2748     */
2749    public List<CodeableConcept> getFoodPreferenceModifier() { 
2750      if (this.foodPreferenceModifier == null)
2751        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
2752      return this.foodPreferenceModifier;
2753    }
2754
2755    public boolean hasFoodPreferenceModifier() { 
2756      if (this.foodPreferenceModifier == null)
2757        return false;
2758      for (CodeableConcept item : this.foodPreferenceModifier)
2759        if (!item.isEmpty())
2760          return true;
2761      return false;
2762    }
2763
2764    /**
2765     * @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.)
2766     */
2767    // syntactic sugar
2768    public CodeableConcept addFoodPreferenceModifier() { //3
2769      CodeableConcept t = new CodeableConcept();
2770      if (this.foodPreferenceModifier == null)
2771        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
2772      this.foodPreferenceModifier.add(t);
2773      return t;
2774    }
2775
2776    // syntactic sugar
2777    public NutritionOrder addFoodPreferenceModifier(CodeableConcept t) { //3
2778      if (t == null)
2779        return this;
2780      if (this.foodPreferenceModifier == null)
2781        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
2782      this.foodPreferenceModifier.add(t);
2783      return this;
2784    }
2785
2786    /**
2787     * @return {@link #excludeFoodModifier} (This modifier is used to convey order-specific modifiers about the type of food 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.)
2788     */
2789    public List<CodeableConcept> getExcludeFoodModifier() { 
2790      if (this.excludeFoodModifier == null)
2791        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
2792      return this.excludeFoodModifier;
2793    }
2794
2795    public boolean hasExcludeFoodModifier() { 
2796      if (this.excludeFoodModifier == null)
2797        return false;
2798      for (CodeableConcept item : this.excludeFoodModifier)
2799        if (!item.isEmpty())
2800          return true;
2801      return false;
2802    }
2803
2804    /**
2805     * @return {@link #excludeFoodModifier} (This modifier is used to convey order-specific modifiers about the type of food 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.)
2806     */
2807    // syntactic sugar
2808    public CodeableConcept addExcludeFoodModifier() { //3
2809      CodeableConcept t = new CodeableConcept();
2810      if (this.excludeFoodModifier == null)
2811        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
2812      this.excludeFoodModifier.add(t);
2813      return t;
2814    }
2815
2816    // syntactic sugar
2817    public NutritionOrder addExcludeFoodModifier(CodeableConcept t) { //3
2818      if (t == null)
2819        return this;
2820      if (this.excludeFoodModifier == null)
2821        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
2822      this.excludeFoodModifier.add(t);
2823      return this;
2824    }
2825
2826    /**
2827     * @return {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
2828     */
2829    public NutritionOrderOralDietComponent getOralDiet() { 
2830      if (this.oralDiet == null)
2831        if (Configuration.errorOnAutoCreate())
2832          throw new Error("Attempt to auto-create NutritionOrder.oralDiet");
2833        else if (Configuration.doAutoCreate())
2834          this.oralDiet = new NutritionOrderOralDietComponent(); // cc
2835      return this.oralDiet;
2836    }
2837
2838    public boolean hasOralDiet() { 
2839      return this.oralDiet != null && !this.oralDiet.isEmpty();
2840    }
2841
2842    /**
2843     * @param value {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
2844     */
2845    public NutritionOrder setOralDiet(NutritionOrderOralDietComponent value) { 
2846      this.oralDiet = value;
2847      return this;
2848    }
2849
2850    /**
2851     * @return {@link #supplement} (Oral nutritional products given in order to add further nutritional value to the patient's diet.)
2852     */
2853    public List<NutritionOrderSupplementComponent> getSupplement() { 
2854      if (this.supplement == null)
2855        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
2856      return this.supplement;
2857    }
2858
2859    public boolean hasSupplement() { 
2860      if (this.supplement == null)
2861        return false;
2862      for (NutritionOrderSupplementComponent item : this.supplement)
2863        if (!item.isEmpty())
2864          return true;
2865      return false;
2866    }
2867
2868    /**
2869     * @return {@link #supplement} (Oral nutritional products given in order to add further nutritional value to the patient's diet.)
2870     */
2871    // syntactic sugar
2872    public NutritionOrderSupplementComponent addSupplement() { //3
2873      NutritionOrderSupplementComponent t = new NutritionOrderSupplementComponent();
2874      if (this.supplement == null)
2875        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
2876      this.supplement.add(t);
2877      return t;
2878    }
2879
2880    // syntactic sugar
2881    public NutritionOrder addSupplement(NutritionOrderSupplementComponent t) { //3
2882      if (t == null)
2883        return this;
2884      if (this.supplement == null)
2885        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
2886      this.supplement.add(t);
2887      return this;
2888    }
2889
2890    /**
2891     * @return {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
2892     */
2893    public NutritionOrderEnteralFormulaComponent getEnteralFormula() { 
2894      if (this.enteralFormula == null)
2895        if (Configuration.errorOnAutoCreate())
2896          throw new Error("Attempt to auto-create NutritionOrder.enteralFormula");
2897        else if (Configuration.doAutoCreate())
2898          this.enteralFormula = new NutritionOrderEnteralFormulaComponent(); // cc
2899      return this.enteralFormula;
2900    }
2901
2902    public boolean hasEnteralFormula() { 
2903      return this.enteralFormula != null && !this.enteralFormula.isEmpty();
2904    }
2905
2906    /**
2907     * @param value {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
2908     */
2909    public NutritionOrder setEnteralFormula(NutritionOrderEnteralFormulaComponent value) { 
2910      this.enteralFormula = value;
2911      return this;
2912    }
2913
2914      protected void listChildren(List<Property> childrenList) {
2915        super.listChildren(childrenList);
2916        childrenList.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));
2917        childrenList.add(new Property("status", "code", "The workflow status of the nutrition order/request.", 0, java.lang.Integer.MAX_VALUE, status));
2918        childrenList.add(new Property("patient", "Reference(Patient)", "The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.", 0, java.lang.Integer.MAX_VALUE, patient));
2919        childrenList.add(new Property("encounter", "Reference(Encounter)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, java.lang.Integer.MAX_VALUE, encounter));
2920        childrenList.add(new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, java.lang.Integer.MAX_VALUE, dateTime));
2921        childrenList.add(new Property("orderer", "Reference(Practitioner)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, java.lang.Integer.MAX_VALUE, orderer));
2922        childrenList.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));
2923        childrenList.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));
2924        childrenList.add(new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food 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));
2925        childrenList.add(new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, java.lang.Integer.MAX_VALUE, oralDiet));
2926        childrenList.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));
2927        childrenList.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, java.lang.Integer.MAX_VALUE, enteralFormula));
2928      }
2929
2930      @Override
2931      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2932        switch (hash) {
2933        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2934        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<NutritionOrderStatus>
2935        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2936        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
2937        case 1792749467: /*dateTime*/ return this.dateTime == null ? new Base[0] : new Base[] {this.dateTime}; // DateTimeType
2938        case -1207109509: /*orderer*/ return this.orderer == null ? new Base[0] : new Base[] {this.orderer}; // Reference
2939        case -120164120: /*allergyIntolerance*/ return this.allergyIntolerance == null ? new Base[0] : this.allergyIntolerance.toArray(new Base[this.allergyIntolerance.size()]); // Reference
2940        case 659473872: /*foodPreferenceModifier*/ return this.foodPreferenceModifier == null ? new Base[0] : this.foodPreferenceModifier.toArray(new Base[this.foodPreferenceModifier.size()]); // CodeableConcept
2941        case 1760260175: /*excludeFoodModifier*/ return this.excludeFoodModifier == null ? new Base[0] : this.excludeFoodModifier.toArray(new Base[this.excludeFoodModifier.size()]); // CodeableConcept
2942        case 1153521250: /*oralDiet*/ return this.oralDiet == null ? new Base[0] : new Base[] {this.oralDiet}; // NutritionOrderOralDietComponent
2943        case -711993159: /*supplement*/ return this.supplement == null ? new Base[0] : this.supplement.toArray(new Base[this.supplement.size()]); // NutritionOrderSupplementComponent
2944        case -671083805: /*enteralFormula*/ return this.enteralFormula == null ? new Base[0] : new Base[] {this.enteralFormula}; // NutritionOrderEnteralFormulaComponent
2945        default: return super.getProperty(hash, name, checkValid);
2946        }
2947
2948      }
2949
2950      @Override
2951      public void setProperty(int hash, String name, Base value) throws FHIRException {
2952        switch (hash) {
2953        case -1618432855: // identifier
2954          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2955          break;
2956        case -892481550: // status
2957          this.status = new NutritionOrderStatusEnumFactory().fromType(value); // Enumeration<NutritionOrderStatus>
2958          break;
2959        case -791418107: // patient
2960          this.patient = castToReference(value); // Reference
2961          break;
2962        case 1524132147: // encounter
2963          this.encounter = castToReference(value); // Reference
2964          break;
2965        case 1792749467: // dateTime
2966          this.dateTime = castToDateTime(value); // DateTimeType
2967          break;
2968        case -1207109509: // orderer
2969          this.orderer = castToReference(value); // Reference
2970          break;
2971        case -120164120: // allergyIntolerance
2972          this.getAllergyIntolerance().add(castToReference(value)); // Reference
2973          break;
2974        case 659473872: // foodPreferenceModifier
2975          this.getFoodPreferenceModifier().add(castToCodeableConcept(value)); // CodeableConcept
2976          break;
2977        case 1760260175: // excludeFoodModifier
2978          this.getExcludeFoodModifier().add(castToCodeableConcept(value)); // CodeableConcept
2979          break;
2980        case 1153521250: // oralDiet
2981          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
2982          break;
2983        case -711993159: // supplement
2984          this.getSupplement().add((NutritionOrderSupplementComponent) value); // NutritionOrderSupplementComponent
2985          break;
2986        case -671083805: // enteralFormula
2987          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
2988          break;
2989        default: super.setProperty(hash, name, value);
2990        }
2991
2992      }
2993
2994      @Override
2995      public void setProperty(String name, Base value) throws FHIRException {
2996        if (name.equals("identifier"))
2997          this.getIdentifier().add(castToIdentifier(value));
2998        else if (name.equals("status"))
2999          this.status = new NutritionOrderStatusEnumFactory().fromType(value); // Enumeration<NutritionOrderStatus>
3000        else if (name.equals("patient"))
3001          this.patient = castToReference(value); // Reference
3002        else if (name.equals("encounter"))
3003          this.encounter = castToReference(value); // Reference
3004        else if (name.equals("dateTime"))
3005          this.dateTime = castToDateTime(value); // DateTimeType
3006        else if (name.equals("orderer"))
3007          this.orderer = castToReference(value); // Reference
3008        else if (name.equals("allergyIntolerance"))
3009          this.getAllergyIntolerance().add(castToReference(value));
3010        else if (name.equals("foodPreferenceModifier"))
3011          this.getFoodPreferenceModifier().add(castToCodeableConcept(value));
3012        else if (name.equals("excludeFoodModifier"))
3013          this.getExcludeFoodModifier().add(castToCodeableConcept(value));
3014        else if (name.equals("oralDiet"))
3015          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
3016        else if (name.equals("supplement"))
3017          this.getSupplement().add((NutritionOrderSupplementComponent) value);
3018        else if (name.equals("enteralFormula"))
3019          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
3020        else
3021          super.setProperty(name, value);
3022      }
3023
3024      @Override
3025      public Base makeProperty(int hash, String name) throws FHIRException {
3026        switch (hash) {
3027        case -1618432855:  return addIdentifier(); // Identifier
3028        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<NutritionOrderStatus>
3029        case -791418107:  return getPatient(); // Reference
3030        case 1524132147:  return getEncounter(); // Reference
3031        case 1792749467: throw new FHIRException("Cannot make property dateTime as it is not a complex type"); // DateTimeType
3032        case -1207109509:  return getOrderer(); // Reference
3033        case -120164120:  return addAllergyIntolerance(); // Reference
3034        case 659473872:  return addFoodPreferenceModifier(); // CodeableConcept
3035        case 1760260175:  return addExcludeFoodModifier(); // CodeableConcept
3036        case 1153521250:  return getOralDiet(); // NutritionOrderOralDietComponent
3037        case -711993159:  return addSupplement(); // NutritionOrderSupplementComponent
3038        case -671083805:  return getEnteralFormula(); // NutritionOrderEnteralFormulaComponent
3039        default: return super.makeProperty(hash, name);
3040        }
3041
3042      }
3043
3044      @Override
3045      public Base addChild(String name) throws FHIRException {
3046        if (name.equals("identifier")) {
3047          return addIdentifier();
3048        }
3049        else if (name.equals("status")) {
3050          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.status");
3051        }
3052        else if (name.equals("patient")) {
3053          this.patient = new Reference();
3054          return this.patient;
3055        }
3056        else if (name.equals("encounter")) {
3057          this.encounter = new Reference();
3058          return this.encounter;
3059        }
3060        else if (name.equals("dateTime")) {
3061          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.dateTime");
3062        }
3063        else if (name.equals("orderer")) {
3064          this.orderer = new Reference();
3065          return this.orderer;
3066        }
3067        else if (name.equals("allergyIntolerance")) {
3068          return addAllergyIntolerance();
3069        }
3070        else if (name.equals("foodPreferenceModifier")) {
3071          return addFoodPreferenceModifier();
3072        }
3073        else if (name.equals("excludeFoodModifier")) {
3074          return addExcludeFoodModifier();
3075        }
3076        else if (name.equals("oralDiet")) {
3077          this.oralDiet = new NutritionOrderOralDietComponent();
3078          return this.oralDiet;
3079        }
3080        else if (name.equals("supplement")) {
3081          return addSupplement();
3082        }
3083        else if (name.equals("enteralFormula")) {
3084          this.enteralFormula = new NutritionOrderEnteralFormulaComponent();
3085          return this.enteralFormula;
3086        }
3087        else
3088          return super.addChild(name);
3089      }
3090
3091  public String fhirType() {
3092    return "NutritionOrder";
3093
3094  }
3095
3096      public NutritionOrder copy() {
3097        NutritionOrder dst = new NutritionOrder();
3098        copyValues(dst);
3099        if (identifier != null) {
3100          dst.identifier = new ArrayList<Identifier>();
3101          for (Identifier i : identifier)
3102            dst.identifier.add(i.copy());
3103        };
3104        dst.status = status == null ? null : status.copy();
3105        dst.patient = patient == null ? null : patient.copy();
3106        dst.encounter = encounter == null ? null : encounter.copy();
3107        dst.dateTime = dateTime == null ? null : dateTime.copy();
3108        dst.orderer = orderer == null ? null : orderer.copy();
3109        if (allergyIntolerance != null) {
3110          dst.allergyIntolerance = new ArrayList<Reference>();
3111          for (Reference i : allergyIntolerance)
3112            dst.allergyIntolerance.add(i.copy());
3113        };
3114        if (foodPreferenceModifier != null) {
3115          dst.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3116          for (CodeableConcept i : foodPreferenceModifier)
3117            dst.foodPreferenceModifier.add(i.copy());
3118        };
3119        if (excludeFoodModifier != null) {
3120          dst.excludeFoodModifier = new ArrayList<CodeableConcept>();
3121          for (CodeableConcept i : excludeFoodModifier)
3122            dst.excludeFoodModifier.add(i.copy());
3123        };
3124        dst.oralDiet = oralDiet == null ? null : oralDiet.copy();
3125        if (supplement != null) {
3126          dst.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3127          for (NutritionOrderSupplementComponent i : supplement)
3128            dst.supplement.add(i.copy());
3129        };
3130        dst.enteralFormula = enteralFormula == null ? null : enteralFormula.copy();
3131        return dst;
3132      }
3133
3134      protected NutritionOrder typedCopy() {
3135        return copy();
3136      }
3137
3138      @Override
3139      public boolean equalsDeep(Base other) {
3140        if (!super.equalsDeep(other))
3141          return false;
3142        if (!(other instanceof NutritionOrder))
3143          return false;
3144        NutritionOrder o = (NutritionOrder) other;
3145        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(patient, o.patient, true)
3146           && compareDeep(encounter, o.encounter, true) && compareDeep(dateTime, o.dateTime, true) && compareDeep(orderer, o.orderer, true)
3147           && compareDeep(allergyIntolerance, o.allergyIntolerance, true) && compareDeep(foodPreferenceModifier, o.foodPreferenceModifier, true)
3148           && compareDeep(excludeFoodModifier, o.excludeFoodModifier, true) && compareDeep(oralDiet, o.oralDiet, true)
3149           && compareDeep(supplement, o.supplement, true) && compareDeep(enteralFormula, o.enteralFormula, true)
3150          ;
3151      }
3152
3153      @Override
3154      public boolean equalsShallow(Base other) {
3155        if (!super.equalsShallow(other))
3156          return false;
3157        if (!(other instanceof NutritionOrder))
3158          return false;
3159        NutritionOrder o = (NutritionOrder) other;
3160        return compareValues(status, o.status, true) && compareValues(dateTime, o.dateTime, true);
3161      }
3162
3163      public boolean isEmpty() {
3164        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
3165           && (patient == null || patient.isEmpty()) && (encounter == null || encounter.isEmpty()) && (dateTime == null || dateTime.isEmpty())
3166           && (orderer == null || orderer.isEmpty()) && (allergyIntolerance == null || allergyIntolerance.isEmpty())
3167           && (foodPreferenceModifier == null || foodPreferenceModifier.isEmpty()) && (excludeFoodModifier == null || excludeFoodModifier.isEmpty())
3168           && (oralDiet == null || oralDiet.isEmpty()) && (supplement == null || supplement.isEmpty())
3169           && (enteralFormula == null || enteralFormula.isEmpty());
3170      }
3171
3172  @Override
3173  public ResourceType getResourceType() {
3174    return ResourceType.NutritionOrder;
3175   }
3176
3177 /**
3178   * Search parameter: <b>patient</b>
3179   * <p>
3180   * Description: <b>The identity of the person who requires the diet, formula or nutritional supplement</b><br>
3181   * Type: <b>reference</b><br>
3182   * Path: <b>NutritionOrder.patient</b><br>
3183   * </p>
3184   */
3185  @SearchParamDefinition(name="patient", path="NutritionOrder.patient", description="The identity of the person who requires the diet, formula or nutritional supplement", type="reference" )
3186  public static final String SP_PATIENT = "patient";
3187 /**
3188   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3189   * <p>
3190   * Description: <b>The identity of the person who requires the diet, formula or nutritional supplement</b><br>
3191   * Type: <b>reference</b><br>
3192   * Path: <b>NutritionOrder.patient</b><br>
3193   * </p>
3194   */
3195  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
3196
3197/**
3198   * Constant for fluent queries to be used to add include statements. Specifies
3199   * the path value of "<b>NutritionOrder:patient</b>".
3200   */
3201  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("NutritionOrder:patient").toLocked();
3202
3203 /**
3204   * Search parameter: <b>status</b>
3205   * <p>
3206   * Description: <b>Status of the nutrition order.</b><br>
3207   * Type: <b>token</b><br>
3208   * Path: <b>NutritionOrder.status</b><br>
3209   * </p>
3210   */
3211  @SearchParamDefinition(name="status", path="NutritionOrder.status", description="Status of the nutrition order.", type="token" )
3212  public static final String SP_STATUS = "status";
3213 /**
3214   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3215   * <p>
3216   * Description: <b>Status of the nutrition order.</b><br>
3217   * Type: <b>token</b><br>
3218   * Path: <b>NutritionOrder.status</b><br>
3219   * </p>
3220   */
3221  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
3222
3223 /**
3224   * Search parameter: <b>supplement</b>
3225   * <p>
3226   * Description: <b>Type of supplement product requested</b><br>
3227   * Type: <b>token</b><br>
3228   * Path: <b>NutritionOrder.supplement.type</b><br>
3229   * </p>
3230   */
3231  @SearchParamDefinition(name="supplement", path="NutritionOrder.supplement.type", description="Type of supplement product requested", type="token" )
3232  public static final String SP_SUPPLEMENT = "supplement";
3233 /**
3234   * <b>Fluent Client</b> search parameter constant for <b>supplement</b>
3235   * <p>
3236   * Description: <b>Type of supplement product requested</b><br>
3237   * Type: <b>token</b><br>
3238   * Path: <b>NutritionOrder.supplement.type</b><br>
3239   * </p>
3240   */
3241  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUPPLEMENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUPPLEMENT);
3242
3243 /**
3244   * Search parameter: <b>oraldiet</b>
3245   * <p>
3246   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
3247   * Type: <b>token</b><br>
3248   * Path: <b>NutritionOrder.oralDiet.type</b><br>
3249   * </p>
3250   */
3251  @SearchParamDefinition(name="oraldiet", path="NutritionOrder.oralDiet.type", description="Type of diet that can be consumed orally (i.e., take via the mouth).", type="token" )
3252  public static final String SP_ORALDIET = "oraldiet";
3253 /**
3254   * <b>Fluent Client</b> search parameter constant for <b>oraldiet</b>
3255   * <p>
3256   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
3257   * Type: <b>token</b><br>
3258   * Path: <b>NutritionOrder.oralDiet.type</b><br>
3259   * </p>
3260   */
3261  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORALDIET = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ORALDIET);
3262
3263 /**
3264   * Search parameter: <b>provider</b>
3265   * <p>
3266   * Description: <b>The identify of the provider who placed the nutrition order</b><br>
3267   * Type: <b>reference</b><br>
3268   * Path: <b>NutritionOrder.orderer</b><br>
3269   * </p>
3270   */
3271  @SearchParamDefinition(name="provider", path="NutritionOrder.orderer", description="The identify of the provider who placed the nutrition order", type="reference" )
3272  public static final String SP_PROVIDER = "provider";
3273 /**
3274   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
3275   * <p>
3276   * Description: <b>The identify of the provider who placed the nutrition order</b><br>
3277   * Type: <b>reference</b><br>
3278   * Path: <b>NutritionOrder.orderer</b><br>
3279   * </p>
3280   */
3281  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
3282
3283/**
3284   * Constant for fluent queries to be used to add include statements. Specifies
3285   * the path value of "<b>NutritionOrder:provider</b>".
3286   */
3287  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("NutritionOrder:provider").toLocked();
3288
3289 /**
3290   * Search parameter: <b>encounter</b>
3291   * <p>
3292   * Description: <b>Return nutrition orders with this encounter identifier</b><br>
3293   * Type: <b>reference</b><br>
3294   * Path: <b>NutritionOrder.encounter</b><br>
3295   * </p>
3296   */
3297  @SearchParamDefinition(name="encounter", path="NutritionOrder.encounter", description="Return nutrition orders with this encounter identifier", type="reference" )
3298  public static final String SP_ENCOUNTER = "encounter";
3299 /**
3300   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
3301   * <p>
3302   * Description: <b>Return nutrition orders with this encounter identifier</b><br>
3303   * Type: <b>reference</b><br>
3304   * Path: <b>NutritionOrder.encounter</b><br>
3305   * </p>
3306   */
3307  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
3308
3309/**
3310   * Constant for fluent queries to be used to add include statements. Specifies
3311   * the path value of "<b>NutritionOrder:encounter</b>".
3312   */
3313  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("NutritionOrder:encounter").toLocked();
3314
3315 /**
3316   * Search parameter: <b>datetime</b>
3317   * <p>
3318   * Description: <b>Return nutrition orders requested on this date</b><br>
3319   * Type: <b>date</b><br>
3320   * Path: <b>NutritionOrder.dateTime</b><br>
3321   * </p>
3322   */
3323  @SearchParamDefinition(name="datetime", path="NutritionOrder.dateTime", description="Return nutrition orders requested on this date", type="date" )
3324  public static final String SP_DATETIME = "datetime";
3325 /**
3326   * <b>Fluent Client</b> search parameter constant for <b>datetime</b>
3327   * <p>
3328   * Description: <b>Return nutrition orders requested on this date</b><br>
3329   * Type: <b>date</b><br>
3330   * Path: <b>NutritionOrder.dateTime</b><br>
3331   * </p>
3332   */
3333  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATETIME = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATETIME);
3334
3335 /**
3336   * Search parameter: <b>additive</b>
3337   * <p>
3338   * Description: <b>Type of module component to add to the feeding</b><br>
3339   * Type: <b>token</b><br>
3340   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
3341   * </p>
3342   */
3343  @SearchParamDefinition(name="additive", path="NutritionOrder.enteralFormula.additiveType", description="Type of module component to add to the feeding", type="token" )
3344  public static final String SP_ADDITIVE = "additive";
3345 /**
3346   * <b>Fluent Client</b> search parameter constant for <b>additive</b>
3347   * <p>
3348   * Description: <b>Type of module component to add to the feeding</b><br>
3349   * Type: <b>token</b><br>
3350   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
3351   * </p>
3352   */
3353  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDITIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDITIVE);
3354
3355 /**
3356   * Search parameter: <b>identifier</b>
3357   * <p>
3358   * Description: <b>Return nutrition orders with this external identifier</b><br>
3359   * Type: <b>token</b><br>
3360   * Path: <b>NutritionOrder.identifier</b><br>
3361   * </p>
3362   */
3363  @SearchParamDefinition(name="identifier", path="NutritionOrder.identifier", description="Return nutrition orders with this external identifier", type="token" )
3364  public static final String SP_IDENTIFIER = "identifier";
3365 /**
3366   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3367   * <p>
3368   * Description: <b>Return nutrition orders with this external identifier</b><br>
3369   * Type: <b>token</b><br>
3370   * Path: <b>NutritionOrder.identifier</b><br>
3371   * </p>
3372   */
3373  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
3374
3375 /**
3376   * Search parameter: <b>formula</b>
3377   * <p>
3378   * Description: <b>Type of enteral or infant formula</b><br>
3379   * Type: <b>token</b><br>
3380   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
3381   * </p>
3382   */
3383  @SearchParamDefinition(name="formula", path="NutritionOrder.enteralFormula.baseFormulaType", description="Type of enteral or infant formula", type="token" )
3384  public static final String SP_FORMULA = "formula";
3385 /**
3386   * <b>Fluent Client</b> search parameter constant for <b>formula</b>
3387   * <p>
3388   * Description: <b>Type of enteral or infant formula</b><br>
3389   * Type: <b>token</b><br>
3390   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
3391   * </p>
3392   */
3393  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMULA = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORMULA);
3394
3395
3396}