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