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