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