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