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