001package org.hl7.fhir.r4.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
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;
056
057import org.hl7.fhir.exceptions.FHIRException;
058import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
059import org.hl7.fhir.utilities.Utilities;
060
061import ca.uhn.fhir.model.api.annotation.Block;
062import ca.uhn.fhir.model.api.annotation.Child;
063import ca.uhn.fhir.model.api.annotation.Description;
064import ca.uhn.fhir.model.api.annotation.ResourceDef;
065import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
066/**
067 * A group of related requests that can be used to capture intended activities that have inter-dependencies such as "give this medication after that one".
068 */
069@ResourceDef(name="RequestGroup", profile="http://hl7.org/fhir/StructureDefinition/RequestGroup")
070public class RequestGroup extends DomainResource {
071
072    public enum RequestStatus {
073        /**
074         * The request has been created but is not yet complete or ready for action.
075         */
076        DRAFT, 
077        /**
078         * The request is in force and ready to be acted upon.
079         */
080        ACTIVE, 
081        /**
082         * The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.
083         */
084        ONHOLD, 
085        /**
086         * 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.
087         */
088        REVOKED, 
089        /**
090         * The activity described by the request has been fully performed.  No further activity will occur.
091         */
092        COMPLETED, 
093        /**
094         * 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".).
095         */
096        ENTEREDINERROR, 
097        /**
098         * 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.
099         */
100        UNKNOWN, 
101        /**
102         * added to help the parsers with the generic types
103         */
104        NULL;
105        public static RequestStatus fromCode(String codeString) throws FHIRException {
106            if (codeString == null || "".equals(codeString))
107                return null;
108        if ("draft".equals(codeString))
109          return DRAFT;
110        if ("active".equals(codeString))
111          return ACTIVE;
112        if ("on-hold".equals(codeString))
113          return ONHOLD;
114        if ("revoked".equals(codeString))
115          return REVOKED;
116        if ("completed".equals(codeString))
117          return COMPLETED;
118        if ("entered-in-error".equals(codeString))
119          return ENTEREDINERROR;
120        if ("unknown".equals(codeString))
121          return UNKNOWN;
122        if (Configuration.isAcceptInvalidEnums())
123          return null;
124        else
125          throw new FHIRException("Unknown RequestStatus code '"+codeString+"'");
126        }
127        public String toCode() {
128          switch (this) {
129            case DRAFT: return "draft";
130            case ACTIVE: return "active";
131            case ONHOLD: return "on-hold";
132            case REVOKED: return "revoked";
133            case COMPLETED: return "completed";
134            case ENTEREDINERROR: return "entered-in-error";
135            case UNKNOWN: return "unknown";
136            default: return "?";
137          }
138        }
139        public String getSystem() {
140          switch (this) {
141            case DRAFT: return "http://hl7.org/fhir/request-status";
142            case ACTIVE: return "http://hl7.org/fhir/request-status";
143            case ONHOLD: return "http://hl7.org/fhir/request-status";
144            case REVOKED: return "http://hl7.org/fhir/request-status";
145            case COMPLETED: return "http://hl7.org/fhir/request-status";
146            case ENTEREDINERROR: return "http://hl7.org/fhir/request-status";
147            case UNKNOWN: return "http://hl7.org/fhir/request-status";
148            default: return "?";
149          }
150        }
151        public String getDefinition() {
152          switch (this) {
153            case DRAFT: return "The request has been created but is not yet complete or ready for action.";
154            case ACTIVE: return "The request is in force and ready to be acted upon.";
155            case ONHOLD: return "The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.";
156            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.";
157            case COMPLETED: return "The activity described by the request has been fully performed.  No further activity will occur.";
158            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\".).";
159            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.";
160            default: return "?";
161          }
162        }
163        public String getDisplay() {
164          switch (this) {
165            case DRAFT: return "Draft";
166            case ACTIVE: return "Active";
167            case ONHOLD: return "On Hold";
168            case REVOKED: return "Revoked";
169            case COMPLETED: return "Completed";
170            case ENTEREDINERROR: return "Entered in Error";
171            case UNKNOWN: return "Unknown";
172            default: return "?";
173          }
174        }
175    }
176
177  public static class RequestStatusEnumFactory implements EnumFactory<RequestStatus> {
178    public RequestStatus fromCode(String codeString) throws IllegalArgumentException {
179      if (codeString == null || "".equals(codeString))
180            if (codeString == null || "".equals(codeString))
181                return null;
182        if ("draft".equals(codeString))
183          return RequestStatus.DRAFT;
184        if ("active".equals(codeString))
185          return RequestStatus.ACTIVE;
186        if ("on-hold".equals(codeString))
187          return RequestStatus.ONHOLD;
188        if ("revoked".equals(codeString))
189          return RequestStatus.REVOKED;
190        if ("completed".equals(codeString))
191          return RequestStatus.COMPLETED;
192        if ("entered-in-error".equals(codeString))
193          return RequestStatus.ENTEREDINERROR;
194        if ("unknown".equals(codeString))
195          return RequestStatus.UNKNOWN;
196        throw new IllegalArgumentException("Unknown RequestStatus code '"+codeString+"'");
197        }
198        public Enumeration<RequestStatus> fromType(Base code) throws FHIRException {
199          if (code == null)
200            return null;
201          if (code.isEmpty())
202            return new Enumeration<RequestStatus>(this);
203          String codeString = ((PrimitiveType) code).asStringValue();
204          if (codeString == null || "".equals(codeString))
205            return null;
206        if ("draft".equals(codeString))
207          return new Enumeration<RequestStatus>(this, RequestStatus.DRAFT);
208        if ("active".equals(codeString))
209          return new Enumeration<RequestStatus>(this, RequestStatus.ACTIVE);
210        if ("on-hold".equals(codeString))
211          return new Enumeration<RequestStatus>(this, RequestStatus.ONHOLD);
212        if ("revoked".equals(codeString))
213          return new Enumeration<RequestStatus>(this, RequestStatus.REVOKED);
214        if ("completed".equals(codeString))
215          return new Enumeration<RequestStatus>(this, RequestStatus.COMPLETED);
216        if ("entered-in-error".equals(codeString))
217          return new Enumeration<RequestStatus>(this, RequestStatus.ENTEREDINERROR);
218        if ("unknown".equals(codeString))
219          return new Enumeration<RequestStatus>(this, RequestStatus.UNKNOWN);
220        throw new FHIRException("Unknown RequestStatus code '"+codeString+"'");
221        }
222    public String toCode(RequestStatus code) {
223      if (code == RequestStatus.DRAFT)
224        return "draft";
225      if (code == RequestStatus.ACTIVE)
226        return "active";
227      if (code == RequestStatus.ONHOLD)
228        return "on-hold";
229      if (code == RequestStatus.REVOKED)
230        return "revoked";
231      if (code == RequestStatus.COMPLETED)
232        return "completed";
233      if (code == RequestStatus.ENTEREDINERROR)
234        return "entered-in-error";
235      if (code == RequestStatus.UNKNOWN)
236        return "unknown";
237      return "?";
238      }
239    public String toSystem(RequestStatus code) {
240      return code.getSystem();
241      }
242    }
243
244    public enum RequestIntent {
245        /**
246         * 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.
247         */
248        PROPOSAL, 
249        /**
250         * The request represents an intention to ensure something occurs without providing an authorization for others to act.
251         */
252        PLAN, 
253        /**
254         * The request represents a legally binding instruction authored by a Patient or RelatedPerson.
255         */
256        DIRECTIVE, 
257        /**
258         * The request represents a request/demand and authorization for action by a Practitioner.
259         */
260        ORDER, 
261        /**
262         * The request represents an original authorization for action.
263         */
264        ORIGINALORDER, 
265        /**
266         * 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.
267         */
268        REFLEXORDER, 
269        /**
270         * 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.
271         */
272        FILLERORDER, 
273        /**
274         * 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.
275         */
276        INSTANCEORDER, 
277        /**
278         * 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.
279         */
280        OPTION, 
281        /**
282         * added to help the parsers with the generic types
283         */
284        NULL;
285        public static RequestIntent fromCode(String codeString) throws FHIRException {
286            if (codeString == null || "".equals(codeString))
287                return null;
288        if ("proposal".equals(codeString))
289          return PROPOSAL;
290        if ("plan".equals(codeString))
291          return PLAN;
292        if ("directive".equals(codeString))
293          return DIRECTIVE;
294        if ("order".equals(codeString))
295          return ORDER;
296        if ("original-order".equals(codeString))
297          return ORIGINALORDER;
298        if ("reflex-order".equals(codeString))
299          return REFLEXORDER;
300        if ("filler-order".equals(codeString))
301          return FILLERORDER;
302        if ("instance-order".equals(codeString))
303          return INSTANCEORDER;
304        if ("option".equals(codeString))
305          return OPTION;
306        if (Configuration.isAcceptInvalidEnums())
307          return null;
308        else
309          throw new FHIRException("Unknown RequestIntent code '"+codeString+"'");
310        }
311        public String toCode() {
312          switch (this) {
313            case PROPOSAL: return "proposal";
314            case PLAN: return "plan";
315            case DIRECTIVE: return "directive";
316            case ORDER: return "order";
317            case ORIGINALORDER: return "original-order";
318            case REFLEXORDER: return "reflex-order";
319            case FILLERORDER: return "filler-order";
320            case INSTANCEORDER: return "instance-order";
321            case OPTION: return "option";
322            default: return "?";
323          }
324        }
325        public String getSystem() {
326          switch (this) {
327            case PROPOSAL: return "http://hl7.org/fhir/request-intent";
328            case PLAN: return "http://hl7.org/fhir/request-intent";
329            case DIRECTIVE: return "http://hl7.org/fhir/request-intent";
330            case ORDER: return "http://hl7.org/fhir/request-intent";
331            case ORIGINALORDER: return "http://hl7.org/fhir/request-intent";
332            case REFLEXORDER: return "http://hl7.org/fhir/request-intent";
333            case FILLERORDER: return "http://hl7.org/fhir/request-intent";
334            case INSTANCEORDER: return "http://hl7.org/fhir/request-intent";
335            case OPTION: return "http://hl7.org/fhir/request-intent";
336            default: return "?";
337          }
338        }
339        public String getDefinition() {
340          switch (this) {
341            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.";
342            case PLAN: return "The request represents an intention to ensure something occurs without providing an authorization for others to act.";
343            case DIRECTIVE: return "The request represents a legally binding instruction authored by a Patient or RelatedPerson.";
344            case ORDER: return "The request represents a request/demand and authorization for action by a Practitioner.";
345            case ORIGINALORDER: return "The request represents an original authorization for action.";
346            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.";
347            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.";
348            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.";
349            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.";
350            default: return "?";
351          }
352        }
353        public String getDisplay() {
354          switch (this) {
355            case PROPOSAL: return "Proposal";
356            case PLAN: return "Plan";
357            case DIRECTIVE: return "Directive";
358            case ORDER: return "Order";
359            case ORIGINALORDER: return "Original Order";
360            case REFLEXORDER: return "Reflex Order";
361            case FILLERORDER: return "Filler Order";
362            case INSTANCEORDER: return "Instance Order";
363            case OPTION: return "Option";
364            default: return "?";
365          }
366        }
367    }
368
369  public static class RequestIntentEnumFactory implements EnumFactory<RequestIntent> {
370    public RequestIntent fromCode(String codeString) throws IllegalArgumentException {
371      if (codeString == null || "".equals(codeString))
372            if (codeString == null || "".equals(codeString))
373                return null;
374        if ("proposal".equals(codeString))
375          return RequestIntent.PROPOSAL;
376        if ("plan".equals(codeString))
377          return RequestIntent.PLAN;
378        if ("directive".equals(codeString))
379          return RequestIntent.DIRECTIVE;
380        if ("order".equals(codeString))
381          return RequestIntent.ORDER;
382        if ("original-order".equals(codeString))
383          return RequestIntent.ORIGINALORDER;
384        if ("reflex-order".equals(codeString))
385          return RequestIntent.REFLEXORDER;
386        if ("filler-order".equals(codeString))
387          return RequestIntent.FILLERORDER;
388        if ("instance-order".equals(codeString))
389          return RequestIntent.INSTANCEORDER;
390        if ("option".equals(codeString))
391          return RequestIntent.OPTION;
392        throw new IllegalArgumentException("Unknown RequestIntent code '"+codeString+"'");
393        }
394        public Enumeration<RequestIntent> fromType(Base code) throws FHIRException {
395          if (code == null)
396            return null;
397          if (code.isEmpty())
398            return new Enumeration<RequestIntent>(this);
399          String codeString = ((PrimitiveType) code).asStringValue();
400          if (codeString == null || "".equals(codeString))
401            return null;
402        if ("proposal".equals(codeString))
403          return new Enumeration<RequestIntent>(this, RequestIntent.PROPOSAL);
404        if ("plan".equals(codeString))
405          return new Enumeration<RequestIntent>(this, RequestIntent.PLAN);
406        if ("directive".equals(codeString))
407          return new Enumeration<RequestIntent>(this, RequestIntent.DIRECTIVE);
408        if ("order".equals(codeString))
409          return new Enumeration<RequestIntent>(this, RequestIntent.ORDER);
410        if ("original-order".equals(codeString))
411          return new Enumeration<RequestIntent>(this, RequestIntent.ORIGINALORDER);
412        if ("reflex-order".equals(codeString))
413          return new Enumeration<RequestIntent>(this, RequestIntent.REFLEXORDER);
414        if ("filler-order".equals(codeString))
415          return new Enumeration<RequestIntent>(this, RequestIntent.FILLERORDER);
416        if ("instance-order".equals(codeString))
417          return new Enumeration<RequestIntent>(this, RequestIntent.INSTANCEORDER);
418        if ("option".equals(codeString))
419          return new Enumeration<RequestIntent>(this, RequestIntent.OPTION);
420        throw new FHIRException("Unknown RequestIntent code '"+codeString+"'");
421        }
422    public String toCode(RequestIntent code) {
423      if (code == RequestIntent.PROPOSAL)
424        return "proposal";
425      if (code == RequestIntent.PLAN)
426        return "plan";
427      if (code == RequestIntent.DIRECTIVE)
428        return "directive";
429      if (code == RequestIntent.ORDER)
430        return "order";
431      if (code == RequestIntent.ORIGINALORDER)
432        return "original-order";
433      if (code == RequestIntent.REFLEXORDER)
434        return "reflex-order";
435      if (code == RequestIntent.FILLERORDER)
436        return "filler-order";
437      if (code == RequestIntent.INSTANCEORDER)
438        return "instance-order";
439      if (code == RequestIntent.OPTION)
440        return "option";
441      return "?";
442      }
443    public String toSystem(RequestIntent code) {
444      return code.getSystem();
445      }
446    }
447
448    public enum RequestPriority {
449        /**
450         * The request has normal priority.
451         */
452        ROUTINE, 
453        /**
454         * The request should be actioned promptly - higher priority than routine.
455         */
456        URGENT, 
457        /**
458         * The request should be actioned as soon as possible - higher priority than urgent.
459         */
460        ASAP, 
461        /**
462         * The request should be actioned immediately - highest possible priority.  E.g. an emergency.
463         */
464        STAT, 
465        /**
466         * added to help the parsers with the generic types
467         */
468        NULL;
469        public static RequestPriority fromCode(String codeString) throws FHIRException {
470            if (codeString == null || "".equals(codeString))
471                return null;
472        if ("routine".equals(codeString))
473          return ROUTINE;
474        if ("urgent".equals(codeString))
475          return URGENT;
476        if ("asap".equals(codeString))
477          return ASAP;
478        if ("stat".equals(codeString))
479          return STAT;
480        if (Configuration.isAcceptInvalidEnums())
481          return null;
482        else
483          throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
484        }
485        public String toCode() {
486          switch (this) {
487            case ROUTINE: return "routine";
488            case URGENT: return "urgent";
489            case ASAP: return "asap";
490            case STAT: return "stat";
491            default: return "?";
492          }
493        }
494        public String getSystem() {
495          switch (this) {
496            case ROUTINE: return "http://hl7.org/fhir/request-priority";
497            case URGENT: return "http://hl7.org/fhir/request-priority";
498            case ASAP: return "http://hl7.org/fhir/request-priority";
499            case STAT: return "http://hl7.org/fhir/request-priority";
500            default: return "?";
501          }
502        }
503        public String getDefinition() {
504          switch (this) {
505            case ROUTINE: return "The request has normal priority.";
506            case URGENT: return "The request should be actioned promptly - higher priority than routine.";
507            case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent.";
508            case STAT: return "The request should be actioned immediately - highest possible priority.  E.g. an emergency.";
509            default: return "?";
510          }
511        }
512        public String getDisplay() {
513          switch (this) {
514            case ROUTINE: return "Routine";
515            case URGENT: return "Urgent";
516            case ASAP: return "ASAP";
517            case STAT: return "STAT";
518            default: return "?";
519          }
520        }
521    }
522
523  public static class RequestPriorityEnumFactory implements EnumFactory<RequestPriority> {
524    public RequestPriority fromCode(String codeString) throws IllegalArgumentException {
525      if (codeString == null || "".equals(codeString))
526            if (codeString == null || "".equals(codeString))
527                return null;
528        if ("routine".equals(codeString))
529          return RequestPriority.ROUTINE;
530        if ("urgent".equals(codeString))
531          return RequestPriority.URGENT;
532        if ("asap".equals(codeString))
533          return RequestPriority.ASAP;
534        if ("stat".equals(codeString))
535          return RequestPriority.STAT;
536        throw new IllegalArgumentException("Unknown RequestPriority code '"+codeString+"'");
537        }
538        public Enumeration<RequestPriority> fromType(Base code) throws FHIRException {
539          if (code == null)
540            return null;
541          if (code.isEmpty())
542            return new Enumeration<RequestPriority>(this);
543          String codeString = ((PrimitiveType) code).asStringValue();
544          if (codeString == null || "".equals(codeString))
545            return null;
546        if ("routine".equals(codeString))
547          return new Enumeration<RequestPriority>(this, RequestPriority.ROUTINE);
548        if ("urgent".equals(codeString))
549          return new Enumeration<RequestPriority>(this, RequestPriority.URGENT);
550        if ("asap".equals(codeString))
551          return new Enumeration<RequestPriority>(this, RequestPriority.ASAP);
552        if ("stat".equals(codeString))
553          return new Enumeration<RequestPriority>(this, RequestPriority.STAT);
554        throw new FHIRException("Unknown RequestPriority code '"+codeString+"'");
555        }
556    public String toCode(RequestPriority code) {
557      if (code == RequestPriority.ROUTINE)
558        return "routine";
559      if (code == RequestPriority.URGENT)
560        return "urgent";
561      if (code == RequestPriority.ASAP)
562        return "asap";
563      if (code == RequestPriority.STAT)
564        return "stat";
565      return "?";
566      }
567    public String toSystem(RequestPriority code) {
568      return code.getSystem();
569      }
570    }
571
572    public enum ActionConditionKind {
573        /**
574         * The condition describes whether or not a given action is applicable.
575         */
576        APPLICABILITY, 
577        /**
578         * The condition is a starting condition for the action.
579         */
580        START, 
581        /**
582         * The condition is a stop, or exit condition for the action.
583         */
584        STOP, 
585        /**
586         * added to help the parsers with the generic types
587         */
588        NULL;
589        public static ActionConditionKind fromCode(String codeString) throws FHIRException {
590            if (codeString == null || "".equals(codeString))
591                return null;
592        if ("applicability".equals(codeString))
593          return APPLICABILITY;
594        if ("start".equals(codeString))
595          return START;
596        if ("stop".equals(codeString))
597          return STOP;
598        if (Configuration.isAcceptInvalidEnums())
599          return null;
600        else
601          throw new FHIRException("Unknown ActionConditionKind code '"+codeString+"'");
602        }
603        public String toCode() {
604          switch (this) {
605            case APPLICABILITY: return "applicability";
606            case START: return "start";
607            case STOP: return "stop";
608            default: return "?";
609          }
610        }
611        public String getSystem() {
612          switch (this) {
613            case APPLICABILITY: return "http://hl7.org/fhir/action-condition-kind";
614            case START: return "http://hl7.org/fhir/action-condition-kind";
615            case STOP: return "http://hl7.org/fhir/action-condition-kind";
616            default: return "?";
617          }
618        }
619        public String getDefinition() {
620          switch (this) {
621            case APPLICABILITY: return "The condition describes whether or not a given action is applicable.";
622            case START: return "The condition is a starting condition for the action.";
623            case STOP: return "The condition is a stop, or exit condition for the action.";
624            default: return "?";
625          }
626        }
627        public String getDisplay() {
628          switch (this) {
629            case APPLICABILITY: return "Applicability";
630            case START: return "Start";
631            case STOP: return "Stop";
632            default: return "?";
633          }
634        }
635    }
636
637  public static class ActionConditionKindEnumFactory implements EnumFactory<ActionConditionKind> {
638    public ActionConditionKind fromCode(String codeString) throws IllegalArgumentException {
639      if (codeString == null || "".equals(codeString))
640            if (codeString == null || "".equals(codeString))
641                return null;
642        if ("applicability".equals(codeString))
643          return ActionConditionKind.APPLICABILITY;
644        if ("start".equals(codeString))
645          return ActionConditionKind.START;
646        if ("stop".equals(codeString))
647          return ActionConditionKind.STOP;
648        throw new IllegalArgumentException("Unknown ActionConditionKind code '"+codeString+"'");
649        }
650        public Enumeration<ActionConditionKind> fromType(Base code) throws FHIRException {
651          if (code == null)
652            return null;
653          if (code.isEmpty())
654            return new Enumeration<ActionConditionKind>(this);
655          String codeString = ((PrimitiveType) code).asStringValue();
656          if (codeString == null || "".equals(codeString))
657            return null;
658        if ("applicability".equals(codeString))
659          return new Enumeration<ActionConditionKind>(this, ActionConditionKind.APPLICABILITY);
660        if ("start".equals(codeString))
661          return new Enumeration<ActionConditionKind>(this, ActionConditionKind.START);
662        if ("stop".equals(codeString))
663          return new Enumeration<ActionConditionKind>(this, ActionConditionKind.STOP);
664        throw new FHIRException("Unknown ActionConditionKind code '"+codeString+"'");
665        }
666    public String toCode(ActionConditionKind code) {
667      if (code == ActionConditionKind.APPLICABILITY)
668        return "applicability";
669      if (code == ActionConditionKind.START)
670        return "start";
671      if (code == ActionConditionKind.STOP)
672        return "stop";
673      return "?";
674      }
675    public String toSystem(ActionConditionKind code) {
676      return code.getSystem();
677      }
678    }
679
680    public enum ActionRelationshipType {
681        /**
682         * The action must be performed before the start of the related action.
683         */
684        BEFORESTART, 
685        /**
686         * The action must be performed before the related action.
687         */
688        BEFORE, 
689        /**
690         * The action must be performed before the end of the related action.
691         */
692        BEFOREEND, 
693        /**
694         * The action must be performed concurrent with the start of the related action.
695         */
696        CONCURRENTWITHSTART, 
697        /**
698         * The action must be performed concurrent with the related action.
699         */
700        CONCURRENT, 
701        /**
702         * The action must be performed concurrent with the end of the related action.
703         */
704        CONCURRENTWITHEND, 
705        /**
706         * The action must be performed after the start of the related action.
707         */
708        AFTERSTART, 
709        /**
710         * The action must be performed after the related action.
711         */
712        AFTER, 
713        /**
714         * The action must be performed after the end of the related action.
715         */
716        AFTEREND, 
717        /**
718         * added to help the parsers with the generic types
719         */
720        NULL;
721        public static ActionRelationshipType fromCode(String codeString) throws FHIRException {
722            if (codeString == null || "".equals(codeString))
723                return null;
724        if ("before-start".equals(codeString))
725          return BEFORESTART;
726        if ("before".equals(codeString))
727          return BEFORE;
728        if ("before-end".equals(codeString))
729          return BEFOREEND;
730        if ("concurrent-with-start".equals(codeString))
731          return CONCURRENTWITHSTART;
732        if ("concurrent".equals(codeString))
733          return CONCURRENT;
734        if ("concurrent-with-end".equals(codeString))
735          return CONCURRENTWITHEND;
736        if ("after-start".equals(codeString))
737          return AFTERSTART;
738        if ("after".equals(codeString))
739          return AFTER;
740        if ("after-end".equals(codeString))
741          return AFTEREND;
742        if (Configuration.isAcceptInvalidEnums())
743          return null;
744        else
745          throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
746        }
747        public String toCode() {
748          switch (this) {
749            case BEFORESTART: return "before-start";
750            case BEFORE: return "before";
751            case BEFOREEND: return "before-end";
752            case CONCURRENTWITHSTART: return "concurrent-with-start";
753            case CONCURRENT: return "concurrent";
754            case CONCURRENTWITHEND: return "concurrent-with-end";
755            case AFTERSTART: return "after-start";
756            case AFTER: return "after";
757            case AFTEREND: return "after-end";
758            default: return "?";
759          }
760        }
761        public String getSystem() {
762          switch (this) {
763            case BEFORESTART: return "http://hl7.org/fhir/action-relationship-type";
764            case BEFORE: return "http://hl7.org/fhir/action-relationship-type";
765            case BEFOREEND: return "http://hl7.org/fhir/action-relationship-type";
766            case CONCURRENTWITHSTART: return "http://hl7.org/fhir/action-relationship-type";
767            case CONCURRENT: return "http://hl7.org/fhir/action-relationship-type";
768            case CONCURRENTWITHEND: return "http://hl7.org/fhir/action-relationship-type";
769            case AFTERSTART: return "http://hl7.org/fhir/action-relationship-type";
770            case AFTER: return "http://hl7.org/fhir/action-relationship-type";
771            case AFTEREND: return "http://hl7.org/fhir/action-relationship-type";
772            default: return "?";
773          }
774        }
775        public String getDefinition() {
776          switch (this) {
777            case BEFORESTART: return "The action must be performed before the start of the related action.";
778            case BEFORE: return "The action must be performed before the related action.";
779            case BEFOREEND: return "The action must be performed before the end of the related action.";
780            case CONCURRENTWITHSTART: return "The action must be performed concurrent with the start of the related action.";
781            case CONCURRENT: return "The action must be performed concurrent with the related action.";
782            case CONCURRENTWITHEND: return "The action must be performed concurrent with the end of the related action.";
783            case AFTERSTART: return "The action must be performed after the start of the related action.";
784            case AFTER: return "The action must be performed after the related action.";
785            case AFTEREND: return "The action must be performed after the end of the related action.";
786            default: return "?";
787          }
788        }
789        public String getDisplay() {
790          switch (this) {
791            case BEFORESTART: return "Before Start";
792            case BEFORE: return "Before";
793            case BEFOREEND: return "Before End";
794            case CONCURRENTWITHSTART: return "Concurrent With Start";
795            case CONCURRENT: return "Concurrent";
796            case CONCURRENTWITHEND: return "Concurrent With End";
797            case AFTERSTART: return "After Start";
798            case AFTER: return "After";
799            case AFTEREND: return "After End";
800            default: return "?";
801          }
802        }
803    }
804
805  public static class ActionRelationshipTypeEnumFactory implements EnumFactory<ActionRelationshipType> {
806    public ActionRelationshipType fromCode(String codeString) throws IllegalArgumentException {
807      if (codeString == null || "".equals(codeString))
808            if (codeString == null || "".equals(codeString))
809                return null;
810        if ("before-start".equals(codeString))
811          return ActionRelationshipType.BEFORESTART;
812        if ("before".equals(codeString))
813          return ActionRelationshipType.BEFORE;
814        if ("before-end".equals(codeString))
815          return ActionRelationshipType.BEFOREEND;
816        if ("concurrent-with-start".equals(codeString))
817          return ActionRelationshipType.CONCURRENTWITHSTART;
818        if ("concurrent".equals(codeString))
819          return ActionRelationshipType.CONCURRENT;
820        if ("concurrent-with-end".equals(codeString))
821          return ActionRelationshipType.CONCURRENTWITHEND;
822        if ("after-start".equals(codeString))
823          return ActionRelationshipType.AFTERSTART;
824        if ("after".equals(codeString))
825          return ActionRelationshipType.AFTER;
826        if ("after-end".equals(codeString))
827          return ActionRelationshipType.AFTEREND;
828        throw new IllegalArgumentException("Unknown ActionRelationshipType code '"+codeString+"'");
829        }
830        public Enumeration<ActionRelationshipType> fromType(Base code) throws FHIRException {
831          if (code == null)
832            return null;
833          if (code.isEmpty())
834            return new Enumeration<ActionRelationshipType>(this);
835          String codeString = ((PrimitiveType) code).asStringValue();
836          if (codeString == null || "".equals(codeString))
837            return null;
838        if ("before-start".equals(codeString))
839          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.BEFORESTART);
840        if ("before".equals(codeString))
841          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.BEFORE);
842        if ("before-end".equals(codeString))
843          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.BEFOREEND);
844        if ("concurrent-with-start".equals(codeString))
845          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.CONCURRENTWITHSTART);
846        if ("concurrent".equals(codeString))
847          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.CONCURRENT);
848        if ("concurrent-with-end".equals(codeString))
849          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.CONCURRENTWITHEND);
850        if ("after-start".equals(codeString))
851          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.AFTERSTART);
852        if ("after".equals(codeString))
853          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.AFTER);
854        if ("after-end".equals(codeString))
855          return new Enumeration<ActionRelationshipType>(this, ActionRelationshipType.AFTEREND);
856        throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
857        }
858    public String toCode(ActionRelationshipType code) {
859      if (code == ActionRelationshipType.BEFORESTART)
860        return "before-start";
861      if (code == ActionRelationshipType.BEFORE)
862        return "before";
863      if (code == ActionRelationshipType.BEFOREEND)
864        return "before-end";
865      if (code == ActionRelationshipType.CONCURRENTWITHSTART)
866        return "concurrent-with-start";
867      if (code == ActionRelationshipType.CONCURRENT)
868        return "concurrent";
869      if (code == ActionRelationshipType.CONCURRENTWITHEND)
870        return "concurrent-with-end";
871      if (code == ActionRelationshipType.AFTERSTART)
872        return "after-start";
873      if (code == ActionRelationshipType.AFTER)
874        return "after";
875      if (code == ActionRelationshipType.AFTEREND)
876        return "after-end";
877      return "?";
878      }
879    public String toSystem(ActionRelationshipType code) {
880      return code.getSystem();
881      }
882    }
883
884    public enum ActionGroupingBehavior {
885        /**
886         * Any group marked with this behavior should be displayed as a visual group to the end user.
887         */
888        VISUALGROUP, 
889        /**
890         * A group with this behavior logically groups its sub-elements, and may be shown as a visual group to the end user, but it is not required to do so.
891         */
892        LOGICALGROUP, 
893        /**
894         * A group of related alternative actions is a sentence group if the target referenced by the action is the same in all the actions and each action simply constitutes a different variation on how to specify the details for the target. For example, two actions that could be in a SentenceGroup are "aspirin, 500 mg, 2 times per day" and "aspirin, 300 mg, 3 times per day". In both cases, aspirin is the target referenced by the action, and the two actions represent different options for how aspirin might be ordered for the patient. Note that a SentenceGroup would almost always have an associated selection behavior of "AtMostOne", unless it's a required action, in which case, it would be "ExactlyOne".
895         */
896        SENTENCEGROUP, 
897        /**
898         * added to help the parsers with the generic types
899         */
900        NULL;
901        public static ActionGroupingBehavior fromCode(String codeString) throws FHIRException {
902            if (codeString == null || "".equals(codeString))
903                return null;
904        if ("visual-group".equals(codeString))
905          return VISUALGROUP;
906        if ("logical-group".equals(codeString))
907          return LOGICALGROUP;
908        if ("sentence-group".equals(codeString))
909          return SENTENCEGROUP;
910        if (Configuration.isAcceptInvalidEnums())
911          return null;
912        else
913          throw new FHIRException("Unknown ActionGroupingBehavior code '"+codeString+"'");
914        }
915        public String toCode() {
916          switch (this) {
917            case VISUALGROUP: return "visual-group";
918            case LOGICALGROUP: return "logical-group";
919            case SENTENCEGROUP: return "sentence-group";
920            default: return "?";
921          }
922        }
923        public String getSystem() {
924          switch (this) {
925            case VISUALGROUP: return "http://hl7.org/fhir/action-grouping-behavior";
926            case LOGICALGROUP: return "http://hl7.org/fhir/action-grouping-behavior";
927            case SENTENCEGROUP: return "http://hl7.org/fhir/action-grouping-behavior";
928            default: return "?";
929          }
930        }
931        public String getDefinition() {
932          switch (this) {
933            case VISUALGROUP: return "Any group marked with this behavior should be displayed as a visual group to the end user.";
934            case LOGICALGROUP: return "A group with this behavior logically groups its sub-elements, and may be shown as a visual group to the end user, but it is not required to do so.";
935            case SENTENCEGROUP: return "A group of related alternative actions is a sentence group if the target referenced by the action is the same in all the actions and each action simply constitutes a different variation on how to specify the details for the target. For example, two actions that could be in a SentenceGroup are \"aspirin, 500 mg, 2 times per day\" and \"aspirin, 300 mg, 3 times per day\". In both cases, aspirin is the target referenced by the action, and the two actions represent different options for how aspirin might be ordered for the patient. Note that a SentenceGroup would almost always have an associated selection behavior of \"AtMostOne\", unless it's a required action, in which case, it would be \"ExactlyOne\".";
936            default: return "?";
937          }
938        }
939        public String getDisplay() {
940          switch (this) {
941            case VISUALGROUP: return "Visual Group";
942            case LOGICALGROUP: return "Logical Group";
943            case SENTENCEGROUP: return "Sentence Group";
944            default: return "?";
945          }
946        }
947    }
948
949  public static class ActionGroupingBehaviorEnumFactory implements EnumFactory<ActionGroupingBehavior> {
950    public ActionGroupingBehavior fromCode(String codeString) throws IllegalArgumentException {
951      if (codeString == null || "".equals(codeString))
952            if (codeString == null || "".equals(codeString))
953                return null;
954        if ("visual-group".equals(codeString))
955          return ActionGroupingBehavior.VISUALGROUP;
956        if ("logical-group".equals(codeString))
957          return ActionGroupingBehavior.LOGICALGROUP;
958        if ("sentence-group".equals(codeString))
959          return ActionGroupingBehavior.SENTENCEGROUP;
960        throw new IllegalArgumentException("Unknown ActionGroupingBehavior code '"+codeString+"'");
961        }
962        public Enumeration<ActionGroupingBehavior> fromType(Base code) throws FHIRException {
963          if (code == null)
964            return null;
965          if (code.isEmpty())
966            return new Enumeration<ActionGroupingBehavior>(this);
967          String codeString = ((PrimitiveType) code).asStringValue();
968          if (codeString == null || "".equals(codeString))
969            return null;
970        if ("visual-group".equals(codeString))
971          return new Enumeration<ActionGroupingBehavior>(this, ActionGroupingBehavior.VISUALGROUP);
972        if ("logical-group".equals(codeString))
973          return new Enumeration<ActionGroupingBehavior>(this, ActionGroupingBehavior.LOGICALGROUP);
974        if ("sentence-group".equals(codeString))
975          return new Enumeration<ActionGroupingBehavior>(this, ActionGroupingBehavior.SENTENCEGROUP);
976        throw new FHIRException("Unknown ActionGroupingBehavior code '"+codeString+"'");
977        }
978    public String toCode(ActionGroupingBehavior code) {
979      if (code == ActionGroupingBehavior.VISUALGROUP)
980        return "visual-group";
981      if (code == ActionGroupingBehavior.LOGICALGROUP)
982        return "logical-group";
983      if (code == ActionGroupingBehavior.SENTENCEGROUP)
984        return "sentence-group";
985      return "?";
986      }
987    public String toSystem(ActionGroupingBehavior code) {
988      return code.getSystem();
989      }
990    }
991
992    public enum ActionSelectionBehavior {
993        /**
994         * Any number of the actions in the group may be chosen, from zero to all.
995         */
996        ANY, 
997        /**
998         * All the actions in the group must be selected as a single unit.
999         */
1000        ALL, 
1001        /**
1002         * All the actions in the group are meant to be chosen as a single unit: either all must be selected by the end user, or none may be selected.
1003         */
1004        ALLORNONE, 
1005        /**
1006         * The end user must choose one and only one of the selectable actions in the group. The user SHALL NOT choose none of the actions in the group.
1007         */
1008        EXACTLYONE, 
1009        /**
1010         * The end user may choose zero or at most one of the actions in the group.
1011         */
1012        ATMOSTONE, 
1013        /**
1014         * The end user must choose a minimum of one, and as many additional as desired.
1015         */
1016        ONEORMORE, 
1017        /**
1018         * added to help the parsers with the generic types
1019         */
1020        NULL;
1021        public static ActionSelectionBehavior fromCode(String codeString) throws FHIRException {
1022            if (codeString == null || "".equals(codeString))
1023                return null;
1024        if ("any".equals(codeString))
1025          return ANY;
1026        if ("all".equals(codeString))
1027          return ALL;
1028        if ("all-or-none".equals(codeString))
1029          return ALLORNONE;
1030        if ("exactly-one".equals(codeString))
1031          return EXACTLYONE;
1032        if ("at-most-one".equals(codeString))
1033          return ATMOSTONE;
1034        if ("one-or-more".equals(codeString))
1035          return ONEORMORE;
1036        if (Configuration.isAcceptInvalidEnums())
1037          return null;
1038        else
1039          throw new FHIRException("Unknown ActionSelectionBehavior code '"+codeString+"'");
1040        }
1041        public String toCode() {
1042          switch (this) {
1043            case ANY: return "any";
1044            case ALL: return "all";
1045            case ALLORNONE: return "all-or-none";
1046            case EXACTLYONE: return "exactly-one";
1047            case ATMOSTONE: return "at-most-one";
1048            case ONEORMORE: return "one-or-more";
1049            default: return "?";
1050          }
1051        }
1052        public String getSystem() {
1053          switch (this) {
1054            case ANY: return "http://hl7.org/fhir/action-selection-behavior";
1055            case ALL: return "http://hl7.org/fhir/action-selection-behavior";
1056            case ALLORNONE: return "http://hl7.org/fhir/action-selection-behavior";
1057            case EXACTLYONE: return "http://hl7.org/fhir/action-selection-behavior";
1058            case ATMOSTONE: return "http://hl7.org/fhir/action-selection-behavior";
1059            case ONEORMORE: return "http://hl7.org/fhir/action-selection-behavior";
1060            default: return "?";
1061          }
1062        }
1063        public String getDefinition() {
1064          switch (this) {
1065            case ANY: return "Any number of the actions in the group may be chosen, from zero to all.";
1066            case ALL: return "All the actions in the group must be selected as a single unit.";
1067            case ALLORNONE: return "All the actions in the group are meant to be chosen as a single unit: either all must be selected by the end user, or none may be selected.";
1068            case EXACTLYONE: return "The end user must choose one and only one of the selectable actions in the group. The user SHALL NOT choose none of the actions in the group.";
1069            case ATMOSTONE: return "The end user may choose zero or at most one of the actions in the group.";
1070            case ONEORMORE: return "The end user must choose a minimum of one, and as many additional as desired.";
1071            default: return "?";
1072          }
1073        }
1074        public String getDisplay() {
1075          switch (this) {
1076            case ANY: return "Any";
1077            case ALL: return "All";
1078            case ALLORNONE: return "All Or None";
1079            case EXACTLYONE: return "Exactly One";
1080            case ATMOSTONE: return "At Most One";
1081            case ONEORMORE: return "One Or More";
1082            default: return "?";
1083          }
1084        }
1085    }
1086
1087  public static class ActionSelectionBehaviorEnumFactory implements EnumFactory<ActionSelectionBehavior> {
1088    public ActionSelectionBehavior fromCode(String codeString) throws IllegalArgumentException {
1089      if (codeString == null || "".equals(codeString))
1090            if (codeString == null || "".equals(codeString))
1091                return null;
1092        if ("any".equals(codeString))
1093          return ActionSelectionBehavior.ANY;
1094        if ("all".equals(codeString))
1095          return ActionSelectionBehavior.ALL;
1096        if ("all-or-none".equals(codeString))
1097          return ActionSelectionBehavior.ALLORNONE;
1098        if ("exactly-one".equals(codeString))
1099          return ActionSelectionBehavior.EXACTLYONE;
1100        if ("at-most-one".equals(codeString))
1101          return ActionSelectionBehavior.ATMOSTONE;
1102        if ("one-or-more".equals(codeString))
1103          return ActionSelectionBehavior.ONEORMORE;
1104        throw new IllegalArgumentException("Unknown ActionSelectionBehavior code '"+codeString+"'");
1105        }
1106        public Enumeration<ActionSelectionBehavior> fromType(Base code) throws FHIRException {
1107          if (code == null)
1108            return null;
1109          if (code.isEmpty())
1110            return new Enumeration<ActionSelectionBehavior>(this);
1111          String codeString = ((PrimitiveType) code).asStringValue();
1112          if (codeString == null || "".equals(codeString))
1113            return null;
1114        if ("any".equals(codeString))
1115          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ANY);
1116        if ("all".equals(codeString))
1117          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ALL);
1118        if ("all-or-none".equals(codeString))
1119          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ALLORNONE);
1120        if ("exactly-one".equals(codeString))
1121          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.EXACTLYONE);
1122        if ("at-most-one".equals(codeString))
1123          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ATMOSTONE);
1124        if ("one-or-more".equals(codeString))
1125          return new Enumeration<ActionSelectionBehavior>(this, ActionSelectionBehavior.ONEORMORE);
1126        throw new FHIRException("Unknown ActionSelectionBehavior code '"+codeString+"'");
1127        }
1128    public String toCode(ActionSelectionBehavior code) {
1129      if (code == ActionSelectionBehavior.ANY)
1130        return "any";
1131      if (code == ActionSelectionBehavior.ALL)
1132        return "all";
1133      if (code == ActionSelectionBehavior.ALLORNONE)
1134        return "all-or-none";
1135      if (code == ActionSelectionBehavior.EXACTLYONE)
1136        return "exactly-one";
1137      if (code == ActionSelectionBehavior.ATMOSTONE)
1138        return "at-most-one";
1139      if (code == ActionSelectionBehavior.ONEORMORE)
1140        return "one-or-more";
1141      return "?";
1142      }
1143    public String toSystem(ActionSelectionBehavior code) {
1144      return code.getSystem();
1145      }
1146    }
1147
1148    public enum ActionRequiredBehavior {
1149        /**
1150         * An action with this behavior must be included in the actions processed by the end user; the end user SHALL NOT choose not to include this action.
1151         */
1152        MUST, 
1153        /**
1154         * An action with this behavior may be included in the set of actions processed by the end user.
1155         */
1156        COULD, 
1157        /**
1158         * An action with this behavior must be included in the set of actions processed by the end user, unless the end user provides documentation as to why the action was not included.
1159         */
1160        MUSTUNLESSDOCUMENTED, 
1161        /**
1162         * added to help the parsers with the generic types
1163         */
1164        NULL;
1165        public static ActionRequiredBehavior fromCode(String codeString) throws FHIRException {
1166            if (codeString == null || "".equals(codeString))
1167                return null;
1168        if ("must".equals(codeString))
1169          return MUST;
1170        if ("could".equals(codeString))
1171          return COULD;
1172        if ("must-unless-documented".equals(codeString))
1173          return MUSTUNLESSDOCUMENTED;
1174        if (Configuration.isAcceptInvalidEnums())
1175          return null;
1176        else
1177          throw new FHIRException("Unknown ActionRequiredBehavior code '"+codeString+"'");
1178        }
1179        public String toCode() {
1180          switch (this) {
1181            case MUST: return "must";
1182            case COULD: return "could";
1183            case MUSTUNLESSDOCUMENTED: return "must-unless-documented";
1184            default: return "?";
1185          }
1186        }
1187        public String getSystem() {
1188          switch (this) {
1189            case MUST: return "http://hl7.org/fhir/action-required-behavior";
1190            case COULD: return "http://hl7.org/fhir/action-required-behavior";
1191            case MUSTUNLESSDOCUMENTED: return "http://hl7.org/fhir/action-required-behavior";
1192            default: return "?";
1193          }
1194        }
1195        public String getDefinition() {
1196          switch (this) {
1197            case MUST: return "An action with this behavior must be included in the actions processed by the end user; the end user SHALL NOT choose not to include this action.";
1198            case COULD: return "An action with this behavior may be included in the set of actions processed by the end user.";
1199            case MUSTUNLESSDOCUMENTED: return "An action with this behavior must be included in the set of actions processed by the end user, unless the end user provides documentation as to why the action was not included.";
1200            default: return "?";
1201          }
1202        }
1203        public String getDisplay() {
1204          switch (this) {
1205            case MUST: return "Must";
1206            case COULD: return "Could";
1207            case MUSTUNLESSDOCUMENTED: return "Must Unless Documented";
1208            default: return "?";
1209          }
1210        }
1211    }
1212
1213  public static class ActionRequiredBehaviorEnumFactory implements EnumFactory<ActionRequiredBehavior> {
1214    public ActionRequiredBehavior fromCode(String codeString) throws IllegalArgumentException {
1215      if (codeString == null || "".equals(codeString))
1216            if (codeString == null || "".equals(codeString))
1217                return null;
1218        if ("must".equals(codeString))
1219          return ActionRequiredBehavior.MUST;
1220        if ("could".equals(codeString))
1221          return ActionRequiredBehavior.COULD;
1222        if ("must-unless-documented".equals(codeString))
1223          return ActionRequiredBehavior.MUSTUNLESSDOCUMENTED;
1224        throw new IllegalArgumentException("Unknown ActionRequiredBehavior code '"+codeString+"'");
1225        }
1226        public Enumeration<ActionRequiredBehavior> fromType(Base code) throws FHIRException {
1227          if (code == null)
1228            return null;
1229          if (code.isEmpty())
1230            return new Enumeration<ActionRequiredBehavior>(this);
1231          String codeString = ((PrimitiveType) code).asStringValue();
1232          if (codeString == null || "".equals(codeString))
1233            return null;
1234        if ("must".equals(codeString))
1235          return new Enumeration<ActionRequiredBehavior>(this, ActionRequiredBehavior.MUST);
1236        if ("could".equals(codeString))
1237          return new Enumeration<ActionRequiredBehavior>(this, ActionRequiredBehavior.COULD);
1238        if ("must-unless-documented".equals(codeString))
1239          return new Enumeration<ActionRequiredBehavior>(this, ActionRequiredBehavior.MUSTUNLESSDOCUMENTED);
1240        throw new FHIRException("Unknown ActionRequiredBehavior code '"+codeString+"'");
1241        }
1242    public String toCode(ActionRequiredBehavior code) {
1243      if (code == ActionRequiredBehavior.MUST)
1244        return "must";
1245      if (code == ActionRequiredBehavior.COULD)
1246        return "could";
1247      if (code == ActionRequiredBehavior.MUSTUNLESSDOCUMENTED)
1248        return "must-unless-documented";
1249      return "?";
1250      }
1251    public String toSystem(ActionRequiredBehavior code) {
1252      return code.getSystem();
1253      }
1254    }
1255
1256    public enum ActionPrecheckBehavior {
1257        /**
1258         * An action with this behavior is one of the most frequent action that is, or should be, included by an end user, for the particular context in which the action occurs. The system displaying the action to the end user should consider "pre-checking" such an action as a convenience for the user.
1259         */
1260        YES, 
1261        /**
1262         * An action with this behavior is one of the less frequent actions included by the end user, for the particular context in which the action occurs. The system displaying the actions to the end user would typically not "pre-check" such an action.
1263         */
1264        NO, 
1265        /**
1266         * added to help the parsers with the generic types
1267         */
1268        NULL;
1269        public static ActionPrecheckBehavior fromCode(String codeString) throws FHIRException {
1270            if (codeString == null || "".equals(codeString))
1271                return null;
1272        if ("yes".equals(codeString))
1273          return YES;
1274        if ("no".equals(codeString))
1275          return NO;
1276        if (Configuration.isAcceptInvalidEnums())
1277          return null;
1278        else
1279          throw new FHIRException("Unknown ActionPrecheckBehavior code '"+codeString+"'");
1280        }
1281        public String toCode() {
1282          switch (this) {
1283            case YES: return "yes";
1284            case NO: return "no";
1285            default: return "?";
1286          }
1287        }
1288        public String getSystem() {
1289          switch (this) {
1290            case YES: return "http://hl7.org/fhir/action-precheck-behavior";
1291            case NO: return "http://hl7.org/fhir/action-precheck-behavior";
1292            default: return "?";
1293          }
1294        }
1295        public String getDefinition() {
1296          switch (this) {
1297            case YES: return "An action with this behavior is one of the most frequent action that is, or should be, included by an end user, for the particular context in which the action occurs. The system displaying the action to the end user should consider \"pre-checking\" such an action as a convenience for the user.";
1298            case NO: return "An action with this behavior is one of the less frequent actions included by the end user, for the particular context in which the action occurs. The system displaying the actions to the end user would typically not \"pre-check\" such an action.";
1299            default: return "?";
1300          }
1301        }
1302        public String getDisplay() {
1303          switch (this) {
1304            case YES: return "Yes";
1305            case NO: return "No";
1306            default: return "?";
1307          }
1308        }
1309    }
1310
1311  public static class ActionPrecheckBehaviorEnumFactory implements EnumFactory<ActionPrecheckBehavior> {
1312    public ActionPrecheckBehavior fromCode(String codeString) throws IllegalArgumentException {
1313      if (codeString == null || "".equals(codeString))
1314            if (codeString == null || "".equals(codeString))
1315                return null;
1316        if ("yes".equals(codeString))
1317          return ActionPrecheckBehavior.YES;
1318        if ("no".equals(codeString))
1319          return ActionPrecheckBehavior.NO;
1320        throw new IllegalArgumentException("Unknown ActionPrecheckBehavior code '"+codeString+"'");
1321        }
1322        public Enumeration<ActionPrecheckBehavior> fromType(Base code) throws FHIRException {
1323          if (code == null)
1324            return null;
1325          if (code.isEmpty())
1326            return new Enumeration<ActionPrecheckBehavior>(this);
1327          String codeString = ((PrimitiveType) code).asStringValue();
1328          if (codeString == null || "".equals(codeString))
1329            return null;
1330        if ("yes".equals(codeString))
1331          return new Enumeration<ActionPrecheckBehavior>(this, ActionPrecheckBehavior.YES);
1332        if ("no".equals(codeString))
1333          return new Enumeration<ActionPrecheckBehavior>(this, ActionPrecheckBehavior.NO);
1334        throw new FHIRException("Unknown ActionPrecheckBehavior code '"+codeString+"'");
1335        }
1336    public String toCode(ActionPrecheckBehavior code) {
1337      if (code == ActionPrecheckBehavior.YES)
1338        return "yes";
1339      if (code == ActionPrecheckBehavior.NO)
1340        return "no";
1341      return "?";
1342      }
1343    public String toSystem(ActionPrecheckBehavior code) {
1344      return code.getSystem();
1345      }
1346    }
1347
1348    public enum ActionCardinalityBehavior {
1349        /**
1350         * The action may only be selected one time.
1351         */
1352        SINGLE, 
1353        /**
1354         * The action may be selected multiple times.
1355         */
1356        MULTIPLE, 
1357        /**
1358         * added to help the parsers with the generic types
1359         */
1360        NULL;
1361        public static ActionCardinalityBehavior fromCode(String codeString) throws FHIRException {
1362            if (codeString == null || "".equals(codeString))
1363                return null;
1364        if ("single".equals(codeString))
1365          return SINGLE;
1366        if ("multiple".equals(codeString))
1367          return MULTIPLE;
1368        if (Configuration.isAcceptInvalidEnums())
1369          return null;
1370        else
1371          throw new FHIRException("Unknown ActionCardinalityBehavior code '"+codeString+"'");
1372        }
1373        public String toCode() {
1374          switch (this) {
1375            case SINGLE: return "single";
1376            case MULTIPLE: return "multiple";
1377            default: return "?";
1378          }
1379        }
1380        public String getSystem() {
1381          switch (this) {
1382            case SINGLE: return "http://hl7.org/fhir/action-cardinality-behavior";
1383            case MULTIPLE: return "http://hl7.org/fhir/action-cardinality-behavior";
1384            default: return "?";
1385          }
1386        }
1387        public String getDefinition() {
1388          switch (this) {
1389            case SINGLE: return "The action may only be selected one time.";
1390            case MULTIPLE: return "The action may be selected multiple times.";
1391            default: return "?";
1392          }
1393        }
1394        public String getDisplay() {
1395          switch (this) {
1396            case SINGLE: return "Single";
1397            case MULTIPLE: return "Multiple";
1398            default: return "?";
1399          }
1400        }
1401    }
1402
1403  public static class ActionCardinalityBehaviorEnumFactory implements EnumFactory<ActionCardinalityBehavior> {
1404    public ActionCardinalityBehavior fromCode(String codeString) throws IllegalArgumentException {
1405      if (codeString == null || "".equals(codeString))
1406            if (codeString == null || "".equals(codeString))
1407                return null;
1408        if ("single".equals(codeString))
1409          return ActionCardinalityBehavior.SINGLE;
1410        if ("multiple".equals(codeString))
1411          return ActionCardinalityBehavior.MULTIPLE;
1412        throw new IllegalArgumentException("Unknown ActionCardinalityBehavior code '"+codeString+"'");
1413        }
1414        public Enumeration<ActionCardinalityBehavior> fromType(Base code) throws FHIRException {
1415          if (code == null)
1416            return null;
1417          if (code.isEmpty())
1418            return new Enumeration<ActionCardinalityBehavior>(this);
1419          String codeString = ((PrimitiveType) code).asStringValue();
1420          if (codeString == null || "".equals(codeString))
1421            return null;
1422        if ("single".equals(codeString))
1423          return new Enumeration<ActionCardinalityBehavior>(this, ActionCardinalityBehavior.SINGLE);
1424        if ("multiple".equals(codeString))
1425          return new Enumeration<ActionCardinalityBehavior>(this, ActionCardinalityBehavior.MULTIPLE);
1426        throw new FHIRException("Unknown ActionCardinalityBehavior code '"+codeString+"'");
1427        }
1428    public String toCode(ActionCardinalityBehavior code) {
1429      if (code == ActionCardinalityBehavior.SINGLE)
1430        return "single";
1431      if (code == ActionCardinalityBehavior.MULTIPLE)
1432        return "multiple";
1433      return "?";
1434      }
1435    public String toSystem(ActionCardinalityBehavior code) {
1436      return code.getSystem();
1437      }
1438    }
1439
1440    @Block()
1441    public static class RequestGroupActionComponent extends BackboneElement implements IBaseBackboneElement {
1442        /**
1443         * A user-visible prefix for the action.
1444         */
1445        @Child(name = "prefix", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1446        @Description(shortDefinition="User-visible prefix for the action (e.g. 1. or A.)", formalDefinition="A user-visible prefix for the action." )
1447        protected StringType prefix;
1448
1449        /**
1450         * The title of the action displayed to a user.
1451         */
1452        @Child(name = "title", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1453        @Description(shortDefinition="User-visible title", formalDefinition="The title of the action displayed to a user." )
1454        protected StringType title;
1455
1456        /**
1457         * A short description of the action used to provide a summary to display to the user.
1458         */
1459        @Child(name = "description", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1460        @Description(shortDefinition="Short description of the action", formalDefinition="A short description of the action used to provide a summary to display to the user." )
1461        protected StringType description;
1462
1463        /**
1464         * A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
1465         */
1466        @Child(name = "textEquivalent", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1467        @Description(shortDefinition="Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system", formalDefinition="A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically." )
1468        protected StringType textEquivalent;
1469
1470        /**
1471         * Indicates how quickly the action should be addressed with respect to other actions.
1472         */
1473        @Child(name = "priority", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
1474        @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the action should be addressed with respect to other actions." )
1475        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
1476        protected Enumeration<RequestPriority> priority;
1477
1478        /**
1479         * A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a section of a documentation template.
1480         */
1481        @Child(name = "code", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1482        @Description(shortDefinition="Code representing the meaning of the action or sub-actions", formalDefinition="A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a section of a documentation template." )
1483        protected List<CodeableConcept> code;
1484
1485        /**
1486         * Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.
1487         */
1488        @Child(name = "documentation", type = {RelatedArtifact.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1489        @Description(shortDefinition="Supporting documentation for the intended performer of the action", formalDefinition="Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources." )
1490        protected List<RelatedArtifact> documentation;
1491
1492        /**
1493         * An expression that describes applicability criteria, or start/stop conditions for the action.
1494         */
1495        @Child(name = "condition", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1496        @Description(shortDefinition="Whether or not the action is applicable", formalDefinition="An expression that describes applicability criteria, or start/stop conditions for the action." )
1497        protected List<RequestGroupActionConditionComponent> condition;
1498
1499        /**
1500         * A relationship to another action such as "before" or "30-60 minutes after start of".
1501         */
1502        @Child(name = "relatedAction", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1503        @Description(shortDefinition="Relationship to another action", formalDefinition="A relationship to another action such as \"before\" or \"30-60 minutes after start of\"." )
1504        protected List<RequestGroupActionRelatedActionComponent> relatedAction;
1505
1506        /**
1507         * An optional value describing when the action should be performed.
1508         */
1509        @Child(name = "timing", type = {DateTimeType.class, Age.class, Period.class, Duration.class, Range.class, Timing.class}, order=10, min=0, max=1, modifier=false, summary=false)
1510        @Description(shortDefinition="When the action should take place", formalDefinition="An optional value describing when the action should be performed." )
1511        protected Type timing;
1512
1513        /**
1514         * The participant that should perform or be responsible for this action.
1515         */
1516        @Child(name = "participant", type = {Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Device.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1517        @Description(shortDefinition="Who should perform the action", formalDefinition="The participant that should perform or be responsible for this action." )
1518        protected List<Reference> participant;
1519        /**
1520         * The actual objects that are the target of the reference (The participant that should perform or be responsible for this action.)
1521         */
1522        protected List<Resource> participantTarget;
1523
1524
1525        /**
1526         * The type of action to perform (create, update, remove).
1527         */
1528        @Child(name = "type", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
1529        @Description(shortDefinition="create | update | remove | fire-event", formalDefinition="The type of action to perform (create, update, remove)." )
1530        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-type")
1531        protected CodeableConcept type;
1532
1533        /**
1534         * Defines the grouping behavior for the action and its children.
1535         */
1536        @Child(name = "groupingBehavior", type = {CodeType.class}, order=13, min=0, max=1, modifier=false, summary=false)
1537        @Description(shortDefinition="visual-group | logical-group | sentence-group", formalDefinition="Defines the grouping behavior for the action and its children." )
1538        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-grouping-behavior")
1539        protected Enumeration<ActionGroupingBehavior> groupingBehavior;
1540
1541        /**
1542         * Defines the selection behavior for the action and its children.
1543         */
1544        @Child(name = "selectionBehavior", type = {CodeType.class}, order=14, min=0, max=1, modifier=false, summary=false)
1545        @Description(shortDefinition="any | all | all-or-none | exactly-one | at-most-one | one-or-more", formalDefinition="Defines the selection behavior for the action and its children." )
1546        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-selection-behavior")
1547        protected Enumeration<ActionSelectionBehavior> selectionBehavior;
1548
1549        /**
1550         * Defines expectations around whether an action is required.
1551         */
1552        @Child(name = "requiredBehavior", type = {CodeType.class}, order=15, min=0, max=1, modifier=false, summary=false)
1553        @Description(shortDefinition="must | could | must-unless-documented", formalDefinition="Defines expectations around whether an action is required." )
1554        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-required-behavior")
1555        protected Enumeration<ActionRequiredBehavior> requiredBehavior;
1556
1557        /**
1558         * Defines whether the action should usually be preselected.
1559         */
1560        @Child(name = "precheckBehavior", type = {CodeType.class}, order=16, min=0, max=1, modifier=false, summary=false)
1561        @Description(shortDefinition="yes | no", formalDefinition="Defines whether the action should usually be preselected." )
1562        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-precheck-behavior")
1563        protected Enumeration<ActionPrecheckBehavior> precheckBehavior;
1564
1565        /**
1566         * Defines whether the action can be selected multiple times.
1567         */
1568        @Child(name = "cardinalityBehavior", type = {CodeType.class}, order=17, min=0, max=1, modifier=false, summary=false)
1569        @Description(shortDefinition="single | multiple", formalDefinition="Defines whether the action can be selected multiple times." )
1570        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-cardinality-behavior")
1571        protected Enumeration<ActionCardinalityBehavior> cardinalityBehavior;
1572
1573        /**
1574         * The resource that is the target of the action (e.g. CommunicationRequest).
1575         */
1576        @Child(name = "resource", type = {Reference.class}, order=18, min=0, max=1, modifier=false, summary=false)
1577        @Description(shortDefinition="The target of the action", formalDefinition="The resource that is the target of the action (e.g. CommunicationRequest)." )
1578        protected Reference resource;
1579
1580        /**
1581         * The actual object that is the target of the reference (The resource that is the target of the action (e.g. CommunicationRequest).)
1582         */
1583        protected Resource resourceTarget;
1584
1585        /**
1586         * Sub actions.
1587         */
1588        @Child(name = "action", type = {RequestGroupActionComponent.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1589        @Description(shortDefinition="Sub action", formalDefinition="Sub actions." )
1590        protected List<RequestGroupActionComponent> action;
1591
1592        private static final long serialVersionUID = 296752321L;
1593
1594    /**
1595     * Constructor
1596     */
1597      public RequestGroupActionComponent() {
1598        super();
1599      }
1600
1601        /**
1602         * @return {@link #prefix} (A user-visible prefix for the action.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
1603         */
1604        public StringType getPrefixElement() { 
1605          if (this.prefix == null)
1606            if (Configuration.errorOnAutoCreate())
1607              throw new Error("Attempt to auto-create RequestGroupActionComponent.prefix");
1608            else if (Configuration.doAutoCreate())
1609              this.prefix = new StringType(); // bb
1610          return this.prefix;
1611        }
1612
1613        public boolean hasPrefixElement() { 
1614          return this.prefix != null && !this.prefix.isEmpty();
1615        }
1616
1617        public boolean hasPrefix() { 
1618          return this.prefix != null && !this.prefix.isEmpty();
1619        }
1620
1621        /**
1622         * @param value {@link #prefix} (A user-visible prefix for the action.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
1623         */
1624        public RequestGroupActionComponent setPrefixElement(StringType value) { 
1625          this.prefix = value;
1626          return this;
1627        }
1628
1629        /**
1630         * @return A user-visible prefix for the action.
1631         */
1632        public String getPrefix() { 
1633          return this.prefix == null ? null : this.prefix.getValue();
1634        }
1635
1636        /**
1637         * @param value A user-visible prefix for the action.
1638         */
1639        public RequestGroupActionComponent setPrefix(String value) { 
1640          if (Utilities.noString(value))
1641            this.prefix = null;
1642          else {
1643            if (this.prefix == null)
1644              this.prefix = new StringType();
1645            this.prefix.setValue(value);
1646          }
1647          return this;
1648        }
1649
1650        /**
1651         * @return {@link #title} (The title of the action displayed to a user.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1652         */
1653        public StringType getTitleElement() { 
1654          if (this.title == null)
1655            if (Configuration.errorOnAutoCreate())
1656              throw new Error("Attempt to auto-create RequestGroupActionComponent.title");
1657            else if (Configuration.doAutoCreate())
1658              this.title = new StringType(); // bb
1659          return this.title;
1660        }
1661
1662        public boolean hasTitleElement() { 
1663          return this.title != null && !this.title.isEmpty();
1664        }
1665
1666        public boolean hasTitle() { 
1667          return this.title != null && !this.title.isEmpty();
1668        }
1669
1670        /**
1671         * @param value {@link #title} (The title of the action displayed to a user.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1672         */
1673        public RequestGroupActionComponent setTitleElement(StringType value) { 
1674          this.title = value;
1675          return this;
1676        }
1677
1678        /**
1679         * @return The title of the action displayed to a user.
1680         */
1681        public String getTitle() { 
1682          return this.title == null ? null : this.title.getValue();
1683        }
1684
1685        /**
1686         * @param value The title of the action displayed to a user.
1687         */
1688        public RequestGroupActionComponent setTitle(String value) { 
1689          if (Utilities.noString(value))
1690            this.title = null;
1691          else {
1692            if (this.title == null)
1693              this.title = new StringType();
1694            this.title.setValue(value);
1695          }
1696          return this;
1697        }
1698
1699        /**
1700         * @return {@link #description} (A short description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1701         */
1702        public StringType getDescriptionElement() { 
1703          if (this.description == null)
1704            if (Configuration.errorOnAutoCreate())
1705              throw new Error("Attempt to auto-create RequestGroupActionComponent.description");
1706            else if (Configuration.doAutoCreate())
1707              this.description = new StringType(); // bb
1708          return this.description;
1709        }
1710
1711        public boolean hasDescriptionElement() { 
1712          return this.description != null && !this.description.isEmpty();
1713        }
1714
1715        public boolean hasDescription() { 
1716          return this.description != null && !this.description.isEmpty();
1717        }
1718
1719        /**
1720         * @param value {@link #description} (A short description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1721         */
1722        public RequestGroupActionComponent setDescriptionElement(StringType value) { 
1723          this.description = value;
1724          return this;
1725        }
1726
1727        /**
1728         * @return A short description of the action used to provide a summary to display to the user.
1729         */
1730        public String getDescription() { 
1731          return this.description == null ? null : this.description.getValue();
1732        }
1733
1734        /**
1735         * @param value A short description of the action used to provide a summary to display to the user.
1736         */
1737        public RequestGroupActionComponent setDescription(String value) { 
1738          if (Utilities.noString(value))
1739            this.description = null;
1740          else {
1741            if (this.description == null)
1742              this.description = new StringType();
1743            this.description.setValue(value);
1744          }
1745          return this;
1746        }
1747
1748        /**
1749         * @return {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
1750         */
1751        public StringType getTextEquivalentElement() { 
1752          if (this.textEquivalent == null)
1753            if (Configuration.errorOnAutoCreate())
1754              throw new Error("Attempt to auto-create RequestGroupActionComponent.textEquivalent");
1755            else if (Configuration.doAutoCreate())
1756              this.textEquivalent = new StringType(); // bb
1757          return this.textEquivalent;
1758        }
1759
1760        public boolean hasTextEquivalentElement() { 
1761          return this.textEquivalent != null && !this.textEquivalent.isEmpty();
1762        }
1763
1764        public boolean hasTextEquivalent() { 
1765          return this.textEquivalent != null && !this.textEquivalent.isEmpty();
1766        }
1767
1768        /**
1769         * @param value {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
1770         */
1771        public RequestGroupActionComponent setTextEquivalentElement(StringType value) { 
1772          this.textEquivalent = value;
1773          return this;
1774        }
1775
1776        /**
1777         * @return A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
1778         */
1779        public String getTextEquivalent() { 
1780          return this.textEquivalent == null ? null : this.textEquivalent.getValue();
1781        }
1782
1783        /**
1784         * @param value A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
1785         */
1786        public RequestGroupActionComponent setTextEquivalent(String value) { 
1787          if (Utilities.noString(value))
1788            this.textEquivalent = null;
1789          else {
1790            if (this.textEquivalent == null)
1791              this.textEquivalent = new StringType();
1792            this.textEquivalent.setValue(value);
1793          }
1794          return this;
1795        }
1796
1797        /**
1798         * @return {@link #priority} (Indicates how quickly the action should be addressed with respect to other actions.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1799         */
1800        public Enumeration<RequestPriority> getPriorityElement() { 
1801          if (this.priority == null)
1802            if (Configuration.errorOnAutoCreate())
1803              throw new Error("Attempt to auto-create RequestGroupActionComponent.priority");
1804            else if (Configuration.doAutoCreate())
1805              this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
1806          return this.priority;
1807        }
1808
1809        public boolean hasPriorityElement() { 
1810          return this.priority != null && !this.priority.isEmpty();
1811        }
1812
1813        public boolean hasPriority() { 
1814          return this.priority != null && !this.priority.isEmpty();
1815        }
1816
1817        /**
1818         * @param value {@link #priority} (Indicates how quickly the action should be addressed with respect to other actions.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
1819         */
1820        public RequestGroupActionComponent setPriorityElement(Enumeration<RequestPriority> value) { 
1821          this.priority = value;
1822          return this;
1823        }
1824
1825        /**
1826         * @return Indicates how quickly the action should be addressed with respect to other actions.
1827         */
1828        public RequestPriority getPriority() { 
1829          return this.priority == null ? null : this.priority.getValue();
1830        }
1831
1832        /**
1833         * @param value Indicates how quickly the action should be addressed with respect to other actions.
1834         */
1835        public RequestGroupActionComponent setPriority(RequestPriority value) { 
1836          if (value == null)
1837            this.priority = null;
1838          else {
1839            if (this.priority == null)
1840              this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
1841            this.priority.setValue(value);
1842          }
1843          return this;
1844        }
1845
1846        /**
1847         * @return {@link #code} (A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a section of a documentation template.)
1848         */
1849        public List<CodeableConcept> getCode() { 
1850          if (this.code == null)
1851            this.code = new ArrayList<CodeableConcept>();
1852          return this.code;
1853        }
1854
1855        /**
1856         * @return Returns a reference to <code>this</code> for easy method chaining
1857         */
1858        public RequestGroupActionComponent setCode(List<CodeableConcept> theCode) { 
1859          this.code = theCode;
1860          return this;
1861        }
1862
1863        public boolean hasCode() { 
1864          if (this.code == null)
1865            return false;
1866          for (CodeableConcept item : this.code)
1867            if (!item.isEmpty())
1868              return true;
1869          return false;
1870        }
1871
1872        public CodeableConcept addCode() { //3
1873          CodeableConcept t = new CodeableConcept();
1874          if (this.code == null)
1875            this.code = new ArrayList<CodeableConcept>();
1876          this.code.add(t);
1877          return t;
1878        }
1879
1880        public RequestGroupActionComponent addCode(CodeableConcept t) { //3
1881          if (t == null)
1882            return this;
1883          if (this.code == null)
1884            this.code = new ArrayList<CodeableConcept>();
1885          this.code.add(t);
1886          return this;
1887        }
1888
1889        /**
1890         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
1891         */
1892        public CodeableConcept getCodeFirstRep() { 
1893          if (getCode().isEmpty()) {
1894            addCode();
1895          }
1896          return getCode().get(0);
1897        }
1898
1899        /**
1900         * @return {@link #documentation} (Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.)
1901         */
1902        public List<RelatedArtifact> getDocumentation() { 
1903          if (this.documentation == null)
1904            this.documentation = new ArrayList<RelatedArtifact>();
1905          return this.documentation;
1906        }
1907
1908        /**
1909         * @return Returns a reference to <code>this</code> for easy method chaining
1910         */
1911        public RequestGroupActionComponent setDocumentation(List<RelatedArtifact> theDocumentation) { 
1912          this.documentation = theDocumentation;
1913          return this;
1914        }
1915
1916        public boolean hasDocumentation() { 
1917          if (this.documentation == null)
1918            return false;
1919          for (RelatedArtifact item : this.documentation)
1920            if (!item.isEmpty())
1921              return true;
1922          return false;
1923        }
1924
1925        public RelatedArtifact addDocumentation() { //3
1926          RelatedArtifact t = new RelatedArtifact();
1927          if (this.documentation == null)
1928            this.documentation = new ArrayList<RelatedArtifact>();
1929          this.documentation.add(t);
1930          return t;
1931        }
1932
1933        public RequestGroupActionComponent addDocumentation(RelatedArtifact t) { //3
1934          if (t == null)
1935            return this;
1936          if (this.documentation == null)
1937            this.documentation = new ArrayList<RelatedArtifact>();
1938          this.documentation.add(t);
1939          return this;
1940        }
1941
1942        /**
1943         * @return The first repetition of repeating field {@link #documentation}, creating it if it does not already exist
1944         */
1945        public RelatedArtifact getDocumentationFirstRep() { 
1946          if (getDocumentation().isEmpty()) {
1947            addDocumentation();
1948          }
1949          return getDocumentation().get(0);
1950        }
1951
1952        /**
1953         * @return {@link #condition} (An expression that describes applicability criteria, or start/stop conditions for the action.)
1954         */
1955        public List<RequestGroupActionConditionComponent> getCondition() { 
1956          if (this.condition == null)
1957            this.condition = new ArrayList<RequestGroupActionConditionComponent>();
1958          return this.condition;
1959        }
1960
1961        /**
1962         * @return Returns a reference to <code>this</code> for easy method chaining
1963         */
1964        public RequestGroupActionComponent setCondition(List<RequestGroupActionConditionComponent> theCondition) { 
1965          this.condition = theCondition;
1966          return this;
1967        }
1968
1969        public boolean hasCondition() { 
1970          if (this.condition == null)
1971            return false;
1972          for (RequestGroupActionConditionComponent item : this.condition)
1973            if (!item.isEmpty())
1974              return true;
1975          return false;
1976        }
1977
1978        public RequestGroupActionConditionComponent addCondition() { //3
1979          RequestGroupActionConditionComponent t = new RequestGroupActionConditionComponent();
1980          if (this.condition == null)
1981            this.condition = new ArrayList<RequestGroupActionConditionComponent>();
1982          this.condition.add(t);
1983          return t;
1984        }
1985
1986        public RequestGroupActionComponent addCondition(RequestGroupActionConditionComponent t) { //3
1987          if (t == null)
1988            return this;
1989          if (this.condition == null)
1990            this.condition = new ArrayList<RequestGroupActionConditionComponent>();
1991          this.condition.add(t);
1992          return this;
1993        }
1994
1995        /**
1996         * @return The first repetition of repeating field {@link #condition}, creating it if it does not already exist
1997         */
1998        public RequestGroupActionConditionComponent getConditionFirstRep() { 
1999          if (getCondition().isEmpty()) {
2000            addCondition();
2001          }
2002          return getCondition().get(0);
2003        }
2004
2005        /**
2006         * @return {@link #relatedAction} (A relationship to another action such as "before" or "30-60 minutes after start of".)
2007         */
2008        public List<RequestGroupActionRelatedActionComponent> getRelatedAction() { 
2009          if (this.relatedAction == null)
2010            this.relatedAction = new ArrayList<RequestGroupActionRelatedActionComponent>();
2011          return this.relatedAction;
2012        }
2013
2014        /**
2015         * @return Returns a reference to <code>this</code> for easy method chaining
2016         */
2017        public RequestGroupActionComponent setRelatedAction(List<RequestGroupActionRelatedActionComponent> theRelatedAction) { 
2018          this.relatedAction = theRelatedAction;
2019          return this;
2020        }
2021
2022        public boolean hasRelatedAction() { 
2023          if (this.relatedAction == null)
2024            return false;
2025          for (RequestGroupActionRelatedActionComponent item : this.relatedAction)
2026            if (!item.isEmpty())
2027              return true;
2028          return false;
2029        }
2030
2031        public RequestGroupActionRelatedActionComponent addRelatedAction() { //3
2032          RequestGroupActionRelatedActionComponent t = new RequestGroupActionRelatedActionComponent();
2033          if (this.relatedAction == null)
2034            this.relatedAction = new ArrayList<RequestGroupActionRelatedActionComponent>();
2035          this.relatedAction.add(t);
2036          return t;
2037        }
2038
2039        public RequestGroupActionComponent addRelatedAction(RequestGroupActionRelatedActionComponent t) { //3
2040          if (t == null)
2041            return this;
2042          if (this.relatedAction == null)
2043            this.relatedAction = new ArrayList<RequestGroupActionRelatedActionComponent>();
2044          this.relatedAction.add(t);
2045          return this;
2046        }
2047
2048        /**
2049         * @return The first repetition of repeating field {@link #relatedAction}, creating it if it does not already exist
2050         */
2051        public RequestGroupActionRelatedActionComponent getRelatedActionFirstRep() { 
2052          if (getRelatedAction().isEmpty()) {
2053            addRelatedAction();
2054          }
2055          return getRelatedAction().get(0);
2056        }
2057
2058        /**
2059         * @return {@link #timing} (An optional value describing when the action should be performed.)
2060         */
2061        public Type getTiming() { 
2062          return this.timing;
2063        }
2064
2065        /**
2066         * @return {@link #timing} (An optional value describing when the action should be performed.)
2067         */
2068        public DateTimeType getTimingDateTimeType() throws FHIRException { 
2069          if (this.timing == null)
2070            this.timing = new DateTimeType();
2071          if (!(this.timing instanceof DateTimeType))
2072            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered");
2073          return (DateTimeType) this.timing;
2074        }
2075
2076        public boolean hasTimingDateTimeType() { 
2077          return this != null && this.timing instanceof DateTimeType;
2078        }
2079
2080        /**
2081         * @return {@link #timing} (An optional value describing when the action should be performed.)
2082         */
2083        public Age getTimingAge() throws FHIRException { 
2084          if (this.timing == null)
2085            this.timing = new Age();
2086          if (!(this.timing instanceof Age))
2087            throw new FHIRException("Type mismatch: the type Age was expected, but "+this.timing.getClass().getName()+" was encountered");
2088          return (Age) this.timing;
2089        }
2090
2091        public boolean hasTimingAge() { 
2092          return this != null && this.timing instanceof Age;
2093        }
2094
2095        /**
2096         * @return {@link #timing} (An optional value describing when the action should be performed.)
2097         */
2098        public Period getTimingPeriod() throws FHIRException { 
2099          if (this.timing == null)
2100            this.timing = new Period();
2101          if (!(this.timing instanceof Period))
2102            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
2103          return (Period) this.timing;
2104        }
2105
2106        public boolean hasTimingPeriod() { 
2107          return this != null && this.timing instanceof Period;
2108        }
2109
2110        /**
2111         * @return {@link #timing} (An optional value describing when the action should be performed.)
2112         */
2113        public Duration getTimingDuration() throws FHIRException { 
2114          if (this.timing == null)
2115            this.timing = new Duration();
2116          if (!(this.timing instanceof Duration))
2117            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.timing.getClass().getName()+" was encountered");
2118          return (Duration) this.timing;
2119        }
2120
2121        public boolean hasTimingDuration() { 
2122          return this != null && this.timing instanceof Duration;
2123        }
2124
2125        /**
2126         * @return {@link #timing} (An optional value describing when the action should be performed.)
2127         */
2128        public Range getTimingRange() throws FHIRException { 
2129          if (this.timing == null)
2130            this.timing = new Range();
2131          if (!(this.timing instanceof Range))
2132            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.timing.getClass().getName()+" was encountered");
2133          return (Range) this.timing;
2134        }
2135
2136        public boolean hasTimingRange() { 
2137          return this != null && this.timing instanceof Range;
2138        }
2139
2140        /**
2141         * @return {@link #timing} (An optional value describing when the action should be performed.)
2142         */
2143        public Timing getTimingTiming() throws FHIRException { 
2144          if (this.timing == null)
2145            this.timing = new Timing();
2146          if (!(this.timing instanceof Timing))
2147            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered");
2148          return (Timing) this.timing;
2149        }
2150
2151        public boolean hasTimingTiming() { 
2152          return this != null && this.timing instanceof Timing;
2153        }
2154
2155        public boolean hasTiming() { 
2156          return this.timing != null && !this.timing.isEmpty();
2157        }
2158
2159        /**
2160         * @param value {@link #timing} (An optional value describing when the action should be performed.)
2161         */
2162        public RequestGroupActionComponent setTiming(Type value) { 
2163          if (value != null && !(value instanceof DateTimeType || value instanceof Age || value instanceof Period || value instanceof Duration || value instanceof Range || value instanceof Timing))
2164            throw new Error("Not the right type for RequestGroup.action.timing[x]: "+value.fhirType());
2165          this.timing = value;
2166          return this;
2167        }
2168
2169        /**
2170         * @return {@link #participant} (The participant that should perform or be responsible for this action.)
2171         */
2172        public List<Reference> getParticipant() { 
2173          if (this.participant == null)
2174            this.participant = new ArrayList<Reference>();
2175          return this.participant;
2176        }
2177
2178        /**
2179         * @return Returns a reference to <code>this</code> for easy method chaining
2180         */
2181        public RequestGroupActionComponent setParticipant(List<Reference> theParticipant) { 
2182          this.participant = theParticipant;
2183          return this;
2184        }
2185
2186        public boolean hasParticipant() { 
2187          if (this.participant == null)
2188            return false;
2189          for (Reference item : this.participant)
2190            if (!item.isEmpty())
2191              return true;
2192          return false;
2193        }
2194
2195        public Reference addParticipant() { //3
2196          Reference t = new Reference();
2197          if (this.participant == null)
2198            this.participant = new ArrayList<Reference>();
2199          this.participant.add(t);
2200          return t;
2201        }
2202
2203        public RequestGroupActionComponent addParticipant(Reference t) { //3
2204          if (t == null)
2205            return this;
2206          if (this.participant == null)
2207            this.participant = new ArrayList<Reference>();
2208          this.participant.add(t);
2209          return this;
2210        }
2211
2212        /**
2213         * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist
2214         */
2215        public Reference getParticipantFirstRep() { 
2216          if (getParticipant().isEmpty()) {
2217            addParticipant();
2218          }
2219          return getParticipant().get(0);
2220        }
2221
2222        /**
2223         * @deprecated Use Reference#setResource(IBaseResource) instead
2224         */
2225        @Deprecated
2226        public List<Resource> getParticipantTarget() { 
2227          if (this.participantTarget == null)
2228            this.participantTarget = new ArrayList<Resource>();
2229          return this.participantTarget;
2230        }
2231
2232        /**
2233         * @return {@link #type} (The type of action to perform (create, update, remove).)
2234         */
2235        public CodeableConcept getType() { 
2236          if (this.type == null)
2237            if (Configuration.errorOnAutoCreate())
2238              throw new Error("Attempt to auto-create RequestGroupActionComponent.type");
2239            else if (Configuration.doAutoCreate())
2240              this.type = new CodeableConcept(); // cc
2241          return this.type;
2242        }
2243
2244        public boolean hasType() { 
2245          return this.type != null && !this.type.isEmpty();
2246        }
2247
2248        /**
2249         * @param value {@link #type} (The type of action to perform (create, update, remove).)
2250         */
2251        public RequestGroupActionComponent setType(CodeableConcept value) { 
2252          this.type = value;
2253          return this;
2254        }
2255
2256        /**
2257         * @return {@link #groupingBehavior} (Defines the grouping behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getGroupingBehavior" gives direct access to the value
2258         */
2259        public Enumeration<ActionGroupingBehavior> getGroupingBehaviorElement() { 
2260          if (this.groupingBehavior == null)
2261            if (Configuration.errorOnAutoCreate())
2262              throw new Error("Attempt to auto-create RequestGroupActionComponent.groupingBehavior");
2263            else if (Configuration.doAutoCreate())
2264              this.groupingBehavior = new Enumeration<ActionGroupingBehavior>(new ActionGroupingBehaviorEnumFactory()); // bb
2265          return this.groupingBehavior;
2266        }
2267
2268        public boolean hasGroupingBehaviorElement() { 
2269          return this.groupingBehavior != null && !this.groupingBehavior.isEmpty();
2270        }
2271
2272        public boolean hasGroupingBehavior() { 
2273          return this.groupingBehavior != null && !this.groupingBehavior.isEmpty();
2274        }
2275
2276        /**
2277         * @param value {@link #groupingBehavior} (Defines the grouping behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getGroupingBehavior" gives direct access to the value
2278         */
2279        public RequestGroupActionComponent setGroupingBehaviorElement(Enumeration<ActionGroupingBehavior> value) { 
2280          this.groupingBehavior = value;
2281          return this;
2282        }
2283
2284        /**
2285         * @return Defines the grouping behavior for the action and its children.
2286         */
2287        public ActionGroupingBehavior getGroupingBehavior() { 
2288          return this.groupingBehavior == null ? null : this.groupingBehavior.getValue();
2289        }
2290
2291        /**
2292         * @param value Defines the grouping behavior for the action and its children.
2293         */
2294        public RequestGroupActionComponent setGroupingBehavior(ActionGroupingBehavior value) { 
2295          if (value == null)
2296            this.groupingBehavior = null;
2297          else {
2298            if (this.groupingBehavior == null)
2299              this.groupingBehavior = new Enumeration<ActionGroupingBehavior>(new ActionGroupingBehaviorEnumFactory());
2300            this.groupingBehavior.setValue(value);
2301          }
2302          return this;
2303        }
2304
2305        /**
2306         * @return {@link #selectionBehavior} (Defines the selection behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getSelectionBehavior" gives direct access to the value
2307         */
2308        public Enumeration<ActionSelectionBehavior> getSelectionBehaviorElement() { 
2309          if (this.selectionBehavior == null)
2310            if (Configuration.errorOnAutoCreate())
2311              throw new Error("Attempt to auto-create RequestGroupActionComponent.selectionBehavior");
2312            else if (Configuration.doAutoCreate())
2313              this.selectionBehavior = new Enumeration<ActionSelectionBehavior>(new ActionSelectionBehaviorEnumFactory()); // bb
2314          return this.selectionBehavior;
2315        }
2316
2317        public boolean hasSelectionBehaviorElement() { 
2318          return this.selectionBehavior != null && !this.selectionBehavior.isEmpty();
2319        }
2320
2321        public boolean hasSelectionBehavior() { 
2322          return this.selectionBehavior != null && !this.selectionBehavior.isEmpty();
2323        }
2324
2325        /**
2326         * @param value {@link #selectionBehavior} (Defines the selection behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getSelectionBehavior" gives direct access to the value
2327         */
2328        public RequestGroupActionComponent setSelectionBehaviorElement(Enumeration<ActionSelectionBehavior> value) { 
2329          this.selectionBehavior = value;
2330          return this;
2331        }
2332
2333        /**
2334         * @return Defines the selection behavior for the action and its children.
2335         */
2336        public ActionSelectionBehavior getSelectionBehavior() { 
2337          return this.selectionBehavior == null ? null : this.selectionBehavior.getValue();
2338        }
2339
2340        /**
2341         * @param value Defines the selection behavior for the action and its children.
2342         */
2343        public RequestGroupActionComponent setSelectionBehavior(ActionSelectionBehavior value) { 
2344          if (value == null)
2345            this.selectionBehavior = null;
2346          else {
2347            if (this.selectionBehavior == null)
2348              this.selectionBehavior = new Enumeration<ActionSelectionBehavior>(new ActionSelectionBehaviorEnumFactory());
2349            this.selectionBehavior.setValue(value);
2350          }
2351          return this;
2352        }
2353
2354        /**
2355         * @return {@link #requiredBehavior} (Defines expectations around whether an action is required.). This is the underlying object with id, value and extensions. The accessor "getRequiredBehavior" gives direct access to the value
2356         */
2357        public Enumeration<ActionRequiredBehavior> getRequiredBehaviorElement() { 
2358          if (this.requiredBehavior == null)
2359            if (Configuration.errorOnAutoCreate())
2360              throw new Error("Attempt to auto-create RequestGroupActionComponent.requiredBehavior");
2361            else if (Configuration.doAutoCreate())
2362              this.requiredBehavior = new Enumeration<ActionRequiredBehavior>(new ActionRequiredBehaviorEnumFactory()); // bb
2363          return this.requiredBehavior;
2364        }
2365
2366        public boolean hasRequiredBehaviorElement() { 
2367          return this.requiredBehavior != null && !this.requiredBehavior.isEmpty();
2368        }
2369
2370        public boolean hasRequiredBehavior() { 
2371          return this.requiredBehavior != null && !this.requiredBehavior.isEmpty();
2372        }
2373
2374        /**
2375         * @param value {@link #requiredBehavior} (Defines expectations around whether an action is required.). This is the underlying object with id, value and extensions. The accessor "getRequiredBehavior" gives direct access to the value
2376         */
2377        public RequestGroupActionComponent setRequiredBehaviorElement(Enumeration<ActionRequiredBehavior> value) { 
2378          this.requiredBehavior = value;
2379          return this;
2380        }
2381
2382        /**
2383         * @return Defines expectations around whether an action is required.
2384         */
2385        public ActionRequiredBehavior getRequiredBehavior() { 
2386          return this.requiredBehavior == null ? null : this.requiredBehavior.getValue();
2387        }
2388
2389        /**
2390         * @param value Defines expectations around whether an action is required.
2391         */
2392        public RequestGroupActionComponent setRequiredBehavior(ActionRequiredBehavior value) { 
2393          if (value == null)
2394            this.requiredBehavior = null;
2395          else {
2396            if (this.requiredBehavior == null)
2397              this.requiredBehavior = new Enumeration<ActionRequiredBehavior>(new ActionRequiredBehaviorEnumFactory());
2398            this.requiredBehavior.setValue(value);
2399          }
2400          return this;
2401        }
2402
2403        /**
2404         * @return {@link #precheckBehavior} (Defines whether the action should usually be preselected.). This is the underlying object with id, value and extensions. The accessor "getPrecheckBehavior" gives direct access to the value
2405         */
2406        public Enumeration<ActionPrecheckBehavior> getPrecheckBehaviorElement() { 
2407          if (this.precheckBehavior == null)
2408            if (Configuration.errorOnAutoCreate())
2409              throw new Error("Attempt to auto-create RequestGroupActionComponent.precheckBehavior");
2410            else if (Configuration.doAutoCreate())
2411              this.precheckBehavior = new Enumeration<ActionPrecheckBehavior>(new ActionPrecheckBehaviorEnumFactory()); // bb
2412          return this.precheckBehavior;
2413        }
2414
2415        public boolean hasPrecheckBehaviorElement() { 
2416          return this.precheckBehavior != null && !this.precheckBehavior.isEmpty();
2417        }
2418
2419        public boolean hasPrecheckBehavior() { 
2420          return this.precheckBehavior != null && !this.precheckBehavior.isEmpty();
2421        }
2422
2423        /**
2424         * @param value {@link #precheckBehavior} (Defines whether the action should usually be preselected.). This is the underlying object with id, value and extensions. The accessor "getPrecheckBehavior" gives direct access to the value
2425         */
2426        public RequestGroupActionComponent setPrecheckBehaviorElement(Enumeration<ActionPrecheckBehavior> value) { 
2427          this.precheckBehavior = value;
2428          return this;
2429        }
2430
2431        /**
2432         * @return Defines whether the action should usually be preselected.
2433         */
2434        public ActionPrecheckBehavior getPrecheckBehavior() { 
2435          return this.precheckBehavior == null ? null : this.precheckBehavior.getValue();
2436        }
2437
2438        /**
2439         * @param value Defines whether the action should usually be preselected.
2440         */
2441        public RequestGroupActionComponent setPrecheckBehavior(ActionPrecheckBehavior value) { 
2442          if (value == null)
2443            this.precheckBehavior = null;
2444          else {
2445            if (this.precheckBehavior == null)
2446              this.precheckBehavior = new Enumeration<ActionPrecheckBehavior>(new ActionPrecheckBehaviorEnumFactory());
2447            this.precheckBehavior.setValue(value);
2448          }
2449          return this;
2450        }
2451
2452        /**
2453         * @return {@link #cardinalityBehavior} (Defines whether the action can be selected multiple times.). This is the underlying object with id, value and extensions. The accessor "getCardinalityBehavior" gives direct access to the value
2454         */
2455        public Enumeration<ActionCardinalityBehavior> getCardinalityBehaviorElement() { 
2456          if (this.cardinalityBehavior == null)
2457            if (Configuration.errorOnAutoCreate())
2458              throw new Error("Attempt to auto-create RequestGroupActionComponent.cardinalityBehavior");
2459            else if (Configuration.doAutoCreate())
2460              this.cardinalityBehavior = new Enumeration<ActionCardinalityBehavior>(new ActionCardinalityBehaviorEnumFactory()); // bb
2461          return this.cardinalityBehavior;
2462        }
2463
2464        public boolean hasCardinalityBehaviorElement() { 
2465          return this.cardinalityBehavior != null && !this.cardinalityBehavior.isEmpty();
2466        }
2467
2468        public boolean hasCardinalityBehavior() { 
2469          return this.cardinalityBehavior != null && !this.cardinalityBehavior.isEmpty();
2470        }
2471
2472        /**
2473         * @param value {@link #cardinalityBehavior} (Defines whether the action can be selected multiple times.). This is the underlying object with id, value and extensions. The accessor "getCardinalityBehavior" gives direct access to the value
2474         */
2475        public RequestGroupActionComponent setCardinalityBehaviorElement(Enumeration<ActionCardinalityBehavior> value) { 
2476          this.cardinalityBehavior = value;
2477          return this;
2478        }
2479
2480        /**
2481         * @return Defines whether the action can be selected multiple times.
2482         */
2483        public ActionCardinalityBehavior getCardinalityBehavior() { 
2484          return this.cardinalityBehavior == null ? null : this.cardinalityBehavior.getValue();
2485        }
2486
2487        /**
2488         * @param value Defines whether the action can be selected multiple times.
2489         */
2490        public RequestGroupActionComponent setCardinalityBehavior(ActionCardinalityBehavior value) { 
2491          if (value == null)
2492            this.cardinalityBehavior = null;
2493          else {
2494            if (this.cardinalityBehavior == null)
2495              this.cardinalityBehavior = new Enumeration<ActionCardinalityBehavior>(new ActionCardinalityBehaviorEnumFactory());
2496            this.cardinalityBehavior.setValue(value);
2497          }
2498          return this;
2499        }
2500
2501        /**
2502         * @return {@link #resource} (The resource that is the target of the action (e.g. CommunicationRequest).)
2503         */
2504        public Reference getResource() { 
2505          if (this.resource == null)
2506            if (Configuration.errorOnAutoCreate())
2507              throw new Error("Attempt to auto-create RequestGroupActionComponent.resource");
2508            else if (Configuration.doAutoCreate())
2509              this.resource = new Reference(); // cc
2510          return this.resource;
2511        }
2512
2513        public boolean hasResource() { 
2514          return this.resource != null && !this.resource.isEmpty();
2515        }
2516
2517        /**
2518         * @param value {@link #resource} (The resource that is the target of the action (e.g. CommunicationRequest).)
2519         */
2520        public RequestGroupActionComponent setResource(Reference value) { 
2521          this.resource = value;
2522          return this;
2523        }
2524
2525        /**
2526         * @return {@link #resource} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The resource that is the target of the action (e.g. CommunicationRequest).)
2527         */
2528        public Resource getResourceTarget() { 
2529          return this.resourceTarget;
2530        }
2531
2532        /**
2533         * @param value {@link #resource} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The resource that is the target of the action (e.g. CommunicationRequest).)
2534         */
2535        public RequestGroupActionComponent setResourceTarget(Resource value) { 
2536          this.resourceTarget = value;
2537          return this;
2538        }
2539
2540        /**
2541         * @return {@link #action} (Sub actions.)
2542         */
2543        public List<RequestGroupActionComponent> getAction() { 
2544          if (this.action == null)
2545            this.action = new ArrayList<RequestGroupActionComponent>();
2546          return this.action;
2547        }
2548
2549        /**
2550         * @return Returns a reference to <code>this</code> for easy method chaining
2551         */
2552        public RequestGroupActionComponent setAction(List<RequestGroupActionComponent> theAction) { 
2553          this.action = theAction;
2554          return this;
2555        }
2556
2557        public boolean hasAction() { 
2558          if (this.action == null)
2559            return false;
2560          for (RequestGroupActionComponent item : this.action)
2561            if (!item.isEmpty())
2562              return true;
2563          return false;
2564        }
2565
2566        public RequestGroupActionComponent addAction() { //3
2567          RequestGroupActionComponent t = new RequestGroupActionComponent();
2568          if (this.action == null)
2569            this.action = new ArrayList<RequestGroupActionComponent>();
2570          this.action.add(t);
2571          return t;
2572        }
2573
2574        public RequestGroupActionComponent addAction(RequestGroupActionComponent t) { //3
2575          if (t == null)
2576            return this;
2577          if (this.action == null)
2578            this.action = new ArrayList<RequestGroupActionComponent>();
2579          this.action.add(t);
2580          return this;
2581        }
2582
2583        /**
2584         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
2585         */
2586        public RequestGroupActionComponent getActionFirstRep() { 
2587          if (getAction().isEmpty()) {
2588            addAction();
2589          }
2590          return getAction().get(0);
2591        }
2592
2593        protected void listChildren(List<Property> children) {
2594          super.listChildren(children);
2595          children.add(new Property("prefix", "string", "A user-visible prefix for the action.", 0, 1, prefix));
2596          children.add(new Property("title", "string", "The title of the action displayed to a user.", 0, 1, title));
2597          children.add(new Property("description", "string", "A short description of the action used to provide a summary to display to the user.", 0, 1, description));
2598          children.add(new Property("textEquivalent", "string", "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.", 0, 1, textEquivalent));
2599          children.add(new Property("priority", "code", "Indicates how quickly the action should be addressed with respect to other actions.", 0, 1, priority));
2600          children.add(new Property("code", "CodeableConcept", "A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a section of a documentation template.", 0, java.lang.Integer.MAX_VALUE, code));
2601          children.add(new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation));
2602          children.add(new Property("condition", "", "An expression that describes applicability criteria, or start/stop conditions for the action.", 0, java.lang.Integer.MAX_VALUE, condition));
2603          children.add(new Property("relatedAction", "", "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".", 0, java.lang.Integer.MAX_VALUE, relatedAction));
2604          children.add(new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing));
2605          children.add(new Property("participant", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device)", "The participant that should perform or be responsible for this action.", 0, java.lang.Integer.MAX_VALUE, participant));
2606          children.add(new Property("type", "CodeableConcept", "The type of action to perform (create, update, remove).", 0, 1, type));
2607          children.add(new Property("groupingBehavior", "code", "Defines the grouping behavior for the action and its children.", 0, 1, groupingBehavior));
2608          children.add(new Property("selectionBehavior", "code", "Defines the selection behavior for the action and its children.", 0, 1, selectionBehavior));
2609          children.add(new Property("requiredBehavior", "code", "Defines expectations around whether an action is required.", 0, 1, requiredBehavior));
2610          children.add(new Property("precheckBehavior", "code", "Defines whether the action should usually be preselected.", 0, 1, precheckBehavior));
2611          children.add(new Property("cardinalityBehavior", "code", "Defines whether the action can be selected multiple times.", 0, 1, cardinalityBehavior));
2612          children.add(new Property("resource", "Reference(Any)", "The resource that is the target of the action (e.g. CommunicationRequest).", 0, 1, resource));
2613          children.add(new Property("action", "@RequestGroup.action", "Sub actions.", 0, java.lang.Integer.MAX_VALUE, action));
2614        }
2615
2616        @Override
2617        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2618          switch (_hash) {
2619          case -980110702: /*prefix*/  return new Property("prefix", "string", "A user-visible prefix for the action.", 0, 1, prefix);
2620          case 110371416: /*title*/  return new Property("title", "string", "The title of the action displayed to a user.", 0, 1, title);
2621          case -1724546052: /*description*/  return new Property("description", "string", "A short description of the action used to provide a summary to display to the user.", 0, 1, description);
2622          case -900391049: /*textEquivalent*/  return new Property("textEquivalent", "string", "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.", 0, 1, textEquivalent);
2623          case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the action should be addressed with respect to other actions.", 0, 1, priority);
2624          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a section of a documentation template.", 0, java.lang.Integer.MAX_VALUE, code);
2625          case 1587405498: /*documentation*/  return new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation);
2626          case -861311717: /*condition*/  return new Property("condition", "", "An expression that describes applicability criteria, or start/stop conditions for the action.", 0, java.lang.Integer.MAX_VALUE, condition);
2627          case -384107967: /*relatedAction*/  return new Property("relatedAction", "", "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".", 0, java.lang.Integer.MAX_VALUE, relatedAction);
2628          case 164632566: /*timing[x]*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
2629          case -873664438: /*timing*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
2630          case -1837458939: /*timingDateTime*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
2631          case 164607061: /*timingAge*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
2632          case -615615829: /*timingPeriod*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
2633          case -1327253506: /*timingDuration*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
2634          case -710871277: /*timingRange*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
2635          case -497554124: /*timingTiming*/  return new Property("timing[x]", "dateTime|Age|Period|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
2636          case 767422259: /*participant*/  return new Property("participant", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device)", "The participant that should perform or be responsible for this action.", 0, java.lang.Integer.MAX_VALUE, participant);
2637          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of action to perform (create, update, remove).", 0, 1, type);
2638          case 586678389: /*groupingBehavior*/  return new Property("groupingBehavior", "code", "Defines the grouping behavior for the action and its children.", 0, 1, groupingBehavior);
2639          case 168639486: /*selectionBehavior*/  return new Property("selectionBehavior", "code", "Defines the selection behavior for the action and its children.", 0, 1, selectionBehavior);
2640          case -1163906287: /*requiredBehavior*/  return new Property("requiredBehavior", "code", "Defines expectations around whether an action is required.", 0, 1, requiredBehavior);
2641          case -1174249033: /*precheckBehavior*/  return new Property("precheckBehavior", "code", "Defines whether the action should usually be preselected.", 0, 1, precheckBehavior);
2642          case -922577408: /*cardinalityBehavior*/  return new Property("cardinalityBehavior", "code", "Defines whether the action can be selected multiple times.", 0, 1, cardinalityBehavior);
2643          case -341064690: /*resource*/  return new Property("resource", "Reference(Any)", "The resource that is the target of the action (e.g. CommunicationRequest).", 0, 1, resource);
2644          case -1422950858: /*action*/  return new Property("action", "@RequestGroup.action", "Sub actions.", 0, java.lang.Integer.MAX_VALUE, action);
2645          default: return super.getNamedProperty(_hash, _name, _checkValid);
2646          }
2647
2648        }
2649
2650      @Override
2651      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2652        switch (hash) {
2653        case -980110702: /*prefix*/ return this.prefix == null ? new Base[0] : new Base[] {this.prefix}; // StringType
2654        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
2655        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2656        case -900391049: /*textEquivalent*/ return this.textEquivalent == null ? new Base[0] : new Base[] {this.textEquivalent}; // StringType
2657        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
2658        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
2659        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : this.documentation.toArray(new Base[this.documentation.size()]); // RelatedArtifact
2660        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : this.condition.toArray(new Base[this.condition.size()]); // RequestGroupActionConditionComponent
2661        case -384107967: /*relatedAction*/ return this.relatedAction == null ? new Base[0] : this.relatedAction.toArray(new Base[this.relatedAction.size()]); // RequestGroupActionRelatedActionComponent
2662        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
2663        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // Reference
2664        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2665        case 586678389: /*groupingBehavior*/ return this.groupingBehavior == null ? new Base[0] : new Base[] {this.groupingBehavior}; // Enumeration<ActionGroupingBehavior>
2666        case 168639486: /*selectionBehavior*/ return this.selectionBehavior == null ? new Base[0] : new Base[] {this.selectionBehavior}; // Enumeration<ActionSelectionBehavior>
2667        case -1163906287: /*requiredBehavior*/ return this.requiredBehavior == null ? new Base[0] : new Base[] {this.requiredBehavior}; // Enumeration<ActionRequiredBehavior>
2668        case -1174249033: /*precheckBehavior*/ return this.precheckBehavior == null ? new Base[0] : new Base[] {this.precheckBehavior}; // Enumeration<ActionPrecheckBehavior>
2669        case -922577408: /*cardinalityBehavior*/ return this.cardinalityBehavior == null ? new Base[0] : new Base[] {this.cardinalityBehavior}; // Enumeration<ActionCardinalityBehavior>
2670        case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Reference
2671        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // RequestGroupActionComponent
2672        default: return super.getProperty(hash, name, checkValid);
2673        }
2674
2675      }
2676
2677      @Override
2678      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2679        switch (hash) {
2680        case -980110702: // prefix
2681          this.prefix = castToString(value); // StringType
2682          return value;
2683        case 110371416: // title
2684          this.title = castToString(value); // StringType
2685          return value;
2686        case -1724546052: // description
2687          this.description = castToString(value); // StringType
2688          return value;
2689        case -900391049: // textEquivalent
2690          this.textEquivalent = castToString(value); // StringType
2691          return value;
2692        case -1165461084: // priority
2693          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
2694          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
2695          return value;
2696        case 3059181: // code
2697          this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
2698          return value;
2699        case 1587405498: // documentation
2700          this.getDocumentation().add(castToRelatedArtifact(value)); // RelatedArtifact
2701          return value;
2702        case -861311717: // condition
2703          this.getCondition().add((RequestGroupActionConditionComponent) value); // RequestGroupActionConditionComponent
2704          return value;
2705        case -384107967: // relatedAction
2706          this.getRelatedAction().add((RequestGroupActionRelatedActionComponent) value); // RequestGroupActionRelatedActionComponent
2707          return value;
2708        case -873664438: // timing
2709          this.timing = castToType(value); // Type
2710          return value;
2711        case 767422259: // participant
2712          this.getParticipant().add(castToReference(value)); // Reference
2713          return value;
2714        case 3575610: // type
2715          this.type = castToCodeableConcept(value); // CodeableConcept
2716          return value;
2717        case 586678389: // groupingBehavior
2718          value = new ActionGroupingBehaviorEnumFactory().fromType(castToCode(value));
2719          this.groupingBehavior = (Enumeration) value; // Enumeration<ActionGroupingBehavior>
2720          return value;
2721        case 168639486: // selectionBehavior
2722          value = new ActionSelectionBehaviorEnumFactory().fromType(castToCode(value));
2723          this.selectionBehavior = (Enumeration) value; // Enumeration<ActionSelectionBehavior>
2724          return value;
2725        case -1163906287: // requiredBehavior
2726          value = new ActionRequiredBehaviorEnumFactory().fromType(castToCode(value));
2727          this.requiredBehavior = (Enumeration) value; // Enumeration<ActionRequiredBehavior>
2728          return value;
2729        case -1174249033: // precheckBehavior
2730          value = new ActionPrecheckBehaviorEnumFactory().fromType(castToCode(value));
2731          this.precheckBehavior = (Enumeration) value; // Enumeration<ActionPrecheckBehavior>
2732          return value;
2733        case -922577408: // cardinalityBehavior
2734          value = new ActionCardinalityBehaviorEnumFactory().fromType(castToCode(value));
2735          this.cardinalityBehavior = (Enumeration) value; // Enumeration<ActionCardinalityBehavior>
2736          return value;
2737        case -341064690: // resource
2738          this.resource = castToReference(value); // Reference
2739          return value;
2740        case -1422950858: // action
2741          this.getAction().add((RequestGroupActionComponent) value); // RequestGroupActionComponent
2742          return value;
2743        default: return super.setProperty(hash, name, value);
2744        }
2745
2746      }
2747
2748      @Override
2749      public Base setProperty(String name, Base value) throws FHIRException {
2750        if (name.equals("prefix")) {
2751          this.prefix = castToString(value); // StringType
2752        } else if (name.equals("title")) {
2753          this.title = castToString(value); // StringType
2754        } else if (name.equals("description")) {
2755          this.description = castToString(value); // StringType
2756        } else if (name.equals("textEquivalent")) {
2757          this.textEquivalent = castToString(value); // StringType
2758        } else if (name.equals("priority")) {
2759          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
2760          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
2761        } else if (name.equals("code")) {
2762          this.getCode().add(castToCodeableConcept(value));
2763        } else if (name.equals("documentation")) {
2764          this.getDocumentation().add(castToRelatedArtifact(value));
2765        } else if (name.equals("condition")) {
2766          this.getCondition().add((RequestGroupActionConditionComponent) value);
2767        } else if (name.equals("relatedAction")) {
2768          this.getRelatedAction().add((RequestGroupActionRelatedActionComponent) value);
2769        } else if (name.equals("timing[x]")) {
2770          this.timing = castToType(value); // Type
2771        } else if (name.equals("participant")) {
2772          this.getParticipant().add(castToReference(value));
2773        } else if (name.equals("type")) {
2774          this.type = castToCodeableConcept(value); // CodeableConcept
2775        } else if (name.equals("groupingBehavior")) {
2776          value = new ActionGroupingBehaviorEnumFactory().fromType(castToCode(value));
2777          this.groupingBehavior = (Enumeration) value; // Enumeration<ActionGroupingBehavior>
2778        } else if (name.equals("selectionBehavior")) {
2779          value = new ActionSelectionBehaviorEnumFactory().fromType(castToCode(value));
2780          this.selectionBehavior = (Enumeration) value; // Enumeration<ActionSelectionBehavior>
2781        } else if (name.equals("requiredBehavior")) {
2782          value = new ActionRequiredBehaviorEnumFactory().fromType(castToCode(value));
2783          this.requiredBehavior = (Enumeration) value; // Enumeration<ActionRequiredBehavior>
2784        } else if (name.equals("precheckBehavior")) {
2785          value = new ActionPrecheckBehaviorEnumFactory().fromType(castToCode(value));
2786          this.precheckBehavior = (Enumeration) value; // Enumeration<ActionPrecheckBehavior>
2787        } else if (name.equals("cardinalityBehavior")) {
2788          value = new ActionCardinalityBehaviorEnumFactory().fromType(castToCode(value));
2789          this.cardinalityBehavior = (Enumeration) value; // Enumeration<ActionCardinalityBehavior>
2790        } else if (name.equals("resource")) {
2791          this.resource = castToReference(value); // Reference
2792        } else if (name.equals("action")) {
2793          this.getAction().add((RequestGroupActionComponent) value);
2794        } else
2795          return super.setProperty(name, value);
2796        return value;
2797      }
2798
2799      @Override
2800      public Base makeProperty(int hash, String name) throws FHIRException {
2801        switch (hash) {
2802        case -980110702:  return getPrefixElement();
2803        case 110371416:  return getTitleElement();
2804        case -1724546052:  return getDescriptionElement();
2805        case -900391049:  return getTextEquivalentElement();
2806        case -1165461084:  return getPriorityElement();
2807        case 3059181:  return addCode(); 
2808        case 1587405498:  return addDocumentation(); 
2809        case -861311717:  return addCondition(); 
2810        case -384107967:  return addRelatedAction(); 
2811        case 164632566:  return getTiming(); 
2812        case -873664438:  return getTiming(); 
2813        case 767422259:  return addParticipant(); 
2814        case 3575610:  return getType(); 
2815        case 586678389:  return getGroupingBehaviorElement();
2816        case 168639486:  return getSelectionBehaviorElement();
2817        case -1163906287:  return getRequiredBehaviorElement();
2818        case -1174249033:  return getPrecheckBehaviorElement();
2819        case -922577408:  return getCardinalityBehaviorElement();
2820        case -341064690:  return getResource(); 
2821        case -1422950858:  return addAction(); 
2822        default: return super.makeProperty(hash, name);
2823        }
2824
2825      }
2826
2827      @Override
2828      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2829        switch (hash) {
2830        case -980110702: /*prefix*/ return new String[] {"string"};
2831        case 110371416: /*title*/ return new String[] {"string"};
2832        case -1724546052: /*description*/ return new String[] {"string"};
2833        case -900391049: /*textEquivalent*/ return new String[] {"string"};
2834        case -1165461084: /*priority*/ return new String[] {"code"};
2835        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2836        case 1587405498: /*documentation*/ return new String[] {"RelatedArtifact"};
2837        case -861311717: /*condition*/ return new String[] {};
2838        case -384107967: /*relatedAction*/ return new String[] {};
2839        case -873664438: /*timing*/ return new String[] {"dateTime", "Age", "Period", "Duration", "Range", "Timing"};
2840        case 767422259: /*participant*/ return new String[] {"Reference"};
2841        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2842        case 586678389: /*groupingBehavior*/ return new String[] {"code"};
2843        case 168639486: /*selectionBehavior*/ return new String[] {"code"};
2844        case -1163906287: /*requiredBehavior*/ return new String[] {"code"};
2845        case -1174249033: /*precheckBehavior*/ return new String[] {"code"};
2846        case -922577408: /*cardinalityBehavior*/ return new String[] {"code"};
2847        case -341064690: /*resource*/ return new String[] {"Reference"};
2848        case -1422950858: /*action*/ return new String[] {"@RequestGroup.action"};
2849        default: return super.getTypesForProperty(hash, name);
2850        }
2851
2852      }
2853
2854      @Override
2855      public Base addChild(String name) throws FHIRException {
2856        if (name.equals("prefix")) {
2857          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.prefix");
2858        }
2859        else if (name.equals("title")) {
2860          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.title");
2861        }
2862        else if (name.equals("description")) {
2863          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.description");
2864        }
2865        else if (name.equals("textEquivalent")) {
2866          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.textEquivalent");
2867        }
2868        else if (name.equals("priority")) {
2869          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.priority");
2870        }
2871        else if (name.equals("code")) {
2872          return addCode();
2873        }
2874        else if (name.equals("documentation")) {
2875          return addDocumentation();
2876        }
2877        else if (name.equals("condition")) {
2878          return addCondition();
2879        }
2880        else if (name.equals("relatedAction")) {
2881          return addRelatedAction();
2882        }
2883        else if (name.equals("timingDateTime")) {
2884          this.timing = new DateTimeType();
2885          return this.timing;
2886        }
2887        else if (name.equals("timingAge")) {
2888          this.timing = new Age();
2889          return this.timing;
2890        }
2891        else if (name.equals("timingPeriod")) {
2892          this.timing = new Period();
2893          return this.timing;
2894        }
2895        else if (name.equals("timingDuration")) {
2896          this.timing = new Duration();
2897          return this.timing;
2898        }
2899        else if (name.equals("timingRange")) {
2900          this.timing = new Range();
2901          return this.timing;
2902        }
2903        else if (name.equals("timingTiming")) {
2904          this.timing = new Timing();
2905          return this.timing;
2906        }
2907        else if (name.equals("participant")) {
2908          return addParticipant();
2909        }
2910        else if (name.equals("type")) {
2911          this.type = new CodeableConcept();
2912          return this.type;
2913        }
2914        else if (name.equals("groupingBehavior")) {
2915          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.groupingBehavior");
2916        }
2917        else if (name.equals("selectionBehavior")) {
2918          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.selectionBehavior");
2919        }
2920        else if (name.equals("requiredBehavior")) {
2921          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.requiredBehavior");
2922        }
2923        else if (name.equals("precheckBehavior")) {
2924          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.precheckBehavior");
2925        }
2926        else if (name.equals("cardinalityBehavior")) {
2927          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.cardinalityBehavior");
2928        }
2929        else if (name.equals("resource")) {
2930          this.resource = new Reference();
2931          return this.resource;
2932        }
2933        else if (name.equals("action")) {
2934          return addAction();
2935        }
2936        else
2937          return super.addChild(name);
2938      }
2939
2940      public RequestGroupActionComponent copy() {
2941        RequestGroupActionComponent dst = new RequestGroupActionComponent();
2942        copyValues(dst);
2943        dst.prefix = prefix == null ? null : prefix.copy();
2944        dst.title = title == null ? null : title.copy();
2945        dst.description = description == null ? null : description.copy();
2946        dst.textEquivalent = textEquivalent == null ? null : textEquivalent.copy();
2947        dst.priority = priority == null ? null : priority.copy();
2948        if (code != null) {
2949          dst.code = new ArrayList<CodeableConcept>();
2950          for (CodeableConcept i : code)
2951            dst.code.add(i.copy());
2952        };
2953        if (documentation != null) {
2954          dst.documentation = new ArrayList<RelatedArtifact>();
2955          for (RelatedArtifact i : documentation)
2956            dst.documentation.add(i.copy());
2957        };
2958        if (condition != null) {
2959          dst.condition = new ArrayList<RequestGroupActionConditionComponent>();
2960          for (RequestGroupActionConditionComponent i : condition)
2961            dst.condition.add(i.copy());
2962        };
2963        if (relatedAction != null) {
2964          dst.relatedAction = new ArrayList<RequestGroupActionRelatedActionComponent>();
2965          for (RequestGroupActionRelatedActionComponent i : relatedAction)
2966            dst.relatedAction.add(i.copy());
2967        };
2968        dst.timing = timing == null ? null : timing.copy();
2969        if (participant != null) {
2970          dst.participant = new ArrayList<Reference>();
2971          for (Reference i : participant)
2972            dst.participant.add(i.copy());
2973        };
2974        dst.type = type == null ? null : type.copy();
2975        dst.groupingBehavior = groupingBehavior == null ? null : groupingBehavior.copy();
2976        dst.selectionBehavior = selectionBehavior == null ? null : selectionBehavior.copy();
2977        dst.requiredBehavior = requiredBehavior == null ? null : requiredBehavior.copy();
2978        dst.precheckBehavior = precheckBehavior == null ? null : precheckBehavior.copy();
2979        dst.cardinalityBehavior = cardinalityBehavior == null ? null : cardinalityBehavior.copy();
2980        dst.resource = resource == null ? null : resource.copy();
2981        if (action != null) {
2982          dst.action = new ArrayList<RequestGroupActionComponent>();
2983          for (RequestGroupActionComponent i : action)
2984            dst.action.add(i.copy());
2985        };
2986        return dst;
2987      }
2988
2989      @Override
2990      public boolean equalsDeep(Base other_) {
2991        if (!super.equalsDeep(other_))
2992          return false;
2993        if (!(other_ instanceof RequestGroupActionComponent))
2994          return false;
2995        RequestGroupActionComponent o = (RequestGroupActionComponent) other_;
2996        return compareDeep(prefix, o.prefix, true) && compareDeep(title, o.title, true) && compareDeep(description, o.description, true)
2997           && compareDeep(textEquivalent, o.textEquivalent, true) && compareDeep(priority, o.priority, true)
2998           && compareDeep(code, o.code, true) && compareDeep(documentation, o.documentation, true) && compareDeep(condition, o.condition, true)
2999           && compareDeep(relatedAction, o.relatedAction, true) && compareDeep(timing, o.timing, true) && compareDeep(participant, o.participant, true)
3000           && compareDeep(type, o.type, true) && compareDeep(groupingBehavior, o.groupingBehavior, true) && compareDeep(selectionBehavior, o.selectionBehavior, true)
3001           && compareDeep(requiredBehavior, o.requiredBehavior, true) && compareDeep(precheckBehavior, o.precheckBehavior, true)
3002           && compareDeep(cardinalityBehavior, o.cardinalityBehavior, true) && compareDeep(resource, o.resource, true)
3003           && compareDeep(action, o.action, true);
3004      }
3005
3006      @Override
3007      public boolean equalsShallow(Base other_) {
3008        if (!super.equalsShallow(other_))
3009          return false;
3010        if (!(other_ instanceof RequestGroupActionComponent))
3011          return false;
3012        RequestGroupActionComponent o = (RequestGroupActionComponent) other_;
3013        return compareValues(prefix, o.prefix, true) && compareValues(title, o.title, true) && compareValues(description, o.description, true)
3014           && compareValues(textEquivalent, o.textEquivalent, true) && compareValues(priority, o.priority, true)
3015           && compareValues(groupingBehavior, o.groupingBehavior, true) && compareValues(selectionBehavior, o.selectionBehavior, true)
3016           && compareValues(requiredBehavior, o.requiredBehavior, true) && compareValues(precheckBehavior, o.precheckBehavior, true)
3017           && compareValues(cardinalityBehavior, o.cardinalityBehavior, true);
3018      }
3019
3020      public boolean isEmpty() {
3021        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(prefix, title, description
3022          , textEquivalent, priority, code, documentation, condition, relatedAction, timing
3023          , participant, type, groupingBehavior, selectionBehavior, requiredBehavior, precheckBehavior
3024          , cardinalityBehavior, resource, action);
3025      }
3026
3027  public String fhirType() {
3028    return "RequestGroup.action";
3029
3030  }
3031
3032  }
3033
3034    @Block()
3035    public static class RequestGroupActionConditionComponent extends BackboneElement implements IBaseBackboneElement {
3036        /**
3037         * The kind of condition.
3038         */
3039        @Child(name = "kind", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3040        @Description(shortDefinition="applicability | start | stop", formalDefinition="The kind of condition." )
3041        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-condition-kind")
3042        protected Enumeration<ActionConditionKind> kind;
3043
3044        /**
3045         * An expression that returns true or false, indicating whether or not the condition is satisfied.
3046         */
3047        @Child(name = "expression", type = {Expression.class}, order=2, min=0, max=1, modifier=false, summary=false)
3048        @Description(shortDefinition="Boolean-valued expression", formalDefinition="An expression that returns true or false, indicating whether or not the condition is satisfied." )
3049        protected Expression expression;
3050
3051        private static final long serialVersionUID = -455150438L;
3052
3053    /**
3054     * Constructor
3055     */
3056      public RequestGroupActionConditionComponent() {
3057        super();
3058      }
3059
3060    /**
3061     * Constructor
3062     */
3063      public RequestGroupActionConditionComponent(Enumeration<ActionConditionKind> kind) {
3064        super();
3065        this.kind = kind;
3066      }
3067
3068        /**
3069         * @return {@link #kind} (The kind of condition.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
3070         */
3071        public Enumeration<ActionConditionKind> getKindElement() { 
3072          if (this.kind == null)
3073            if (Configuration.errorOnAutoCreate())
3074              throw new Error("Attempt to auto-create RequestGroupActionConditionComponent.kind");
3075            else if (Configuration.doAutoCreate())
3076              this.kind = new Enumeration<ActionConditionKind>(new ActionConditionKindEnumFactory()); // bb
3077          return this.kind;
3078        }
3079
3080        public boolean hasKindElement() { 
3081          return this.kind != null && !this.kind.isEmpty();
3082        }
3083
3084        public boolean hasKind() { 
3085          return this.kind != null && !this.kind.isEmpty();
3086        }
3087
3088        /**
3089         * @param value {@link #kind} (The kind of condition.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
3090         */
3091        public RequestGroupActionConditionComponent setKindElement(Enumeration<ActionConditionKind> value) { 
3092          this.kind = value;
3093          return this;
3094        }
3095
3096        /**
3097         * @return The kind of condition.
3098         */
3099        public ActionConditionKind getKind() { 
3100          return this.kind == null ? null : this.kind.getValue();
3101        }
3102
3103        /**
3104         * @param value The kind of condition.
3105         */
3106        public RequestGroupActionConditionComponent setKind(ActionConditionKind value) { 
3107            if (this.kind == null)
3108              this.kind = new Enumeration<ActionConditionKind>(new ActionConditionKindEnumFactory());
3109            this.kind.setValue(value);
3110          return this;
3111        }
3112
3113        /**
3114         * @return {@link #expression} (An expression that returns true or false, indicating whether or not the condition is satisfied.)
3115         */
3116        public Expression getExpression() { 
3117          if (this.expression == null)
3118            if (Configuration.errorOnAutoCreate())
3119              throw new Error("Attempt to auto-create RequestGroupActionConditionComponent.expression");
3120            else if (Configuration.doAutoCreate())
3121              this.expression = new Expression(); // cc
3122          return this.expression;
3123        }
3124
3125        public boolean hasExpression() { 
3126          return this.expression != null && !this.expression.isEmpty();
3127        }
3128
3129        /**
3130         * @param value {@link #expression} (An expression that returns true or false, indicating whether or not the condition is satisfied.)
3131         */
3132        public RequestGroupActionConditionComponent setExpression(Expression value) { 
3133          this.expression = value;
3134          return this;
3135        }
3136
3137        protected void listChildren(List<Property> children) {
3138          super.listChildren(children);
3139          children.add(new Property("kind", "code", "The kind of condition.", 0, 1, kind));
3140          children.add(new Property("expression", "Expression", "An expression that returns true or false, indicating whether or not the condition is satisfied.", 0, 1, expression));
3141        }
3142
3143        @Override
3144        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3145          switch (_hash) {
3146          case 3292052: /*kind*/  return new Property("kind", "code", "The kind of condition.", 0, 1, kind);
3147          case -1795452264: /*expression*/  return new Property("expression", "Expression", "An expression that returns true or false, indicating whether or not the condition is satisfied.", 0, 1, expression);
3148          default: return super.getNamedProperty(_hash, _name, _checkValid);
3149          }
3150
3151        }
3152
3153      @Override
3154      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3155        switch (hash) {
3156        case 3292052: /*kind*/ return this.kind == null ? new Base[0] : new Base[] {this.kind}; // Enumeration<ActionConditionKind>
3157        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // Expression
3158        default: return super.getProperty(hash, name, checkValid);
3159        }
3160
3161      }
3162
3163      @Override
3164      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3165        switch (hash) {
3166        case 3292052: // kind
3167          value = new ActionConditionKindEnumFactory().fromType(castToCode(value));
3168          this.kind = (Enumeration) value; // Enumeration<ActionConditionKind>
3169          return value;
3170        case -1795452264: // expression
3171          this.expression = castToExpression(value); // Expression
3172          return value;
3173        default: return super.setProperty(hash, name, value);
3174        }
3175
3176      }
3177
3178      @Override
3179      public Base setProperty(String name, Base value) throws FHIRException {
3180        if (name.equals("kind")) {
3181          value = new ActionConditionKindEnumFactory().fromType(castToCode(value));
3182          this.kind = (Enumeration) value; // Enumeration<ActionConditionKind>
3183        } else if (name.equals("expression")) {
3184          this.expression = castToExpression(value); // Expression
3185        } else
3186          return super.setProperty(name, value);
3187        return value;
3188      }
3189
3190      @Override
3191      public Base makeProperty(int hash, String name) throws FHIRException {
3192        switch (hash) {
3193        case 3292052:  return getKindElement();
3194        case -1795452264:  return getExpression(); 
3195        default: return super.makeProperty(hash, name);
3196        }
3197
3198      }
3199
3200      @Override
3201      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3202        switch (hash) {
3203        case 3292052: /*kind*/ return new String[] {"code"};
3204        case -1795452264: /*expression*/ return new String[] {"Expression"};
3205        default: return super.getTypesForProperty(hash, name);
3206        }
3207
3208      }
3209
3210      @Override
3211      public Base addChild(String name) throws FHIRException {
3212        if (name.equals("kind")) {
3213          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.kind");
3214        }
3215        else if (name.equals("expression")) {
3216          this.expression = new Expression();
3217          return this.expression;
3218        }
3219        else
3220          return super.addChild(name);
3221      }
3222
3223      public RequestGroupActionConditionComponent copy() {
3224        RequestGroupActionConditionComponent dst = new RequestGroupActionConditionComponent();
3225        copyValues(dst);
3226        dst.kind = kind == null ? null : kind.copy();
3227        dst.expression = expression == null ? null : expression.copy();
3228        return dst;
3229      }
3230
3231      @Override
3232      public boolean equalsDeep(Base other_) {
3233        if (!super.equalsDeep(other_))
3234          return false;
3235        if (!(other_ instanceof RequestGroupActionConditionComponent))
3236          return false;
3237        RequestGroupActionConditionComponent o = (RequestGroupActionConditionComponent) other_;
3238        return compareDeep(kind, o.kind, true) && compareDeep(expression, o.expression, true);
3239      }
3240
3241      @Override
3242      public boolean equalsShallow(Base other_) {
3243        if (!super.equalsShallow(other_))
3244          return false;
3245        if (!(other_ instanceof RequestGroupActionConditionComponent))
3246          return false;
3247        RequestGroupActionConditionComponent o = (RequestGroupActionConditionComponent) other_;
3248        return compareValues(kind, o.kind, true);
3249      }
3250
3251      public boolean isEmpty() {
3252        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(kind, expression);
3253      }
3254
3255  public String fhirType() {
3256    return "RequestGroup.action.condition";
3257
3258  }
3259
3260  }
3261
3262    @Block()
3263    public static class RequestGroupActionRelatedActionComponent extends BackboneElement implements IBaseBackboneElement {
3264        /**
3265         * The element id of the action this is related to.
3266         */
3267        @Child(name = "actionId", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3268        @Description(shortDefinition="What action this is related to", formalDefinition="The element id of the action this is related to." )
3269        protected IdType actionId;
3270
3271        /**
3272         * The relationship of this action to the related action.
3273         */
3274        @Child(name = "relationship", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
3275        @Description(shortDefinition="before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end", formalDefinition="The relationship of this action to the related action." )
3276        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-relationship-type")
3277        protected Enumeration<ActionRelationshipType> relationship;
3278
3279        /**
3280         * A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.
3281         */
3282        @Child(name = "offset", type = {Duration.class, Range.class}, order=3, min=0, max=1, modifier=false, summary=false)
3283        @Description(shortDefinition="Time offset for the relationship", formalDefinition="A duration or range of durations to apply to the relationship. For example, 30-60 minutes before." )
3284        protected Type offset;
3285
3286        private static final long serialVersionUID = 1063306770L;
3287
3288    /**
3289     * Constructor
3290     */
3291      public RequestGroupActionRelatedActionComponent() {
3292        super();
3293      }
3294
3295    /**
3296     * Constructor
3297     */
3298      public RequestGroupActionRelatedActionComponent(IdType actionId, Enumeration<ActionRelationshipType> relationship) {
3299        super();
3300        this.actionId = actionId;
3301        this.relationship = relationship;
3302      }
3303
3304        /**
3305         * @return {@link #actionId} (The element id of the action this is related to.). This is the underlying object with id, value and extensions. The accessor "getActionId" gives direct access to the value
3306         */
3307        public IdType getActionIdElement() { 
3308          if (this.actionId == null)
3309            if (Configuration.errorOnAutoCreate())
3310              throw new Error("Attempt to auto-create RequestGroupActionRelatedActionComponent.actionId");
3311            else if (Configuration.doAutoCreate())
3312              this.actionId = new IdType(); // bb
3313          return this.actionId;
3314        }
3315
3316        public boolean hasActionIdElement() { 
3317          return this.actionId != null && !this.actionId.isEmpty();
3318        }
3319
3320        public boolean hasActionId() { 
3321          return this.actionId != null && !this.actionId.isEmpty();
3322        }
3323
3324        /**
3325         * @param value {@link #actionId} (The element id of the action this is related to.). This is the underlying object with id, value and extensions. The accessor "getActionId" gives direct access to the value
3326         */
3327        public RequestGroupActionRelatedActionComponent setActionIdElement(IdType value) { 
3328          this.actionId = value;
3329          return this;
3330        }
3331
3332        /**
3333         * @return The element id of the action this is related to.
3334         */
3335        public String getActionId() { 
3336          return this.actionId == null ? null : this.actionId.getValue();
3337        }
3338
3339        /**
3340         * @param value The element id of the action this is related to.
3341         */
3342        public RequestGroupActionRelatedActionComponent setActionId(String value) { 
3343            if (this.actionId == null)
3344              this.actionId = new IdType();
3345            this.actionId.setValue(value);
3346          return this;
3347        }
3348
3349        /**
3350         * @return {@link #relationship} (The relationship of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
3351         */
3352        public Enumeration<ActionRelationshipType> getRelationshipElement() { 
3353          if (this.relationship == null)
3354            if (Configuration.errorOnAutoCreate())
3355              throw new Error("Attempt to auto-create RequestGroupActionRelatedActionComponent.relationship");
3356            else if (Configuration.doAutoCreate())
3357              this.relationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory()); // bb
3358          return this.relationship;
3359        }
3360
3361        public boolean hasRelationshipElement() { 
3362          return this.relationship != null && !this.relationship.isEmpty();
3363        }
3364
3365        public boolean hasRelationship() { 
3366          return this.relationship != null && !this.relationship.isEmpty();
3367        }
3368
3369        /**
3370         * @param value {@link #relationship} (The relationship of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
3371         */
3372        public RequestGroupActionRelatedActionComponent setRelationshipElement(Enumeration<ActionRelationshipType> value) { 
3373          this.relationship = value;
3374          return this;
3375        }
3376
3377        /**
3378         * @return The relationship of this action to the related action.
3379         */
3380        public ActionRelationshipType getRelationship() { 
3381          return this.relationship == null ? null : this.relationship.getValue();
3382        }
3383
3384        /**
3385         * @param value The relationship of this action to the related action.
3386         */
3387        public RequestGroupActionRelatedActionComponent setRelationship(ActionRelationshipType value) { 
3388            if (this.relationship == null)
3389              this.relationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory());
3390            this.relationship.setValue(value);
3391          return this;
3392        }
3393
3394        /**
3395         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
3396         */
3397        public Type getOffset() { 
3398          return this.offset;
3399        }
3400
3401        /**
3402         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
3403         */
3404        public Duration getOffsetDuration() throws FHIRException { 
3405          if (this.offset == null)
3406            this.offset = new Duration();
3407          if (!(this.offset instanceof Duration))
3408            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.offset.getClass().getName()+" was encountered");
3409          return (Duration) this.offset;
3410        }
3411
3412        public boolean hasOffsetDuration() { 
3413          return this != null && this.offset instanceof Duration;
3414        }
3415
3416        /**
3417         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
3418         */
3419        public Range getOffsetRange() throws FHIRException { 
3420          if (this.offset == null)
3421            this.offset = new Range();
3422          if (!(this.offset instanceof Range))
3423            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.offset.getClass().getName()+" was encountered");
3424          return (Range) this.offset;
3425        }
3426
3427        public boolean hasOffsetRange() { 
3428          return this != null && this.offset instanceof Range;
3429        }
3430
3431        public boolean hasOffset() { 
3432          return this.offset != null && !this.offset.isEmpty();
3433        }
3434
3435        /**
3436         * @param value {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
3437         */
3438        public RequestGroupActionRelatedActionComponent setOffset(Type value) { 
3439          if (value != null && !(value instanceof Duration || value instanceof Range))
3440            throw new Error("Not the right type for RequestGroup.action.relatedAction.offset[x]: "+value.fhirType());
3441          this.offset = value;
3442          return this;
3443        }
3444
3445        protected void listChildren(List<Property> children) {
3446          super.listChildren(children);
3447          children.add(new Property("actionId", "id", "The element id of the action this is related to.", 0, 1, actionId));
3448          children.add(new Property("relationship", "code", "The relationship of this action to the related action.", 0, 1, relationship));
3449          children.add(new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset));
3450        }
3451
3452        @Override
3453        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3454          switch (_hash) {
3455          case -1656172047: /*actionId*/  return new Property("actionId", "id", "The element id of the action this is related to.", 0, 1, actionId);
3456          case -261851592: /*relationship*/  return new Property("relationship", "code", "The relationship of this action to the related action.", 0, 1, relationship);
3457          case -1960684787: /*offset[x]*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
3458          case -1019779949: /*offset*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
3459          case 134075207: /*offsetDuration*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
3460          case 1263585386: /*offsetRange*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
3461          default: return super.getNamedProperty(_hash, _name, _checkValid);
3462          }
3463
3464        }
3465
3466      @Override
3467      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3468        switch (hash) {
3469        case -1656172047: /*actionId*/ return this.actionId == null ? new Base[0] : new Base[] {this.actionId}; // IdType
3470        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Enumeration<ActionRelationshipType>
3471        case -1019779949: /*offset*/ return this.offset == null ? new Base[0] : new Base[] {this.offset}; // Type
3472        default: return super.getProperty(hash, name, checkValid);
3473        }
3474
3475      }
3476
3477      @Override
3478      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3479        switch (hash) {
3480        case -1656172047: // actionId
3481          this.actionId = castToId(value); // IdType
3482          return value;
3483        case -261851592: // relationship
3484          value = new ActionRelationshipTypeEnumFactory().fromType(castToCode(value));
3485          this.relationship = (Enumeration) value; // Enumeration<ActionRelationshipType>
3486          return value;
3487        case -1019779949: // offset
3488          this.offset = castToType(value); // Type
3489          return value;
3490        default: return super.setProperty(hash, name, value);
3491        }
3492
3493      }
3494
3495      @Override
3496      public Base setProperty(String name, Base value) throws FHIRException {
3497        if (name.equals("actionId")) {
3498          this.actionId = castToId(value); // IdType
3499        } else if (name.equals("relationship")) {
3500          value = new ActionRelationshipTypeEnumFactory().fromType(castToCode(value));
3501          this.relationship = (Enumeration) value; // Enumeration<ActionRelationshipType>
3502        } else if (name.equals("offset[x]")) {
3503          this.offset = castToType(value); // Type
3504        } else
3505          return super.setProperty(name, value);
3506        return value;
3507      }
3508
3509      @Override
3510      public Base makeProperty(int hash, String name) throws FHIRException {
3511        switch (hash) {
3512        case -1656172047:  return getActionIdElement();
3513        case -261851592:  return getRelationshipElement();
3514        case -1960684787:  return getOffset(); 
3515        case -1019779949:  return getOffset(); 
3516        default: return super.makeProperty(hash, name);
3517        }
3518
3519      }
3520
3521      @Override
3522      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3523        switch (hash) {
3524        case -1656172047: /*actionId*/ return new String[] {"id"};
3525        case -261851592: /*relationship*/ return new String[] {"code"};
3526        case -1019779949: /*offset*/ return new String[] {"Duration", "Range"};
3527        default: return super.getTypesForProperty(hash, name);
3528        }
3529
3530      }
3531
3532      @Override
3533      public Base addChild(String name) throws FHIRException {
3534        if (name.equals("actionId")) {
3535          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.actionId");
3536        }
3537        else if (name.equals("relationship")) {
3538          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.relationship");
3539        }
3540        else if (name.equals("offsetDuration")) {
3541          this.offset = new Duration();
3542          return this.offset;
3543        }
3544        else if (name.equals("offsetRange")) {
3545          this.offset = new Range();
3546          return this.offset;
3547        }
3548        else
3549          return super.addChild(name);
3550      }
3551
3552      public RequestGroupActionRelatedActionComponent copy() {
3553        RequestGroupActionRelatedActionComponent dst = new RequestGroupActionRelatedActionComponent();
3554        copyValues(dst);
3555        dst.actionId = actionId == null ? null : actionId.copy();
3556        dst.relationship = relationship == null ? null : relationship.copy();
3557        dst.offset = offset == null ? null : offset.copy();
3558        return dst;
3559      }
3560
3561      @Override
3562      public boolean equalsDeep(Base other_) {
3563        if (!super.equalsDeep(other_))
3564          return false;
3565        if (!(other_ instanceof RequestGroupActionRelatedActionComponent))
3566          return false;
3567        RequestGroupActionRelatedActionComponent o = (RequestGroupActionRelatedActionComponent) other_;
3568        return compareDeep(actionId, o.actionId, true) && compareDeep(relationship, o.relationship, true)
3569           && compareDeep(offset, o.offset, true);
3570      }
3571
3572      @Override
3573      public boolean equalsShallow(Base other_) {
3574        if (!super.equalsShallow(other_))
3575          return false;
3576        if (!(other_ instanceof RequestGroupActionRelatedActionComponent))
3577          return false;
3578        RequestGroupActionRelatedActionComponent o = (RequestGroupActionRelatedActionComponent) other_;
3579        return compareValues(actionId, o.actionId, true) && compareValues(relationship, o.relationship, true)
3580          ;
3581      }
3582
3583      public boolean isEmpty() {
3584        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(actionId, relationship, offset
3585          );
3586      }
3587
3588  public String fhirType() {
3589    return "RequestGroup.action.relatedAction";
3590
3591  }
3592
3593  }
3594
3595    /**
3596     * Allows a service to provide a unique, business identifier for the request.
3597     */
3598    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3599    @Description(shortDefinition="Business identifier", formalDefinition="Allows a service to provide a unique, business identifier for the request." )
3600    protected List<Identifier> identifier;
3601
3602    /**
3603     * A canonical URL referencing a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.
3604     */
3605    @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3606    @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="A canonical URL referencing a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request." )
3607    protected List<CanonicalType> instantiatesCanonical;
3608
3609    /**
3610     * A URL referencing an externally defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.
3611     */
3612    @Child(name = "instantiatesUri", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3613    @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="A URL referencing an externally defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request." )
3614    protected List<UriType> instantiatesUri;
3615
3616    /**
3617     * A plan, proposal or order that is fulfilled in whole or in part by this request.
3618     */
3619    @Child(name = "basedOn", type = {Reference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3620    @Description(shortDefinition="Fulfills plan, proposal, or order", formalDefinition="A plan, proposal or order that is fulfilled in whole or in part by this request." )
3621    protected List<Reference> basedOn;
3622    /**
3623     * The actual objects that are the target of the reference (A plan, proposal or order that is fulfilled in whole or in part by this request.)
3624     */
3625    protected List<Resource> basedOnTarget;
3626
3627
3628    /**
3629     * Completed or terminated request(s) whose function is taken by this new request.
3630     */
3631    @Child(name = "replaces", type = {Reference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3632    @Description(shortDefinition="Request(s) replaced by this request", formalDefinition="Completed or terminated request(s) whose function is taken by this new request." )
3633    protected List<Reference> replaces;
3634    /**
3635     * The actual objects that are the target of the reference (Completed or terminated request(s) whose function is taken by this new request.)
3636     */
3637    protected List<Resource> replacesTarget;
3638
3639
3640    /**
3641     * A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.
3642     */
3643    @Child(name = "groupIdentifier", type = {Identifier.class}, order=5, min=0, max=1, modifier=false, summary=true)
3644    @Description(shortDefinition="Composite request this is part of", formalDefinition="A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form." )
3645    protected Identifier groupIdentifier;
3646
3647    /**
3648     * The current state of the request. For request groups, the status reflects the status of all the requests in the group.
3649     */
3650    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
3651    @Description(shortDefinition="draft | active | suspended | cancelled | completed | entered-in-error | unknown", formalDefinition="The current state of the request. For request groups, the status reflects the status of all the requests in the group." )
3652    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-status")
3653    protected Enumeration<RequestStatus> status;
3654
3655    /**
3656     * Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain.
3657     */
3658    @Child(name = "intent", type = {CodeType.class}, order=7, min=1, max=1, modifier=true, summary=true)
3659    @Description(shortDefinition="proposal | plan | order", formalDefinition="Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain." )
3660    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-intent")
3661    protected Enumeration<RequestIntent> intent;
3662
3663    /**
3664     * Indicates how quickly the request should be addressed with respect to other requests.
3665     */
3666    @Child(name = "priority", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
3667    @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the request should be addressed with respect to other requests." )
3668    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
3669    protected Enumeration<RequestPriority> priority;
3670
3671    /**
3672     * A code that identifies what the overall request group is.
3673     */
3674    @Child(name = "code", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true)
3675    @Description(shortDefinition="What's being requested/ordered", formalDefinition="A code that identifies what the overall request group is." )
3676    protected CodeableConcept code;
3677
3678    /**
3679     * The subject for which the request group was created.
3680     */
3681    @Child(name = "subject", type = {Patient.class, Group.class}, order=10, min=0, max=1, modifier=false, summary=false)
3682    @Description(shortDefinition="Who the request group is about", formalDefinition="The subject for which the request group was created." )
3683    protected Reference subject;
3684
3685    /**
3686     * The actual object that is the target of the reference (The subject for which the request group was created.)
3687     */
3688    protected Resource subjectTarget;
3689
3690    /**
3691     * Describes the context of the request group, if any.
3692     */
3693    @Child(name = "encounter", type = {Encounter.class}, order=11, min=0, max=1, modifier=false, summary=false)
3694    @Description(shortDefinition="Created as part of", formalDefinition="Describes the context of the request group, if any." )
3695    protected Reference encounter;
3696
3697    /**
3698     * The actual object that is the target of the reference (Describes the context of the request group, if any.)
3699     */
3700    protected Encounter encounterTarget;
3701
3702    /**
3703     * Indicates when the request group was created.
3704     */
3705    @Child(name = "authoredOn", type = {DateTimeType.class}, order=12, min=0, max=1, modifier=false, summary=false)
3706    @Description(shortDefinition="When the request group was authored", formalDefinition="Indicates when the request group was created." )
3707    protected DateTimeType authoredOn;
3708
3709    /**
3710     * Provides a reference to the author of the request group.
3711     */
3712    @Child(name = "author", type = {Device.class, Practitioner.class, PractitionerRole.class}, order=13, min=0, max=1, modifier=false, summary=false)
3713    @Description(shortDefinition="Device or practitioner that authored the request group", formalDefinition="Provides a reference to the author of the request group." )
3714    protected Reference author;
3715
3716    /**
3717     * The actual object that is the target of the reference (Provides a reference to the author of the request group.)
3718     */
3719    protected Resource authorTarget;
3720
3721    /**
3722     * Describes the reason for the request group in coded or textual form.
3723     */
3724    @Child(name = "reasonCode", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3725    @Description(shortDefinition="Why the request group is needed", formalDefinition="Describes the reason for the request group in coded or textual form." )
3726    protected List<CodeableConcept> reasonCode;
3727
3728    /**
3729     * Indicates another resource whose existence justifies this request group.
3730     */
3731    @Child(name = "reasonReference", type = {Condition.class, Observation.class, DiagnosticReport.class, DocumentReference.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3732    @Description(shortDefinition="Why the request group is needed", formalDefinition="Indicates another resource whose existence justifies this request group." )
3733    protected List<Reference> reasonReference;
3734    /**
3735     * The actual objects that are the target of the reference (Indicates another resource whose existence justifies this request group.)
3736     */
3737    protected List<Resource> reasonReferenceTarget;
3738
3739
3740    /**
3741     * Provides a mechanism to communicate additional information about the response.
3742     */
3743    @Child(name = "note", type = {Annotation.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3744    @Description(shortDefinition="Additional notes about the response", formalDefinition="Provides a mechanism to communicate additional information about the response." )
3745    protected List<Annotation> note;
3746
3747    /**
3748     * The actions, if any, produced by the evaluation of the artifact.
3749     */
3750    @Child(name = "action", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3751    @Description(shortDefinition="Proposed actions, if any", formalDefinition="The actions, if any, produced by the evaluation of the artifact." )
3752    protected List<RequestGroupActionComponent> action;
3753
3754    private static final long serialVersionUID = -2053492070L;
3755
3756  /**
3757   * Constructor
3758   */
3759    public RequestGroup() {
3760      super();
3761    }
3762
3763  /**
3764   * Constructor
3765   */
3766    public RequestGroup(Enumeration<RequestStatus> status, Enumeration<RequestIntent> intent) {
3767      super();
3768      this.status = status;
3769      this.intent = intent;
3770    }
3771
3772    /**
3773     * @return {@link #identifier} (Allows a service to provide a unique, business identifier for the request.)
3774     */
3775    public List<Identifier> getIdentifier() { 
3776      if (this.identifier == null)
3777        this.identifier = new ArrayList<Identifier>();
3778      return this.identifier;
3779    }
3780
3781    /**
3782     * @return Returns a reference to <code>this</code> for easy method chaining
3783     */
3784    public RequestGroup setIdentifier(List<Identifier> theIdentifier) { 
3785      this.identifier = theIdentifier;
3786      return this;
3787    }
3788
3789    public boolean hasIdentifier() { 
3790      if (this.identifier == null)
3791        return false;
3792      for (Identifier item : this.identifier)
3793        if (!item.isEmpty())
3794          return true;
3795      return false;
3796    }
3797
3798    public Identifier addIdentifier() { //3
3799      Identifier t = new Identifier();
3800      if (this.identifier == null)
3801        this.identifier = new ArrayList<Identifier>();
3802      this.identifier.add(t);
3803      return t;
3804    }
3805
3806    public RequestGroup addIdentifier(Identifier t) { //3
3807      if (t == null)
3808        return this;
3809      if (this.identifier == null)
3810        this.identifier = new ArrayList<Identifier>();
3811      this.identifier.add(t);
3812      return this;
3813    }
3814
3815    /**
3816     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
3817     */
3818    public Identifier getIdentifierFirstRep() { 
3819      if (getIdentifier().isEmpty()) {
3820        addIdentifier();
3821      }
3822      return getIdentifier().get(0);
3823    }
3824
3825    /**
3826     * @return {@link #instantiatesCanonical} (A canonical URL referencing a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.)
3827     */
3828    public List<CanonicalType> getInstantiatesCanonical() { 
3829      if (this.instantiatesCanonical == null)
3830        this.instantiatesCanonical = new ArrayList<CanonicalType>();
3831      return this.instantiatesCanonical;
3832    }
3833
3834    /**
3835     * @return Returns a reference to <code>this</code> for easy method chaining
3836     */
3837    public RequestGroup setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) { 
3838      this.instantiatesCanonical = theInstantiatesCanonical;
3839      return this;
3840    }
3841
3842    public boolean hasInstantiatesCanonical() { 
3843      if (this.instantiatesCanonical == null)
3844        return false;
3845      for (CanonicalType item : this.instantiatesCanonical)
3846        if (!item.isEmpty())
3847          return true;
3848      return false;
3849    }
3850
3851    /**
3852     * @return {@link #instantiatesCanonical} (A canonical URL referencing a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.)
3853     */
3854    public CanonicalType addInstantiatesCanonicalElement() {//2 
3855      CanonicalType t = new CanonicalType();
3856      if (this.instantiatesCanonical == null)
3857        this.instantiatesCanonical = new ArrayList<CanonicalType>();
3858      this.instantiatesCanonical.add(t);
3859      return t;
3860    }
3861
3862    /**
3863     * @param value {@link #instantiatesCanonical} (A canonical URL referencing a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.)
3864     */
3865    public RequestGroup addInstantiatesCanonical(String value) { //1
3866      CanonicalType t = new CanonicalType();
3867      t.setValue(value);
3868      if (this.instantiatesCanonical == null)
3869        this.instantiatesCanonical = new ArrayList<CanonicalType>();
3870      this.instantiatesCanonical.add(t);
3871      return this;
3872    }
3873
3874    /**
3875     * @param value {@link #instantiatesCanonical} (A canonical URL referencing a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.)
3876     */
3877    public boolean hasInstantiatesCanonical(String value) { 
3878      if (this.instantiatesCanonical == null)
3879        return false;
3880      for (CanonicalType v : this.instantiatesCanonical)
3881        if (v.getValue().equals(value)) // canonical
3882          return true;
3883      return false;
3884    }
3885
3886    /**
3887     * @return {@link #instantiatesUri} (A URL referencing an externally defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.)
3888     */
3889    public List<UriType> getInstantiatesUri() { 
3890      if (this.instantiatesUri == null)
3891        this.instantiatesUri = new ArrayList<UriType>();
3892      return this.instantiatesUri;
3893    }
3894
3895    /**
3896     * @return Returns a reference to <code>this</code> for easy method chaining
3897     */
3898    public RequestGroup setInstantiatesUri(List<UriType> theInstantiatesUri) { 
3899      this.instantiatesUri = theInstantiatesUri;
3900      return this;
3901    }
3902
3903    public boolean hasInstantiatesUri() { 
3904      if (this.instantiatesUri == null)
3905        return false;
3906      for (UriType item : this.instantiatesUri)
3907        if (!item.isEmpty())
3908          return true;
3909      return false;
3910    }
3911
3912    /**
3913     * @return {@link #instantiatesUri} (A URL referencing an externally defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.)
3914     */
3915    public UriType addInstantiatesUriElement() {//2 
3916      UriType t = new UriType();
3917      if (this.instantiatesUri == null)
3918        this.instantiatesUri = new ArrayList<UriType>();
3919      this.instantiatesUri.add(t);
3920      return t;
3921    }
3922
3923    /**
3924     * @param value {@link #instantiatesUri} (A URL referencing an externally defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.)
3925     */
3926    public RequestGroup addInstantiatesUri(String value) { //1
3927      UriType t = new UriType();
3928      t.setValue(value);
3929      if (this.instantiatesUri == null)
3930        this.instantiatesUri = new ArrayList<UriType>();
3931      this.instantiatesUri.add(t);
3932      return this;
3933    }
3934
3935    /**
3936     * @param value {@link #instantiatesUri} (A URL referencing an externally defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.)
3937     */
3938    public boolean hasInstantiatesUri(String value) { 
3939      if (this.instantiatesUri == null)
3940        return false;
3941      for (UriType v : this.instantiatesUri)
3942        if (v.getValue().equals(value)) // uri
3943          return true;
3944      return false;
3945    }
3946
3947    /**
3948     * @return {@link #basedOn} (A plan, proposal or order that is fulfilled in whole or in part by this request.)
3949     */
3950    public List<Reference> getBasedOn() { 
3951      if (this.basedOn == null)
3952        this.basedOn = new ArrayList<Reference>();
3953      return this.basedOn;
3954    }
3955
3956    /**
3957     * @return Returns a reference to <code>this</code> for easy method chaining
3958     */
3959    public RequestGroup setBasedOn(List<Reference> theBasedOn) { 
3960      this.basedOn = theBasedOn;
3961      return this;
3962    }
3963
3964    public boolean hasBasedOn() { 
3965      if (this.basedOn == null)
3966        return false;
3967      for (Reference item : this.basedOn)
3968        if (!item.isEmpty())
3969          return true;
3970      return false;
3971    }
3972
3973    public Reference addBasedOn() { //3
3974      Reference t = new Reference();
3975      if (this.basedOn == null)
3976        this.basedOn = new ArrayList<Reference>();
3977      this.basedOn.add(t);
3978      return t;
3979    }
3980
3981    public RequestGroup addBasedOn(Reference t) { //3
3982      if (t == null)
3983        return this;
3984      if (this.basedOn == null)
3985        this.basedOn = new ArrayList<Reference>();
3986      this.basedOn.add(t);
3987      return this;
3988    }
3989
3990    /**
3991     * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist
3992     */
3993    public Reference getBasedOnFirstRep() { 
3994      if (getBasedOn().isEmpty()) {
3995        addBasedOn();
3996      }
3997      return getBasedOn().get(0);
3998    }
3999
4000    /**
4001     * @deprecated Use Reference#setResource(IBaseResource) instead
4002     */
4003    @Deprecated
4004    public List<Resource> getBasedOnTarget() { 
4005      if (this.basedOnTarget == null)
4006        this.basedOnTarget = new ArrayList<Resource>();
4007      return this.basedOnTarget;
4008    }
4009
4010    /**
4011     * @return {@link #replaces} (Completed or terminated request(s) whose function is taken by this new request.)
4012     */
4013    public List<Reference> getReplaces() { 
4014      if (this.replaces == null)
4015        this.replaces = new ArrayList<Reference>();
4016      return this.replaces;
4017    }
4018
4019    /**
4020     * @return Returns a reference to <code>this</code> for easy method chaining
4021     */
4022    public RequestGroup setReplaces(List<Reference> theReplaces) { 
4023      this.replaces = theReplaces;
4024      return this;
4025    }
4026
4027    public boolean hasReplaces() { 
4028      if (this.replaces == null)
4029        return false;
4030      for (Reference item : this.replaces)
4031        if (!item.isEmpty())
4032          return true;
4033      return false;
4034    }
4035
4036    public Reference addReplaces() { //3
4037      Reference t = new Reference();
4038      if (this.replaces == null)
4039        this.replaces = new ArrayList<Reference>();
4040      this.replaces.add(t);
4041      return t;
4042    }
4043
4044    public RequestGroup addReplaces(Reference t) { //3
4045      if (t == null)
4046        return this;
4047      if (this.replaces == null)
4048        this.replaces = new ArrayList<Reference>();
4049      this.replaces.add(t);
4050      return this;
4051    }
4052
4053    /**
4054     * @return The first repetition of repeating field {@link #replaces}, creating it if it does not already exist
4055     */
4056    public Reference getReplacesFirstRep() { 
4057      if (getReplaces().isEmpty()) {
4058        addReplaces();
4059      }
4060      return getReplaces().get(0);
4061    }
4062
4063    /**
4064     * @deprecated Use Reference#setResource(IBaseResource) instead
4065     */
4066    @Deprecated
4067    public List<Resource> getReplacesTarget() { 
4068      if (this.replacesTarget == null)
4069        this.replacesTarget = new ArrayList<Resource>();
4070      return this.replacesTarget;
4071    }
4072
4073    /**
4074     * @return {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.)
4075     */
4076    public Identifier getGroupIdentifier() { 
4077      if (this.groupIdentifier == null)
4078        if (Configuration.errorOnAutoCreate())
4079          throw new Error("Attempt to auto-create RequestGroup.groupIdentifier");
4080        else if (Configuration.doAutoCreate())
4081          this.groupIdentifier = new Identifier(); // cc
4082      return this.groupIdentifier;
4083    }
4084
4085    public boolean hasGroupIdentifier() { 
4086      return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
4087    }
4088
4089    /**
4090     * @param value {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.)
4091     */
4092    public RequestGroup setGroupIdentifier(Identifier value) { 
4093      this.groupIdentifier = value;
4094      return this;
4095    }
4096
4097    /**
4098     * @return {@link #status} (The current state of the request. For request groups, the status reflects the status of all the requests in the group.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4099     */
4100    public Enumeration<RequestStatus> getStatusElement() { 
4101      if (this.status == null)
4102        if (Configuration.errorOnAutoCreate())
4103          throw new Error("Attempt to auto-create RequestGroup.status");
4104        else if (Configuration.doAutoCreate())
4105          this.status = new Enumeration<RequestStatus>(new RequestStatusEnumFactory()); // bb
4106      return this.status;
4107    }
4108
4109    public boolean hasStatusElement() { 
4110      return this.status != null && !this.status.isEmpty();
4111    }
4112
4113    public boolean hasStatus() { 
4114      return this.status != null && !this.status.isEmpty();
4115    }
4116
4117    /**
4118     * @param value {@link #status} (The current state of the request. For request groups, the status reflects the status of all the requests in the group.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
4119     */
4120    public RequestGroup setStatusElement(Enumeration<RequestStatus> value) { 
4121      this.status = value;
4122      return this;
4123    }
4124
4125    /**
4126     * @return The current state of the request. For request groups, the status reflects the status of all the requests in the group.
4127     */
4128    public RequestStatus getStatus() { 
4129      return this.status == null ? null : this.status.getValue();
4130    }
4131
4132    /**
4133     * @param value The current state of the request. For request groups, the status reflects the status of all the requests in the group.
4134     */
4135    public RequestGroup setStatus(RequestStatus value) { 
4136        if (this.status == null)
4137          this.status = new Enumeration<RequestStatus>(new RequestStatusEnumFactory());
4138        this.status.setValue(value);
4139      return this;
4140    }
4141
4142    /**
4143     * @return {@link #intent} (Indicates the level of authority/intentionality associated with the request 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
4144     */
4145    public Enumeration<RequestIntent> getIntentElement() { 
4146      if (this.intent == null)
4147        if (Configuration.errorOnAutoCreate())
4148          throw new Error("Attempt to auto-create RequestGroup.intent");
4149        else if (Configuration.doAutoCreate())
4150          this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory()); // bb
4151      return this.intent;
4152    }
4153
4154    public boolean hasIntentElement() { 
4155      return this.intent != null && !this.intent.isEmpty();
4156    }
4157
4158    public boolean hasIntent() { 
4159      return this.intent != null && !this.intent.isEmpty();
4160    }
4161
4162    /**
4163     * @param value {@link #intent} (Indicates the level of authority/intentionality associated with the request 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
4164     */
4165    public RequestGroup setIntentElement(Enumeration<RequestIntent> value) { 
4166      this.intent = value;
4167      return this;
4168    }
4169
4170    /**
4171     * @return Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain.
4172     */
4173    public RequestIntent getIntent() { 
4174      return this.intent == null ? null : this.intent.getValue();
4175    }
4176
4177    /**
4178     * @param value Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain.
4179     */
4180    public RequestGroup setIntent(RequestIntent value) { 
4181        if (this.intent == null)
4182          this.intent = new Enumeration<RequestIntent>(new RequestIntentEnumFactory());
4183        this.intent.setValue(value);
4184      return this;
4185    }
4186
4187    /**
4188     * @return {@link #priority} (Indicates how quickly the request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
4189     */
4190    public Enumeration<RequestPriority> getPriorityElement() { 
4191      if (this.priority == null)
4192        if (Configuration.errorOnAutoCreate())
4193          throw new Error("Attempt to auto-create RequestGroup.priority");
4194        else if (Configuration.doAutoCreate())
4195          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
4196      return this.priority;
4197    }
4198
4199    public boolean hasPriorityElement() { 
4200      return this.priority != null && !this.priority.isEmpty();
4201    }
4202
4203    public boolean hasPriority() { 
4204      return this.priority != null && !this.priority.isEmpty();
4205    }
4206
4207    /**
4208     * @param value {@link #priority} (Indicates how quickly the request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
4209     */
4210    public RequestGroup setPriorityElement(Enumeration<RequestPriority> value) { 
4211      this.priority = value;
4212      return this;
4213    }
4214
4215    /**
4216     * @return Indicates how quickly the request should be addressed with respect to other requests.
4217     */
4218    public RequestPriority getPriority() { 
4219      return this.priority == null ? null : this.priority.getValue();
4220    }
4221
4222    /**
4223     * @param value Indicates how quickly the request should be addressed with respect to other requests.
4224     */
4225    public RequestGroup setPriority(RequestPriority value) { 
4226      if (value == null)
4227        this.priority = null;
4228      else {
4229        if (this.priority == null)
4230          this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
4231        this.priority.setValue(value);
4232      }
4233      return this;
4234    }
4235
4236    /**
4237     * @return {@link #code} (A code that identifies what the overall request group is.)
4238     */
4239    public CodeableConcept getCode() { 
4240      if (this.code == null)
4241        if (Configuration.errorOnAutoCreate())
4242          throw new Error("Attempt to auto-create RequestGroup.code");
4243        else if (Configuration.doAutoCreate())
4244          this.code = new CodeableConcept(); // cc
4245      return this.code;
4246    }
4247
4248    public boolean hasCode() { 
4249      return this.code != null && !this.code.isEmpty();
4250    }
4251
4252    /**
4253     * @param value {@link #code} (A code that identifies what the overall request group is.)
4254     */
4255    public RequestGroup setCode(CodeableConcept value) { 
4256      this.code = value;
4257      return this;
4258    }
4259
4260    /**
4261     * @return {@link #subject} (The subject for which the request group was created.)
4262     */
4263    public Reference getSubject() { 
4264      if (this.subject == null)
4265        if (Configuration.errorOnAutoCreate())
4266          throw new Error("Attempt to auto-create RequestGroup.subject");
4267        else if (Configuration.doAutoCreate())
4268          this.subject = new Reference(); // cc
4269      return this.subject;
4270    }
4271
4272    public boolean hasSubject() { 
4273      return this.subject != null && !this.subject.isEmpty();
4274    }
4275
4276    /**
4277     * @param value {@link #subject} (The subject for which the request group was created.)
4278     */
4279    public RequestGroup setSubject(Reference value) { 
4280      this.subject = value;
4281      return this;
4282    }
4283
4284    /**
4285     * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The subject for which the request group was created.)
4286     */
4287    public Resource getSubjectTarget() { 
4288      return this.subjectTarget;
4289    }
4290
4291    /**
4292     * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The subject for which the request group was created.)
4293     */
4294    public RequestGroup setSubjectTarget(Resource value) { 
4295      this.subjectTarget = value;
4296      return this;
4297    }
4298
4299    /**
4300     * @return {@link #encounter} (Describes the context of the request group, if any.)
4301     */
4302    public Reference getEncounter() { 
4303      if (this.encounter == null)
4304        if (Configuration.errorOnAutoCreate())
4305          throw new Error("Attempt to auto-create RequestGroup.encounter");
4306        else if (Configuration.doAutoCreate())
4307          this.encounter = new Reference(); // cc
4308      return this.encounter;
4309    }
4310
4311    public boolean hasEncounter() { 
4312      return this.encounter != null && !this.encounter.isEmpty();
4313    }
4314
4315    /**
4316     * @param value {@link #encounter} (Describes the context of the request group, if any.)
4317     */
4318    public RequestGroup setEncounter(Reference value) { 
4319      this.encounter = value;
4320      return this;
4321    }
4322
4323    /**
4324     * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the context of the request group, if any.)
4325     */
4326    public Encounter getEncounterTarget() { 
4327      if (this.encounterTarget == null)
4328        if (Configuration.errorOnAutoCreate())
4329          throw new Error("Attempt to auto-create RequestGroup.encounter");
4330        else if (Configuration.doAutoCreate())
4331          this.encounterTarget = new Encounter(); // aa
4332      return this.encounterTarget;
4333    }
4334
4335    /**
4336     * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the context of the request group, if any.)
4337     */
4338    public RequestGroup setEncounterTarget(Encounter value) { 
4339      this.encounterTarget = value;
4340      return this;
4341    }
4342
4343    /**
4344     * @return {@link #authoredOn} (Indicates when the request group was created.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
4345     */
4346    public DateTimeType getAuthoredOnElement() { 
4347      if (this.authoredOn == null)
4348        if (Configuration.errorOnAutoCreate())
4349          throw new Error("Attempt to auto-create RequestGroup.authoredOn");
4350        else if (Configuration.doAutoCreate())
4351          this.authoredOn = new DateTimeType(); // bb
4352      return this.authoredOn;
4353    }
4354
4355    public boolean hasAuthoredOnElement() { 
4356      return this.authoredOn != null && !this.authoredOn.isEmpty();
4357    }
4358
4359    public boolean hasAuthoredOn() { 
4360      return this.authoredOn != null && !this.authoredOn.isEmpty();
4361    }
4362
4363    /**
4364     * @param value {@link #authoredOn} (Indicates when the request group was created.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value
4365     */
4366    public RequestGroup setAuthoredOnElement(DateTimeType value) { 
4367      this.authoredOn = value;
4368      return this;
4369    }
4370
4371    /**
4372     * @return Indicates when the request group was created.
4373     */
4374    public Date getAuthoredOn() { 
4375      return this.authoredOn == null ? null : this.authoredOn.getValue();
4376    }
4377
4378    /**
4379     * @param value Indicates when the request group was created.
4380     */
4381    public RequestGroup setAuthoredOn(Date value) { 
4382      if (value == null)
4383        this.authoredOn = null;
4384      else {
4385        if (this.authoredOn == null)
4386          this.authoredOn = new DateTimeType();
4387        this.authoredOn.setValue(value);
4388      }
4389      return this;
4390    }
4391
4392    /**
4393     * @return {@link #author} (Provides a reference to the author of the request group.)
4394     */
4395    public Reference getAuthor() { 
4396      if (this.author == null)
4397        if (Configuration.errorOnAutoCreate())
4398          throw new Error("Attempt to auto-create RequestGroup.author");
4399        else if (Configuration.doAutoCreate())
4400          this.author = new Reference(); // cc
4401      return this.author;
4402    }
4403
4404    public boolean hasAuthor() { 
4405      return this.author != null && !this.author.isEmpty();
4406    }
4407
4408    /**
4409     * @param value {@link #author} (Provides a reference to the author of the request group.)
4410     */
4411    public RequestGroup setAuthor(Reference value) { 
4412      this.author = value;
4413      return this;
4414    }
4415
4416    /**
4417     * @return {@link #author} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Provides a reference to the author of the request group.)
4418     */
4419    public Resource getAuthorTarget() { 
4420      return this.authorTarget;
4421    }
4422
4423    /**
4424     * @param value {@link #author} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Provides a reference to the author of the request group.)
4425     */
4426    public RequestGroup setAuthorTarget(Resource value) { 
4427      this.authorTarget = value;
4428      return this;
4429    }
4430
4431    /**
4432     * @return {@link #reasonCode} (Describes the reason for the request group in coded or textual form.)
4433     */
4434    public List<CodeableConcept> getReasonCode() { 
4435      if (this.reasonCode == null)
4436        this.reasonCode = new ArrayList<CodeableConcept>();
4437      return this.reasonCode;
4438    }
4439
4440    /**
4441     * @return Returns a reference to <code>this</code> for easy method chaining
4442     */
4443    public RequestGroup setReasonCode(List<CodeableConcept> theReasonCode) { 
4444      this.reasonCode = theReasonCode;
4445      return this;
4446    }
4447
4448    public boolean hasReasonCode() { 
4449      if (this.reasonCode == null)
4450        return false;
4451      for (CodeableConcept item : this.reasonCode)
4452        if (!item.isEmpty())
4453          return true;
4454      return false;
4455    }
4456
4457    public CodeableConcept addReasonCode() { //3
4458      CodeableConcept t = new CodeableConcept();
4459      if (this.reasonCode == null)
4460        this.reasonCode = new ArrayList<CodeableConcept>();
4461      this.reasonCode.add(t);
4462      return t;
4463    }
4464
4465    public RequestGroup addReasonCode(CodeableConcept t) { //3
4466      if (t == null)
4467        return this;
4468      if (this.reasonCode == null)
4469        this.reasonCode = new ArrayList<CodeableConcept>();
4470      this.reasonCode.add(t);
4471      return this;
4472    }
4473
4474    /**
4475     * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist
4476     */
4477    public CodeableConcept getReasonCodeFirstRep() { 
4478      if (getReasonCode().isEmpty()) {
4479        addReasonCode();
4480      }
4481      return getReasonCode().get(0);
4482    }
4483
4484    /**
4485     * @return {@link #reasonReference} (Indicates another resource whose existence justifies this request group.)
4486     */
4487    public List<Reference> getReasonReference() { 
4488      if (this.reasonReference == null)
4489        this.reasonReference = new ArrayList<Reference>();
4490      return this.reasonReference;
4491    }
4492
4493    /**
4494     * @return Returns a reference to <code>this</code> for easy method chaining
4495     */
4496    public RequestGroup setReasonReference(List<Reference> theReasonReference) { 
4497      this.reasonReference = theReasonReference;
4498      return this;
4499    }
4500
4501    public boolean hasReasonReference() { 
4502      if (this.reasonReference == null)
4503        return false;
4504      for (Reference item : this.reasonReference)
4505        if (!item.isEmpty())
4506          return true;
4507      return false;
4508    }
4509
4510    public Reference addReasonReference() { //3
4511      Reference t = new Reference();
4512      if (this.reasonReference == null)
4513        this.reasonReference = new ArrayList<Reference>();
4514      this.reasonReference.add(t);
4515      return t;
4516    }
4517
4518    public RequestGroup addReasonReference(Reference t) { //3
4519      if (t == null)
4520        return this;
4521      if (this.reasonReference == null)
4522        this.reasonReference = new ArrayList<Reference>();
4523      this.reasonReference.add(t);
4524      return this;
4525    }
4526
4527    /**
4528     * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist
4529     */
4530    public Reference getReasonReferenceFirstRep() { 
4531      if (getReasonReference().isEmpty()) {
4532        addReasonReference();
4533      }
4534      return getReasonReference().get(0);
4535    }
4536
4537    /**
4538     * @deprecated Use Reference#setResource(IBaseResource) instead
4539     */
4540    @Deprecated
4541    public List<Resource> getReasonReferenceTarget() { 
4542      if (this.reasonReferenceTarget == null)
4543        this.reasonReferenceTarget = new ArrayList<Resource>();
4544      return this.reasonReferenceTarget;
4545    }
4546
4547    /**
4548     * @return {@link #note} (Provides a mechanism to communicate additional information about the response.)
4549     */
4550    public List<Annotation> getNote() { 
4551      if (this.note == null)
4552        this.note = new ArrayList<Annotation>();
4553      return this.note;
4554    }
4555
4556    /**
4557     * @return Returns a reference to <code>this</code> for easy method chaining
4558     */
4559    public RequestGroup setNote(List<Annotation> theNote) { 
4560      this.note = theNote;
4561      return this;
4562    }
4563
4564    public boolean hasNote() { 
4565      if (this.note == null)
4566        return false;
4567      for (Annotation item : this.note)
4568        if (!item.isEmpty())
4569          return true;
4570      return false;
4571    }
4572
4573    public Annotation addNote() { //3
4574      Annotation t = new Annotation();
4575      if (this.note == null)
4576        this.note = new ArrayList<Annotation>();
4577      this.note.add(t);
4578      return t;
4579    }
4580
4581    public RequestGroup addNote(Annotation t) { //3
4582      if (t == null)
4583        return this;
4584      if (this.note == null)
4585        this.note = new ArrayList<Annotation>();
4586      this.note.add(t);
4587      return this;
4588    }
4589
4590    /**
4591     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
4592     */
4593    public Annotation getNoteFirstRep() { 
4594      if (getNote().isEmpty()) {
4595        addNote();
4596      }
4597      return getNote().get(0);
4598    }
4599
4600    /**
4601     * @return {@link #action} (The actions, if any, produced by the evaluation of the artifact.)
4602     */
4603    public List<RequestGroupActionComponent> getAction() { 
4604      if (this.action == null)
4605        this.action = new ArrayList<RequestGroupActionComponent>();
4606      return this.action;
4607    }
4608
4609    /**
4610     * @return Returns a reference to <code>this</code> for easy method chaining
4611     */
4612    public RequestGroup setAction(List<RequestGroupActionComponent> theAction) { 
4613      this.action = theAction;
4614      return this;
4615    }
4616
4617    public boolean hasAction() { 
4618      if (this.action == null)
4619        return false;
4620      for (RequestGroupActionComponent item : this.action)
4621        if (!item.isEmpty())
4622          return true;
4623      return false;
4624    }
4625
4626    public RequestGroupActionComponent addAction() { //3
4627      RequestGroupActionComponent t = new RequestGroupActionComponent();
4628      if (this.action == null)
4629        this.action = new ArrayList<RequestGroupActionComponent>();
4630      this.action.add(t);
4631      return t;
4632    }
4633
4634    public RequestGroup addAction(RequestGroupActionComponent t) { //3
4635      if (t == null)
4636        return this;
4637      if (this.action == null)
4638        this.action = new ArrayList<RequestGroupActionComponent>();
4639      this.action.add(t);
4640      return this;
4641    }
4642
4643    /**
4644     * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist
4645     */
4646    public RequestGroupActionComponent getActionFirstRep() { 
4647      if (getAction().isEmpty()) {
4648        addAction();
4649      }
4650      return getAction().get(0);
4651    }
4652
4653      protected void listChildren(List<Property> children) {
4654        super.listChildren(children);
4655        children.add(new Property("identifier", "Identifier", "Allows a service to provide a unique, business identifier for the request.", 0, java.lang.Integer.MAX_VALUE, identifier));
4656        children.add(new Property("instantiatesCanonical", "canonical", "A canonical URL referencing a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
4657        children.add(new Property("instantiatesUri", "uri", "A URL referencing an externally defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri));
4658        children.add(new Property("basedOn", "Reference(Any)", "A plan, proposal or order that is fulfilled in whole or in part by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn));
4659        children.add(new Property("replaces", "Reference(Any)", "Completed or terminated request(s) whose function is taken by this new request.", 0, java.lang.Integer.MAX_VALUE, replaces));
4660        children.add(new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.", 0, 1, groupIdentifier));
4661        children.add(new Property("status", "code", "The current state of the request. For request groups, the status reflects the status of all the requests in the group.", 0, 1, status));
4662        children.add(new Property("intent", "code", "Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain.", 0, 1, intent));
4663        children.add(new Property("priority", "code", "Indicates how quickly the request should be addressed with respect to other requests.", 0, 1, priority));
4664        children.add(new Property("code", "CodeableConcept", "A code that identifies what the overall request group is.", 0, 1, code));
4665        children.add(new Property("subject", "Reference(Patient|Group)", "The subject for which the request group was created.", 0, 1, subject));
4666        children.add(new Property("encounter", "Reference(Encounter)", "Describes the context of the request group, if any.", 0, 1, encounter));
4667        children.add(new Property("authoredOn", "dateTime", "Indicates when the request group was created.", 0, 1, authoredOn));
4668        children.add(new Property("author", "Reference(Device|Practitioner|PractitionerRole)", "Provides a reference to the author of the request group.", 0, 1, author));
4669        children.add(new Property("reasonCode", "CodeableConcept", "Describes the reason for the request group in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reasonCode));
4670        children.add(new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Indicates another resource whose existence justifies this request group.", 0, java.lang.Integer.MAX_VALUE, reasonReference));
4671        children.add(new Property("note", "Annotation", "Provides a mechanism to communicate additional information about the response.", 0, java.lang.Integer.MAX_VALUE, note));
4672        children.add(new Property("action", "", "The actions, if any, produced by the evaluation of the artifact.", 0, java.lang.Integer.MAX_VALUE, action));
4673      }
4674
4675      @Override
4676      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4677        switch (_hash) {
4678        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Allows a service to provide a unique, business identifier for the request.", 0, java.lang.Integer.MAX_VALUE, identifier);
4679        case 8911915: /*instantiatesCanonical*/  return new Property("instantiatesCanonical", "canonical", "A canonical URL referencing a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
4680        case -1926393373: /*instantiatesUri*/  return new Property("instantiatesUri", "uri", "A URL referencing an externally defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri);
4681        case -332612366: /*basedOn*/  return new Property("basedOn", "Reference(Any)", "A plan, proposal or order that is fulfilled in whole or in part by this request.", 0, java.lang.Integer.MAX_VALUE, basedOn);
4682        case -430332865: /*replaces*/  return new Property("replaces", "Reference(Any)", "Completed or terminated request(s) whose function is taken by this new request.", 0, java.lang.Integer.MAX_VALUE, replaces);
4683        case -445338488: /*groupIdentifier*/  return new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.", 0, 1, groupIdentifier);
4684        case -892481550: /*status*/  return new Property("status", "code", "The current state of the request. For request groups, the status reflects the status of all the requests in the group.", 0, 1, status);
4685        case -1183762788: /*intent*/  return new Property("intent", "code", "Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain.", 0, 1, intent);
4686        case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the request should be addressed with respect to other requests.", 0, 1, priority);
4687        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code that identifies what the overall request group is.", 0, 1, code);
4688        case -1867885268: /*subject*/  return new Property("subject", "Reference(Patient|Group)", "The subject for which the request group was created.", 0, 1, subject);
4689        case 1524132147: /*encounter*/  return new Property("encounter", "Reference(Encounter)", "Describes the context of the request group, if any.", 0, 1, encounter);
4690        case -1500852503: /*authoredOn*/  return new Property("authoredOn", "dateTime", "Indicates when the request group was created.", 0, 1, authoredOn);
4691        case -1406328437: /*author*/  return new Property("author", "Reference(Device|Practitioner|PractitionerRole)", "Provides a reference to the author of the request group.", 0, 1, author);
4692        case 722137681: /*reasonCode*/  return new Property("reasonCode", "CodeableConcept", "Describes the reason for the request group in coded or textual form.", 0, java.lang.Integer.MAX_VALUE, reasonCode);
4693        case -1146218137: /*reasonReference*/  return new Property("reasonReference", "Reference(Condition|Observation|DiagnosticReport|DocumentReference)", "Indicates another resource whose existence justifies this request group.", 0, java.lang.Integer.MAX_VALUE, reasonReference);
4694        case 3387378: /*note*/  return new Property("note", "Annotation", "Provides a mechanism to communicate additional information about the response.", 0, java.lang.Integer.MAX_VALUE, note);
4695        case -1422950858: /*action*/  return new Property("action", "", "The actions, if any, produced by the evaluation of the artifact.", 0, java.lang.Integer.MAX_VALUE, action);
4696        default: return super.getNamedProperty(_hash, _name, _checkValid);
4697        }
4698
4699      }
4700
4701      @Override
4702      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4703        switch (hash) {
4704        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4705        case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
4706        case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
4707        case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
4708        case -430332865: /*replaces*/ return this.replaces == null ? new Base[0] : this.replaces.toArray(new Base[this.replaces.size()]); // Reference
4709        case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier
4710        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<RequestStatus>
4711        case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration<RequestIntent>
4712        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
4713        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
4714        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
4715        case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference
4716        case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType
4717        case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
4718        case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
4719        case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
4720        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
4721        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // RequestGroupActionComponent
4722        default: return super.getProperty(hash, name, checkValid);
4723        }
4724
4725      }
4726
4727      @Override
4728      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4729        switch (hash) {
4730        case -1618432855: // identifier
4731          this.getIdentifier().add(castToIdentifier(value)); // Identifier
4732          return value;
4733        case 8911915: // instantiatesCanonical
4734          this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
4735          return value;
4736        case -1926393373: // instantiatesUri
4737          this.getInstantiatesUri().add(castToUri(value)); // UriType
4738          return value;
4739        case -332612366: // basedOn
4740          this.getBasedOn().add(castToReference(value)); // Reference
4741          return value;
4742        case -430332865: // replaces
4743          this.getReplaces().add(castToReference(value)); // Reference
4744          return value;
4745        case -445338488: // groupIdentifier
4746          this.groupIdentifier = castToIdentifier(value); // Identifier
4747          return value;
4748        case -892481550: // status
4749          value = new RequestStatusEnumFactory().fromType(castToCode(value));
4750          this.status = (Enumeration) value; // Enumeration<RequestStatus>
4751          return value;
4752        case -1183762788: // intent
4753          value = new RequestIntentEnumFactory().fromType(castToCode(value));
4754          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
4755          return value;
4756        case -1165461084: // priority
4757          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
4758          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
4759          return value;
4760        case 3059181: // code
4761          this.code = castToCodeableConcept(value); // CodeableConcept
4762          return value;
4763        case -1867885268: // subject
4764          this.subject = castToReference(value); // Reference
4765          return value;
4766        case 1524132147: // encounter
4767          this.encounter = castToReference(value); // Reference
4768          return value;
4769        case -1500852503: // authoredOn
4770          this.authoredOn = castToDateTime(value); // DateTimeType
4771          return value;
4772        case -1406328437: // author
4773          this.author = castToReference(value); // Reference
4774          return value;
4775        case 722137681: // reasonCode
4776          this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
4777          return value;
4778        case -1146218137: // reasonReference
4779          this.getReasonReference().add(castToReference(value)); // Reference
4780          return value;
4781        case 3387378: // note
4782          this.getNote().add(castToAnnotation(value)); // Annotation
4783          return value;
4784        case -1422950858: // action
4785          this.getAction().add((RequestGroupActionComponent) value); // RequestGroupActionComponent
4786          return value;
4787        default: return super.setProperty(hash, name, value);
4788        }
4789
4790      }
4791
4792      @Override
4793      public Base setProperty(String name, Base value) throws FHIRException {
4794        if (name.equals("identifier")) {
4795          this.getIdentifier().add(castToIdentifier(value));
4796        } else if (name.equals("instantiatesCanonical")) {
4797          this.getInstantiatesCanonical().add(castToCanonical(value));
4798        } else if (name.equals("instantiatesUri")) {
4799          this.getInstantiatesUri().add(castToUri(value));
4800        } else if (name.equals("basedOn")) {
4801          this.getBasedOn().add(castToReference(value));
4802        } else if (name.equals("replaces")) {
4803          this.getReplaces().add(castToReference(value));
4804        } else if (name.equals("groupIdentifier")) {
4805          this.groupIdentifier = castToIdentifier(value); // Identifier
4806        } else if (name.equals("status")) {
4807          value = new RequestStatusEnumFactory().fromType(castToCode(value));
4808          this.status = (Enumeration) value; // Enumeration<RequestStatus>
4809        } else if (name.equals("intent")) {
4810          value = new RequestIntentEnumFactory().fromType(castToCode(value));
4811          this.intent = (Enumeration) value; // Enumeration<RequestIntent>
4812        } else if (name.equals("priority")) {
4813          value = new RequestPriorityEnumFactory().fromType(castToCode(value));
4814          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
4815        } else if (name.equals("code")) {
4816          this.code = castToCodeableConcept(value); // CodeableConcept
4817        } else if (name.equals("subject")) {
4818          this.subject = castToReference(value); // Reference
4819        } else if (name.equals("encounter")) {
4820          this.encounter = castToReference(value); // Reference
4821        } else if (name.equals("authoredOn")) {
4822          this.authoredOn = castToDateTime(value); // DateTimeType
4823        } else if (name.equals("author")) {
4824          this.author = castToReference(value); // Reference
4825        } else if (name.equals("reasonCode")) {
4826          this.getReasonCode().add(castToCodeableConcept(value));
4827        } else if (name.equals("reasonReference")) {
4828          this.getReasonReference().add(castToReference(value));
4829        } else if (name.equals("note")) {
4830          this.getNote().add(castToAnnotation(value));
4831        } else if (name.equals("action")) {
4832          this.getAction().add((RequestGroupActionComponent) value);
4833        } else
4834          return super.setProperty(name, value);
4835        return value;
4836      }
4837
4838      @Override
4839      public Base makeProperty(int hash, String name) throws FHIRException {
4840        switch (hash) {
4841        case -1618432855:  return addIdentifier(); 
4842        case 8911915:  return addInstantiatesCanonicalElement();
4843        case -1926393373:  return addInstantiatesUriElement();
4844        case -332612366:  return addBasedOn(); 
4845        case -430332865:  return addReplaces(); 
4846        case -445338488:  return getGroupIdentifier(); 
4847        case -892481550:  return getStatusElement();
4848        case -1183762788:  return getIntentElement();
4849        case -1165461084:  return getPriorityElement();
4850        case 3059181:  return getCode(); 
4851        case -1867885268:  return getSubject(); 
4852        case 1524132147:  return getEncounter(); 
4853        case -1500852503:  return getAuthoredOnElement();
4854        case -1406328437:  return getAuthor(); 
4855        case 722137681:  return addReasonCode(); 
4856        case -1146218137:  return addReasonReference(); 
4857        case 3387378:  return addNote(); 
4858        case -1422950858:  return addAction(); 
4859        default: return super.makeProperty(hash, name);
4860        }
4861
4862      }
4863
4864      @Override
4865      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4866        switch (hash) {
4867        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4868        case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"};
4869        case -1926393373: /*instantiatesUri*/ return new String[] {"uri"};
4870        case -332612366: /*basedOn*/ return new String[] {"Reference"};
4871        case -430332865: /*replaces*/ return new String[] {"Reference"};
4872        case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"};
4873        case -892481550: /*status*/ return new String[] {"code"};
4874        case -1183762788: /*intent*/ return new String[] {"code"};
4875        case -1165461084: /*priority*/ return new String[] {"code"};
4876        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
4877        case -1867885268: /*subject*/ return new String[] {"Reference"};
4878        case 1524132147: /*encounter*/ return new String[] {"Reference"};
4879        case -1500852503: /*authoredOn*/ return new String[] {"dateTime"};
4880        case -1406328437: /*author*/ return new String[] {"Reference"};
4881        case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"};
4882        case -1146218137: /*reasonReference*/ return new String[] {"Reference"};
4883        case 3387378: /*note*/ return new String[] {"Annotation"};
4884        case -1422950858: /*action*/ return new String[] {};
4885        default: return super.getTypesForProperty(hash, name);
4886        }
4887
4888      }
4889
4890      @Override
4891      public Base addChild(String name) throws FHIRException {
4892        if (name.equals("identifier")) {
4893          return addIdentifier();
4894        }
4895        else if (name.equals("instantiatesCanonical")) {
4896          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.instantiatesCanonical");
4897        }
4898        else if (name.equals("instantiatesUri")) {
4899          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.instantiatesUri");
4900        }
4901        else if (name.equals("basedOn")) {
4902          return addBasedOn();
4903        }
4904        else if (name.equals("replaces")) {
4905          return addReplaces();
4906        }
4907        else if (name.equals("groupIdentifier")) {
4908          this.groupIdentifier = new Identifier();
4909          return this.groupIdentifier;
4910        }
4911        else if (name.equals("status")) {
4912          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.status");
4913        }
4914        else if (name.equals("intent")) {
4915          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.intent");
4916        }
4917        else if (name.equals("priority")) {
4918          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.priority");
4919        }
4920        else if (name.equals("code")) {
4921          this.code = new CodeableConcept();
4922          return this.code;
4923        }
4924        else if (name.equals("subject")) {
4925          this.subject = new Reference();
4926          return this.subject;
4927        }
4928        else if (name.equals("encounter")) {
4929          this.encounter = new Reference();
4930          return this.encounter;
4931        }
4932        else if (name.equals("authoredOn")) {
4933          throw new FHIRException("Cannot call addChild on a primitive type RequestGroup.authoredOn");
4934        }
4935        else if (name.equals("author")) {
4936          this.author = new Reference();
4937          return this.author;
4938        }
4939        else if (name.equals("reasonCode")) {
4940          return addReasonCode();
4941        }
4942        else if (name.equals("reasonReference")) {
4943          return addReasonReference();
4944        }
4945        else if (name.equals("note")) {
4946          return addNote();
4947        }
4948        else if (name.equals("action")) {
4949          return addAction();
4950        }
4951        else
4952          return super.addChild(name);
4953      }
4954
4955  public String fhirType() {
4956    return "RequestGroup";
4957
4958  }
4959
4960      public RequestGroup copy() {
4961        RequestGroup dst = new RequestGroup();
4962        copyValues(dst);
4963        if (identifier != null) {
4964          dst.identifier = new ArrayList<Identifier>();
4965          for (Identifier i : identifier)
4966            dst.identifier.add(i.copy());
4967        };
4968        if (instantiatesCanonical != null) {
4969          dst.instantiatesCanonical = new ArrayList<CanonicalType>();
4970          for (CanonicalType i : instantiatesCanonical)
4971            dst.instantiatesCanonical.add(i.copy());
4972        };
4973        if (instantiatesUri != null) {
4974          dst.instantiatesUri = new ArrayList<UriType>();
4975          for (UriType i : instantiatesUri)
4976            dst.instantiatesUri.add(i.copy());
4977        };
4978        if (basedOn != null) {
4979          dst.basedOn = new ArrayList<Reference>();
4980          for (Reference i : basedOn)
4981            dst.basedOn.add(i.copy());
4982        };
4983        if (replaces != null) {
4984          dst.replaces = new ArrayList<Reference>();
4985          for (Reference i : replaces)
4986            dst.replaces.add(i.copy());
4987        };
4988        dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
4989        dst.status = status == null ? null : status.copy();
4990        dst.intent = intent == null ? null : intent.copy();
4991        dst.priority = priority == null ? null : priority.copy();
4992        dst.code = code == null ? null : code.copy();
4993        dst.subject = subject == null ? null : subject.copy();
4994        dst.encounter = encounter == null ? null : encounter.copy();
4995        dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
4996        dst.author = author == null ? null : author.copy();
4997        if (reasonCode != null) {
4998          dst.reasonCode = new ArrayList<CodeableConcept>();
4999          for (CodeableConcept i : reasonCode)
5000            dst.reasonCode.add(i.copy());
5001        };
5002        if (reasonReference != null) {
5003          dst.reasonReference = new ArrayList<Reference>();
5004          for (Reference i : reasonReference)
5005            dst.reasonReference.add(i.copy());
5006        };
5007        if (note != null) {
5008          dst.note = new ArrayList<Annotation>();
5009          for (Annotation i : note)
5010            dst.note.add(i.copy());
5011        };
5012        if (action != null) {
5013          dst.action = new ArrayList<RequestGroupActionComponent>();
5014          for (RequestGroupActionComponent i : action)
5015            dst.action.add(i.copy());
5016        };
5017        return dst;
5018      }
5019
5020      protected RequestGroup typedCopy() {
5021        return copy();
5022      }
5023
5024      @Override
5025      public boolean equalsDeep(Base other_) {
5026        if (!super.equalsDeep(other_))
5027          return false;
5028        if (!(other_ instanceof RequestGroup))
5029          return false;
5030        RequestGroup o = (RequestGroup) other_;
5031        return compareDeep(identifier, o.identifier, true) && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
5032           && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
5033           && compareDeep(replaces, o.replaces, true) && compareDeep(groupIdentifier, o.groupIdentifier, true)
5034           && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true) && compareDeep(priority, o.priority, true)
5035           && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
5036           && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(author, o.author, true) && compareDeep(reasonCode, o.reasonCode, true)
5037           && compareDeep(reasonReference, o.reasonReference, true) && compareDeep(note, o.note, true) && compareDeep(action, o.action, true)
5038          ;
5039      }
5040
5041      @Override
5042      public boolean equalsShallow(Base other_) {
5043        if (!super.equalsShallow(other_))
5044          return false;
5045        if (!(other_ instanceof RequestGroup))
5046          return false;
5047        RequestGroup o = (RequestGroup) other_;
5048        return compareValues(instantiatesCanonical, o.instantiatesCanonical, true) && compareValues(instantiatesUri, o.instantiatesUri, true)
5049           && compareValues(status, o.status, true) && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true)
5050           && compareValues(authoredOn, o.authoredOn, true);
5051      }
5052
5053      public boolean isEmpty() {
5054        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical
5055          , instantiatesUri, basedOn, replaces, groupIdentifier, status, intent, priority
5056          , code, subject, encounter, authoredOn, author, reasonCode, reasonReference, note
5057          , action);
5058      }
5059
5060  @Override
5061  public ResourceType getResourceType() {
5062    return ResourceType.RequestGroup;
5063   }
5064
5065 /**
5066   * Search parameter: <b>authored</b>
5067   * <p>
5068   * Description: <b>The date the request group was authored</b><br>
5069   * Type: <b>date</b><br>
5070   * Path: <b>RequestGroup.authoredOn</b><br>
5071   * </p>
5072   */
5073  @SearchParamDefinition(name="authored", path="RequestGroup.authoredOn", description="The date the request group was authored", type="date" )
5074  public static final String SP_AUTHORED = "authored";
5075 /**
5076   * <b>Fluent Client</b> search parameter constant for <b>authored</b>
5077   * <p>
5078   * Description: <b>The date the request group was authored</b><br>
5079   * Type: <b>date</b><br>
5080   * Path: <b>RequestGroup.authoredOn</b><br>
5081   * </p>
5082   */
5083  public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHORED);
5084
5085 /**
5086   * Search parameter: <b>identifier</b>
5087   * <p>
5088   * Description: <b>External identifiers for the request group</b><br>
5089   * Type: <b>token</b><br>
5090   * Path: <b>RequestGroup.identifier</b><br>
5091   * </p>
5092   */
5093  @SearchParamDefinition(name="identifier", path="RequestGroup.identifier", description="External identifiers for the request group", type="token" )
5094  public static final String SP_IDENTIFIER = "identifier";
5095 /**
5096   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
5097   * <p>
5098   * Description: <b>External identifiers for the request group</b><br>
5099   * Type: <b>token</b><br>
5100   * Path: <b>RequestGroup.identifier</b><br>
5101   * </p>
5102   */
5103  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
5104
5105 /**
5106   * Search parameter: <b>code</b>
5107   * <p>
5108   * Description: <b>The code of the request group</b><br>
5109   * Type: <b>token</b><br>
5110   * Path: <b>RequestGroup.code</b><br>
5111   * </p>
5112   */
5113  @SearchParamDefinition(name="code", path="RequestGroup.code", description="The code of the request group", type="token" )
5114  public static final String SP_CODE = "code";
5115 /**
5116   * <b>Fluent Client</b> search parameter constant for <b>code</b>
5117   * <p>
5118   * Description: <b>The code of the request group</b><br>
5119   * Type: <b>token</b><br>
5120   * Path: <b>RequestGroup.code</b><br>
5121   * </p>
5122   */
5123  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
5124
5125 /**
5126   * Search parameter: <b>subject</b>
5127   * <p>
5128   * Description: <b>The subject that the request group is about</b><br>
5129   * Type: <b>reference</b><br>
5130   * Path: <b>RequestGroup.subject</b><br>
5131   * </p>
5132   */
5133  @SearchParamDefinition(name="subject", path="RequestGroup.subject", description="The subject that the request group is about", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class } )
5134  public static final String SP_SUBJECT = "subject";
5135 /**
5136   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
5137   * <p>
5138   * Description: <b>The subject that the request group is about</b><br>
5139   * Type: <b>reference</b><br>
5140   * Path: <b>RequestGroup.subject</b><br>
5141   * </p>
5142   */
5143  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
5144
5145/**
5146   * Constant for fluent queries to be used to add include statements. Specifies
5147   * the path value of "<b>RequestGroup:subject</b>".
5148   */
5149  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("RequestGroup:subject").toLocked();
5150
5151 /**
5152   * Search parameter: <b>author</b>
5153   * <p>
5154   * Description: <b>The author of the request group</b><br>
5155   * Type: <b>reference</b><br>
5156   * Path: <b>RequestGroup.author</b><br>
5157   * </p>
5158   */
5159  @SearchParamDefinition(name="author", path="RequestGroup.author", description="The author of the request group", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Practitioner.class, PractitionerRole.class } )
5160  public static final String SP_AUTHOR = "author";
5161 /**
5162   * <b>Fluent Client</b> search parameter constant for <b>author</b>
5163   * <p>
5164   * Description: <b>The author of the request group</b><br>
5165   * Type: <b>reference</b><br>
5166   * Path: <b>RequestGroup.author</b><br>
5167   * </p>
5168   */
5169  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
5170
5171/**
5172   * Constant for fluent queries to be used to add include statements. Specifies
5173   * the path value of "<b>RequestGroup:author</b>".
5174   */
5175  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("RequestGroup:author").toLocked();
5176
5177 /**
5178   * Search parameter: <b>instantiates-canonical</b>
5179   * <p>
5180   * Description: <b>The FHIR-based definition from which the request group is realized</b><br>
5181   * Type: <b>reference</b><br>
5182   * Path: <b>RequestGroup.instantiatesCanonical</b><br>
5183   * </p>
5184   */
5185  @SearchParamDefinition(name="instantiates-canonical", path="RequestGroup.instantiatesCanonical", description="The FHIR-based definition from which the request group is realized", type="reference" )
5186  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
5187 /**
5188   * <b>Fluent Client</b> search parameter constant for <b>instantiates-canonical</b>
5189   * <p>
5190   * Description: <b>The FHIR-based definition from which the request group is realized</b><br>
5191   * Type: <b>reference</b><br>
5192   * Path: <b>RequestGroup.instantiatesCanonical</b><br>
5193   * </p>
5194   */
5195  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSTANTIATES_CANONICAL);
5196
5197/**
5198   * Constant for fluent queries to be used to add include statements. Specifies
5199   * the path value of "<b>RequestGroup:instantiates-canonical</b>".
5200   */
5201  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include("RequestGroup:instantiates-canonical").toLocked();
5202
5203 /**
5204   * Search parameter: <b>encounter</b>
5205   * <p>
5206   * Description: <b>The encounter the request group applies to</b><br>
5207   * Type: <b>reference</b><br>
5208   * Path: <b>RequestGroup.encounter</b><br>
5209   * </p>
5210   */
5211  @SearchParamDefinition(name="encounter", path="RequestGroup.encounter", description="The encounter the request group applies to", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } )
5212  public static final String SP_ENCOUNTER = "encounter";
5213 /**
5214   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
5215   * <p>
5216   * Description: <b>The encounter the request group applies to</b><br>
5217   * Type: <b>reference</b><br>
5218   * Path: <b>RequestGroup.encounter</b><br>
5219   * </p>
5220   */
5221  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER);
5222
5223/**
5224   * Constant for fluent queries to be used to add include statements. Specifies
5225   * the path value of "<b>RequestGroup:encounter</b>".
5226   */
5227  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("RequestGroup:encounter").toLocked();
5228
5229 /**
5230   * Search parameter: <b>priority</b>
5231   * <p>
5232   * Description: <b>The priority of the request group</b><br>
5233   * Type: <b>token</b><br>
5234   * Path: <b>RequestGroup.priority</b><br>
5235   * </p>
5236   */
5237  @SearchParamDefinition(name="priority", path="RequestGroup.priority", description="The priority of the request group", type="token" )
5238  public static final String SP_PRIORITY = "priority";
5239 /**
5240   * <b>Fluent Client</b> search parameter constant for <b>priority</b>
5241   * <p>
5242   * Description: <b>The priority of the request group</b><br>
5243   * Type: <b>token</b><br>
5244   * Path: <b>RequestGroup.priority</b><br>
5245   * </p>
5246   */
5247  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY);
5248
5249 /**
5250   * Search parameter: <b>intent</b>
5251   * <p>
5252   * Description: <b>The intent of the request group</b><br>
5253   * Type: <b>token</b><br>
5254   * Path: <b>RequestGroup.intent</b><br>
5255   * </p>
5256   */
5257  @SearchParamDefinition(name="intent", path="RequestGroup.intent", description="The intent of the request group", type="token" )
5258  public static final String SP_INTENT = "intent";
5259 /**
5260   * <b>Fluent Client</b> search parameter constant for <b>intent</b>
5261   * <p>
5262   * Description: <b>The intent of the request group</b><br>
5263   * Type: <b>token</b><br>
5264   * Path: <b>RequestGroup.intent</b><br>
5265   * </p>
5266   */
5267  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT);
5268
5269 /**
5270   * Search parameter: <b>participant</b>
5271   * <p>
5272   * Description: <b>The participant in the requests in the group</b><br>
5273   * Type: <b>reference</b><br>
5274   * Path: <b>RequestGroup.action.participant</b><br>
5275   * </p>
5276   */
5277  @SearchParamDefinition(name="participant", path="RequestGroup.action.participant", description="The participant in the requests in the group", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name="RelatedPerson") }, target={Device.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } )
5278  public static final String SP_PARTICIPANT = "participant";
5279 /**
5280   * <b>Fluent Client</b> search parameter constant for <b>participant</b>
5281   * <p>
5282   * Description: <b>The participant in the requests in the group</b><br>
5283   * Type: <b>reference</b><br>
5284   * Path: <b>RequestGroup.action.participant</b><br>
5285   * </p>
5286   */
5287  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTICIPANT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTICIPANT);
5288
5289/**
5290   * Constant for fluent queries to be used to add include statements. Specifies
5291   * the path value of "<b>RequestGroup:participant</b>".
5292   */
5293  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTICIPANT = new ca.uhn.fhir.model.api.Include("RequestGroup:participant").toLocked();
5294
5295 /**
5296   * Search parameter: <b>group-identifier</b>
5297   * <p>
5298   * Description: <b>The group identifier for the request group</b><br>
5299   * Type: <b>token</b><br>
5300   * Path: <b>RequestGroup.groupIdentifier</b><br>
5301   * </p>
5302   */
5303  @SearchParamDefinition(name="group-identifier", path="RequestGroup.groupIdentifier", description="The group identifier for the request group", type="token" )
5304  public static final String SP_GROUP_IDENTIFIER = "group-identifier";
5305 /**
5306   * <b>Fluent Client</b> search parameter constant for <b>group-identifier</b>
5307   * <p>
5308   * Description: <b>The group identifier for the request group</b><br>
5309   * Type: <b>token</b><br>
5310   * Path: <b>RequestGroup.groupIdentifier</b><br>
5311   * </p>
5312   */
5313  public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_GROUP_IDENTIFIER);
5314
5315 /**
5316   * Search parameter: <b>patient</b>
5317   * <p>
5318   * Description: <b>The identity of a patient to search for request groups</b><br>
5319   * Type: <b>reference</b><br>
5320   * Path: <b>RequestGroup.subject</b><br>
5321   * </p>
5322   */
5323  @SearchParamDefinition(name="patient", path="RequestGroup.subject.where(resolve() is Patient)", description="The identity of a patient to search for request groups", type="reference", target={Patient.class } )
5324  public static final String SP_PATIENT = "patient";
5325 /**
5326   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
5327   * <p>
5328   * Description: <b>The identity of a patient to search for request groups</b><br>
5329   * Type: <b>reference</b><br>
5330   * Path: <b>RequestGroup.subject</b><br>
5331   * </p>
5332   */
5333  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
5334
5335/**
5336   * Constant for fluent queries to be used to add include statements. Specifies
5337   * the path value of "<b>RequestGroup:patient</b>".
5338   */
5339  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("RequestGroup:patient").toLocked();
5340
5341 /**
5342   * Search parameter: <b>instantiates-uri</b>
5343   * <p>
5344   * Description: <b>The external definition from which the request group is realized</b><br>
5345   * Type: <b>uri</b><br>
5346   * Path: <b>RequestGroup.instantiatesUri</b><br>
5347   * </p>
5348   */
5349  @SearchParamDefinition(name="instantiates-uri", path="RequestGroup.instantiatesUri", description="The external definition from which the request group is realized", type="uri" )
5350  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
5351 /**
5352   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
5353   * <p>
5354   * Description: <b>The external definition from which the request group is realized</b><br>
5355   * Type: <b>uri</b><br>
5356   * Path: <b>RequestGroup.instantiatesUri</b><br>
5357   * </p>
5358   */
5359  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_INSTANTIATES_URI);
5360
5361 /**
5362   * Search parameter: <b>status</b>
5363   * <p>
5364   * Description: <b>The status of the request group</b><br>
5365   * Type: <b>token</b><br>
5366   * Path: <b>RequestGroup.status</b><br>
5367   * </p>
5368   */
5369  @SearchParamDefinition(name="status", path="RequestGroup.status", description="The status of the request group", type="token" )
5370  public static final String SP_STATUS = "status";
5371 /**
5372   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5373   * <p>
5374   * Description: <b>The status of the request group</b><br>
5375   * Type: <b>token</b><br>
5376   * Path: <b>RequestGroup.status</b><br>
5377   * </p>
5378   */
5379  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5380
5381
5382}
5383