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