001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.
047 */
048@ResourceDef(name="NutritionOrder", profile="http://hl7.org/fhir/StructureDefinition/NutritionOrder")
049public class NutritionOrder extends DomainResource {
050
051    public enum NutritionOrderStatus {
052        /**
053         * The request has been created but is not yet complete or ready for action.
054         */
055        DRAFT, 
056        /**
057         * The request is in force and ready to be acted upon.
058         */
059        ACTIVE, 
060        /**
061         * The authorization/request to act has been temporarily withdrawn but is expected to resume in the future.
062         */
063        ONHOLD, 
064        /**
065         * The authorization/request to act has been terminated prior to the known full completion of the intended actions.  No further activity should occur.
066         */
067        REVOKED, 
068        /**
069         * Activity against the request has been sufficiently completed to the satisfaction of the requester.
070         */
071        COMPLETED, 
072        /**
073         * This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be "cancelled" rather than "entered-in-error".).
074         */
075        ENTEREDINERROR, 
076        /**
077         * The authoring system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for "other" . One of the listed statuses is presumed to apply,  but the system creating the request does not know.
078         */
079        UNKNOWN, 
080        /**
081         * added to help the parsers with the generic types
082         */
083        NULL;
084        public static NutritionOrderStatus fromCode(String codeString) throws FHIRException {
085            if (codeString == null || "".equals(codeString))
086                return null;
087        if ("draft".equals(codeString))
088          return DRAFT;
089        if ("active".equals(codeString))
090          return ACTIVE;
091        if ("on-hold".equals(codeString))
092          return ONHOLD;
093        if ("revoked".equals(codeString))
094          return REVOKED;
095        if ("completed".equals(codeString))
096          return COMPLETED;
097        if ("entered-in-error".equals(codeString))
098          return ENTEREDINERROR;
099        if ("unknown".equals(codeString))
100          return UNKNOWN;
101        if (Configuration.isAcceptInvalidEnums())
102          return null;
103        else
104          throw new FHIRException("Unknown NutritionOrderStatus code '"+codeString+"'");
105        }
106        public String toCode() {
107          switch (this) {
108            case DRAFT: return "draft";
109            case ACTIVE: return "active";
110            case ONHOLD: return "on-hold";
111            case REVOKED: return "revoked";
112            case COMPLETED: return "completed";
113            case ENTEREDINERROR: return "entered-in-error";
114            case UNKNOWN: return "unknown";
115            default: return "?";
116          }
117        }
118        public String getSystem() {
119          switch (this) {
120            case DRAFT: return "http://hl7.org/fhir/request-status";
121            case ACTIVE: return "http://hl7.org/fhir/request-status";
122            case ONHOLD: return "http://hl7.org/fhir/request-status";
123            case REVOKED: return "http://hl7.org/fhir/request-status";
124            case COMPLETED: return "http://hl7.org/fhir/request-status";
125            case ENTEREDINERROR: return "http://hl7.org/fhir/request-status";
126            case UNKNOWN: return "http://hl7.org/fhir/request-status";
127            default: return "?";
128          }
129        }
130        public String getDefinition() {
131          switch (this) {
132            case DRAFT: return "The request has been created but is not yet complete or ready for action.";
133            case ACTIVE: return "The request is in force and ready to be acted upon.";
134            case ONHOLD: return "The authorization/request to act has been temporarily withdrawn but is expected to resume in the future.";
135            case REVOKED: return "The authorization/request to act has been terminated prior to the known full completion of the intended actions.  No further activity should occur.";
136            case COMPLETED: return "Activity against the request has been sufficiently completed to the satisfaction of the requester.";
137            case ENTEREDINERROR: return "This electronic record should never have existed, though it is possible that real-world decisions were based on it.  (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".).";
138            case UNKNOWN: return "The authoring system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" . One of the listed statuses is presumed to apply,  but the system creating the request does not know.";
139            default: return "?";
140          }
141        }
142        public String getDisplay() {
143          switch (this) {
144            case DRAFT: return "Draft";
145            case ACTIVE: return "Active";
146            case ONHOLD: return "On Hold";
147            case REVOKED: return "Revoked";
148            case COMPLETED: return "Completed";
149            case ENTEREDINERROR: return "Entered in Error";
150            case UNKNOWN: return "Unknown";
151            default: return "?";
152          }
153        }
154    }
155
156  public static class NutritionOrderStatusEnumFactory implements EnumFactory<NutritionOrderStatus> {
157    public NutritionOrderStatus fromCode(String codeString) throws IllegalArgumentException {
158      if (codeString == null || "".equals(codeString))
159            if (codeString == null || "".equals(codeString))
160                return null;
161        if ("draft".equals(codeString))
162          return NutritionOrderStatus.DRAFT;
163        if ("active".equals(codeString))
164          return NutritionOrderStatus.ACTIVE;
165        if ("on-hold".equals(codeString))
166          return NutritionOrderStatus.ONHOLD;
167        if ("revoked".equals(codeString))
168          return NutritionOrderStatus.REVOKED;
169        if ("completed".equals(codeString))
170          return NutritionOrderStatus.COMPLETED;
171        if ("entered-in-error".equals(codeString))
172          return NutritionOrderStatus.ENTEREDINERROR;
173        if ("unknown".equals(codeString))
174          return NutritionOrderStatus.UNKNOWN;
175        throw new IllegalArgumentException("Unknown NutritionOrderStatus code '"+codeString+"'");
176        }
177        public Enumeration<NutritionOrderStatus> fromType(Base code) throws FHIRException {
178          if (code == null)
179            return null;
180          if (code.isEmpty())
181            return new Enumeration<NutritionOrderStatus>(this);
182          String codeString = ((PrimitiveType) code).asStringValue();
183          if (codeString == null || "".equals(codeString))
184            return null;
185        if ("draft".equals(codeString))
186          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.DRAFT);
187        if ("active".equals(codeString))
188          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ACTIVE);
189        if ("on-hold".equals(codeString))
190          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ONHOLD);
191        if ("revoked".equals(codeString))
192          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.REVOKED);
193        if ("completed".equals(codeString))
194          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.COMPLETED);
195        if ("entered-in-error".equals(codeString))
196          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ENTEREDINERROR);
197        if ("unknown".equals(codeString))
198          return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.UNKNOWN);
199        throw new FHIRException("Unknown NutritionOrderStatus code '"+codeString+"'");
200        }
201    public String toCode(NutritionOrderStatus code) {
202      if (code == NutritionOrderStatus.DRAFT)
203        return "draft";
204      if (code == NutritionOrderStatus.ACTIVE)
205        return "active";
206      if (code == NutritionOrderStatus.ONHOLD)
207        return "on-hold";
208      if (code == NutritionOrderStatus.REVOKED)
209        return "revoked";
210      if (code == NutritionOrderStatus.COMPLETED)
211        return "completed";
212      if (code == NutritionOrderStatus.ENTEREDINERROR)
213        return "entered-in-error";
214      if (code == NutritionOrderStatus.UNKNOWN)
215        return "unknown";
216      return "?";
217      }
218    public String toSystem(NutritionOrderStatus code) {
219      return code.getSystem();
220      }
221    }
222
223    public enum NutritiionOrderIntent {
224        /**
225         * The request is a suggestion made by someone/something that does not have an intention to ensure it occurs and without providing an authorization to act.
226         */
227        PROPOSAL, 
228        /**
229         * The request represents an intention to ensure something occurs without providing an authorization for others to act.
230         */
231        PLAN, 
232        /**
233         * The request represents a request/demand and authorization for action.
234         */
235        ORDER, 
236        /**
237         * The request represents an original authorization for action.
238         */
239        ORIGINALORDER, 
240        /**
241         * The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.
242         */
243        REFLEXORDER, 
244        /**
245         * The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order.
246         */
247        FILLERORDER, 
248        /**
249         * An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.
250         */
251        INSTANCEORDER, 
252        /**
253         * The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.  Refer to [[[RequestGroup]]] for additional information on how this status is used.
254         */
255        OPTION, 
256        /**
257         * added to help the parsers with the generic types
258         */
259        NULL;
260        public static NutritiionOrderIntent fromCode(String codeString) throws FHIRException {
261            if (codeString == null || "".equals(codeString))
262                return null;
263        if ("proposal".equals(codeString))
264          return PROPOSAL;
265        if ("plan".equals(codeString))
266          return PLAN;
267        if ("order".equals(codeString))
268          return ORDER;
269        if ("original-order".equals(codeString))
270          return ORIGINALORDER;
271        if ("reflex-order".equals(codeString))
272          return REFLEXORDER;
273        if ("filler-order".equals(codeString))
274          return FILLERORDER;
275        if ("instance-order".equals(codeString))
276          return INSTANCEORDER;
277        if ("option".equals(codeString))
278          return OPTION;
279        if (Configuration.isAcceptInvalidEnums())
280          return null;
281        else
282          throw new FHIRException("Unknown NutritiionOrderIntent code '"+codeString+"'");
283        }
284        public String toCode() {
285          switch (this) {
286            case PROPOSAL: return "proposal";
287            case PLAN: return "plan";
288            case ORDER: return "order";
289            case ORIGINALORDER: return "original-order";
290            case REFLEXORDER: return "reflex-order";
291            case FILLERORDER: return "filler-order";
292            case INSTANCEORDER: return "instance-order";
293            case OPTION: return "option";
294            default: return "?";
295          }
296        }
297        public String getSystem() {
298          switch (this) {
299            case PROPOSAL: return "http://hl7.org/fhir/request-intent";
300            case PLAN: return "http://hl7.org/fhir/request-intent";
301            case ORDER: return "http://hl7.org/fhir/request-intent";
302            case ORIGINALORDER: return "http://hl7.org/fhir/request-intent";
303            case REFLEXORDER: return "http://hl7.org/fhir/request-intent";
304            case FILLERORDER: return "http://hl7.org/fhir/request-intent";
305            case INSTANCEORDER: return "http://hl7.org/fhir/request-intent";
306            case OPTION: return "http://hl7.org/fhir/request-intent";
307            default: return "?";
308          }
309        }
310        public String getDefinition() {
311          switch (this) {
312            case PROPOSAL: return "The request is a suggestion made by someone/something that does not have an intention to ensure it occurs and without providing an authorization to act.";
313            case PLAN: return "The request represents an intention to ensure something occurs without providing an authorization for others to act.";
314            case ORDER: return "The request represents a request/demand and authorization for action.";
315            case ORIGINALORDER: return "The request represents an original authorization for action.";
316            case REFLEXORDER: return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.";
317            case FILLERORDER: return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order.";
318            case INSTANCEORDER: return "An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.";
319            case OPTION: return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.  Refer to [[[RequestGroup]]] for additional information on how this status is used.";
320            default: return "?";
321          }
322        }
323        public String getDisplay() {
324          switch (this) {
325            case PROPOSAL: return "Proposal";
326            case PLAN: return "Plan";
327            case ORDER: return "Order";
328            case ORIGINALORDER: return "Original Order";
329            case REFLEXORDER: return "Reflex Order";
330            case FILLERORDER: return "Filler Order";
331            case INSTANCEORDER: return "Instance Order";
332            case OPTION: return "Option";
333            default: return "?";
334          }
335        }
336    }
337
338  public static class NutritiionOrderIntentEnumFactory implements EnumFactory<NutritiionOrderIntent> {
339    public NutritiionOrderIntent fromCode(String codeString) throws IllegalArgumentException {
340      if (codeString == null || "".equals(codeString))
341            if (codeString == null || "".equals(codeString))
342                return null;
343        if ("proposal".equals(codeString))
344          return NutritiionOrderIntent.PROPOSAL;
345        if ("plan".equals(codeString))
346          return NutritiionOrderIntent.PLAN;
347        if ("order".equals(codeString))
348          return NutritiionOrderIntent.ORDER;
349        if ("original-order".equals(codeString))
350          return NutritiionOrderIntent.ORIGINALORDER;
351        if ("reflex-order".equals(codeString))
352          return NutritiionOrderIntent.REFLEXORDER;
353        if ("filler-order".equals(codeString))
354          return NutritiionOrderIntent.FILLERORDER;
355        if ("instance-order".equals(codeString))
356          return NutritiionOrderIntent.INSTANCEORDER;
357        if ("option".equals(codeString))
358          return NutritiionOrderIntent.OPTION;
359        throw new IllegalArgumentException("Unknown NutritiionOrderIntent code '"+codeString+"'");
360        }
361        public Enumeration<NutritiionOrderIntent> fromType(Base code) throws FHIRException {
362          if (code == null)
363            return null;
364          if (code.isEmpty())
365            return new Enumeration<NutritiionOrderIntent>(this);
366          String codeString = ((PrimitiveType) code).asStringValue();
367          if (codeString == null || "".equals(codeString))
368            return null;
369        if ("proposal".equals(codeString))
370          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.PROPOSAL);
371        if ("plan".equals(codeString))
372          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.PLAN);
373        if ("order".equals(codeString))
374          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.ORDER);
375        if ("original-order".equals(codeString))
376          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.ORIGINALORDER);
377        if ("reflex-order".equals(codeString))
378          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.REFLEXORDER);
379        if ("filler-order".equals(codeString))
380          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.FILLERORDER);
381        if ("instance-order".equals(codeString))
382          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.INSTANCEORDER);
383        if ("option".equals(codeString))
384          return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.OPTION);
385        throw new FHIRException("Unknown NutritiionOrderIntent code '"+codeString+"'");
386        }
387    public String toCode(NutritiionOrderIntent code) {
388      if (code == NutritiionOrderIntent.PROPOSAL)
389        return "proposal";
390      if (code == NutritiionOrderIntent.PLAN)
391        return "plan";
392      if (code == NutritiionOrderIntent.ORDER)
393        return "order";
394      if (code == NutritiionOrderIntent.ORIGINALORDER)
395        return "original-order";
396      if (code == NutritiionOrderIntent.REFLEXORDER)
397        return "reflex-order";
398      if (code == NutritiionOrderIntent.FILLERORDER)
399        return "filler-order";
400      if (code == NutritiionOrderIntent.INSTANCEORDER)
401        return "instance-order";
402      if (code == NutritiionOrderIntent.OPTION)
403        return "option";
404      return "?";
405      }
406    public String toSystem(NutritiionOrderIntent code) {
407      return code.getSystem();
408      }
409    }
410
411    @Block()
412    public static class NutritionOrderOralDietComponent extends BackboneElement implements IBaseBackboneElement {
413        /**
414         * The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.
415         */
416        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
417        @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." )
418        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/diet-type")
419        protected List<CodeableConcept> type;
420
421        /**
422         * The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.
423         */
424        @Child(name = "schedule", type = {Timing.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
425        @Description(shortDefinition="Scheduled frequency of diet", formalDefinition="The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present." )
426        protected List<Timing> schedule;
427
428        /**
429         * Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.
430         */
431        @Child(name = "nutrient", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
432        @Description(shortDefinition="Required  nutrient modifications", formalDefinition="Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet." )
433        protected List<NutritionOrderOralDietNutrientComponent> nutrient;
434
435        /**
436         * Class that describes any texture modifications required for the patient to safely consume various types of solid foods.
437         */
438        @Child(name = "texture", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
439        @Description(shortDefinition="Required  texture modifications", formalDefinition="Class that describes any texture modifications required for the patient to safely consume various types of solid foods." )
440        protected List<NutritionOrderOralDietTextureComponent> texture;
441
442        /**
443         * The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.
444         */
445        @Child(name = "fluidConsistencyType", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
446        @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." )
447        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/consistency-type")
448        protected List<CodeableConcept> fluidConsistencyType;
449
450        /**
451         * Free text or additional instructions or information pertaining to the oral diet.
452         */
453        @Child(name = "instruction", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
454        @Description(shortDefinition="Instructions or additional information about the oral diet", formalDefinition="Free text or additional instructions or information pertaining to the oral diet." )
455        protected StringType instruction;
456
457        private static final long serialVersionUID = 973058412L;
458
459    /**
460     * Constructor
461     */
462      public NutritionOrderOralDietComponent() {
463        super();
464      }
465
466        /**
467         * @return {@link #type} (The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.)
468         */
469        public List<CodeableConcept> getType() { 
470          if (this.type == null)
471            this.type = new ArrayList<CodeableConcept>();
472          return this.type;
473        }
474
475        /**
476         * @return Returns a reference to <code>this</code> for easy method chaining
477         */
478        public NutritionOrderOralDietComponent setType(List<CodeableConcept> theType) { 
479          this.type = theType;
480          return this;
481        }
482
483        public boolean hasType() { 
484          if (this.type == null)
485            return false;
486          for (CodeableConcept item : this.type)
487            if (!item.isEmpty())
488              return true;
489          return false;
490        }
491
492        public CodeableConcept addType() { //3
493          CodeableConcept t = new CodeableConcept();
494          if (this.type == null)
495            this.type = new ArrayList<CodeableConcept>();
496          this.type.add(t);
497          return t;
498        }
499
500        public NutritionOrderOralDietComponent addType(CodeableConcept t) { //3
501          if (t == null)
502            return this;
503          if (this.type == null)
504            this.type = new ArrayList<CodeableConcept>();
505          this.type.add(t);
506          return this;
507        }
508
509        /**
510         * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
511         */
512        public CodeableConcept getTypeFirstRep() { 
513          if (getType().isEmpty()) {
514            addType();
515          }
516          return getType().get(0);
517        }
518
519        /**
520         * @return {@link #schedule} (The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.)
521         */
522        public List<Timing> getSchedule() { 
523          if (this.schedule == null)
524            this.schedule = new ArrayList<Timing>();
525          return this.schedule;
526        }
527
528        /**
529         * @return Returns a reference to <code>this</code> for easy method chaining
530         */
531        public NutritionOrderOralDietComponent setSchedule(List<Timing> theSchedule) { 
532          this.schedule = theSchedule;
533          return this;
534        }
535
536        public boolean hasSchedule() { 
537          if (this.schedule == null)
538            return false;
539          for (Timing item : this.schedule)
540            if (!item.isEmpty())
541              return true;
542          return false;
543        }
544
545        public Timing addSchedule() { //3
546          Timing t = new Timing();
547          if (this.schedule == null)
548            this.schedule = new ArrayList<Timing>();
549          this.schedule.add(t);
550          return t;
551        }
552
553        public NutritionOrderOralDietComponent addSchedule(Timing t) { //3
554          if (t == null)
555            return this;
556          if (this.schedule == null)
557            this.schedule = new ArrayList<Timing>();
558          this.schedule.add(t);
559          return this;
560        }
561
562        /**
563         * @return The first repetition of repeating field {@link #schedule}, creating it if it does not already exist
564         */
565        public Timing getScheduleFirstRep() { 
566          if (getSchedule().isEmpty()) {
567            addSchedule();
568          }
569          return getSchedule().get(0);
570        }
571
572        /**
573         * @return {@link #nutrient} (Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.)
574         */
575        public List<NutritionOrderOralDietNutrientComponent> getNutrient() { 
576          if (this.nutrient == null)
577            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
578          return this.nutrient;
579        }
580
581        /**
582         * @return Returns a reference to <code>this</code> for easy method chaining
583         */
584        public NutritionOrderOralDietComponent setNutrient(List<NutritionOrderOralDietNutrientComponent> theNutrient) { 
585          this.nutrient = theNutrient;
586          return this;
587        }
588
589        public boolean hasNutrient() { 
590          if (this.nutrient == null)
591            return false;
592          for (NutritionOrderOralDietNutrientComponent item : this.nutrient)
593            if (!item.isEmpty())
594              return true;
595          return false;
596        }
597
598        public NutritionOrderOralDietNutrientComponent addNutrient() { //3
599          NutritionOrderOralDietNutrientComponent t = new NutritionOrderOralDietNutrientComponent();
600          if (this.nutrient == null)
601            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
602          this.nutrient.add(t);
603          return t;
604        }
605
606        public NutritionOrderOralDietComponent addNutrient(NutritionOrderOralDietNutrientComponent t) { //3
607          if (t == null)
608            return this;
609          if (this.nutrient == null)
610            this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
611          this.nutrient.add(t);
612          return this;
613        }
614
615        /**
616         * @return The first repetition of repeating field {@link #nutrient}, creating it if it does not already exist
617         */
618        public NutritionOrderOralDietNutrientComponent getNutrientFirstRep() { 
619          if (getNutrient().isEmpty()) {
620            addNutrient();
621          }
622          return getNutrient().get(0);
623        }
624
625        /**
626         * @return {@link #texture} (Class that describes any texture modifications required for the patient to safely consume various types of solid foods.)
627         */
628        public List<NutritionOrderOralDietTextureComponent> getTexture() { 
629          if (this.texture == null)
630            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
631          return this.texture;
632        }
633
634        /**
635         * @return Returns a reference to <code>this</code> for easy method chaining
636         */
637        public NutritionOrderOralDietComponent setTexture(List<NutritionOrderOralDietTextureComponent> theTexture) { 
638          this.texture = theTexture;
639          return this;
640        }
641
642        public boolean hasTexture() { 
643          if (this.texture == null)
644            return false;
645          for (NutritionOrderOralDietTextureComponent item : this.texture)
646            if (!item.isEmpty())
647              return true;
648          return false;
649        }
650
651        public NutritionOrderOralDietTextureComponent addTexture() { //3
652          NutritionOrderOralDietTextureComponent t = new NutritionOrderOralDietTextureComponent();
653          if (this.texture == null)
654            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
655          this.texture.add(t);
656          return t;
657        }
658
659        public NutritionOrderOralDietComponent addTexture(NutritionOrderOralDietTextureComponent t) { //3
660          if (t == null)
661            return this;
662          if (this.texture == null)
663            this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
664          this.texture.add(t);
665          return this;
666        }
667
668        /**
669         * @return The first repetition of repeating field {@link #texture}, creating it if it does not already exist
670         */
671        public NutritionOrderOralDietTextureComponent getTextureFirstRep() { 
672          if (getTexture().isEmpty()) {
673            addTexture();
674          }
675          return getTexture().get(0);
676        }
677
678        /**
679         * @return {@link #fluidConsistencyType} (The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.)
680         */
681        public List<CodeableConcept> getFluidConsistencyType() { 
682          if (this.fluidConsistencyType == null)
683            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
684          return this.fluidConsistencyType;
685        }
686
687        /**
688         * @return Returns a reference to <code>this</code> for easy method chaining
689         */
690        public NutritionOrderOralDietComponent setFluidConsistencyType(List<CodeableConcept> theFluidConsistencyType) { 
691          this.fluidConsistencyType = theFluidConsistencyType;
692          return this;
693        }
694
695        public boolean hasFluidConsistencyType() { 
696          if (this.fluidConsistencyType == null)
697            return false;
698          for (CodeableConcept item : this.fluidConsistencyType)
699            if (!item.isEmpty())
700              return true;
701          return false;
702        }
703
704        public CodeableConcept addFluidConsistencyType() { //3
705          CodeableConcept t = new CodeableConcept();
706          if (this.fluidConsistencyType == null)
707            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
708          this.fluidConsistencyType.add(t);
709          return t;
710        }
711
712        public NutritionOrderOralDietComponent addFluidConsistencyType(CodeableConcept t) { //3
713          if (t == null)
714            return this;
715          if (this.fluidConsistencyType == null)
716            this.fluidConsistencyType = new ArrayList<CodeableConcept>();
717          this.fluidConsistencyType.add(t);
718          return this;
719        }
720
721        /**
722         * @return The first repetition of repeating field {@link #fluidConsistencyType}, creating it if it does not already exist
723         */
724        public CodeableConcept getFluidConsistencyTypeFirstRep() { 
725          if (getFluidConsistencyType().isEmpty()) {
726            addFluidConsistencyType();
727          }
728          return getFluidConsistencyType().get(0);
729        }
730
731        /**
732         * @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
733         */
734        public StringType getInstructionElement() { 
735          if (this.instruction == null)
736            if (Configuration.errorOnAutoCreate())
737              throw new Error("Attempt to auto-create NutritionOrderOralDietComponent.instruction");
738            else if (Configuration.doAutoCreate())
739              this.instruction = new StringType(); // bb
740          return this.instruction;
741        }
742
743        public boolean hasInstructionElement() { 
744          return this.instruction != null && !this.instruction.isEmpty();
745        }
746
747        public boolean hasInstruction() { 
748          return this.instruction != null && !this.instruction.isEmpty();
749        }
750
751        /**
752         * @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
753         */
754        public NutritionOrderOralDietComponent setInstructionElement(StringType value) { 
755          this.instruction = value;
756          return this;
757        }
758
759        /**
760         * @return Free text or additional instructions or information pertaining to the oral diet.
761         */
762        public String getInstruction() { 
763          return this.instruction == null ? null : this.instruction.getValue();
764        }
765
766        /**
767         * @param value Free text or additional instructions or information pertaining to the oral diet.
768         */
769        public NutritionOrderOralDietComponent setInstruction(String value) { 
770          if (Utilities.noString(value))
771            this.instruction = null;
772          else {
773            if (this.instruction == null)
774              this.instruction = new StringType();
775            this.instruction.setValue(value);
776          }
777          return this;
778        }
779
780        protected void listChildren(List<Property> children) {
781          super.listChildren(children);
782          children.add(new Property("type", "CodeableConcept", "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0, java.lang.Integer.MAX_VALUE, type));
783          children.add(new Property("schedule", "Timing", "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule));
784          children.add(new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient));
785          children.add(new Property("texture", "", "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.", 0, java.lang.Integer.MAX_VALUE, texture));
786          children.add(new Property("fluidConsistencyType", "CodeableConcept", "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.", 0, java.lang.Integer.MAX_VALUE, fluidConsistencyType));
787          children.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction));
788        }
789
790        @Override
791        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
792          switch (_hash) {
793          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0, java.lang.Integer.MAX_VALUE, type);
794          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule);
795          case -1671151641: /*nutrient*/  return new Property("nutrient", "", "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.", 0, java.lang.Integer.MAX_VALUE, nutrient);
796          case -1417816805: /*texture*/  return new Property("texture", "", "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.", 0, java.lang.Integer.MAX_VALUE, texture);
797          case -525105592: /*fluidConsistencyType*/  return new Property("fluidConsistencyType", "CodeableConcept", "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.", 0, java.lang.Integer.MAX_VALUE, fluidConsistencyType);
798          case 301526158: /*instruction*/  return new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction);
799          default: return super.getNamedProperty(_hash, _name, _checkValid);
800          }
801
802        }
803
804      @Override
805      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
806        switch (hash) {
807        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
808        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
809        case -1671151641: /*nutrient*/ return this.nutrient == null ? new Base[0] : this.nutrient.toArray(new Base[this.nutrient.size()]); // NutritionOrderOralDietNutrientComponent
810        case -1417816805: /*texture*/ return this.texture == null ? new Base[0] : this.texture.toArray(new Base[this.texture.size()]); // NutritionOrderOralDietTextureComponent
811        case -525105592: /*fluidConsistencyType*/ return this.fluidConsistencyType == null ? new Base[0] : this.fluidConsistencyType.toArray(new Base[this.fluidConsistencyType.size()]); // CodeableConcept
812        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
813        default: return super.getProperty(hash, name, checkValid);
814        }
815
816      }
817
818      @Override
819      public Base setProperty(int hash, String name, Base value) throws FHIRException {
820        switch (hash) {
821        case 3575610: // type
822          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
823          return value;
824        case -697920873: // schedule
825          this.getSchedule().add(castToTiming(value)); // Timing
826          return value;
827        case -1671151641: // nutrient
828          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value); // NutritionOrderOralDietNutrientComponent
829          return value;
830        case -1417816805: // texture
831          this.getTexture().add((NutritionOrderOralDietTextureComponent) value); // NutritionOrderOralDietTextureComponent
832          return value;
833        case -525105592: // fluidConsistencyType
834          this.getFluidConsistencyType().add(castToCodeableConcept(value)); // CodeableConcept
835          return value;
836        case 301526158: // instruction
837          this.instruction = castToString(value); // StringType
838          return value;
839        default: return super.setProperty(hash, name, value);
840        }
841
842      }
843
844      @Override
845      public Base setProperty(String name, Base value) throws FHIRException {
846        if (name.equals("type")) {
847          this.getType().add(castToCodeableConcept(value));
848        } else if (name.equals("schedule")) {
849          this.getSchedule().add(castToTiming(value));
850        } else if (name.equals("nutrient")) {
851          this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value);
852        } else if (name.equals("texture")) {
853          this.getTexture().add((NutritionOrderOralDietTextureComponent) value);
854        } else if (name.equals("fluidConsistencyType")) {
855          this.getFluidConsistencyType().add(castToCodeableConcept(value));
856        } else if (name.equals("instruction")) {
857          this.instruction = castToString(value); // StringType
858        } else
859          return super.setProperty(name, value);
860        return value;
861      }
862
863      @Override
864      public Base makeProperty(int hash, String name) throws FHIRException {
865        switch (hash) {
866        case 3575610:  return addType(); 
867        case -697920873:  return addSchedule(); 
868        case -1671151641:  return addNutrient(); 
869        case -1417816805:  return addTexture(); 
870        case -525105592:  return addFluidConsistencyType(); 
871        case 301526158:  return getInstructionElement();
872        default: return super.makeProperty(hash, name);
873        }
874
875      }
876
877      @Override
878      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
879        switch (hash) {
880        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
881        case -697920873: /*schedule*/ return new String[] {"Timing"};
882        case -1671151641: /*nutrient*/ return new String[] {};
883        case -1417816805: /*texture*/ return new String[] {};
884        case -525105592: /*fluidConsistencyType*/ return new String[] {"CodeableConcept"};
885        case 301526158: /*instruction*/ return new String[] {"string"};
886        default: return super.getTypesForProperty(hash, name);
887        }
888
889      }
890
891      @Override
892      public Base addChild(String name) throws FHIRException {
893        if (name.equals("type")) {
894          return addType();
895        }
896        else if (name.equals("schedule")) {
897          return addSchedule();
898        }
899        else if (name.equals("nutrient")) {
900          return addNutrient();
901        }
902        else if (name.equals("texture")) {
903          return addTexture();
904        }
905        else if (name.equals("fluidConsistencyType")) {
906          return addFluidConsistencyType();
907        }
908        else if (name.equals("instruction")) {
909          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instruction");
910        }
911        else
912          return super.addChild(name);
913      }
914
915      public NutritionOrderOralDietComponent copy() {
916        NutritionOrderOralDietComponent dst = new NutritionOrderOralDietComponent();
917        copyValues(dst);
918        if (type != null) {
919          dst.type = new ArrayList<CodeableConcept>();
920          for (CodeableConcept i : type)
921            dst.type.add(i.copy());
922        };
923        if (schedule != null) {
924          dst.schedule = new ArrayList<Timing>();
925          for (Timing i : schedule)
926            dst.schedule.add(i.copy());
927        };
928        if (nutrient != null) {
929          dst.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
930          for (NutritionOrderOralDietNutrientComponent i : nutrient)
931            dst.nutrient.add(i.copy());
932        };
933        if (texture != null) {
934          dst.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
935          for (NutritionOrderOralDietTextureComponent i : texture)
936            dst.texture.add(i.copy());
937        };
938        if (fluidConsistencyType != null) {
939          dst.fluidConsistencyType = new ArrayList<CodeableConcept>();
940          for (CodeableConcept i : fluidConsistencyType)
941            dst.fluidConsistencyType.add(i.copy());
942        };
943        dst.instruction = instruction == null ? null : instruction.copy();
944        return dst;
945      }
946
947      @Override
948      public boolean equalsDeep(Base other_) {
949        if (!super.equalsDeep(other_))
950          return false;
951        if (!(other_ instanceof NutritionOrderOralDietComponent))
952          return false;
953        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
954        return compareDeep(type, o.type, true) && compareDeep(schedule, o.schedule, true) && compareDeep(nutrient, o.nutrient, true)
955           && compareDeep(texture, o.texture, true) && compareDeep(fluidConsistencyType, o.fluidConsistencyType, true)
956           && compareDeep(instruction, o.instruction, true);
957      }
958
959      @Override
960      public boolean equalsShallow(Base other_) {
961        if (!super.equalsShallow(other_))
962          return false;
963        if (!(other_ instanceof NutritionOrderOralDietComponent))
964          return false;
965        NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
966        return compareValues(instruction, o.instruction, true);
967      }
968
969      public boolean isEmpty() {
970        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, schedule, nutrient
971          , texture, fluidConsistencyType, instruction);
972      }
973
974  public String fhirType() {
975    return "NutritionOrder.oralDiet";
976
977  }
978
979  }
980
981    @Block()
982    public static class NutritionOrderOralDietNutrientComponent extends BackboneElement implements IBaseBackboneElement {
983        /**
984         * The nutrient that is being modified such as carbohydrate or sodium.
985         */
986        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
987        @Description(shortDefinition="Type of nutrient that is being modified", formalDefinition="The nutrient that is being modified such as carbohydrate or sodium." )
988        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/nutrient-code")
989        protected CodeableConcept modifier;
990
991        /**
992         * The quantity of the specified nutrient to include in diet.
993         */
994        @Child(name = "amount", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
995        @Description(shortDefinition="Quantity of the specified nutrient", formalDefinition="The quantity of the specified nutrient to include in diet." )
996        protected Quantity amount;
997
998        private static final long serialVersionUID = 1042462093L;
999
1000    /**
1001     * Constructor
1002     */
1003      public NutritionOrderOralDietNutrientComponent() {
1004        super();
1005      }
1006
1007        /**
1008         * @return {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
1009         */
1010        public CodeableConcept getModifier() { 
1011          if (this.modifier == null)
1012            if (Configuration.errorOnAutoCreate())
1013              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.modifier");
1014            else if (Configuration.doAutoCreate())
1015              this.modifier = new CodeableConcept(); // cc
1016          return this.modifier;
1017        }
1018
1019        public boolean hasModifier() { 
1020          return this.modifier != null && !this.modifier.isEmpty();
1021        }
1022
1023        /**
1024         * @param value {@link #modifier} (The nutrient that is being modified such as carbohydrate or sodium.)
1025         */
1026        public NutritionOrderOralDietNutrientComponent setModifier(CodeableConcept value) { 
1027          this.modifier = value;
1028          return this;
1029        }
1030
1031        /**
1032         * @return {@link #amount} (The quantity of the specified nutrient to include in diet.)
1033         */
1034        public Quantity getAmount() { 
1035          if (this.amount == null)
1036            if (Configuration.errorOnAutoCreate())
1037              throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.amount");
1038            else if (Configuration.doAutoCreate())
1039              this.amount = new Quantity(); // cc
1040          return this.amount;
1041        }
1042
1043        public boolean hasAmount() { 
1044          return this.amount != null && !this.amount.isEmpty();
1045        }
1046
1047        /**
1048         * @param value {@link #amount} (The quantity of the specified nutrient to include in diet.)
1049         */
1050        public NutritionOrderOralDietNutrientComponent setAmount(Quantity value) { 
1051          this.amount = value;
1052          return this;
1053        }
1054
1055        protected void listChildren(List<Property> children) {
1056          super.listChildren(children);
1057          children.add(new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier));
1058          children.add(new Property("amount", "SimpleQuantity", "The quantity of the specified nutrient to include in diet.", 0, 1, amount));
1059        }
1060
1061        @Override
1062        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1063          switch (_hash) {
1064          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier);
1065          case -1413853096: /*amount*/  return new Property("amount", "SimpleQuantity", "The quantity of the specified nutrient to include in diet.", 0, 1, amount);
1066          default: return super.getNamedProperty(_hash, _name, _checkValid);
1067          }
1068
1069        }
1070
1071      @Override
1072      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1073        switch (hash) {
1074        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
1075        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Quantity
1076        default: return super.getProperty(hash, name, checkValid);
1077        }
1078
1079      }
1080
1081      @Override
1082      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1083        switch (hash) {
1084        case -615513385: // modifier
1085          this.modifier = castToCodeableConcept(value); // CodeableConcept
1086          return value;
1087        case -1413853096: // amount
1088          this.amount = castToQuantity(value); // Quantity
1089          return value;
1090        default: return super.setProperty(hash, name, value);
1091        }
1092
1093      }
1094
1095      @Override
1096      public Base setProperty(String name, Base value) throws FHIRException {
1097        if (name.equals("modifier")) {
1098          this.modifier = castToCodeableConcept(value); // CodeableConcept
1099        } else if (name.equals("amount")) {
1100          this.amount = castToQuantity(value); // Quantity
1101        } else
1102          return super.setProperty(name, value);
1103        return value;
1104      }
1105
1106      @Override
1107      public Base makeProperty(int hash, String name) throws FHIRException {
1108        switch (hash) {
1109        case -615513385:  return getModifier(); 
1110        case -1413853096:  return getAmount(); 
1111        default: return super.makeProperty(hash, name);
1112        }
1113
1114      }
1115
1116      @Override
1117      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1118        switch (hash) {
1119        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
1120        case -1413853096: /*amount*/ return new String[] {"SimpleQuantity"};
1121        default: return super.getTypesForProperty(hash, name);
1122        }
1123
1124      }
1125
1126      @Override
1127      public Base addChild(String name) throws FHIRException {
1128        if (name.equals("modifier")) {
1129          this.modifier = new CodeableConcept();
1130          return this.modifier;
1131        }
1132        else if (name.equals("amount")) {
1133          this.amount = new Quantity();
1134          return this.amount;
1135        }
1136        else
1137          return super.addChild(name);
1138      }
1139
1140      public NutritionOrderOralDietNutrientComponent copy() {
1141        NutritionOrderOralDietNutrientComponent dst = new NutritionOrderOralDietNutrientComponent();
1142        copyValues(dst);
1143        dst.modifier = modifier == null ? null : modifier.copy();
1144        dst.amount = amount == null ? null : amount.copy();
1145        return dst;
1146      }
1147
1148      @Override
1149      public boolean equalsDeep(Base other_) {
1150        if (!super.equalsDeep(other_))
1151          return false;
1152        if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
1153          return false;
1154        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
1155        return compareDeep(modifier, o.modifier, true) && compareDeep(amount, o.amount, true);
1156      }
1157
1158      @Override
1159      public boolean equalsShallow(Base other_) {
1160        if (!super.equalsShallow(other_))
1161          return false;
1162        if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
1163          return false;
1164        NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
1165        return true;
1166      }
1167
1168      public boolean isEmpty() {
1169        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, amount);
1170      }
1171
1172  public String fhirType() {
1173    return "NutritionOrder.oralDiet.nutrient";
1174
1175  }
1176
1177  }
1178
1179    @Block()
1180    public static class NutritionOrderOralDietTextureComponent extends BackboneElement implements IBaseBackboneElement {
1181        /**
1182         * Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.
1183         */
1184        @Child(name = "modifier", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
1185        @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." )
1186        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/texture-code")
1187        protected CodeableConcept modifier;
1188
1189        /**
1190         * The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.
1191         */
1192        @Child(name = "foodType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1193        @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." )
1194        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/modified-foodtype")
1195        protected CodeableConcept foodType;
1196
1197        private static final long serialVersionUID = -56402817L;
1198
1199    /**
1200     * Constructor
1201     */
1202      public NutritionOrderOralDietTextureComponent() {
1203        super();
1204      }
1205
1206        /**
1207         * @return {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
1208         */
1209        public CodeableConcept getModifier() { 
1210          if (this.modifier == null)
1211            if (Configuration.errorOnAutoCreate())
1212              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.modifier");
1213            else if (Configuration.doAutoCreate())
1214              this.modifier = new CodeableConcept(); // cc
1215          return this.modifier;
1216        }
1217
1218        public boolean hasModifier() { 
1219          return this.modifier != null && !this.modifier.isEmpty();
1220        }
1221
1222        /**
1223         * @param value {@link #modifier} (Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.)
1224         */
1225        public NutritionOrderOralDietTextureComponent setModifier(CodeableConcept value) { 
1226          this.modifier = value;
1227          return this;
1228        }
1229
1230        /**
1231         * @return {@link #foodType} (The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.)
1232         */
1233        public CodeableConcept getFoodType() { 
1234          if (this.foodType == null)
1235            if (Configuration.errorOnAutoCreate())
1236              throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.foodType");
1237            else if (Configuration.doAutoCreate())
1238              this.foodType = new CodeableConcept(); // cc
1239          return this.foodType;
1240        }
1241
1242        public boolean hasFoodType() { 
1243          return this.foodType != null && !this.foodType.isEmpty();
1244        }
1245
1246        /**
1247         * @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.)
1248         */
1249        public NutritionOrderOralDietTextureComponent setFoodType(CodeableConcept value) { 
1250          this.foodType = value;
1251          return this;
1252        }
1253
1254        protected void listChildren(List<Property> children) {
1255          super.listChildren(children);
1256          children.add(new Property("modifier", "CodeableConcept", "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.", 0, 1, modifier));
1257          children.add(new Property("foodType", "CodeableConcept", "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.", 0, 1, foodType));
1258        }
1259
1260        @Override
1261        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1262          switch (_hash) {
1263          case -615513385: /*modifier*/  return new Property("modifier", "CodeableConcept", "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.", 0, 1, modifier);
1264          case 379498680: /*foodType*/  return new Property("foodType", "CodeableConcept", "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.", 0, 1, foodType);
1265          default: return super.getNamedProperty(_hash, _name, _checkValid);
1266          }
1267
1268        }
1269
1270      @Override
1271      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1272        switch (hash) {
1273        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : new Base[] {this.modifier}; // CodeableConcept
1274        case 379498680: /*foodType*/ return this.foodType == null ? new Base[0] : new Base[] {this.foodType}; // CodeableConcept
1275        default: return super.getProperty(hash, name, checkValid);
1276        }
1277
1278      }
1279
1280      @Override
1281      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1282        switch (hash) {
1283        case -615513385: // modifier
1284          this.modifier = castToCodeableConcept(value); // CodeableConcept
1285          return value;
1286        case 379498680: // foodType
1287          this.foodType = castToCodeableConcept(value); // CodeableConcept
1288          return value;
1289        default: return super.setProperty(hash, name, value);
1290        }
1291
1292      }
1293
1294      @Override
1295      public Base setProperty(String name, Base value) throws FHIRException {
1296        if (name.equals("modifier")) {
1297          this.modifier = castToCodeableConcept(value); // CodeableConcept
1298        } else if (name.equals("foodType")) {
1299          this.foodType = castToCodeableConcept(value); // CodeableConcept
1300        } else
1301          return super.setProperty(name, value);
1302        return value;
1303      }
1304
1305      @Override
1306      public Base makeProperty(int hash, String name) throws FHIRException {
1307        switch (hash) {
1308        case -615513385:  return getModifier(); 
1309        case 379498680:  return getFoodType(); 
1310        default: return super.makeProperty(hash, name);
1311        }
1312
1313      }
1314
1315      @Override
1316      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1317        switch (hash) {
1318        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
1319        case 379498680: /*foodType*/ return new String[] {"CodeableConcept"};
1320        default: return super.getTypesForProperty(hash, name);
1321        }
1322
1323      }
1324
1325      @Override
1326      public Base addChild(String name) throws FHIRException {
1327        if (name.equals("modifier")) {
1328          this.modifier = new CodeableConcept();
1329          return this.modifier;
1330        }
1331        else if (name.equals("foodType")) {
1332          this.foodType = new CodeableConcept();
1333          return this.foodType;
1334        }
1335        else
1336          return super.addChild(name);
1337      }
1338
1339      public NutritionOrderOralDietTextureComponent copy() {
1340        NutritionOrderOralDietTextureComponent dst = new NutritionOrderOralDietTextureComponent();
1341        copyValues(dst);
1342        dst.modifier = modifier == null ? null : modifier.copy();
1343        dst.foodType = foodType == null ? null : foodType.copy();
1344        return dst;
1345      }
1346
1347      @Override
1348      public boolean equalsDeep(Base other_) {
1349        if (!super.equalsDeep(other_))
1350          return false;
1351        if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1352          return false;
1353        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1354        return compareDeep(modifier, o.modifier, true) && compareDeep(foodType, o.foodType, true);
1355      }
1356
1357      @Override
1358      public boolean equalsShallow(Base other_) {
1359        if (!super.equalsShallow(other_))
1360          return false;
1361        if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1362          return false;
1363        NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1364        return true;
1365      }
1366
1367      public boolean isEmpty() {
1368        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, foodType);
1369      }
1370
1371  public String fhirType() {
1372    return "NutritionOrder.oralDiet.texture";
1373
1374  }
1375
1376  }
1377
1378    @Block()
1379    public static class NutritionOrderSupplementComponent extends BackboneElement implements IBaseBackboneElement {
1380        /**
1381         * The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.
1382         */
1383        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1384        @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." )
1385        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/supplement-type")
1386        protected CodeableConcept type;
1387
1388        /**
1389         * The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1390         */
1391        @Child(name = "productName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1392        @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\"." )
1393        protected StringType productName;
1394
1395        /**
1396         * The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.
1397         */
1398        @Child(name = "schedule", type = {Timing.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1399        @Description(shortDefinition="Scheduled frequency of supplement", formalDefinition="The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present." )
1400        protected List<Timing> schedule;
1401
1402        /**
1403         * The amount of the nutritional supplement to be given.
1404         */
1405        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=false)
1406        @Description(shortDefinition="Amount of the nutritional supplement", formalDefinition="The amount of the nutritional supplement to be given." )
1407        protected Quantity quantity;
1408
1409        /**
1410         * Free text or additional instructions or information pertaining to the oral supplement.
1411         */
1412        @Child(name = "instruction", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1413        @Description(shortDefinition="Instructions or additional information about the oral supplement", formalDefinition="Free text or additional instructions or information pertaining to the oral supplement." )
1414        protected StringType instruction;
1415
1416        private static final long serialVersionUID = -37646618L;
1417
1418    /**
1419     * Constructor
1420     */
1421      public NutritionOrderSupplementComponent() {
1422        super();
1423      }
1424
1425        /**
1426         * @return {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1427         */
1428        public CodeableConcept getType() { 
1429          if (this.type == null)
1430            if (Configuration.errorOnAutoCreate())
1431              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.type");
1432            else if (Configuration.doAutoCreate())
1433              this.type = new CodeableConcept(); // cc
1434          return this.type;
1435        }
1436
1437        public boolean hasType() { 
1438          return this.type != null && !this.type.isEmpty();
1439        }
1440
1441        /**
1442         * @param value {@link #type} (The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.)
1443         */
1444        public NutritionOrderSupplementComponent setType(CodeableConcept value) { 
1445          this.type = value;
1446          return this;
1447        }
1448
1449        /**
1450         * @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
1451         */
1452        public StringType getProductNameElement() { 
1453          if (this.productName == null)
1454            if (Configuration.errorOnAutoCreate())
1455              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.productName");
1456            else if (Configuration.doAutoCreate())
1457              this.productName = new StringType(); // bb
1458          return this.productName;
1459        }
1460
1461        public boolean hasProductNameElement() { 
1462          return this.productName != null && !this.productName.isEmpty();
1463        }
1464
1465        public boolean hasProductName() { 
1466          return this.productName != null && !this.productName.isEmpty();
1467        }
1468
1469        /**
1470         * @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
1471         */
1472        public NutritionOrderSupplementComponent setProductNameElement(StringType value) { 
1473          this.productName = value;
1474          return this;
1475        }
1476
1477        /**
1478         * @return The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1479         */
1480        public String getProductName() { 
1481          return this.productName == null ? null : this.productName.getValue();
1482        }
1483
1484        /**
1485         * @param value The product or brand name of the nutritional supplement such as "Acme Protein Shake".
1486         */
1487        public NutritionOrderSupplementComponent setProductName(String value) { 
1488          if (Utilities.noString(value))
1489            this.productName = null;
1490          else {
1491            if (this.productName == null)
1492              this.productName = new StringType();
1493            this.productName.setValue(value);
1494          }
1495          return this;
1496        }
1497
1498        /**
1499         * @return {@link #schedule} (The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.)
1500         */
1501        public List<Timing> getSchedule() { 
1502          if (this.schedule == null)
1503            this.schedule = new ArrayList<Timing>();
1504          return this.schedule;
1505        }
1506
1507        /**
1508         * @return Returns a reference to <code>this</code> for easy method chaining
1509         */
1510        public NutritionOrderSupplementComponent setSchedule(List<Timing> theSchedule) { 
1511          this.schedule = theSchedule;
1512          return this;
1513        }
1514
1515        public boolean hasSchedule() { 
1516          if (this.schedule == null)
1517            return false;
1518          for (Timing item : this.schedule)
1519            if (!item.isEmpty())
1520              return true;
1521          return false;
1522        }
1523
1524        public Timing addSchedule() { //3
1525          Timing t = new Timing();
1526          if (this.schedule == null)
1527            this.schedule = new ArrayList<Timing>();
1528          this.schedule.add(t);
1529          return t;
1530        }
1531
1532        public NutritionOrderSupplementComponent addSchedule(Timing t) { //3
1533          if (t == null)
1534            return this;
1535          if (this.schedule == null)
1536            this.schedule = new ArrayList<Timing>();
1537          this.schedule.add(t);
1538          return this;
1539        }
1540
1541        /**
1542         * @return The first repetition of repeating field {@link #schedule}, creating it if it does not already exist
1543         */
1544        public Timing getScheduleFirstRep() { 
1545          if (getSchedule().isEmpty()) {
1546            addSchedule();
1547          }
1548          return getSchedule().get(0);
1549        }
1550
1551        /**
1552         * @return {@link #quantity} (The amount of the nutritional supplement to be given.)
1553         */
1554        public Quantity getQuantity() { 
1555          if (this.quantity == null)
1556            if (Configuration.errorOnAutoCreate())
1557              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.quantity");
1558            else if (Configuration.doAutoCreate())
1559              this.quantity = new Quantity(); // cc
1560          return this.quantity;
1561        }
1562
1563        public boolean hasQuantity() { 
1564          return this.quantity != null && !this.quantity.isEmpty();
1565        }
1566
1567        /**
1568         * @param value {@link #quantity} (The amount of the nutritional supplement to be given.)
1569         */
1570        public NutritionOrderSupplementComponent setQuantity(Quantity value) { 
1571          this.quantity = value;
1572          return this;
1573        }
1574
1575        /**
1576         * @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
1577         */
1578        public StringType getInstructionElement() { 
1579          if (this.instruction == null)
1580            if (Configuration.errorOnAutoCreate())
1581              throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.instruction");
1582            else if (Configuration.doAutoCreate())
1583              this.instruction = new StringType(); // bb
1584          return this.instruction;
1585        }
1586
1587        public boolean hasInstructionElement() { 
1588          return this.instruction != null && !this.instruction.isEmpty();
1589        }
1590
1591        public boolean hasInstruction() { 
1592          return this.instruction != null && !this.instruction.isEmpty();
1593        }
1594
1595        /**
1596         * @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
1597         */
1598        public NutritionOrderSupplementComponent setInstructionElement(StringType value) { 
1599          this.instruction = value;
1600          return this;
1601        }
1602
1603        /**
1604         * @return Free text or additional instructions or information pertaining to the oral supplement.
1605         */
1606        public String getInstruction() { 
1607          return this.instruction == null ? null : this.instruction.getValue();
1608        }
1609
1610        /**
1611         * @param value Free text or additional instructions or information pertaining to the oral supplement.
1612         */
1613        public NutritionOrderSupplementComponent setInstruction(String value) { 
1614          if (Utilities.noString(value))
1615            this.instruction = null;
1616          else {
1617            if (this.instruction == null)
1618              this.instruction = new StringType();
1619            this.instruction.setValue(value);
1620          }
1621          return this;
1622        }
1623
1624        protected void listChildren(List<Property> children) {
1625          super.listChildren(children);
1626          children.add(new Property("type", "CodeableConcept", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, 1, type));
1627          children.add(new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1, productName));
1628          children.add(new Property("schedule", "Timing", "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule));
1629          children.add(new Property("quantity", "SimpleQuantity", "The amount of the nutritional supplement to be given.", 0, 1, quantity));
1630          children.add(new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction));
1631        }
1632
1633        @Override
1634        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1635          switch (_hash) {
1636          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.", 0, 1, type);
1637          case -1491817446: /*productName*/  return new Property("productName", "string", "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1, productName);
1638          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.", 0, java.lang.Integer.MAX_VALUE, schedule);
1639          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The amount of the nutritional supplement to be given.", 0, 1, quantity);
1640          case 301526158: /*instruction*/  return new Property("instruction", "string", "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction);
1641          default: return super.getNamedProperty(_hash, _name, _checkValid);
1642          }
1643
1644        }
1645
1646      @Override
1647      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1648        switch (hash) {
1649        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1650        case -1491817446: /*productName*/ return this.productName == null ? new Base[0] : new Base[] {this.productName}; // StringType
1651        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
1652        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1653        case 301526158: /*instruction*/ return this.instruction == null ? new Base[0] : new Base[] {this.instruction}; // StringType
1654        default: return super.getProperty(hash, name, checkValid);
1655        }
1656
1657      }
1658
1659      @Override
1660      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1661        switch (hash) {
1662        case 3575610: // type
1663          this.type = castToCodeableConcept(value); // CodeableConcept
1664          return value;
1665        case -1491817446: // productName
1666          this.productName = castToString(value); // StringType
1667          return value;
1668        case -697920873: // schedule
1669          this.getSchedule().add(castToTiming(value)); // Timing
1670          return value;
1671        case -1285004149: // quantity
1672          this.quantity = castToQuantity(value); // Quantity
1673          return value;
1674        case 301526158: // instruction
1675          this.instruction = castToString(value); // StringType
1676          return value;
1677        default: return super.setProperty(hash, name, value);
1678        }
1679
1680      }
1681
1682      @Override
1683      public Base setProperty(String name, Base value) throws FHIRException {
1684        if (name.equals("type")) {
1685          this.type = castToCodeableConcept(value); // CodeableConcept
1686        } else if (name.equals("productName")) {
1687          this.productName = castToString(value); // StringType
1688        } else if (name.equals("schedule")) {
1689          this.getSchedule().add(castToTiming(value));
1690        } else if (name.equals("quantity")) {
1691          this.quantity = castToQuantity(value); // Quantity
1692        } else if (name.equals("instruction")) {
1693          this.instruction = castToString(value); // StringType
1694        } else
1695          return super.setProperty(name, value);
1696        return value;
1697      }
1698
1699      @Override
1700      public Base makeProperty(int hash, String name) throws FHIRException {
1701        switch (hash) {
1702        case 3575610:  return getType(); 
1703        case -1491817446:  return getProductNameElement();
1704        case -697920873:  return addSchedule(); 
1705        case -1285004149:  return getQuantity(); 
1706        case 301526158:  return getInstructionElement();
1707        default: return super.makeProperty(hash, name);
1708        }
1709
1710      }
1711
1712      @Override
1713      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1714        switch (hash) {
1715        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1716        case -1491817446: /*productName*/ return new String[] {"string"};
1717        case -697920873: /*schedule*/ return new String[] {"Timing"};
1718        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
1719        case 301526158: /*instruction*/ return new String[] {"string"};
1720        default: return super.getTypesForProperty(hash, name);
1721        }
1722
1723      }
1724
1725      @Override
1726      public Base addChild(String name) throws FHIRException {
1727        if (name.equals("type")) {
1728          this.type = new CodeableConcept();
1729          return this.type;
1730        }
1731        else if (name.equals("productName")) {
1732          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.productName");
1733        }
1734        else if (name.equals("schedule")) {
1735          return addSchedule();
1736        }
1737        else if (name.equals("quantity")) {
1738          this.quantity = new Quantity();
1739          return this.quantity;
1740        }
1741        else if (name.equals("instruction")) {
1742          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instruction");
1743        }
1744        else
1745          return super.addChild(name);
1746      }
1747
1748      public NutritionOrderSupplementComponent copy() {
1749        NutritionOrderSupplementComponent dst = new NutritionOrderSupplementComponent();
1750        copyValues(dst);
1751        dst.type = type == null ? null : type.copy();
1752        dst.productName = productName == null ? null : productName.copy();
1753        if (schedule != null) {
1754          dst.schedule = new ArrayList<Timing>();
1755          for (Timing i : schedule)
1756            dst.schedule.add(i.copy());
1757        };
1758        dst.quantity = quantity == null ? null : quantity.copy();
1759        dst.instruction = instruction == null ? null : instruction.copy();
1760        return dst;
1761      }
1762
1763      @Override
1764      public boolean equalsDeep(Base other_) {
1765        if (!super.equalsDeep(other_))
1766          return false;
1767        if (!(other_ instanceof NutritionOrderSupplementComponent))
1768          return false;
1769        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
1770        return compareDeep(type, o.type, true) && compareDeep(productName, o.productName, true) && compareDeep(schedule, o.schedule, true)
1771           && compareDeep(quantity, o.quantity, true) && compareDeep(instruction, o.instruction, true);
1772      }
1773
1774      @Override
1775      public boolean equalsShallow(Base other_) {
1776        if (!super.equalsShallow(other_))
1777          return false;
1778        if (!(other_ instanceof NutritionOrderSupplementComponent))
1779          return false;
1780        NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
1781        return compareValues(productName, o.productName, true) && compareValues(instruction, o.instruction, true)
1782          ;
1783      }
1784
1785      public boolean isEmpty() {
1786        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, productName, schedule
1787          , quantity, instruction);
1788      }
1789
1790  public String fhirType() {
1791    return "NutritionOrder.supplement";
1792
1793  }
1794
1795  }
1796
1797    @Block()
1798    public static class NutritionOrderEnteralFormulaComponent extends BackboneElement implements IBaseBackboneElement {
1799        /**
1800         * The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.
1801         */
1802        @Child(name = "baseFormulaType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1803        @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." )
1804        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/entformula-type")
1805        protected CodeableConcept baseFormulaType;
1806
1807        /**
1808         * The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1809         */
1810        @Child(name = "baseFormulaProductName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1811        @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\"." )
1812        protected StringType baseFormulaProductName;
1813
1814        /**
1815         * 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.
1816         */
1817        @Child(name = "additiveType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1818        @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." )
1819        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/entformula-additive")
1820        protected CodeableConcept additiveType;
1821
1822        /**
1823         * The product or brand name of the type of modular component to be added to the formula.
1824         */
1825        @Child(name = "additiveProductName", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1826        @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." )
1827        protected StringType additiveProductName;
1828
1829        /**
1830         * 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.
1831         */
1832        @Child(name = "caloricDensity", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false)
1833        @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." )
1834        protected Quantity caloricDensity;
1835
1836        /**
1837         * The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.
1838         */
1839        @Child(name = "routeofAdministration", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
1840        @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." )
1841        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/enteral-route")
1842        protected CodeableConcept routeofAdministration;
1843
1844        /**
1845         * 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.
1846         */
1847        @Child(name = "administration", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1848        @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." )
1849        protected List<NutritionOrderEnteralFormulaAdministrationComponent> administration;
1850
1851        /**
1852         * 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.
1853         */
1854        @Child(name = "maxVolumeToDeliver", type = {Quantity.class}, order=8, min=0, max=1, modifier=false, summary=false)
1855        @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." )
1856        protected Quantity maxVolumeToDeliver;
1857
1858        /**
1859         * Free text formula administration, feeding instructions or additional instructions or information.
1860         */
1861        @Child(name = "administrationInstruction", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1862        @Description(shortDefinition="Formula feeding instructions expressed as text", formalDefinition="Free text formula administration, feeding instructions or additional instructions or information." )
1863        protected StringType administrationInstruction;
1864
1865        private static final long serialVersionUID = -124511395L;
1866
1867    /**
1868     * Constructor
1869     */
1870      public NutritionOrderEnteralFormulaComponent() {
1871        super();
1872      }
1873
1874        /**
1875         * @return {@link #baseFormulaType} (The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.)
1876         */
1877        public CodeableConcept getBaseFormulaType() { 
1878          if (this.baseFormulaType == null)
1879            if (Configuration.errorOnAutoCreate())
1880              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaType");
1881            else if (Configuration.doAutoCreate())
1882              this.baseFormulaType = new CodeableConcept(); // cc
1883          return this.baseFormulaType;
1884        }
1885
1886        public boolean hasBaseFormulaType() { 
1887          return this.baseFormulaType != null && !this.baseFormulaType.isEmpty();
1888        }
1889
1890        /**
1891         * @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.)
1892         */
1893        public NutritionOrderEnteralFormulaComponent setBaseFormulaType(CodeableConcept value) { 
1894          this.baseFormulaType = value;
1895          return this;
1896        }
1897
1898        /**
1899         * @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
1900         */
1901        public StringType getBaseFormulaProductNameElement() { 
1902          if (this.baseFormulaProductName == null)
1903            if (Configuration.errorOnAutoCreate())
1904              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaProductName");
1905            else if (Configuration.doAutoCreate())
1906              this.baseFormulaProductName = new StringType(); // bb
1907          return this.baseFormulaProductName;
1908        }
1909
1910        public boolean hasBaseFormulaProductNameElement() { 
1911          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1912        }
1913
1914        public boolean hasBaseFormulaProductName() { 
1915          return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
1916        }
1917
1918        /**
1919         * @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
1920         */
1921        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductNameElement(StringType value) { 
1922          this.baseFormulaProductName = value;
1923          return this;
1924        }
1925
1926        /**
1927         * @return The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1928         */
1929        public String getBaseFormulaProductName() { 
1930          return this.baseFormulaProductName == null ? null : this.baseFormulaProductName.getValue();
1931        }
1932
1933        /**
1934         * @param value The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".
1935         */
1936        public NutritionOrderEnteralFormulaComponent setBaseFormulaProductName(String value) { 
1937          if (Utilities.noString(value))
1938            this.baseFormulaProductName = null;
1939          else {
1940            if (this.baseFormulaProductName == null)
1941              this.baseFormulaProductName = new StringType();
1942            this.baseFormulaProductName.setValue(value);
1943          }
1944          return this;
1945        }
1946
1947        /**
1948         * @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.)
1949         */
1950        public CodeableConcept getAdditiveType() { 
1951          if (this.additiveType == null)
1952            if (Configuration.errorOnAutoCreate())
1953              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveType");
1954            else if (Configuration.doAutoCreate())
1955              this.additiveType = new CodeableConcept(); // cc
1956          return this.additiveType;
1957        }
1958
1959        public boolean hasAdditiveType() { 
1960          return this.additiveType != null && !this.additiveType.isEmpty();
1961        }
1962
1963        /**
1964         * @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.)
1965         */
1966        public NutritionOrderEnteralFormulaComponent setAdditiveType(CodeableConcept value) { 
1967          this.additiveType = value;
1968          return this;
1969        }
1970
1971        /**
1972         * @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
1973         */
1974        public StringType getAdditiveProductNameElement() { 
1975          if (this.additiveProductName == null)
1976            if (Configuration.errorOnAutoCreate())
1977              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveProductName");
1978            else if (Configuration.doAutoCreate())
1979              this.additiveProductName = new StringType(); // bb
1980          return this.additiveProductName;
1981        }
1982
1983        public boolean hasAdditiveProductNameElement() { 
1984          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
1985        }
1986
1987        public boolean hasAdditiveProductName() { 
1988          return this.additiveProductName != null && !this.additiveProductName.isEmpty();
1989        }
1990
1991        /**
1992         * @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
1993         */
1994        public NutritionOrderEnteralFormulaComponent setAdditiveProductNameElement(StringType value) { 
1995          this.additiveProductName = value;
1996          return this;
1997        }
1998
1999        /**
2000         * @return The product or brand name of the type of modular component to be added to the formula.
2001         */
2002        public String getAdditiveProductName() { 
2003          return this.additiveProductName == null ? null : this.additiveProductName.getValue();
2004        }
2005
2006        /**
2007         * @param value The product or brand name of the type of modular component to be added to the formula.
2008         */
2009        public NutritionOrderEnteralFormulaComponent setAdditiveProductName(String value) { 
2010          if (Utilities.noString(value))
2011            this.additiveProductName = null;
2012          else {
2013            if (this.additiveProductName == null)
2014              this.additiveProductName = new StringType();
2015            this.additiveProductName.setValue(value);
2016          }
2017          return this;
2018        }
2019
2020        /**
2021         * @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.)
2022         */
2023        public Quantity getCaloricDensity() { 
2024          if (this.caloricDensity == null)
2025            if (Configuration.errorOnAutoCreate())
2026              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.caloricDensity");
2027            else if (Configuration.doAutoCreate())
2028              this.caloricDensity = new Quantity(); // cc
2029          return this.caloricDensity;
2030        }
2031
2032        public boolean hasCaloricDensity() { 
2033          return this.caloricDensity != null && !this.caloricDensity.isEmpty();
2034        }
2035
2036        /**
2037         * @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.)
2038         */
2039        public NutritionOrderEnteralFormulaComponent setCaloricDensity(Quantity value) { 
2040          this.caloricDensity = value;
2041          return this;
2042        }
2043
2044        /**
2045         * @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.)
2046         */
2047        public CodeableConcept getRouteofAdministration() { 
2048          if (this.routeofAdministration == null)
2049            if (Configuration.errorOnAutoCreate())
2050              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.routeofAdministration");
2051            else if (Configuration.doAutoCreate())
2052              this.routeofAdministration = new CodeableConcept(); // cc
2053          return this.routeofAdministration;
2054        }
2055
2056        public boolean hasRouteofAdministration() { 
2057          return this.routeofAdministration != null && !this.routeofAdministration.isEmpty();
2058        }
2059
2060        /**
2061         * @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.)
2062         */
2063        public NutritionOrderEnteralFormulaComponent setRouteofAdministration(CodeableConcept value) { 
2064          this.routeofAdministration = value;
2065          return this;
2066        }
2067
2068        /**
2069         * @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.)
2070         */
2071        public List<NutritionOrderEnteralFormulaAdministrationComponent> getAdministration() { 
2072          if (this.administration == null)
2073            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2074          return this.administration;
2075        }
2076
2077        /**
2078         * @return Returns a reference to <code>this</code> for easy method chaining
2079         */
2080        public NutritionOrderEnteralFormulaComponent setAdministration(List<NutritionOrderEnteralFormulaAdministrationComponent> theAdministration) { 
2081          this.administration = theAdministration;
2082          return this;
2083        }
2084
2085        public boolean hasAdministration() { 
2086          if (this.administration == null)
2087            return false;
2088          for (NutritionOrderEnteralFormulaAdministrationComponent item : this.administration)
2089            if (!item.isEmpty())
2090              return true;
2091          return false;
2092        }
2093
2094        public NutritionOrderEnteralFormulaAdministrationComponent addAdministration() { //3
2095          NutritionOrderEnteralFormulaAdministrationComponent t = new NutritionOrderEnteralFormulaAdministrationComponent();
2096          if (this.administration == null)
2097            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2098          this.administration.add(t);
2099          return t;
2100        }
2101
2102        public NutritionOrderEnteralFormulaComponent addAdministration(NutritionOrderEnteralFormulaAdministrationComponent t) { //3
2103          if (t == null)
2104            return this;
2105          if (this.administration == null)
2106            this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2107          this.administration.add(t);
2108          return this;
2109        }
2110
2111        /**
2112         * @return The first repetition of repeating field {@link #administration}, creating it if it does not already exist
2113         */
2114        public NutritionOrderEnteralFormulaAdministrationComponent getAdministrationFirstRep() { 
2115          if (getAdministration().isEmpty()) {
2116            addAdministration();
2117          }
2118          return getAdministration().get(0);
2119        }
2120
2121        /**
2122         * @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.)
2123         */
2124        public Quantity getMaxVolumeToDeliver() { 
2125          if (this.maxVolumeToDeliver == null)
2126            if (Configuration.errorOnAutoCreate())
2127              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.maxVolumeToDeliver");
2128            else if (Configuration.doAutoCreate())
2129              this.maxVolumeToDeliver = new Quantity(); // cc
2130          return this.maxVolumeToDeliver;
2131        }
2132
2133        public boolean hasMaxVolumeToDeliver() { 
2134          return this.maxVolumeToDeliver != null && !this.maxVolumeToDeliver.isEmpty();
2135        }
2136
2137        /**
2138         * @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.)
2139         */
2140        public NutritionOrderEnteralFormulaComponent setMaxVolumeToDeliver(Quantity value) { 
2141          this.maxVolumeToDeliver = value;
2142          return this;
2143        }
2144
2145        /**
2146         * @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
2147         */
2148        public StringType getAdministrationInstructionElement() { 
2149          if (this.administrationInstruction == null)
2150            if (Configuration.errorOnAutoCreate())
2151              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.administrationInstruction");
2152            else if (Configuration.doAutoCreate())
2153              this.administrationInstruction = new StringType(); // bb
2154          return this.administrationInstruction;
2155        }
2156
2157        public boolean hasAdministrationInstructionElement() { 
2158          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
2159        }
2160
2161        public boolean hasAdministrationInstruction() { 
2162          return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
2163        }
2164
2165        /**
2166         * @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
2167         */
2168        public NutritionOrderEnteralFormulaComponent setAdministrationInstructionElement(StringType value) { 
2169          this.administrationInstruction = value;
2170          return this;
2171        }
2172
2173        /**
2174         * @return Free text formula administration, feeding instructions or additional instructions or information.
2175         */
2176        public String getAdministrationInstruction() { 
2177          return this.administrationInstruction == null ? null : this.administrationInstruction.getValue();
2178        }
2179
2180        /**
2181         * @param value Free text formula administration, feeding instructions or additional instructions or information.
2182         */
2183        public NutritionOrderEnteralFormulaComponent setAdministrationInstruction(String value) { 
2184          if (Utilities.noString(value))
2185            this.administrationInstruction = null;
2186          else {
2187            if (this.administrationInstruction == null)
2188              this.administrationInstruction = new StringType();
2189            this.administrationInstruction.setValue(value);
2190          }
2191          return this;
2192        }
2193
2194        protected void listChildren(List<Property> children) {
2195          super.listChildren(children);
2196          children.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, 1, baseFormulaType));
2197          children.add(new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, 1, baseFormulaProductName));
2198          children.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, 1, additiveType));
2199          children.add(new Property("additiveProductName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, 1, additiveProductName));
2200          children.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, 1, caloricDensity));
2201          children.add(new Property("routeofAdministration", "CodeableConcept", "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.", 0, 1, routeofAdministration));
2202          children.add(new Property("administration", "", "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.", 0, java.lang.Integer.MAX_VALUE, administration));
2203          children.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, 1, maxVolumeToDeliver));
2204          children.add(new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1, administrationInstruction));
2205        }
2206
2207        @Override
2208        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2209          switch (_hash) {
2210          case -138930641: /*baseFormulaType*/  return 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, 1, baseFormulaType);
2211          case -1267705979: /*baseFormulaProductName*/  return new Property("baseFormulaProductName", "string", "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".", 0, 1, baseFormulaProductName);
2212          case -470746842: /*additiveType*/  return 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, 1, additiveType);
2213          case 488079534: /*additiveProductName*/  return new Property("additiveProductName", "string", "The product or brand name of the type of modular component to be added to the formula.", 0, 1, additiveProductName);
2214          case 186983261: /*caloricDensity*/  return 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, 1, caloricDensity);
2215          case -1710107042: /*routeofAdministration*/  return new Property("routeofAdministration", "CodeableConcept", "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.", 0, 1, routeofAdministration);
2216          case 1255702622: /*administration*/  return new Property("administration", "", "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.", 0, java.lang.Integer.MAX_VALUE, administration);
2217          case 2017924652: /*maxVolumeToDeliver*/  return 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, 1, maxVolumeToDeliver);
2218          case 427085136: /*administrationInstruction*/  return new Property("administrationInstruction", "string", "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1, administrationInstruction);
2219          default: return super.getNamedProperty(_hash, _name, _checkValid);
2220          }
2221
2222        }
2223
2224      @Override
2225      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2226        switch (hash) {
2227        case -138930641: /*baseFormulaType*/ return this.baseFormulaType == null ? new Base[0] : new Base[] {this.baseFormulaType}; // CodeableConcept
2228        case -1267705979: /*baseFormulaProductName*/ return this.baseFormulaProductName == null ? new Base[0] : new Base[] {this.baseFormulaProductName}; // StringType
2229        case -470746842: /*additiveType*/ return this.additiveType == null ? new Base[0] : new Base[] {this.additiveType}; // CodeableConcept
2230        case 488079534: /*additiveProductName*/ return this.additiveProductName == null ? new Base[0] : new Base[] {this.additiveProductName}; // StringType
2231        case 186983261: /*caloricDensity*/ return this.caloricDensity == null ? new Base[0] : new Base[] {this.caloricDensity}; // Quantity
2232        case -1710107042: /*routeofAdministration*/ return this.routeofAdministration == null ? new Base[0] : new Base[] {this.routeofAdministration}; // CodeableConcept
2233        case 1255702622: /*administration*/ return this.administration == null ? new Base[0] : this.administration.toArray(new Base[this.administration.size()]); // NutritionOrderEnteralFormulaAdministrationComponent
2234        case 2017924652: /*maxVolumeToDeliver*/ return this.maxVolumeToDeliver == null ? new Base[0] : new Base[] {this.maxVolumeToDeliver}; // Quantity
2235        case 427085136: /*administrationInstruction*/ return this.administrationInstruction == null ? new Base[0] : new Base[] {this.administrationInstruction}; // StringType
2236        default: return super.getProperty(hash, name, checkValid);
2237        }
2238
2239      }
2240
2241      @Override
2242      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2243        switch (hash) {
2244        case -138930641: // baseFormulaType
2245          this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
2246          return value;
2247        case -1267705979: // baseFormulaProductName
2248          this.baseFormulaProductName = castToString(value); // StringType
2249          return value;
2250        case -470746842: // additiveType
2251          this.additiveType = castToCodeableConcept(value); // CodeableConcept
2252          return value;
2253        case 488079534: // additiveProductName
2254          this.additiveProductName = castToString(value); // StringType
2255          return value;
2256        case 186983261: // caloricDensity
2257          this.caloricDensity = castToQuantity(value); // Quantity
2258          return value;
2259        case -1710107042: // routeofAdministration
2260          this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
2261          return value;
2262        case 1255702622: // administration
2263          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value); // NutritionOrderEnteralFormulaAdministrationComponent
2264          return value;
2265        case 2017924652: // maxVolumeToDeliver
2266          this.maxVolumeToDeliver = castToQuantity(value); // Quantity
2267          return value;
2268        case 427085136: // administrationInstruction
2269          this.administrationInstruction = castToString(value); // StringType
2270          return value;
2271        default: return super.setProperty(hash, name, value);
2272        }
2273
2274      }
2275
2276      @Override
2277      public Base setProperty(String name, Base value) throws FHIRException {
2278        if (name.equals("baseFormulaType")) {
2279          this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
2280        } else if (name.equals("baseFormulaProductName")) {
2281          this.baseFormulaProductName = castToString(value); // StringType
2282        } else if (name.equals("additiveType")) {
2283          this.additiveType = castToCodeableConcept(value); // CodeableConcept
2284        } else if (name.equals("additiveProductName")) {
2285          this.additiveProductName = castToString(value); // StringType
2286        } else if (name.equals("caloricDensity")) {
2287          this.caloricDensity = castToQuantity(value); // Quantity
2288        } else if (name.equals("routeofAdministration")) {
2289          this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
2290        } else if (name.equals("administration")) {
2291          this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value);
2292        } else if (name.equals("maxVolumeToDeliver")) {
2293          this.maxVolumeToDeliver = castToQuantity(value); // Quantity
2294        } else if (name.equals("administrationInstruction")) {
2295          this.administrationInstruction = castToString(value); // StringType
2296        } else
2297          return super.setProperty(name, value);
2298        return value;
2299      }
2300
2301      @Override
2302      public Base makeProperty(int hash, String name) throws FHIRException {
2303        switch (hash) {
2304        case -138930641:  return getBaseFormulaType(); 
2305        case -1267705979:  return getBaseFormulaProductNameElement();
2306        case -470746842:  return getAdditiveType(); 
2307        case 488079534:  return getAdditiveProductNameElement();
2308        case 186983261:  return getCaloricDensity(); 
2309        case -1710107042:  return getRouteofAdministration(); 
2310        case 1255702622:  return addAdministration(); 
2311        case 2017924652:  return getMaxVolumeToDeliver(); 
2312        case 427085136:  return getAdministrationInstructionElement();
2313        default: return super.makeProperty(hash, name);
2314        }
2315
2316      }
2317
2318      @Override
2319      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2320        switch (hash) {
2321        case -138930641: /*baseFormulaType*/ return new String[] {"CodeableConcept"};
2322        case -1267705979: /*baseFormulaProductName*/ return new String[] {"string"};
2323        case -470746842: /*additiveType*/ return new String[] {"CodeableConcept"};
2324        case 488079534: /*additiveProductName*/ return new String[] {"string"};
2325        case 186983261: /*caloricDensity*/ return new String[] {"SimpleQuantity"};
2326        case -1710107042: /*routeofAdministration*/ return new String[] {"CodeableConcept"};
2327        case 1255702622: /*administration*/ return new String[] {};
2328        case 2017924652: /*maxVolumeToDeliver*/ return new String[] {"SimpleQuantity"};
2329        case 427085136: /*administrationInstruction*/ return new String[] {"string"};
2330        default: return super.getTypesForProperty(hash, name);
2331        }
2332
2333      }
2334
2335      @Override
2336      public Base addChild(String name) throws FHIRException {
2337        if (name.equals("baseFormulaType")) {
2338          this.baseFormulaType = new CodeableConcept();
2339          return this.baseFormulaType;
2340        }
2341        else if (name.equals("baseFormulaProductName")) {
2342          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.baseFormulaProductName");
2343        }
2344        else if (name.equals("additiveType")) {
2345          this.additiveType = new CodeableConcept();
2346          return this.additiveType;
2347        }
2348        else if (name.equals("additiveProductName")) {
2349          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.additiveProductName");
2350        }
2351        else if (name.equals("caloricDensity")) {
2352          this.caloricDensity = new Quantity();
2353          return this.caloricDensity;
2354        }
2355        else if (name.equals("routeofAdministration")) {
2356          this.routeofAdministration = new CodeableConcept();
2357          return this.routeofAdministration;
2358        }
2359        else if (name.equals("administration")) {
2360          return addAdministration();
2361        }
2362        else if (name.equals("maxVolumeToDeliver")) {
2363          this.maxVolumeToDeliver = new Quantity();
2364          return this.maxVolumeToDeliver;
2365        }
2366        else if (name.equals("administrationInstruction")) {
2367          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.administrationInstruction");
2368        }
2369        else
2370          return super.addChild(name);
2371      }
2372
2373      public NutritionOrderEnteralFormulaComponent copy() {
2374        NutritionOrderEnteralFormulaComponent dst = new NutritionOrderEnteralFormulaComponent();
2375        copyValues(dst);
2376        dst.baseFormulaType = baseFormulaType == null ? null : baseFormulaType.copy();
2377        dst.baseFormulaProductName = baseFormulaProductName == null ? null : baseFormulaProductName.copy();
2378        dst.additiveType = additiveType == null ? null : additiveType.copy();
2379        dst.additiveProductName = additiveProductName == null ? null : additiveProductName.copy();
2380        dst.caloricDensity = caloricDensity == null ? null : caloricDensity.copy();
2381        dst.routeofAdministration = routeofAdministration == null ? null : routeofAdministration.copy();
2382        if (administration != null) {
2383          dst.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2384          for (NutritionOrderEnteralFormulaAdministrationComponent i : administration)
2385            dst.administration.add(i.copy());
2386        };
2387        dst.maxVolumeToDeliver = maxVolumeToDeliver == null ? null : maxVolumeToDeliver.copy();
2388        dst.administrationInstruction = administrationInstruction == null ? null : administrationInstruction.copy();
2389        return dst;
2390      }
2391
2392      @Override
2393      public boolean equalsDeep(Base other_) {
2394        if (!super.equalsDeep(other_))
2395          return false;
2396        if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2397          return false;
2398        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2399        return compareDeep(baseFormulaType, o.baseFormulaType, true) && compareDeep(baseFormulaProductName, o.baseFormulaProductName, true)
2400           && compareDeep(additiveType, o.additiveType, true) && compareDeep(additiveProductName, o.additiveProductName, true)
2401           && compareDeep(caloricDensity, o.caloricDensity, true) && compareDeep(routeofAdministration, o.routeofAdministration, true)
2402           && compareDeep(administration, o.administration, true) && compareDeep(maxVolumeToDeliver, o.maxVolumeToDeliver, true)
2403           && compareDeep(administrationInstruction, o.administrationInstruction, true);
2404      }
2405
2406      @Override
2407      public boolean equalsShallow(Base other_) {
2408        if (!super.equalsShallow(other_))
2409          return false;
2410        if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2411          return false;
2412        NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2413        return compareValues(baseFormulaProductName, o.baseFormulaProductName, true) && compareValues(additiveProductName, o.additiveProductName, true)
2414           && compareValues(administrationInstruction, o.administrationInstruction, true);
2415      }
2416
2417      public boolean isEmpty() {
2418        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(baseFormulaType, baseFormulaProductName
2419          , additiveType, additiveProductName, caloricDensity, routeofAdministration, administration
2420          , maxVolumeToDeliver, administrationInstruction);
2421      }
2422
2423  public String fhirType() {
2424    return "NutritionOrder.enteralFormula";
2425
2426  }
2427
2428  }
2429
2430    @Block()
2431    public static class NutritionOrderEnteralFormulaAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
2432        /**
2433         * The time period and frequency at which the enteral formula should be delivered to the patient.
2434         */
2435        @Child(name = "schedule", type = {Timing.class}, order=1, min=0, max=1, modifier=false, summary=false)
2436        @Description(shortDefinition="Scheduled frequency of enteral feeding", formalDefinition="The time period and frequency at which the enteral formula should be delivered to the patient." )
2437        protected Timing schedule;
2438
2439        /**
2440         * The volume of formula to provide to the patient per the specified administration schedule.
2441         */
2442        @Child(name = "quantity", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=false)
2443        @Description(shortDefinition="The volume of formula to provide", formalDefinition="The volume of formula to provide to the patient per the specified administration schedule." )
2444        protected Quantity quantity;
2445
2446        /**
2447         * The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.
2448         */
2449        @Child(name = "rate", type = {Quantity.class, Ratio.class}, order=3, min=0, max=1, modifier=false, summary=false)
2450        @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." )
2451        protected Type rate;
2452
2453        private static final long serialVersionUID = 673093291L;
2454
2455    /**
2456     * Constructor
2457     */
2458      public NutritionOrderEnteralFormulaAdministrationComponent() {
2459        super();
2460      }
2461
2462        /**
2463         * @return {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2464         */
2465        public Timing getSchedule() { 
2466          if (this.schedule == null)
2467            if (Configuration.errorOnAutoCreate())
2468              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.schedule");
2469            else if (Configuration.doAutoCreate())
2470              this.schedule = new Timing(); // cc
2471          return this.schedule;
2472        }
2473
2474        public boolean hasSchedule() { 
2475          return this.schedule != null && !this.schedule.isEmpty();
2476        }
2477
2478        /**
2479         * @param value {@link #schedule} (The time period and frequency at which the enteral formula should be delivered to the patient.)
2480         */
2481        public NutritionOrderEnteralFormulaAdministrationComponent setSchedule(Timing value) { 
2482          this.schedule = value;
2483          return this;
2484        }
2485
2486        /**
2487         * @return {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2488         */
2489        public Quantity getQuantity() { 
2490          if (this.quantity == null)
2491            if (Configuration.errorOnAutoCreate())
2492              throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.quantity");
2493            else if (Configuration.doAutoCreate())
2494              this.quantity = new Quantity(); // cc
2495          return this.quantity;
2496        }
2497
2498        public boolean hasQuantity() { 
2499          return this.quantity != null && !this.quantity.isEmpty();
2500        }
2501
2502        /**
2503         * @param value {@link #quantity} (The volume of formula to provide to the patient per the specified administration schedule.)
2504         */
2505        public NutritionOrderEnteralFormulaAdministrationComponent setQuantity(Quantity value) { 
2506          this.quantity = value;
2507          return this;
2508        }
2509
2510        /**
2511         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2512         */
2513        public Type getRate() { 
2514          return this.rate;
2515        }
2516
2517        /**
2518         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2519         */
2520        public Quantity getRateQuantity() throws FHIRException { 
2521          if (this.rate == null)
2522            return null;
2523          if (!(this.rate instanceof Quantity))
2524            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.rate.getClass().getName()+" was encountered");
2525          return (Quantity) this.rate;
2526        }
2527
2528        public boolean hasRateQuantity() { 
2529          return this != null && this.rate instanceof Quantity;
2530        }
2531
2532        /**
2533         * @return {@link #rate} (The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.)
2534         */
2535        public Ratio getRateRatio() throws FHIRException { 
2536          if (this.rate == null)
2537            return null;
2538          if (!(this.rate instanceof Ratio))
2539            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.rate.getClass().getName()+" was encountered");
2540          return (Ratio) this.rate;
2541        }
2542
2543        public boolean hasRateRatio() { 
2544          return this != null && this.rate instanceof Ratio;
2545        }
2546
2547        public boolean hasRate() { 
2548          return this.rate != null && !this.rate.isEmpty();
2549        }
2550
2551        /**
2552         * @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.)
2553         */
2554        public NutritionOrderEnteralFormulaAdministrationComponent setRate(Type value) { 
2555          if (value != null && !(value instanceof Quantity || value instanceof Ratio))
2556            throw new Error("Not the right type for NutritionOrder.enteralFormula.administration.rate[x]: "+value.fhirType());
2557          this.rate = value;
2558          return this;
2559        }
2560
2561        protected void listChildren(List<Property> children) {
2562          super.listChildren(children);
2563          children.add(new Property("schedule", "Timing", "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, 1, schedule));
2564          children.add(new Property("quantity", "SimpleQuantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1, quantity));
2565          children.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, 1, rate));
2566        }
2567
2568        @Override
2569        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2570          switch (_hash) {
2571          case -697920873: /*schedule*/  return new Property("schedule", "Timing", "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, 1, schedule);
2572          case -1285004149: /*quantity*/  return new Property("quantity", "SimpleQuantity", "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1, quantity);
2573          case 983460768: /*rate[x]*/  return 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, 1, rate);
2574          case 3493088: /*rate*/  return 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, 1, rate);
2575          case -1085459061: /*rateQuantity*/  return 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, 1, rate);
2576          case 204021515: /*rateRatio*/  return 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, 1, rate);
2577          default: return super.getNamedProperty(_hash, _name, _checkValid);
2578          }
2579
2580        }
2581
2582      @Override
2583      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2584        switch (hash) {
2585        case -697920873: /*schedule*/ return this.schedule == null ? new Base[0] : new Base[] {this.schedule}; // Timing
2586        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
2587        case 3493088: /*rate*/ return this.rate == null ? new Base[0] : new Base[] {this.rate}; // Type
2588        default: return super.getProperty(hash, name, checkValid);
2589        }
2590
2591      }
2592
2593      @Override
2594      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2595        switch (hash) {
2596        case -697920873: // schedule
2597          this.schedule = castToTiming(value); // Timing
2598          return value;
2599        case -1285004149: // quantity
2600          this.quantity = castToQuantity(value); // Quantity
2601          return value;
2602        case 3493088: // rate
2603          this.rate = castToType(value); // Type
2604          return value;
2605        default: return super.setProperty(hash, name, value);
2606        }
2607
2608      }
2609
2610      @Override
2611      public Base setProperty(String name, Base value) throws FHIRException {
2612        if (name.equals("schedule")) {
2613          this.schedule = castToTiming(value); // Timing
2614        } else if (name.equals("quantity")) {
2615          this.quantity = castToQuantity(value); // Quantity
2616        } else if (name.equals("rate[x]")) {
2617          this.rate = castToType(value); // Type
2618        } else
2619          return super.setProperty(name, value);
2620        return value;
2621      }
2622
2623      @Override
2624      public Base makeProperty(int hash, String name) throws FHIRException {
2625        switch (hash) {
2626        case -697920873:  return getSchedule(); 
2627        case -1285004149:  return getQuantity(); 
2628        case 983460768:  return getRate(); 
2629        case 3493088:  return getRate(); 
2630        default: return super.makeProperty(hash, name);
2631        }
2632
2633      }
2634
2635      @Override
2636      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2637        switch (hash) {
2638        case -697920873: /*schedule*/ return new String[] {"Timing"};
2639        case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"};
2640        case 3493088: /*rate*/ return new String[] {"SimpleQuantity", "Ratio"};
2641        default: return super.getTypesForProperty(hash, name);
2642        }
2643
2644      }
2645
2646      @Override
2647      public Base addChild(String name) throws FHIRException {
2648        if (name.equals("schedule")) {
2649          this.schedule = new Timing();
2650          return this.schedule;
2651        }
2652        else if (name.equals("quantity")) {
2653          this.quantity = new Quantity();
2654          return this.quantity;
2655        }
2656        else if (name.equals("rateQuantity")) {
2657          this.rate = new Quantity();
2658          return this.rate;
2659        }
2660        else if (name.equals("rateRatio")) {
2661          this.rate = new Ratio();
2662          return this.rate;
2663        }
2664        else
2665          return super.addChild(name);
2666      }
2667
2668      public NutritionOrderEnteralFormulaAdministrationComponent copy() {
2669        NutritionOrderEnteralFormulaAdministrationComponent dst = new NutritionOrderEnteralFormulaAdministrationComponent();
2670        copyValues(dst);
2671        dst.schedule = schedule == null ? null : schedule.copy();
2672        dst.quantity = quantity == null ? null : quantity.copy();
2673        dst.rate = rate == null ? null : rate.copy();
2674        return dst;
2675      }
2676
2677      @Override
2678      public boolean equalsDeep(Base other_) {
2679        if (!super.equalsDeep(other_))
2680          return false;
2681        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2682          return false;
2683        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
2684        return compareDeep(schedule, o.schedule, true) && compareDeep(quantity, o.quantity, true) && compareDeep(rate, o.rate, true)
2685          ;
2686      }
2687
2688      @Override
2689      public boolean equalsShallow(Base other_) {
2690        if (!super.equalsShallow(other_))
2691          return false;
2692        if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
2693          return false;
2694        NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
2695        return true;
2696      }
2697
2698      public boolean isEmpty() {
2699        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(schedule, quantity, rate
2700          );
2701      }
2702
2703  public String fhirType() {
2704    return "NutritionOrder.enteralFormula.administration";
2705
2706  }
2707
2708  }
2709
2710    /**
2711     * Identifiers assigned to this order by the order sender or by the order receiver.
2712     */
2713    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2714    @Description(shortDefinition="Identifiers assigned to this order", formalDefinition="Identifiers assigned to this order by the order sender or by the order receiver." )
2715    protected List<Identifier> identifier;
2716
2717    /**
2718     * The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2719     */
2720    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2721    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2722    protected List<CanonicalType> instantiatesCanonical;
2723
2724    /**
2725     * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2726     */
2727    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2728    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2729    protected List<UriType> instantiatesUri;
2730
2731    /**
2732     * The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.
2733     */
2734    @Child(name = "instantiates", type = {UriType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2735    @Description(shortDefinition="Instantiates protocol or definition", formalDefinition="The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder." )
2736    protected List<UriType> instantiates;
2737
2738    /**
2739     * The workflow status of the nutrition order/request.
2740     */
2741    @Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1, modifier=true, summary=true)
2742    @Description(shortDefinition="proposed | draft | planned | requested | active | on-hold | completed | cancelled | entered-in-error", formalDefinition="The workflow status of the nutrition order/request." )
2743    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
2744    protected Enumeration<NutritionOrderStatus> status;
2745
2746    /**
2747     * Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
2748     */
2749    @Child(name = "intent", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
2750    @Description(shortDefinition="proposal | plan | order", formalDefinition="Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain." )
2751    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-intent")
2752    protected Enumeration<NutritiionOrderIntent> intent;
2753
2754    /**
2755     * The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.
2756     */
2757    @Child(name = "patient", type = {Patient.class}, order=6, min=1, max=1, modifier=false, summary=true)
2758    @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." )
2759    protected Reference patient;
2760
2761    /**
2762     * 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.)
2763     */
2764    protected Patient patientTarget;
2765
2766    /**
2767     * An encounter that provides additional information about the healthcare context in which this request is made.
2768     */
2769    @Child(name = "context", type = {Encounter.class, EpisodeOfCare.class}, order=7, min=0, max=1, modifier=false, summary=false)
2770    @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." )
2771    protected Reference context;
2772
2773    /**
2774     * 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.)
2775     */
2776    protected Resource contextTarget;
2777
2778    /**
2779     * The date and time that this nutrition order was requested.
2780     */
2781    @Child(name = "dateTime", type = {DateTimeType.class}, order=8, min=1, max=1, modifier=false, summary=true)
2782    @Description(shortDefinition="Date and time the nutrition order was requested", formalDefinition="The date and time that this nutrition order was requested." )
2783    protected DateTimeType dateTime;
2784
2785    /**
2786     * The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.
2787     */
2788    @Child(name = "orderer", type = {Practitioner.class, PractitionerRole.class}, order=9, min=0, max=1, modifier=false, summary=true)
2789    @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." )
2790    protected Reference orderer;
2791
2792    /**
2793     * 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.)
2794     */
2795    protected Resource ordererTarget;
2796
2797    /**
2798     * A link to a record of allergies or intolerances  which should be included in the nutrition order.
2799     */
2800    @Child(name = "allergyIntolerance", type = {AllergyIntolerance.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2801    @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." )
2802    protected List<Reference> allergyIntolerance;
2803    /**
2804     * 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.)
2805     */
2806    protected List<AllergyIntolerance> allergyIntoleranceTarget;
2807
2808
2809    /**
2810     * 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.
2811     */
2812    @Child(name = "foodPreferenceModifier", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2813    @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." )
2814    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/encounter-diet")
2815    protected List<CodeableConcept> foodPreferenceModifier;
2816
2817    /**
2818     * This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.
2819     */
2820    @Child(name = "excludeFoodModifier", type = {CodeableConcept.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2821    @Description(shortDefinition="Order-specific modifier about the type of food that should not be given", formalDefinition="This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings." )
2822    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/food-type")
2823    protected List<CodeableConcept> excludeFoodModifier;
2824
2825    /**
2826     * Diet given orally in contrast to enteral (tube) feeding.
2827     */
2828    @Child(name = "oralDiet", type = {}, order=13, min=0, max=1, modifier=false, summary=false)
2829    @Description(shortDefinition="Oral diet components", formalDefinition="Diet given orally in contrast to enteral (tube) feeding." )
2830    protected NutritionOrderOralDietComponent oralDiet;
2831
2832    /**
2833     * Oral nutritional products given in order to add further nutritional value to the patient's diet.
2834     */
2835    @Child(name = "supplement", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2836    @Description(shortDefinition="Supplement components", formalDefinition="Oral nutritional products given in order to add further nutritional value to the patient's diet." )
2837    protected List<NutritionOrderSupplementComponent> supplement;
2838
2839    /**
2840     * Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.
2841     */
2842    @Child(name = "enteralFormula", type = {}, order=15, min=0, max=1, modifier=false, summary=false)
2843    @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." )
2844    protected NutritionOrderEnteralFormulaComponent enteralFormula;
2845
2846    /**
2847     * Comments made about the {{title}} by the requester, performer, subject or other participants.
2848     */
2849    @Child(name = "note", type = {Annotation.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2850    @Description(shortDefinition="Comments", formalDefinition="Comments made about the {{title}} by the requester, performer, subject or other participants." )
2851    protected List<Annotation> note;
2852
2853    private static final long serialVersionUID = 2084704926L;
2854
2855  /**
2856   * Constructor
2857   */
2858    public NutritionOrder() {
2859      super();
2860    }
2861
2862  /**
2863   * Constructor
2864   */
2865    public NutritionOrder(Enumeration<NutritionOrderStatus> status, Enumeration<NutritiionOrderIntent> intent, Reference patient, DateTimeType dateTime) {
2866      super();
2867      this.status = status;
2868      this.intent = intent;
2869      this.patient = patient;
2870      this.dateTime = dateTime;
2871    }
2872
2873    /**
2874     * @return {@link #identifier} (Identifiers assigned to this order by the order sender or by the order receiver.)
2875     */
2876    public List<Identifier> getIdentifier() { 
2877      if (this.identifier == null)
2878        this.identifier = new ArrayList<Identifier>();
2879      return this.identifier;
2880    }
2881
2882    /**
2883     * @return Returns a reference to <code>this</code> for easy method chaining
2884     */
2885    public NutritionOrder setIdentifier(List<Identifier> theIdentifier) { 
2886      this.identifier = theIdentifier;
2887      return this;
2888    }
2889
2890    public boolean hasIdentifier() { 
2891      if (this.identifier == null)
2892        return false;
2893      for (Identifier item : this.identifier)
2894        if (!item.isEmpty())
2895          return true;
2896      return false;
2897    }
2898
2899    public Identifier addIdentifier() { //3
2900      Identifier t = new Identifier();
2901      if (this.identifier == null)
2902        this.identifier = new ArrayList<Identifier>();
2903      this.identifier.add(t);
2904      return t;
2905    }
2906
2907    public NutritionOrder addIdentifier(Identifier t) { //3
2908      if (t == null)
2909        return this;
2910      if (this.identifier == null)
2911        this.identifier = new ArrayList<Identifier>();
2912      this.identifier.add(t);
2913      return this;
2914    }
2915
2916    /**
2917     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
2918     */
2919    public Identifier getIdentifierFirstRep() { 
2920      if (getIdentifier().isEmpty()) {
2921        addIdentifier();
2922      }
2923      return getIdentifier().get(0);
2924    }
2925
2926    /**
2927     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2928     */
2929    public List<CanonicalType> getInstantiatesCanonical() { 
2930      if (this.instantiatesCanonical == null)
2931        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2932      return this.instantiatesCanonical;
2933    }
2934
2935    /**
2936     * @return Returns a reference to <code>this</code> for easy method chaining
2937     */
2938    public NutritionOrder setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
2939      this.instantiatesCanonical = theInstantiatesCanonical;
2940      return this;
2941    }
2942
2943    public boolean hasInstantiatesCanonical() { 
2944      if (this.instantiatesCanonical == null)
2945        return false;
2946      for (CanonicalType item : this.instantiatesCanonical)
2947        if (!item.isEmpty())
2948          return true;
2949      return false;
2950    }
2951
2952    /**
2953     * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2954     */
2955    public CanonicalType addInstantiatesCanonicalElement() {//2 
2956      CanonicalType t = new CanonicalType();
2957      if (this.instantiatesCanonical == null)
2958        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2959      this.instantiatesCanonical.add(t);
2960      return t;
2961    }
2962
2963    /**
2964     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2965     */
2966    public NutritionOrder addInstantiatesCanonical(String value) { //1
2967      CanonicalType t = new CanonicalType();
2968      t.setValue(value);
2969      if (this.instantiatesCanonical == null)
2970        this.instantiatesCanonical = new ArrayList<CanonicalType>();
2971      this.instantiatesCanonical.add(t);
2972      return this;
2973    }
2974
2975    /**
2976     * @param value {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2977     */
2978    public boolean hasInstantiatesCanonical(String value) { 
2979      if (this.instantiatesCanonical == null)
2980        return false;
2981      for (CanonicalType v : this.instantiatesCanonical)
2982        if (v.getValue().equals(value)) // canonical(ActivityDefinition|PlanDefinition)
2983          return true;
2984      return false;
2985    }
2986
2987    /**
2988     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
2989     */
2990    public List<UriType> getInstantiatesUri() { 
2991      if (this.instantiatesUri == null)
2992        this.instantiatesUri = new ArrayList<UriType>();
2993      return this.instantiatesUri;
2994    }
2995
2996    /**
2997     * @return Returns a reference to <code>this</code> for easy method chaining
2998     */
2999    public NutritionOrder setInstantiatesUri(List<UriType> theInstantiatesUri) { 
3000      this.instantiatesUri = theInstantiatesUri;
3001      return this;
3002    }
3003
3004    public boolean hasInstantiatesUri() { 
3005      if (this.instantiatesUri == null)
3006        return false;
3007      for (UriType item : this.instantiatesUri)
3008        if (!item.isEmpty())
3009          return true;
3010      return false;
3011    }
3012
3013    /**
3014     * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3015     */
3016    public UriType addInstantiatesUriElement() {//2 
3017      UriType t = new UriType();
3018      if (this.instantiatesUri == null)
3019        this.instantiatesUri = new ArrayList<UriType>();
3020      this.instantiatesUri.add(t);
3021      return t;
3022    }
3023
3024    /**
3025     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3026     */
3027    public NutritionOrder addInstantiatesUri(String value) { //1
3028      UriType t = new UriType();
3029      t.setValue(value);
3030      if (this.instantiatesUri == null)
3031        this.instantiatesUri = new ArrayList<UriType>();
3032      this.instantiatesUri.add(t);
3033      return this;
3034    }
3035
3036    /**
3037     * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3038     */
3039    public boolean hasInstantiatesUri(String value) { 
3040      if (this.instantiatesUri == null)
3041        return false;
3042      for (UriType v : this.instantiatesUri)
3043        if (v.getValue().equals(value)) // uri
3044          return true;
3045      return false;
3046    }
3047
3048    /**
3049     * @return {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3050     */
3051    public List<UriType> getInstantiates() { 
3052      if (this.instantiates == null)
3053        this.instantiates = new ArrayList<UriType>();
3054      return this.instantiates;
3055    }
3056
3057    /**
3058     * @return Returns a reference to <code>this</code> for easy method chaining
3059     */
3060    public NutritionOrder setInstantiates(List<UriType> theInstantiates) { 
3061      this.instantiates = theInstantiates;
3062      return this;
3063    }
3064
3065    public boolean hasInstantiates() { 
3066      if (this.instantiates == null)
3067        return false;
3068      for (UriType item : this.instantiates)
3069        if (!item.isEmpty())
3070          return true;
3071      return false;
3072    }
3073
3074    /**
3075     * @return {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3076     */
3077    public UriType addInstantiatesElement() {//2 
3078      UriType t = new UriType();
3079      if (this.instantiates == null)
3080        this.instantiates = new ArrayList<UriType>();
3081      this.instantiates.add(t);
3082      return t;
3083    }
3084
3085    /**
3086     * @param value {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3087     */
3088    public NutritionOrder addInstantiates(String value) { //1
3089      UriType t = new UriType();
3090      t.setValue(value);
3091      if (this.instantiates == null)
3092        this.instantiates = new ArrayList<UriType>();
3093      this.instantiates.add(t);
3094      return this;
3095    }
3096
3097    /**
3098     * @param value {@link #instantiates} (The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.)
3099     */
3100    public boolean hasInstantiates(String value) { 
3101      if (this.instantiates == null)
3102        return false;
3103      for (UriType v : this.instantiates)
3104        if (v.getValue().equals(value)) // uri
3105          return true;
3106      return false;
3107    }
3108
3109    /**
3110     * @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
3111     */
3112    public Enumeration<NutritionOrderStatus> getStatusElement() { 
3113      if (this.status == null)
3114        if (Configuration.errorOnAutoCreate())
3115          throw new Error("Attempt to auto-create NutritionOrder.status");
3116        else if (Configuration.doAutoCreate())
3117          this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory()); // bb
3118      return this.status;
3119    }
3120
3121    public boolean hasStatusElement() { 
3122      return this.status != null && !this.status.isEmpty();
3123    }
3124
3125    public boolean hasStatus() { 
3126      return this.status != null && !this.status.isEmpty();
3127    }
3128
3129    /**
3130     * @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
3131     */
3132    public NutritionOrder setStatusElement(Enumeration<NutritionOrderStatus> value) { 
3133      this.status = value;
3134      return this;
3135    }
3136
3137    /**
3138     * @return The workflow status of the nutrition order/request.
3139     */
3140    public NutritionOrderStatus getStatus() { 
3141      return this.status == null ? null : this.status.getValue();
3142    }
3143
3144    /**
3145     * @param value The workflow status of the nutrition order/request.
3146     */
3147    public NutritionOrder setStatus(NutritionOrderStatus value) { 
3148        if (this.status == null)
3149          this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory());
3150        this.status.setValue(value);
3151      return this;
3152    }
3153
3154    /**
3155     * @return {@link #intent} (Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
3156     */
3157    public Enumeration<NutritiionOrderIntent> getIntentElement() { 
3158      if (this.intent == null)
3159        if (Configuration.errorOnAutoCreate())
3160          throw new Error("Attempt to auto-create NutritionOrder.intent");
3161        else if (Configuration.doAutoCreate())
3162          this.intent = new Enumeration<NutritiionOrderIntent>(new NutritiionOrderIntentEnumFactory()); // bb
3163      return this.intent;
3164    }
3165
3166    public boolean hasIntentElement() { 
3167      return this.intent != null && !this.intent.isEmpty();
3168    }
3169
3170    public boolean hasIntent() { 
3171      return this.intent != null && !this.intent.isEmpty();
3172    }
3173
3174    /**
3175     * @param value {@link #intent} (Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value
3176     */
3177    public NutritionOrder setIntentElement(Enumeration<NutritiionOrderIntent> value) { 
3178      this.intent = value;
3179      return this;
3180    }
3181
3182    /**
3183     * @return Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
3184     */
3185    public NutritiionOrderIntent getIntent() { 
3186      return this.intent == null ? null : this.intent.getValue();
3187    }
3188
3189    /**
3190     * @param value Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.
3191     */
3192    public NutritionOrder setIntent(NutritiionOrderIntent value) { 
3193        if (this.intent == null)
3194          this.intent = new Enumeration<NutritiionOrderIntent>(new NutritiionOrderIntentEnumFactory());
3195        this.intent.setValue(value);
3196      return this;
3197    }
3198
3199    /**
3200     * @return {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
3201     */
3202    public Reference getPatient() { 
3203      if (this.patient == null)
3204        if (Configuration.errorOnAutoCreate())
3205          throw new Error("Attempt to auto-create NutritionOrder.patient");
3206        else if (Configuration.doAutoCreate())
3207          this.patient = new Reference(); // cc
3208      return this.patient;
3209    }
3210
3211    public boolean hasPatient() { 
3212      return this.patient != null && !this.patient.isEmpty();
3213    }
3214
3215    /**
3216     * @param value {@link #patient} (The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.)
3217     */
3218    public NutritionOrder setPatient(Reference value) { 
3219      this.patient = value;
3220      return this;
3221    }
3222
3223    /**
3224     * @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.)
3225     */
3226    public Patient getPatientTarget() { 
3227      if (this.patientTarget == null)
3228        if (Configuration.errorOnAutoCreate())
3229          throw new Error("Attempt to auto-create NutritionOrder.patient");
3230        else if (Configuration.doAutoCreate())
3231          this.patientTarget = new Patient(); // aa
3232      return this.patientTarget;
3233    }
3234
3235    /**
3236     * @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.)
3237     */
3238    public NutritionOrder setPatientTarget(Patient value) { 
3239      this.patientTarget = value;
3240      return this;
3241    }
3242
3243    /**
3244     * @return {@link #context} (An encounter that provides additional information about the healthcare context in which this request is made.)
3245     */
3246    public Reference getContext() { 
3247      if (this.context == null)
3248        if (Configuration.errorOnAutoCreate())
3249          throw new Error("Attempt to auto-create NutritionOrder.context");
3250        else if (Configuration.doAutoCreate())
3251          this.context = new Reference(); // cc
3252      return this.context;
3253    }
3254
3255    public boolean hasContext() { 
3256      return this.context != null && !this.context.isEmpty();
3257    }
3258
3259    /**
3260     * @param value {@link #context} (An encounter that provides additional information about the healthcare context in which this request is made.)
3261     */
3262    public NutritionOrder setContext(Reference value) { 
3263      this.context = value;
3264      return this;
3265    }
3266
3267    /**
3268     * @return {@link #context} 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.)
3269     */
3270    public Resource getContextTarget() { 
3271      return this.contextTarget;
3272    }
3273
3274    /**
3275     * @param value {@link #context} 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.)
3276     */
3277    public NutritionOrder setContextTarget(Resource value) { 
3278      this.contextTarget = value;
3279      return this;
3280    }
3281
3282    /**
3283     * @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
3284     */
3285    public DateTimeType getDateTimeElement() { 
3286      if (this.dateTime == null)
3287        if (Configuration.errorOnAutoCreate())
3288          throw new Error("Attempt to auto-create NutritionOrder.dateTime");
3289        else if (Configuration.doAutoCreate())
3290          this.dateTime = new DateTimeType(); // bb
3291      return this.dateTime;
3292    }
3293
3294    public boolean hasDateTimeElement() { 
3295      return this.dateTime != null && !this.dateTime.isEmpty();
3296    }
3297
3298    public boolean hasDateTime() { 
3299      return this.dateTime != null && !this.dateTime.isEmpty();
3300    }
3301
3302    /**
3303     * @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
3304     */
3305    public NutritionOrder setDateTimeElement(DateTimeType value) { 
3306      this.dateTime = value;
3307      return this;
3308    }
3309
3310    /**
3311     * @return The date and time that this nutrition order was requested.
3312     */
3313    public Date getDateTime() { 
3314      return this.dateTime == null ? null : this.dateTime.getValue();
3315    }
3316
3317    /**
3318     * @param value The date and time that this nutrition order was requested.
3319     */
3320    public NutritionOrder setDateTime(Date value) { 
3321        if (this.dateTime == null)
3322          this.dateTime = new DateTimeType();
3323        this.dateTime.setValue(value);
3324      return this;
3325    }
3326
3327    /**
3328     * @return {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
3329     */
3330    public Reference getOrderer() { 
3331      if (this.orderer == null)
3332        if (Configuration.errorOnAutoCreate())
3333          throw new Error("Attempt to auto-create NutritionOrder.orderer");
3334        else if (Configuration.doAutoCreate())
3335          this.orderer = new Reference(); // cc
3336      return this.orderer;
3337    }
3338
3339    public boolean hasOrderer() { 
3340      return this.orderer != null && !this.orderer.isEmpty();
3341    }
3342
3343    /**
3344     * @param value {@link #orderer} (The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.)
3345     */
3346    public NutritionOrder setOrderer(Reference value) { 
3347      this.orderer = value;
3348      return this;
3349    }
3350
3351    /**
3352     * @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.)
3353     */
3354    public Resource getOrdererTarget() { 
3355      return this.ordererTarget;
3356    }
3357
3358    /**
3359     * @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.)
3360     */
3361    public NutritionOrder setOrdererTarget(Resource value) { 
3362      this.ordererTarget = value;
3363      return this;
3364    }
3365
3366    /**
3367     * @return {@link #allergyIntolerance} (A link to a record of allergies or intolerances  which should be included in the nutrition order.)
3368     */
3369    public List<Reference> getAllergyIntolerance() { 
3370      if (this.allergyIntolerance == null)
3371        this.allergyIntolerance = new ArrayList<Reference>();
3372      return this.allergyIntolerance;
3373    }
3374
3375    /**
3376     * @return Returns a reference to <code>this</code> for easy method chaining
3377     */
3378    public NutritionOrder setAllergyIntolerance(List<Reference> theAllergyIntolerance) { 
3379      this.allergyIntolerance = theAllergyIntolerance;
3380      return this;
3381    }
3382
3383    public boolean hasAllergyIntolerance() { 
3384      if (this.allergyIntolerance == null)
3385        return false;
3386      for (Reference item : this.allergyIntolerance)
3387        if (!item.isEmpty())
3388          return true;
3389      return false;
3390    }
3391
3392    public Reference addAllergyIntolerance() { //3
3393      Reference t = new Reference();
3394      if (this.allergyIntolerance == null)
3395        this.allergyIntolerance = new ArrayList<Reference>();
3396      this.allergyIntolerance.add(t);
3397      return t;
3398    }
3399
3400    public NutritionOrder addAllergyIntolerance(Reference t) { //3
3401      if (t == null)
3402        return this;
3403      if (this.allergyIntolerance == null)
3404        this.allergyIntolerance = new ArrayList<Reference>();
3405      this.allergyIntolerance.add(t);
3406      return this;
3407    }
3408
3409    /**
3410     * @return The first repetition of repeating field {@link #allergyIntolerance}, creating it if it does not already exist
3411     */
3412    public Reference getAllergyIntoleranceFirstRep() { 
3413      if (getAllergyIntolerance().isEmpty()) {
3414        addAllergyIntolerance();
3415      }
3416      return getAllergyIntolerance().get(0);
3417    }
3418
3419    /**
3420     * @deprecated Use Reference#setResource(IBaseResource) instead
3421     */
3422    @Deprecated
3423    public List<AllergyIntolerance> getAllergyIntoleranceTarget() { 
3424      if (this.allergyIntoleranceTarget == null)
3425        this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
3426      return this.allergyIntoleranceTarget;
3427    }
3428
3429    /**
3430     * @deprecated Use Reference#setResource(IBaseResource) instead
3431     */
3432    @Deprecated
3433    public AllergyIntolerance addAllergyIntoleranceTarget() { 
3434      AllergyIntolerance r = new AllergyIntolerance();
3435      if (this.allergyIntoleranceTarget == null)
3436        this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
3437      this.allergyIntoleranceTarget.add(r);
3438      return r;
3439    }
3440
3441    /**
3442     * @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.)
3443     */
3444    public List<CodeableConcept> getFoodPreferenceModifier() { 
3445      if (this.foodPreferenceModifier == null)
3446        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3447      return this.foodPreferenceModifier;
3448    }
3449
3450    /**
3451     * @return Returns a reference to <code>this</code> for easy method chaining
3452     */
3453    public NutritionOrder setFoodPreferenceModifier(List<CodeableConcept> theFoodPreferenceModifier) { 
3454      this.foodPreferenceModifier = theFoodPreferenceModifier;
3455      return this;
3456    }
3457
3458    public boolean hasFoodPreferenceModifier() { 
3459      if (this.foodPreferenceModifier == null)
3460        return false;
3461      for (CodeableConcept item : this.foodPreferenceModifier)
3462        if (!item.isEmpty())
3463          return true;
3464      return false;
3465    }
3466
3467    public CodeableConcept addFoodPreferenceModifier() { //3
3468      CodeableConcept t = new CodeableConcept();
3469      if (this.foodPreferenceModifier == null)
3470        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3471      this.foodPreferenceModifier.add(t);
3472      return t;
3473    }
3474
3475    public NutritionOrder addFoodPreferenceModifier(CodeableConcept t) { //3
3476      if (t == null)
3477        return this;
3478      if (this.foodPreferenceModifier == null)
3479        this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
3480      this.foodPreferenceModifier.add(t);
3481      return this;
3482    }
3483
3484    /**
3485     * @return The first repetition of repeating field {@link #foodPreferenceModifier}, creating it if it does not already exist
3486     */
3487    public CodeableConcept getFoodPreferenceModifierFirstRep() { 
3488      if (getFoodPreferenceModifier().isEmpty()) {
3489        addFoodPreferenceModifier();
3490      }
3491      return getFoodPreferenceModifier().get(0);
3492    }
3493
3494    /**
3495     * @return {@link #excludeFoodModifier} (This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.)
3496     */
3497    public List<CodeableConcept> getExcludeFoodModifier() { 
3498      if (this.excludeFoodModifier == null)
3499        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3500      return this.excludeFoodModifier;
3501    }
3502
3503    /**
3504     * @return Returns a reference to <code>this</code> for easy method chaining
3505     */
3506    public NutritionOrder setExcludeFoodModifier(List<CodeableConcept> theExcludeFoodModifier) { 
3507      this.excludeFoodModifier = theExcludeFoodModifier;
3508      return this;
3509    }
3510
3511    public boolean hasExcludeFoodModifier() { 
3512      if (this.excludeFoodModifier == null)
3513        return false;
3514      for (CodeableConcept item : this.excludeFoodModifier)
3515        if (!item.isEmpty())
3516          return true;
3517      return false;
3518    }
3519
3520    public CodeableConcept addExcludeFoodModifier() { //3
3521      CodeableConcept t = new CodeableConcept();
3522      if (this.excludeFoodModifier == null)
3523        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3524      this.excludeFoodModifier.add(t);
3525      return t;
3526    }
3527
3528    public NutritionOrder addExcludeFoodModifier(CodeableConcept t) { //3
3529      if (t == null)
3530        return this;
3531      if (this.excludeFoodModifier == null)
3532        this.excludeFoodModifier = new ArrayList<CodeableConcept>();
3533      this.excludeFoodModifier.add(t);
3534      return this;
3535    }
3536
3537    /**
3538     * @return The first repetition of repeating field {@link #excludeFoodModifier}, creating it if it does not already exist
3539     */
3540    public CodeableConcept getExcludeFoodModifierFirstRep() { 
3541      if (getExcludeFoodModifier().isEmpty()) {
3542        addExcludeFoodModifier();
3543      }
3544      return getExcludeFoodModifier().get(0);
3545    }
3546
3547    /**
3548     * @return {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
3549     */
3550    public NutritionOrderOralDietComponent getOralDiet() { 
3551      if (this.oralDiet == null)
3552        if (Configuration.errorOnAutoCreate())
3553          throw new Error("Attempt to auto-create NutritionOrder.oralDiet");
3554        else if (Configuration.doAutoCreate())
3555          this.oralDiet = new NutritionOrderOralDietComponent(); // cc
3556      return this.oralDiet;
3557    }
3558
3559    public boolean hasOralDiet() { 
3560      return this.oralDiet != null && !this.oralDiet.isEmpty();
3561    }
3562
3563    /**
3564     * @param value {@link #oralDiet} (Diet given orally in contrast to enteral (tube) feeding.)
3565     */
3566    public NutritionOrder setOralDiet(NutritionOrderOralDietComponent value) { 
3567      this.oralDiet = value;
3568      return this;
3569    }
3570
3571    /**
3572     * @return {@link #supplement} (Oral nutritional products given in order to add further nutritional value to the patient's diet.)
3573     */
3574    public List<NutritionOrderSupplementComponent> getSupplement() { 
3575      if (this.supplement == null)
3576        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3577      return this.supplement;
3578    }
3579
3580    /**
3581     * @return Returns a reference to <code>this</code> for easy method chaining
3582     */
3583    public NutritionOrder setSupplement(List<NutritionOrderSupplementComponent> theSupplement) { 
3584      this.supplement = theSupplement;
3585      return this;
3586    }
3587
3588    public boolean hasSupplement() { 
3589      if (this.supplement == null)
3590        return false;
3591      for (NutritionOrderSupplementComponent item : this.supplement)
3592        if (!item.isEmpty())
3593          return true;
3594      return false;
3595    }
3596
3597    public NutritionOrderSupplementComponent addSupplement() { //3
3598      NutritionOrderSupplementComponent t = new NutritionOrderSupplementComponent();
3599      if (this.supplement == null)
3600        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3601      this.supplement.add(t);
3602      return t;
3603    }
3604
3605    public NutritionOrder addSupplement(NutritionOrderSupplementComponent t) { //3
3606      if (t == null)
3607        return this;
3608      if (this.supplement == null)
3609        this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
3610      this.supplement.add(t);
3611      return this;
3612    }
3613
3614    /**
3615     * @return The first repetition of repeating field {@link #supplement}, creating it if it does not already exist
3616     */
3617    public NutritionOrderSupplementComponent getSupplementFirstRep() { 
3618      if (getSupplement().isEmpty()) {
3619        addSupplement();
3620      }
3621      return getSupplement().get(0);
3622    }
3623
3624    /**
3625     * @return {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
3626     */
3627    public NutritionOrderEnteralFormulaComponent getEnteralFormula() { 
3628      if (this.enteralFormula == null)
3629        if (Configuration.errorOnAutoCreate())
3630          throw new Error("Attempt to auto-create NutritionOrder.enteralFormula");
3631        else if (Configuration.doAutoCreate())
3632          this.enteralFormula = new NutritionOrderEnteralFormulaComponent(); // cc
3633      return this.enteralFormula;
3634    }
3635
3636    public boolean hasEnteralFormula() { 
3637      return this.enteralFormula != null && !this.enteralFormula.isEmpty();
3638    }
3639
3640    /**
3641     * @param value {@link #enteralFormula} (Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.)
3642     */
3643    public NutritionOrder setEnteralFormula(NutritionOrderEnteralFormulaComponent value) { 
3644      this.enteralFormula = value;
3645      return this;
3646    }
3647
3648    /**
3649     * @return {@link #note} (Comments made about the {{title}} by the requester, performer, subject or other participants.)
3650     */
3651    public List<Annotation> getNote() { 
3652      if (this.note == null)
3653        this.note = new ArrayList<Annotation>();
3654      return this.note;
3655    }
3656
3657    /**
3658     * @return Returns a reference to <code>this</code> for easy method chaining
3659     */
3660    public NutritionOrder setNote(List<Annotation> theNote) { 
3661      this.note = theNote;
3662      return this;
3663    }
3664
3665    public boolean hasNote() { 
3666      if (this.note == null)
3667        return false;
3668      for (Annotation item : this.note)
3669        if (!item.isEmpty())
3670          return true;
3671      return false;
3672    }
3673
3674    public Annotation addNote() { //3
3675      Annotation t = new Annotation();
3676      if (this.note == null)
3677        this.note = new ArrayList<Annotation>();
3678      this.note.add(t);
3679      return t;
3680    }
3681
3682    public NutritionOrder addNote(Annotation t) { //3
3683      if (t == null)
3684        return this;
3685      if (this.note == null)
3686        this.note = new ArrayList<Annotation>();
3687      this.note.add(t);
3688      return this;
3689    }
3690
3691    /**
3692     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
3693     */
3694    public Annotation getNoteFirstRep() { 
3695      if (getNote().isEmpty()) {
3696        addNote();
3697      }
3698      return getNote().get(0);
3699    }
3700
3701      protected void listChildren(List<Property> children) {
3702        super.listChildren(children);
3703        children.add(new Property("identifier", "Identifier", "Identifiers assigned to this order by the order sender or by the order receiver.", 0, java.lang.Integer.MAX_VALUE, identifier));
3704        children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
3705        children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
3706        children.add(new Property("instantiates", "uri", "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiates));
3707        children.add(new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status));
3708        children.add(new Property("intent", "code", "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.", 0, 1, intent));
3709        children.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, 1, patient));
3710        children.add(new Property("context", "Reference(Encounter|EpisodeOfCare)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, 1, context));
3711        children.add(new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, 1, dateTime));
3712        children.add(new Property("orderer", "Reference(Practitioner|PractitionerRole)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, 1, orderer));
3713        children.add(new Property("allergyIntolerance", "Reference(AllergyIntolerance)", "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0, java.lang.Integer.MAX_VALUE, allergyIntolerance));
3714        children.add(new Property("foodPreferenceModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier));
3715        children.add(new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, excludeFoodModifier));
3716        children.add(new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet));
3717        children.add(new Property("supplement", "", "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0, java.lang.Integer.MAX_VALUE, supplement));
3718        children.add(new Property("enteralFormula", "", "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.", 0, 1, enteralFormula));
3719        children.add(new Property("note", "Annotation", "Comments made about the {{title}} by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note));
3720      }
3721
3722      @Override
3723      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3724        switch (_hash) {
3725        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifiers assigned to this order by the order sender or by the order receiver.", 0, java.lang.Integer.MAX_VALUE, identifier);
3726        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)", "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
3727        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
3728        case -246883639: /*instantiates*/  return new Property("instantiates", "uri", "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.", 0, java.lang.Integer.MAX_VALUE, instantiates);
3729        case -892481550: /*status*/  return new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status);
3730        case -1183762788: /*intent*/  return new Property("intent", "code", "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.", 0, 1, intent);
3731        case -791418107: /*patient*/  return 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, 1, patient);
3732        case 951530927: /*context*/  return new Property("context", "Reference(Encounter|EpisodeOfCare)", "An encounter that provides additional information about the healthcare context in which this request is made.", 0, 1, context);
3733        case 1792749467: /*dateTime*/  return new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0, 1, dateTime);
3734        case -1207109509: /*orderer*/  return new Property("orderer", "Reference(Practitioner|PractitionerRole)", "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.", 0, 1, orderer);
3735        case -120164120: /*allergyIntolerance*/  return new Property("allergyIntolerance", "Reference(AllergyIntolerance)", "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0, java.lang.Integer.MAX_VALUE, allergyIntolerance);
3736        case 659473872: /*foodPreferenceModifier*/  return new Property("foodPreferenceModifier", "CodeableConcept", "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier);
3737        case 1760260175: /*excludeFoodModifier*/  return new Property("excludeFoodModifier", "CodeableConcept", "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.", 0, java.lang.Integer.MAX_VALUE, excludeFoodModifier);
3738        case 1153521250: /*oralDiet*/  return new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet);
3739        case -711993159: /*supplement*/  return new Property("supplement", "", "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0, java.lang.Integer.MAX_VALUE, supplement);
3740        case -671083805: /*enteralFormula*/  return new Property("enteralFormula", "", "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.", 0, 1, enteralFormula);
3741        case 3387378: /*note*/  return new Property("note", "Annotation", "Comments made about the {{title}} by the requester, performer, subject or other participants.", 0, java.lang.Integer.MAX_VALUE, note);
3742        default: return super.getNamedProperty(_hash, _name, _checkValid);
3743        }
3744
3745      }
3746
3747      @Override
3748      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3749        switch (hash) {
3750        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3751        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
3752        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
3753        case -246883639: /*instantiates*/ return this.instantiates == null ? new Base[0] : this.instantiates.toArray(new Base[this.instantiates.size()]); // UriType
3754        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<NutritionOrderStatus>
3755        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<NutritiionOrderIntent>
3756        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
3757        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // Reference
3758        case 1792749467: /*dateTime*/ return this.dateTime == null ? new Base[0] : new Base[] {this.dateTime}; // DateTimeType
3759        case -1207109509: /*orderer*/ return this.orderer == null ? new Base[0] : new Base[] {this.orderer}; // Reference
3760        case -120164120: /*allergyIntolerance*/ return this.allergyIntolerance == null ? new Base[0] : this.allergyIntolerance.toArray(new Base[this.allergyIntolerance.size()]); // Reference
3761        case 659473872: /*foodPreferenceModifier*/ return this.foodPreferenceModifier == null ? new Base[0] : this.foodPreferenceModifier.toArray(new Base[this.foodPreferenceModifier.size()]); // CodeableConcept
3762        case 1760260175: /*excludeFoodModifier*/ return this.excludeFoodModifier == null ? new Base[0] : this.excludeFoodModifier.toArray(new Base[this.excludeFoodModifier.size()]); // CodeableConcept
3763        case 1153521250: /*oralDiet*/ return this.oralDiet == null ? new Base[0] : new Base[] {this.oralDiet}; // NutritionOrderOralDietComponent
3764        case -711993159: /*supplement*/ return this.supplement == null ? new Base[0] : this.supplement.toArray(new Base[this.supplement.size()]); // NutritionOrderSupplementComponent
3765        case -671083805: /*enteralFormula*/ return this.enteralFormula == null ? new Base[0] : new Base[] {this.enteralFormula}; // NutritionOrderEnteralFormulaComponent
3766        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
3767        default: return super.getProperty(hash, name, checkValid);
3768        }
3769
3770      }
3771
3772      @Override
3773      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3774        switch (hash) {
3775        case -1618432855: // identifier
3776          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3777          return value;
3778        case 8911915: // instantiatesCanonical
3779          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
3780          return value;
3781        case -1926393373: // instantiatesUri
3782          this.getInstantiatesUri().add(castToUri(value)); // UriType
3783          return value;
3784        case -246883639: // instantiates
3785          this.getInstantiates().add(castToUri(value)); // UriType
3786          return value;
3787        case -892481550: // status
3788          value = new NutritionOrderStatusEnumFactory().fromType(castToCode(value));
3789          this.status = (Enumeration) value; // Enumeration<NutritionOrderStatus>
3790          return value;
3791        case -1183762788: // intent
3792          value = new NutritiionOrderIntentEnumFactory().fromType(castToCode(value));
3793          this.intent = (Enumeration) value; // Enumeration<NutritiionOrderIntent>
3794          return value;
3795        case -791418107: // patient
3796          this.patient = castToReference(value); // Reference
3797          return value;
3798        case 951530927: // context
3799          this.context = castToReference(value); // Reference
3800          return value;
3801        case 1792749467: // dateTime
3802          this.dateTime = castToDateTime(value); // DateTimeType
3803          return value;
3804        case -1207109509: // orderer
3805          this.orderer = castToReference(value); // Reference
3806          return value;
3807        case -120164120: // allergyIntolerance
3808          this.getAllergyIntolerance().add(castToReference(value)); // Reference
3809          return value;
3810        case 659473872: // foodPreferenceModifier
3811          this.getFoodPreferenceModifier().add(castToCodeableConcept(value)); // CodeableConcept
3812          return value;
3813        case 1760260175: // excludeFoodModifier
3814          this.getExcludeFoodModifier().add(castToCodeableConcept(value)); // CodeableConcept
3815          return value;
3816        case 1153521250: // oralDiet
3817          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
3818          return value;
3819        case -711993159: // supplement
3820          this.getSupplement().add((NutritionOrderSupplementComponent) value); // NutritionOrderSupplementComponent
3821          return value;
3822        case -671083805: // enteralFormula
3823          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
3824          return value;
3825        case 3387378: // note
3826          this.getNote().add(castToAnnotation(value)); // Annotation
3827          return value;
3828        default: return super.setProperty(hash, name, value);
3829        }
3830
3831      }
3832
3833      @Override
3834      public Base setProperty(String name, Base value) throws FHIRException {
3835        if (name.equals("identifier")) {
3836          this.getIdentifier().add(castToIdentifier(value));
3837        } else if (name.equals("instantiatesCanonical")) {
3838          this.getInstantiatesCanonical().add(castToCanonical(value));
3839        } else if (name.equals("instantiatesUri")) {
3840          this.getInstantiatesUri().add(castToUri(value));
3841        } else if (name.equals("instantiates")) {
3842          this.getInstantiates().add(castToUri(value));
3843        } else if (name.equals("status")) {
3844          value = new NutritionOrderStatusEnumFactory().fromType(castToCode(value));
3845          this.status = (Enumeration) value; // Enumeration<NutritionOrderStatus>
3846        } else if (name.equals("intent")) {
3847          value = new NutritiionOrderIntentEnumFactory().fromType(castToCode(value));
3848          this.intent = (Enumeration) value; // Enumeration<NutritiionOrderIntent>
3849        } else if (name.equals("patient")) {
3850          this.patient = castToReference(value); // Reference
3851        } else if (name.equals("context")) {
3852          this.context = castToReference(value); // Reference
3853        } else if (name.equals("dateTime")) {
3854          this.dateTime = castToDateTime(value); // DateTimeType
3855        } else if (name.equals("orderer")) {
3856          this.orderer = castToReference(value); // Reference
3857        } else if (name.equals("allergyIntolerance")) {
3858          this.getAllergyIntolerance().add(castToReference(value));
3859        } else if (name.equals("foodPreferenceModifier")) {
3860          this.getFoodPreferenceModifier().add(castToCodeableConcept(value));
3861        } else if (name.equals("excludeFoodModifier")) {
3862          this.getExcludeFoodModifier().add(castToCodeableConcept(value));
3863        } else if (name.equals("oralDiet")) {
3864          this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
3865        } else if (name.equals("supplement")) {
3866          this.getSupplement().add((NutritionOrderSupplementComponent) value);
3867        } else if (name.equals("enteralFormula")) {
3868          this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
3869        } else if (name.equals("note")) {
3870          this.getNote().add(castToAnnotation(value));
3871        } else
3872          return super.setProperty(name, value);
3873        return value;
3874      }
3875
3876      @Override
3877      public Base makeProperty(int hash, String name) throws FHIRException {
3878        switch (hash) {
3879        case -1618432855:  return addIdentifier(); 
3880        case 8911915:  return addInstantiatesCanonicalElement();
3881        case -1926393373:  return addInstantiatesUriElement();
3882        case -246883639:  return addInstantiatesElement();
3883        case -892481550:  return getStatusElement();
3884        case -1183762788:  return getIntentElement();
3885        case -791418107:  return getPatient(); 
3886        case 951530927:  return getContext(); 
3887        case 1792749467:  return getDateTimeElement();
3888        case -1207109509:  return getOrderer(); 
3889        case -120164120:  return addAllergyIntolerance(); 
3890        case 659473872:  return addFoodPreferenceModifier(); 
3891        case 1760260175:  return addExcludeFoodModifier(); 
3892        case 1153521250:  return getOralDiet(); 
3893        case -711993159:  return addSupplement(); 
3894        case -671083805:  return getEnteralFormula(); 
3895        case 3387378:  return addNote(); 
3896        default: return super.makeProperty(hash, name);
3897        }
3898
3899      }
3900
3901      @Override
3902      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3903        switch (hash) {
3904        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3905        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
3906        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
3907        case -246883639: /*instantiates*/ return new String[] {"uri"};
3908        case -892481550: /*status*/ return new String[] {"code"};
3909        case -1183762788: /*intent*/ return new String[] {"code"};
3910        case -791418107: /*patient*/ return new String[] {"Reference"};
3911        case 951530927: /*context*/ return new String[] {"Reference"};
3912        case 1792749467: /*dateTime*/ return new String[] {"dateTime"};
3913        case -1207109509: /*orderer*/ return new String[] {"Reference"};
3914        case -120164120: /*allergyIntolerance*/ return new String[] {"Reference"};
3915        case 659473872: /*foodPreferenceModifier*/ return new String[] {"CodeableConcept"};
3916        case 1760260175: /*excludeFoodModifier*/ return new String[] {"CodeableConcept"};
3917        case 1153521250: /*oralDiet*/ return new String[] {};
3918        case -711993159: /*supplement*/ return new String[] {};
3919        case -671083805: /*enteralFormula*/ return new String[] {};
3920        case 3387378: /*note*/ return new String[] {"Annotation"};
3921        default: return super.getTypesForProperty(hash, name);
3922        }
3923
3924      }
3925
3926      @Override
3927      public Base addChild(String name) throws FHIRException {
3928        if (name.equals("identifier")) {
3929          return addIdentifier();
3930        }
3931        else if (name.equals("instantiatesCanonical")) {
3932          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiatesCanonical");
3933        }
3934        else if (name.equals("instantiatesUri")) {
3935          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiatesUri");
3936        }
3937        else if (name.equals("instantiates")) {
3938          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.instantiates");
3939        }
3940        else if (name.equals("status")) {
3941          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.status");
3942        }
3943        else if (name.equals("intent")) {
3944          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.intent");
3945        }
3946        else if (name.equals("patient")) {
3947          this.patient = new Reference();
3948          return this.patient;
3949        }
3950        else if (name.equals("context")) {
3951          this.context = new Reference();
3952          return this.context;
3953        }
3954        else if (name.equals("dateTime")) {
3955          throw new FHIRException("Cannot call addChild on a primitive type NutritionOrder.dateTime");
3956        }
3957        else if (name.equals("orderer")) {
3958          this.orderer = new Reference();
3959          return this.orderer;
3960        }
3961        else if (name.equals("allergyIntolerance")) {
3962          return addAllergyIntolerance();
3963        }
3964        else if (name.equals("foodPreferenceModifier")) {
3965          return addFoodPreferenceModifier();
3966        }
3967        else if (name.equals("excludeFoodModifier")) {
3968          return addExcludeFoodModifier();
3969        }
3970        else if (name.equals("oralDiet")) {
3971          this.oralDiet = new NutritionOrderOralDietComponent();
3972          return this.oralDiet;
3973        }
3974        else if (name.equals("supplement")) {
3975          return addSupplement();
3976        }
3977        else if (name.equals("enteralFormula")) {
3978          this.enteralFormula = new NutritionOrderEnteralFormulaComponent();
3979          return this.enteralFormula;
3980        }
3981        else if (name.equals("note")) {
3982          return addNote();
3983        }
3984        else
3985          return super.addChild(name);
3986      }
3987
3988  public String fhirType() {
3989    return "NutritionOrder";
3990
3991  }
3992
3993      public NutritionOrder copy() {
3994        NutritionOrder dst = new NutritionOrder();
3995        copyValues(dst);
3996        if (identifier != null) {
3997          dst.identifier = new ArrayList<Identifier>();
3998          for (Identifier i : identifier)
3999            dst.identifier.add(i.copy());
4000        };
4001        if (instantiatesCanonical != null) {
4002          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
4003          for (CanonicalType i : instantiatesCanonical)
4004            dst.instantiatesCanonical.add(i.copy());
4005        };
4006        if (instantiatesUri != null) {
4007          dst.instantiatesUri = new ArrayList<UriType>();
4008          for (UriType i : instantiatesUri)
4009            dst.instantiatesUri.add(i.copy());
4010        };
4011        if (instantiates != null) {
4012          dst.instantiates = new ArrayList<UriType>();
4013          for (UriType i : instantiates)
4014            dst.instantiates.add(i.copy());
4015        };
4016        dst.status = status == null ? null : status.copy();
4017        dst.intent = intent == null ? null : intent.copy();
4018        dst.patient = patient == null ? null : patient.copy();
4019        dst.context = context == null ? null : context.copy();
4020        dst.dateTime = dateTime == null ? null : dateTime.copy();
4021        dst.orderer = orderer == null ? null : orderer.copy();
4022        if (allergyIntolerance != null) {
4023          dst.allergyIntolerance = new ArrayList<Reference>();
4024          for (Reference i : allergyIntolerance)
4025            dst.allergyIntolerance.add(i.copy());
4026        };
4027        if (foodPreferenceModifier != null) {
4028          dst.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4029          for (CodeableConcept i : foodPreferenceModifier)
4030            dst.foodPreferenceModifier.add(i.copy());
4031        };
4032        if (excludeFoodModifier != null) {
4033          dst.excludeFoodModifier = new ArrayList<CodeableConcept>();
4034          for (CodeableConcept i : excludeFoodModifier)
4035            dst.excludeFoodModifier.add(i.copy());
4036        };
4037        dst.oralDiet = oralDiet == null ? null : oralDiet.copy();
4038        if (supplement != null) {
4039          dst.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4040          for (NutritionOrderSupplementComponent i : supplement)
4041            dst.supplement.add(i.copy());
4042        };
4043        dst.enteralFormula = enteralFormula == null ? null : enteralFormula.copy();
4044        if (note != null) {
4045          dst.note = new ArrayList<Annotation>();
4046          for (Annotation i : note)
4047            dst.note.add(i.copy());
4048        };
4049        return dst;
4050      }
4051
4052      protected NutritionOrder typedCopy() {
4053        return copy();
4054      }
4055
4056      @Override
4057      public boolean equalsDeep(Base other_) {
4058        if (!super.equalsDeep(other_))
4059          return false;
4060        if (!(other_ instanceof NutritionOrder))
4061          return false;
4062        NutritionOrder o = (NutritionOrder) other_;
4063        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
4064           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(instantiates, o.instantiates, true)
4065           && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true) && compareDeep(patient, o.patient, true)
4066           && compareDeep(context, o.context, true) && compareDeep(dateTime, o.dateTime, true) && compareDeep(orderer, o.orderer, true)
4067           && compareDeep(allergyIntolerance, o.allergyIntolerance, true) && compareDeep(foodPreferenceModifier, o.foodPreferenceModifier, true)
4068           && compareDeep(excludeFoodModifier, o.excludeFoodModifier, true) && compareDeep(oralDiet, o.oralDiet, true)
4069           && compareDeep(supplement, o.supplement, true) && compareDeep(enteralFormula, o.enteralFormula, true)
4070           && compareDeep(note, o.note, true);
4071      }
4072
4073      @Override
4074      public boolean equalsShallow(Base other_) {
4075        if (!super.equalsShallow(other_))
4076          return false;
4077        if (!(other_ instanceof NutritionOrder))
4078          return false;
4079        NutritionOrder o = (NutritionOrder) other_;
4080        return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(instantiates, o.instantiates, true)
4081           && compareValues(status, o.status, true) && compareValues(intent, o.intent, true) && compareValues(dateTime, o.dateTime, true)
4082          ;
4083      }
4084
4085      public boolean isEmpty() {
4086        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
4087          , instantiatesUri, instantiates, status, intent, patient, context, dateTime, orderer
4088          , allergyIntolerance, foodPreferenceModifier, excludeFoodModifier, oralDiet, supplement
4089          , enteralFormula, note);
4090      }
4091
4092  @Override
4093  public ResourceType getResourceType() {
4094    return ResourceType.NutritionOrder;
4095   }
4096
4097 /**
4098   * Search parameter: <b>identifier</b>
4099   * <p>
4100   * Description: <b>Return nutrition orders with this external identifier</b><br>
4101   * Type: <b>token</b><br>
4102   * Path: <b>NutritionOrder.identifier</b><br>
4103   * </p>
4104   */
4105  @SearchParamDefinition(name="identifier", path="NutritionOrder.identifier", description="Return nutrition orders with this external identifier", type="token" )
4106  public static final String SP_IDENTIFIER = "identifier";
4107 /**
4108   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4109   * <p>
4110   * Description: <b>Return nutrition orders with this external identifier</b><br>
4111   * Type: <b>token</b><br>
4112   * Path: <b>NutritionOrder.identifier</b><br>
4113   * </p>
4114   */
4115  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4116
4117 /**
4118   * Search parameter: <b>datetime</b>
4119   * <p>
4120   * Description: <b>Return nutrition orders requested on this date</b><br>
4121   * Type: <b>date</b><br>
4122   * Path: <b>NutritionOrder.dateTime</b><br>
4123   * </p>
4124   */
4125  @SearchParamDefinition(name="datetime", path="NutritionOrder.dateTime", description="Return nutrition orders requested on this date", type="date" )
4126  public static final String SP_DATETIME = "datetime";
4127 /**
4128   * <b>Fluent Client</b> search parameter constant for <b>datetime</b>
4129   * <p>
4130   * Description: <b>Return nutrition orders requested on this date</b><br>
4131   * Type: <b>date</b><br>
4132   * Path: <b>NutritionOrder.dateTime</b><br>
4133   * </p>
4134   */
4135  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATETIME = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATETIME);
4136
4137 /**
4138   * Search parameter: <b>provider</b>
4139   * <p>
4140   * Description: <b>The identity of the provider who placed the nutrition order</b><br>
4141   * Type: <b>reference</b><br>
4142   * Path: <b>NutritionOrder.orderer</b><br>
4143   * </p>
4144   */
4145  @SearchParamDefinition(name="provider", path="NutritionOrder.orderer", description="The identity of the provider who placed the nutrition order", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class, PractitionerRole.class } )
4146  public static final String SP_PROVIDER = "provider";
4147 /**
4148   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
4149   * <p>
4150   * Description: <b>The identity of the provider who placed the nutrition order</b><br>
4151   * Type: <b>reference</b><br>
4152   * Path: <b>NutritionOrder.orderer</b><br>
4153   * </p>
4154   */
4155  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PROVIDER);
4156
4157/**
4158   * Constant for fluent queries to be used to add include statements. Specifies
4159   * the path value of "<b>NutritionOrder:provider</b>".
4160   */
4161  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include("NutritionOrder:provider").toLocked();
4162
4163 /**
4164   * Search parameter: <b>patient</b>
4165   * <p>
4166   * Description: <b>The identity of the person who requires the diet, formula or nutritional supplement</b><br>
4167   * Type: <b>reference</b><br>
4168   * Path: <b>NutritionOrder.patient</b><br>
4169   * </p>
4170   */
4171  @SearchParamDefinition(name="patient", path="NutritionOrder.patient", description="The identity of the person who requires the diet, formula or nutritional supplement", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
4172  public static final String SP_PATIENT = "patient";
4173 /**
4174   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
4175   * <p>
4176   * Description: <b>The identity of the person who requires the diet, formula or nutritional supplement</b><br>
4177   * Type: <b>reference</b><br>
4178   * Path: <b>NutritionOrder.patient</b><br>
4179   * </p>
4180   */
4181  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
4182
4183/**
4184   * Constant for fluent queries to be used to add include statements. Specifies
4185   * the path value of "<b>NutritionOrder:patient</b>".
4186   */
4187  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("NutritionOrder:patient").toLocked();
4188
4189 /**
4190   * Search parameter: <b>supplement</b>
4191   * <p>
4192   * Description: <b>Type of supplement product requested</b><br>
4193   * Type: <b>token</b><br>
4194   * Path: <b>NutritionOrder.supplement.type</b><br>
4195   * </p>
4196   */
4197  @SearchParamDefinition(name="supplement", path="NutritionOrder.supplement.type", description="Type of supplement product requested", type="token" )
4198  public static final String SP_SUPPLEMENT = "supplement";
4199 /**
4200   * <b>Fluent Client</b> search parameter constant for <b>supplement</b>
4201   * <p>
4202   * Description: <b>Type of supplement product requested</b><br>
4203   * Type: <b>token</b><br>
4204   * Path: <b>NutritionOrder.supplement.type</b><br>
4205   * </p>
4206   */
4207  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUPPLEMENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SUPPLEMENT);
4208
4209 /**
4210   * Search parameter: <b>context</b>
4211   * <p>
4212   * Description: <b>Return nutrition orders with this encounter identifier</b><br>
4213   * Type: <b>reference</b><br>
4214   * Path: <b>NutritionOrder.context</b><br>
4215   * </p>
4216   */
4217  @SearchParamDefinition(name="context", path="NutritionOrder.context", description="Return nutrition orders with this encounter identifier", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class, EpisodeOfCare.class } )
4218  public static final String SP_CONTEXT = "context";
4219 /**
4220   * <b>Fluent Client</b> search parameter constant for <b>context</b>
4221   * <p>
4222   * Description: <b>Return nutrition orders with this encounter identifier</b><br>
4223   * Type: <b>reference</b><br>
4224   * Path: <b>NutritionOrder.context</b><br>
4225   * </p>
4226   */
4227  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam CONTEXT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_CONTEXT);
4228
4229/**
4230   * Constant for fluent queries to be used to add include statements. Specifies
4231   * the path value of "<b>NutritionOrder:context</b>".
4232   */
4233  public static final ca.uhn.fhir.model.api.Include INCLUDE_CONTEXT = new ca.uhn.fhir.model.api.Include("NutritionOrder:context").toLocked();
4234
4235 /**
4236   * Search parameter: <b>formula</b>
4237   * <p>
4238   * Description: <b>Type of enteral or infant formula</b><br>
4239   * Type: <b>token</b><br>
4240   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
4241   * </p>
4242   */
4243  @SearchParamDefinition(name="formula", path="NutritionOrder.enteralFormula.baseFormulaType", description="Type of enteral or infant formula", type="token" )
4244  public static final String SP_FORMULA = "formula";
4245 /**
4246   * <b>Fluent Client</b> search parameter constant for <b>formula</b>
4247   * <p>
4248   * Description: <b>Type of enteral or infant formula</b><br>
4249   * Type: <b>token</b><br>
4250   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
4251   * </p>
4252   */
4253  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMULA = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FORMULA);
4254
4255 /**
4256   * Search parameter: <b>instantiates-canonical</b>
4257   * <p>
4258   * Description: <b>Instantiates FHIR protocol or definition</b><br>
4259   * Type: <b>reference</b><br>
4260   * Path: <b>NutritionOrder.instantiatesCanonical</b><br>
4261   * </p>
4262   */
4263  @SearchParamDefinition(name="instantiates-canonical", path="NutritionOrder.instantiatesCanonical", description="Instantiates FHIR protocol or definition", type="reference", target={ActivityDefinition.class, PlanDefinition.class } )
4264  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
4265 /**
4266   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
4267   * <p>
4268   * Description: <b>Instantiates FHIR protocol or definition</b><br>
4269   * Type: <b>reference</b><br>
4270   * Path: <b>NutritionOrder.instantiatesCanonical</b><br>
4271   * </p>
4272   */
4273  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
4274
4275/**
4276   * Constant for fluent queries to be used to add include statements. Specifies
4277   * the path value of "<b>NutritionOrder:instantiates-canonical</b>".
4278   */
4279  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("NutritionOrder:instantiates-canonical").toLocked();
4280
4281 /**
4282   * Search parameter: <b>instantiates-uri</b>
4283   * <p>
4284   * Description: <b>Instantiates external protocol or definition</b><br>
4285   * Type: <b>uri</b><br>
4286   * Path: <b>NutritionOrder.instantiatesUri</b><br>
4287   * </p>
4288   */
4289  @SearchParamDefinition(name="instantiates-uri", path="NutritionOrder.instantiatesUri", description="Instantiates external protocol or definition", type="uri" )
4290  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
4291 /**
4292   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
4293   * <p>
4294   * Description: <b>Instantiates external protocol or definition</b><br>
4295   * Type: <b>uri</b><br>
4296   * Path: <b>NutritionOrder.instantiatesUri</b><br>
4297   * </p>
4298   */
4299  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
4300
4301 /**
4302   * Search parameter: <b>oraldiet</b>
4303   * <p>
4304   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
4305   * Type: <b>token</b><br>
4306   * Path: <b>NutritionOrder.oralDiet.type</b><br>
4307   * </p>
4308   */
4309  @SearchParamDefinition(name="oraldiet", path="NutritionOrder.oralDiet.type", description="Type of diet that can be consumed orally (i.e., take via the mouth).", type="token" )
4310  public static final String SP_ORALDIET = "oraldiet";
4311 /**
4312   * <b>Fluent Client</b> search parameter constant for <b>oraldiet</b>
4313   * <p>
4314   * Description: <b>Type of diet that can be consumed orally (i.e., take via the mouth).</b><br>
4315   * Type: <b>token</b><br>
4316   * Path: <b>NutritionOrder.oralDiet.type</b><br>
4317   * </p>
4318   */
4319  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORALDIET = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ORALDIET);
4320
4321 /**
4322   * Search parameter: <b>status</b>
4323   * <p>
4324   * Description: <b>Status of the nutrition order.</b><br>
4325   * Type: <b>token</b><br>
4326   * Path: <b>NutritionOrder.status</b><br>
4327   * </p>
4328   */
4329  @SearchParamDefinition(name="status", path="NutritionOrder.status", description="Status of the nutrition order.", type="token" )
4330  public static final String SP_STATUS = "status";
4331 /**
4332   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4333   * <p>
4334   * Description: <b>Status of the nutrition order.</b><br>
4335   * Type: <b>token</b><br>
4336   * Path: <b>NutritionOrder.status</b><br>
4337   * </p>
4338   */
4339  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4340
4341 /**
4342   * Search parameter: <b>additive</b>
4343   * <p>
4344   * Description: <b>Type of module component to add to the feeding</b><br>
4345   * Type: <b>token</b><br>
4346   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
4347   * </p>
4348   */
4349  @SearchParamDefinition(name="additive", path="NutritionOrder.enteralFormula.additiveType", description="Type of module component to add to the feeding", type="token" )
4350  public static final String SP_ADDITIVE = "additive";
4351 /**
4352   * <b>Fluent Client</b> search parameter constant for <b>additive</b>
4353   * <p>
4354   * Description: <b>Type of module component to add to the feeding</b><br>
4355   * Type: <b>token</b><br>
4356   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
4357   * </p>
4358   */
4359  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDITIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDITIVE);
4360
4361
4362}
4363