All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hl7.fhir.r4.model.RequestGroup Maven / Gradle / Ivy

Go to download

Builds the hapi fhir r4. Requires hapi-fhir-base and hapi-fhir-utilities be built first and be excluded from any other poms requiring it.

The newest version!
package org.hl7.fhir.r4.model;

/*
  Copyright (c) 2011+, HL7, Inc.
  All rights reserved.
  
  Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:
  
   * Redistributions of source code must retain the above copyright notice, this 
     list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright notice, 
     this list of conditions and the following disclaimer in the documentation 
     and/or other materials provided with the distribution.
   * Neither the name of HL7 nor the names of its contributors may be used to 
     endorse or promote products derived from this software without specific 
     prior written permission.
  
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
  POSSIBILITY OF SUCH DAMAGE.
  
*/

// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import org.hl7.fhir.utilities.Utilities;

import ca.uhn.fhir.model.api.annotation.Block;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;

/**
 * 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".
 */
@ResourceDef(name = "RequestGroup", profile = "http://hl7.org/fhir/StructureDefinition/RequestGroup")
public class RequestGroup extends DomainResource {

  public enum RequestStatus {
    /**
     * The request has been created but is not yet complete or ready for action.
     */
    DRAFT,
    /**
     * The request is in force and ready to be acted upon.
     */
    ACTIVE,
    /**
     * The request (and any implicit authorization to act) has been temporarily
     * withdrawn but is expected to resume in the future.
     */
    ONHOLD,
    /**
     * The request (and any implicit authorization to act) has been terminated prior
     * to the known full completion of the intended actions. No further activity
     * should occur.
     */
    REVOKED,
    /**
     * The activity described by the request has been fully performed. No further
     * activity will occur.
     */
    COMPLETED,
    /**
     * This request should never have existed and should be considered 'void'. (It
     * is possible that real-world decisions were based on it. If real-world
     * activity has occurred, the status should be "revoked" rather than
     * "entered-in-error".).
     */
    ENTEREDINERROR,
    /**
     * The authoring/source system does not know which of the status values
     * currently applies for this request. Note: This concept is not to be used for
     * "other" - one of the listed statuses is presumed to apply, but the
     * authoring/source system does not know which.
     */
    UNKNOWN,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static RequestStatus fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("draft".equals(codeString))
        return DRAFT;
      if ("active".equals(codeString))
        return ACTIVE;
      if ("on-hold".equals(codeString))
        return ONHOLD;
      if ("revoked".equals(codeString))
        return REVOKED;
      if ("completed".equals(codeString))
        return COMPLETED;
      if ("entered-in-error".equals(codeString))
        return ENTEREDINERROR;
      if ("unknown".equals(codeString))
        return UNKNOWN;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown RequestStatus code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case DRAFT:
        return "draft";
      case ACTIVE:
        return "active";
      case ONHOLD:
        return "on-hold";
      case REVOKED:
        return "revoked";
      case COMPLETED:
        return "completed";
      case ENTEREDINERROR:
        return "entered-in-error";
      case UNKNOWN:
        return "unknown";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case DRAFT:
        return "http://hl7.org/fhir/request-status";
      case ACTIVE:
        return "http://hl7.org/fhir/request-status";
      case ONHOLD:
        return "http://hl7.org/fhir/request-status";
      case REVOKED:
        return "http://hl7.org/fhir/request-status";
      case COMPLETED:
        return "http://hl7.org/fhir/request-status";
      case ENTEREDINERROR:
        return "http://hl7.org/fhir/request-status";
      case UNKNOWN:
        return "http://hl7.org/fhir/request-status";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case DRAFT:
        return "The request has been created but is not yet complete or ready for action.";
      case ACTIVE:
        return "The request is in force and ready to be acted upon.";
      case ONHOLD:
        return "The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.";
      case REVOKED:
        return "The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.";
      case COMPLETED:
        return "The activity described by the request has been fully performed.  No further activity will occur.";
      case ENTEREDINERROR:
        return "This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be \"revoked\" rather than \"entered-in-error\".).";
      case UNKNOWN:
        return "The authoring/source system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply,  but the authoring/source system does not know which.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case DRAFT:
        return "Draft";
      case ACTIVE:
        return "Active";
      case ONHOLD:
        return "On Hold";
      case REVOKED:
        return "Revoked";
      case COMPLETED:
        return "Completed";
      case ENTEREDINERROR:
        return "Entered in Error";
      case UNKNOWN:
        return "Unknown";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class RequestStatusEnumFactory implements EnumFactory {
    public RequestStatus fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("draft".equals(codeString))
        return RequestStatus.DRAFT;
      if ("active".equals(codeString))
        return RequestStatus.ACTIVE;
      if ("on-hold".equals(codeString))
        return RequestStatus.ONHOLD;
      if ("revoked".equals(codeString))
        return RequestStatus.REVOKED;
      if ("completed".equals(codeString))
        return RequestStatus.COMPLETED;
      if ("entered-in-error".equals(codeString))
        return RequestStatus.ENTEREDINERROR;
      if ("unknown".equals(codeString))
        return RequestStatus.UNKNOWN;
      throw new IllegalArgumentException("Unknown RequestStatus code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, RequestStatus.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, RequestStatus.NULL, code);
      if ("draft".equals(codeString))
        return new Enumeration(this, RequestStatus.DRAFT, code);
      if ("active".equals(codeString))
        return new Enumeration(this, RequestStatus.ACTIVE, code);
      if ("on-hold".equals(codeString))
        return new Enumeration(this, RequestStatus.ONHOLD, code);
      if ("revoked".equals(codeString))
        return new Enumeration(this, RequestStatus.REVOKED, code);
      if ("completed".equals(codeString))
        return new Enumeration(this, RequestStatus.COMPLETED, code);
      if ("entered-in-error".equals(codeString))
        return new Enumeration(this, RequestStatus.ENTEREDINERROR, code);
      if ("unknown".equals(codeString))
        return new Enumeration(this, RequestStatus.UNKNOWN, code);
      throw new FHIRException("Unknown RequestStatus code '" + codeString + "'");
    }

    public String toCode(RequestStatus code) {
      if (code == RequestStatus.DRAFT)
        return "draft";
      if (code == RequestStatus.ACTIVE)
        return "active";
      if (code == RequestStatus.ONHOLD)
        return "on-hold";
      if (code == RequestStatus.REVOKED)
        return "revoked";
      if (code == RequestStatus.COMPLETED)
        return "completed";
      if (code == RequestStatus.ENTEREDINERROR)
        return "entered-in-error";
      if (code == RequestStatus.UNKNOWN)
        return "unknown";
      return "?";
    }

    public String toSystem(RequestStatus code) {
      return code.getSystem();
    }
  }

  public enum RequestIntent {
    /**
     * 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.
     */
    PROPOSAL,
    /**
     * The request represents an intention to ensure something occurs without
     * providing an authorization for others to act.
     */
    PLAN,
    /**
     * The request represents a legally binding instruction authored by a Patient or
     * RelatedPerson.
     */
    DIRECTIVE,
    /**
     * The request represents a request/demand and authorization for action by a
     * Practitioner.
     */
    ORDER,
    /**
     * The request represents an original authorization for action.
     */
    ORIGINALORDER,
    /**
     * 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.
     */
    REFLEXORDER,
    /**
     * 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.
     */
    FILLERORDER,
    /**
     * 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.
     */
    INSTANCEORDER,
    /**
     * 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.
     */
    OPTION,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static RequestIntent fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("proposal".equals(codeString))
        return PROPOSAL;
      if ("plan".equals(codeString))
        return PLAN;
      if ("directive".equals(codeString))
        return DIRECTIVE;
      if ("order".equals(codeString))
        return ORDER;
      if ("original-order".equals(codeString))
        return ORIGINALORDER;
      if ("reflex-order".equals(codeString))
        return REFLEXORDER;
      if ("filler-order".equals(codeString))
        return FILLERORDER;
      if ("instance-order".equals(codeString))
        return INSTANCEORDER;
      if ("option".equals(codeString))
        return OPTION;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown RequestIntent code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case PROPOSAL:
        return "proposal";
      case PLAN:
        return "plan";
      case DIRECTIVE:
        return "directive";
      case ORDER:
        return "order";
      case ORIGINALORDER:
        return "original-order";
      case REFLEXORDER:
        return "reflex-order";
      case FILLERORDER:
        return "filler-order";
      case INSTANCEORDER:
        return "instance-order";
      case OPTION:
        return "option";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case PROPOSAL:
        return "http://hl7.org/fhir/request-intent";
      case PLAN:
        return "http://hl7.org/fhir/request-intent";
      case DIRECTIVE:
        return "http://hl7.org/fhir/request-intent";
      case ORDER:
        return "http://hl7.org/fhir/request-intent";
      case ORIGINALORDER:
        return "http://hl7.org/fhir/request-intent";
      case REFLEXORDER:
        return "http://hl7.org/fhir/request-intent";
      case FILLERORDER:
        return "http://hl7.org/fhir/request-intent";
      case INSTANCEORDER:
        return "http://hl7.org/fhir/request-intent";
      case OPTION:
        return "http://hl7.org/fhir/request-intent";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      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.";
      case PLAN:
        return "The request represents an intention to ensure something occurs without providing an authorization for others to act.";
      case DIRECTIVE:
        return "The request represents a legally binding instruction authored by a Patient or RelatedPerson.";
      case ORDER:
        return "The request represents a request/demand and authorization for action by a Practitioner.";
      case ORIGINALORDER:
        return "The request represents an original authorization for action.";
      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.";
      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.";
      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.";
      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.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case PROPOSAL:
        return "Proposal";
      case PLAN:
        return "Plan";
      case DIRECTIVE:
        return "Directive";
      case ORDER:
        return "Order";
      case ORIGINALORDER:
        return "Original Order";
      case REFLEXORDER:
        return "Reflex Order";
      case FILLERORDER:
        return "Filler Order";
      case INSTANCEORDER:
        return "Instance Order";
      case OPTION:
        return "Option";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class RequestIntentEnumFactory implements EnumFactory {
    public RequestIntent fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("proposal".equals(codeString))
        return RequestIntent.PROPOSAL;
      if ("plan".equals(codeString))
        return RequestIntent.PLAN;
      if ("directive".equals(codeString))
        return RequestIntent.DIRECTIVE;
      if ("order".equals(codeString))
        return RequestIntent.ORDER;
      if ("original-order".equals(codeString))
        return RequestIntent.ORIGINALORDER;
      if ("reflex-order".equals(codeString))
        return RequestIntent.REFLEXORDER;
      if ("filler-order".equals(codeString))
        return RequestIntent.FILLERORDER;
      if ("instance-order".equals(codeString))
        return RequestIntent.INSTANCEORDER;
      if ("option".equals(codeString))
        return RequestIntent.OPTION;
      throw new IllegalArgumentException("Unknown RequestIntent code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, RequestIntent.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, RequestIntent.NULL, code);
      if ("proposal".equals(codeString))
        return new Enumeration(this, RequestIntent.PROPOSAL, code);
      if ("plan".equals(codeString))
        return new Enumeration(this, RequestIntent.PLAN, code);
      if ("directive".equals(codeString))
        return new Enumeration(this, RequestIntent.DIRECTIVE, code);
      if ("order".equals(codeString))
        return new Enumeration(this, RequestIntent.ORDER, code);
      if ("original-order".equals(codeString))
        return new Enumeration(this, RequestIntent.ORIGINALORDER, code);
      if ("reflex-order".equals(codeString))
        return new Enumeration(this, RequestIntent.REFLEXORDER, code);
      if ("filler-order".equals(codeString))
        return new Enumeration(this, RequestIntent.FILLERORDER, code);
      if ("instance-order".equals(codeString))
        return new Enumeration(this, RequestIntent.INSTANCEORDER, code);
      if ("option".equals(codeString))
        return new Enumeration(this, RequestIntent.OPTION, code);
      throw new FHIRException("Unknown RequestIntent code '" + codeString + "'");
    }

    public String toCode(RequestIntent code) {
      if (code == RequestIntent.PROPOSAL)
        return "proposal";
      if (code == RequestIntent.PLAN)
        return "plan";
      if (code == RequestIntent.DIRECTIVE)
        return "directive";
      if (code == RequestIntent.ORDER)
        return "order";
      if (code == RequestIntent.ORIGINALORDER)
        return "original-order";
      if (code == RequestIntent.REFLEXORDER)
        return "reflex-order";
      if (code == RequestIntent.FILLERORDER)
        return "filler-order";
      if (code == RequestIntent.INSTANCEORDER)
        return "instance-order";
      if (code == RequestIntent.OPTION)
        return "option";
      return "?";
    }

    public String toSystem(RequestIntent code) {
      return code.getSystem();
    }
  }

  public enum RequestPriority {
    /**
     * The request has normal priority.
     */
    ROUTINE,
    /**
     * The request should be actioned promptly - higher priority than routine.
     */
    URGENT,
    /**
     * The request should be actioned as soon as possible - higher priority than
     * urgent.
     */
    ASAP,
    /**
     * The request should be actioned immediately - highest possible priority. E.g.
     * an emergency.
     */
    STAT,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static RequestPriority fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("routine".equals(codeString))
        return ROUTINE;
      if ("urgent".equals(codeString))
        return URGENT;
      if ("asap".equals(codeString))
        return ASAP;
      if ("stat".equals(codeString))
        return STAT;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown RequestPriority code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case ROUTINE:
        return "routine";
      case URGENT:
        return "urgent";
      case ASAP:
        return "asap";
      case STAT:
        return "stat";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case ROUTINE:
        return "http://hl7.org/fhir/request-priority";
      case URGENT:
        return "http://hl7.org/fhir/request-priority";
      case ASAP:
        return "http://hl7.org/fhir/request-priority";
      case STAT:
        return "http://hl7.org/fhir/request-priority";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case ROUTINE:
        return "The request has normal priority.";
      case URGENT:
        return "The request should be actioned promptly - higher priority than routine.";
      case ASAP:
        return "The request should be actioned as soon as possible - higher priority than urgent.";
      case STAT:
        return "The request should be actioned immediately - highest possible priority.  E.g. an emergency.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case ROUTINE:
        return "Routine";
      case URGENT:
        return "Urgent";
      case ASAP:
        return "ASAP";
      case STAT:
        return "STAT";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class RequestPriorityEnumFactory implements EnumFactory {
    public RequestPriority fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("routine".equals(codeString))
        return RequestPriority.ROUTINE;
      if ("urgent".equals(codeString))
        return RequestPriority.URGENT;
      if ("asap".equals(codeString))
        return RequestPriority.ASAP;
      if ("stat".equals(codeString))
        return RequestPriority.STAT;
      throw new IllegalArgumentException("Unknown RequestPriority code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, RequestPriority.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, RequestPriority.NULL, code);
      if ("routine".equals(codeString))
        return new Enumeration(this, RequestPriority.ROUTINE, code);
      if ("urgent".equals(codeString))
        return new Enumeration(this, RequestPriority.URGENT, code);
      if ("asap".equals(codeString))
        return new Enumeration(this, RequestPriority.ASAP, code);
      if ("stat".equals(codeString))
        return new Enumeration(this, RequestPriority.STAT, code);
      throw new FHIRException("Unknown RequestPriority code '" + codeString + "'");
    }

    public String toCode(RequestPriority code) {
      if (code == RequestPriority.ROUTINE)
        return "routine";
      if (code == RequestPriority.URGENT)
        return "urgent";
      if (code == RequestPriority.ASAP)
        return "asap";
      if (code == RequestPriority.STAT)
        return "stat";
      return "?";
    }

    public String toSystem(RequestPriority code) {
      return code.getSystem();
    }
  }

  public enum ActionConditionKind {
    /**
     * The condition describes whether or not a given action is applicable.
     */
    APPLICABILITY,
    /**
     * The condition is a starting condition for the action.
     */
    START,
    /**
     * The condition is a stop, or exit condition for the action.
     */
    STOP,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static ActionConditionKind fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("applicability".equals(codeString))
        return APPLICABILITY;
      if ("start".equals(codeString))
        return START;
      if ("stop".equals(codeString))
        return STOP;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown ActionConditionKind code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case APPLICABILITY:
        return "applicability";
      case START:
        return "start";
      case STOP:
        return "stop";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case APPLICABILITY:
        return "http://hl7.org/fhir/action-condition-kind";
      case START:
        return "http://hl7.org/fhir/action-condition-kind";
      case STOP:
        return "http://hl7.org/fhir/action-condition-kind";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case APPLICABILITY:
        return "The condition describes whether or not a given action is applicable.";
      case START:
        return "The condition is a starting condition for the action.";
      case STOP:
        return "The condition is a stop, or exit condition for the action.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case APPLICABILITY:
        return "Applicability";
      case START:
        return "Start";
      case STOP:
        return "Stop";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class ActionConditionKindEnumFactory implements EnumFactory {
    public ActionConditionKind fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("applicability".equals(codeString))
        return ActionConditionKind.APPLICABILITY;
      if ("start".equals(codeString))
        return ActionConditionKind.START;
      if ("stop".equals(codeString))
        return ActionConditionKind.STOP;
      throw new IllegalArgumentException("Unknown ActionConditionKind code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, ActionConditionKind.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, ActionConditionKind.NULL, code);
      if ("applicability".equals(codeString))
        return new Enumeration(this, ActionConditionKind.APPLICABILITY, code);
      if ("start".equals(codeString))
        return new Enumeration(this, ActionConditionKind.START, code);
      if ("stop".equals(codeString))
        return new Enumeration(this, ActionConditionKind.STOP, code);
      throw new FHIRException("Unknown ActionConditionKind code '" + codeString + "'");
    }

    public String toCode(ActionConditionKind code) {
      if (code == ActionConditionKind.APPLICABILITY)
        return "applicability";
      if (code == ActionConditionKind.START)
        return "start";
      if (code == ActionConditionKind.STOP)
        return "stop";
      return "?";
    }

    public String toSystem(ActionConditionKind code) {
      return code.getSystem();
    }
  }

  public enum ActionRelationshipType {
    /**
     * The action must be performed before the start of the related action.
     */
    BEFORESTART,
    /**
     * The action must be performed before the related action.
     */
    BEFORE,
    /**
     * The action must be performed before the end of the related action.
     */
    BEFOREEND,
    /**
     * The action must be performed concurrent with the start of the related action.
     */
    CONCURRENTWITHSTART,
    /**
     * The action must be performed concurrent with the related action.
     */
    CONCURRENT,
    /**
     * The action must be performed concurrent with the end of the related action.
     */
    CONCURRENTWITHEND,
    /**
     * The action must be performed after the start of the related action.
     */
    AFTERSTART,
    /**
     * The action must be performed after the related action.
     */
    AFTER,
    /**
     * The action must be performed after the end of the related action.
     */
    AFTEREND,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static ActionRelationshipType fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("before-start".equals(codeString))
        return BEFORESTART;
      if ("before".equals(codeString))
        return BEFORE;
      if ("before-end".equals(codeString))
        return BEFOREEND;
      if ("concurrent-with-start".equals(codeString))
        return CONCURRENTWITHSTART;
      if ("concurrent".equals(codeString))
        return CONCURRENT;
      if ("concurrent-with-end".equals(codeString))
        return CONCURRENTWITHEND;
      if ("after-start".equals(codeString))
        return AFTERSTART;
      if ("after".equals(codeString))
        return AFTER;
      if ("after-end".equals(codeString))
        return AFTEREND;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown ActionRelationshipType code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case BEFORESTART:
        return "before-start";
      case BEFORE:
        return "before";
      case BEFOREEND:
        return "before-end";
      case CONCURRENTWITHSTART:
        return "concurrent-with-start";
      case CONCURRENT:
        return "concurrent";
      case CONCURRENTWITHEND:
        return "concurrent-with-end";
      case AFTERSTART:
        return "after-start";
      case AFTER:
        return "after";
      case AFTEREND:
        return "after-end";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case BEFORESTART:
        return "http://hl7.org/fhir/action-relationship-type";
      case BEFORE:
        return "http://hl7.org/fhir/action-relationship-type";
      case BEFOREEND:
        return "http://hl7.org/fhir/action-relationship-type";
      case CONCURRENTWITHSTART:
        return "http://hl7.org/fhir/action-relationship-type";
      case CONCURRENT:
        return "http://hl7.org/fhir/action-relationship-type";
      case CONCURRENTWITHEND:
        return "http://hl7.org/fhir/action-relationship-type";
      case AFTERSTART:
        return "http://hl7.org/fhir/action-relationship-type";
      case AFTER:
        return "http://hl7.org/fhir/action-relationship-type";
      case AFTEREND:
        return "http://hl7.org/fhir/action-relationship-type";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case BEFORESTART:
        return "The action must be performed before the start of the related action.";
      case BEFORE:
        return "The action must be performed before the related action.";
      case BEFOREEND:
        return "The action must be performed before the end of the related action.";
      case CONCURRENTWITHSTART:
        return "The action must be performed concurrent with the start of the related action.";
      case CONCURRENT:
        return "The action must be performed concurrent with the related action.";
      case CONCURRENTWITHEND:
        return "The action must be performed concurrent with the end of the related action.";
      case AFTERSTART:
        return "The action must be performed after the start of the related action.";
      case AFTER:
        return "The action must be performed after the related action.";
      case AFTEREND:
        return "The action must be performed after the end of the related action.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case BEFORESTART:
        return "Before Start";
      case BEFORE:
        return "Before";
      case BEFOREEND:
        return "Before End";
      case CONCURRENTWITHSTART:
        return "Concurrent With Start";
      case CONCURRENT:
        return "Concurrent";
      case CONCURRENTWITHEND:
        return "Concurrent With End";
      case AFTERSTART:
        return "After Start";
      case AFTER:
        return "After";
      case AFTEREND:
        return "After End";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class ActionRelationshipTypeEnumFactory implements EnumFactory {
    public ActionRelationshipType fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("before-start".equals(codeString))
        return ActionRelationshipType.BEFORESTART;
      if ("before".equals(codeString))
        return ActionRelationshipType.BEFORE;
      if ("before-end".equals(codeString))
        return ActionRelationshipType.BEFOREEND;
      if ("concurrent-with-start".equals(codeString))
        return ActionRelationshipType.CONCURRENTWITHSTART;
      if ("concurrent".equals(codeString))
        return ActionRelationshipType.CONCURRENT;
      if ("concurrent-with-end".equals(codeString))
        return ActionRelationshipType.CONCURRENTWITHEND;
      if ("after-start".equals(codeString))
        return ActionRelationshipType.AFTERSTART;
      if ("after".equals(codeString))
        return ActionRelationshipType.AFTER;
      if ("after-end".equals(codeString))
        return ActionRelationshipType.AFTEREND;
      throw new IllegalArgumentException("Unknown ActionRelationshipType code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, ActionRelationshipType.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.NULL, code);
      if ("before-start".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.BEFORESTART, code);
      if ("before".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.BEFORE, code);
      if ("before-end".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.BEFOREEND, code);
      if ("concurrent-with-start".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.CONCURRENTWITHSTART, code);
      if ("concurrent".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.CONCURRENT, code);
      if ("concurrent-with-end".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.CONCURRENTWITHEND, code);
      if ("after-start".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.AFTERSTART, code);
      if ("after".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.AFTER, code);
      if ("after-end".equals(codeString))
        return new Enumeration(this, ActionRelationshipType.AFTEREND, code);
      throw new FHIRException("Unknown ActionRelationshipType code '" + codeString + "'");
    }

    public String toCode(ActionRelationshipType code) {
      if (code == ActionRelationshipType.BEFORESTART)
        return "before-start";
      if (code == ActionRelationshipType.BEFORE)
        return "before";
      if (code == ActionRelationshipType.BEFOREEND)
        return "before-end";
      if (code == ActionRelationshipType.CONCURRENTWITHSTART)
        return "concurrent-with-start";
      if (code == ActionRelationshipType.CONCURRENT)
        return "concurrent";
      if (code == ActionRelationshipType.CONCURRENTWITHEND)
        return "concurrent-with-end";
      if (code == ActionRelationshipType.AFTERSTART)
        return "after-start";
      if (code == ActionRelationshipType.AFTER)
        return "after";
      if (code == ActionRelationshipType.AFTEREND)
        return "after-end";
      return "?";
    }

    public String toSystem(ActionRelationshipType code) {
      return code.getSystem();
    }
  }

  public enum ActionGroupingBehavior {
    /**
     * Any group marked with this behavior should be displayed as a visual group to
     * the end user.
     */
    VISUALGROUP,
    /**
     * 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.
     */
    LOGICALGROUP,
    /**
     * 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".
     */
    SENTENCEGROUP,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static ActionGroupingBehavior fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("visual-group".equals(codeString))
        return VISUALGROUP;
      if ("logical-group".equals(codeString))
        return LOGICALGROUP;
      if ("sentence-group".equals(codeString))
        return SENTENCEGROUP;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown ActionGroupingBehavior code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case VISUALGROUP:
        return "visual-group";
      case LOGICALGROUP:
        return "logical-group";
      case SENTENCEGROUP:
        return "sentence-group";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case VISUALGROUP:
        return "http://hl7.org/fhir/action-grouping-behavior";
      case LOGICALGROUP:
        return "http://hl7.org/fhir/action-grouping-behavior";
      case SENTENCEGROUP:
        return "http://hl7.org/fhir/action-grouping-behavior";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case VISUALGROUP:
        return "Any group marked with this behavior should be displayed as a visual group to the end user.";
      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.";
      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\".";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case VISUALGROUP:
        return "Visual Group";
      case LOGICALGROUP:
        return "Logical Group";
      case SENTENCEGROUP:
        return "Sentence Group";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class ActionGroupingBehaviorEnumFactory implements EnumFactory {
    public ActionGroupingBehavior fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("visual-group".equals(codeString))
        return ActionGroupingBehavior.VISUALGROUP;
      if ("logical-group".equals(codeString))
        return ActionGroupingBehavior.LOGICALGROUP;
      if ("sentence-group".equals(codeString))
        return ActionGroupingBehavior.SENTENCEGROUP;
      throw new IllegalArgumentException("Unknown ActionGroupingBehavior code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, ActionGroupingBehavior.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, ActionGroupingBehavior.NULL, code);
      if ("visual-group".equals(codeString))
        return new Enumeration(this, ActionGroupingBehavior.VISUALGROUP, code);
      if ("logical-group".equals(codeString))
        return new Enumeration(this, ActionGroupingBehavior.LOGICALGROUP, code);
      if ("sentence-group".equals(codeString))
        return new Enumeration(this, ActionGroupingBehavior.SENTENCEGROUP, code);
      throw new FHIRException("Unknown ActionGroupingBehavior code '" + codeString + "'");
    }

    public String toCode(ActionGroupingBehavior code) {
      if (code == ActionGroupingBehavior.VISUALGROUP)
        return "visual-group";
      if (code == ActionGroupingBehavior.LOGICALGROUP)
        return "logical-group";
      if (code == ActionGroupingBehavior.SENTENCEGROUP)
        return "sentence-group";
      return "?";
    }

    public String toSystem(ActionGroupingBehavior code) {
      return code.getSystem();
    }
  }

  public enum ActionSelectionBehavior {
    /**
     * Any number of the actions in the group may be chosen, from zero to all.
     */
    ANY,
    /**
     * All the actions in the group must be selected as a single unit.
     */
    ALL,
    /**
     * 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.
     */
    ALLORNONE,
    /**
     * 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.
     */
    EXACTLYONE,
    /**
     * The end user may choose zero or at most one of the actions in the group.
     */
    ATMOSTONE,
    /**
     * The end user must choose a minimum of one, and as many additional as desired.
     */
    ONEORMORE,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static ActionSelectionBehavior fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("any".equals(codeString))
        return ANY;
      if ("all".equals(codeString))
        return ALL;
      if ("all-or-none".equals(codeString))
        return ALLORNONE;
      if ("exactly-one".equals(codeString))
        return EXACTLYONE;
      if ("at-most-one".equals(codeString))
        return ATMOSTONE;
      if ("one-or-more".equals(codeString))
        return ONEORMORE;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown ActionSelectionBehavior code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case ANY:
        return "any";
      case ALL:
        return "all";
      case ALLORNONE:
        return "all-or-none";
      case EXACTLYONE:
        return "exactly-one";
      case ATMOSTONE:
        return "at-most-one";
      case ONEORMORE:
        return "one-or-more";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case ANY:
        return "http://hl7.org/fhir/action-selection-behavior";
      case ALL:
        return "http://hl7.org/fhir/action-selection-behavior";
      case ALLORNONE:
        return "http://hl7.org/fhir/action-selection-behavior";
      case EXACTLYONE:
        return "http://hl7.org/fhir/action-selection-behavior";
      case ATMOSTONE:
        return "http://hl7.org/fhir/action-selection-behavior";
      case ONEORMORE:
        return "http://hl7.org/fhir/action-selection-behavior";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case ANY:
        return "Any number of the actions in the group may be chosen, from zero to all.";
      case ALL:
        return "All the actions in the group must be selected as a single unit.";
      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.";
      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.";
      case ATMOSTONE:
        return "The end user may choose zero or at most one of the actions in the group.";
      case ONEORMORE:
        return "The end user must choose a minimum of one, and as many additional as desired.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case ANY:
        return "Any";
      case ALL:
        return "All";
      case ALLORNONE:
        return "All Or None";
      case EXACTLYONE:
        return "Exactly One";
      case ATMOSTONE:
        return "At Most One";
      case ONEORMORE:
        return "One Or More";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class ActionSelectionBehaviorEnumFactory implements EnumFactory {
    public ActionSelectionBehavior fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("any".equals(codeString))
        return ActionSelectionBehavior.ANY;
      if ("all".equals(codeString))
        return ActionSelectionBehavior.ALL;
      if ("all-or-none".equals(codeString))
        return ActionSelectionBehavior.ALLORNONE;
      if ("exactly-one".equals(codeString))
        return ActionSelectionBehavior.EXACTLYONE;
      if ("at-most-one".equals(codeString))
        return ActionSelectionBehavior.ATMOSTONE;
      if ("one-or-more".equals(codeString))
        return ActionSelectionBehavior.ONEORMORE;
      throw new IllegalArgumentException("Unknown ActionSelectionBehavior code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, ActionSelectionBehavior.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, ActionSelectionBehavior.NULL, code);
      if ("any".equals(codeString))
        return new Enumeration(this, ActionSelectionBehavior.ANY, code);
      if ("all".equals(codeString))
        return new Enumeration(this, ActionSelectionBehavior.ALL, code);
      if ("all-or-none".equals(codeString))
        return new Enumeration(this, ActionSelectionBehavior.ALLORNONE, code);
      if ("exactly-one".equals(codeString))
        return new Enumeration(this, ActionSelectionBehavior.EXACTLYONE, code);
      if ("at-most-one".equals(codeString))
        return new Enumeration(this, ActionSelectionBehavior.ATMOSTONE, code);
      if ("one-or-more".equals(codeString))
        return new Enumeration(this, ActionSelectionBehavior.ONEORMORE, code);
      throw new FHIRException("Unknown ActionSelectionBehavior code '" + codeString + "'");
    }

    public String toCode(ActionSelectionBehavior code) {
      if (code == ActionSelectionBehavior.ANY)
        return "any";
      if (code == ActionSelectionBehavior.ALL)
        return "all";
      if (code == ActionSelectionBehavior.ALLORNONE)
        return "all-or-none";
      if (code == ActionSelectionBehavior.EXACTLYONE)
        return "exactly-one";
      if (code == ActionSelectionBehavior.ATMOSTONE)
        return "at-most-one";
      if (code == ActionSelectionBehavior.ONEORMORE)
        return "one-or-more";
      return "?";
    }

    public String toSystem(ActionSelectionBehavior code) {
      return code.getSystem();
    }
  }

  public enum ActionRequiredBehavior {
    /**
     * 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.
     */
    MUST,
    /**
     * An action with this behavior may be included in the set of actions processed
     * by the end user.
     */
    COULD,
    /**
     * 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.
     */
    MUSTUNLESSDOCUMENTED,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static ActionRequiredBehavior fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("must".equals(codeString))
        return MUST;
      if ("could".equals(codeString))
        return COULD;
      if ("must-unless-documented".equals(codeString))
        return MUSTUNLESSDOCUMENTED;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown ActionRequiredBehavior code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case MUST:
        return "must";
      case COULD:
        return "could";
      case MUSTUNLESSDOCUMENTED:
        return "must-unless-documented";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case MUST:
        return "http://hl7.org/fhir/action-required-behavior";
      case COULD:
        return "http://hl7.org/fhir/action-required-behavior";
      case MUSTUNLESSDOCUMENTED:
        return "http://hl7.org/fhir/action-required-behavior";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      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.";
      case COULD:
        return "An action with this behavior may be included in the set of actions processed by the end user.";
      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.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case MUST:
        return "Must";
      case COULD:
        return "Could";
      case MUSTUNLESSDOCUMENTED:
        return "Must Unless Documented";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class ActionRequiredBehaviorEnumFactory implements EnumFactory {
    public ActionRequiredBehavior fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("must".equals(codeString))
        return ActionRequiredBehavior.MUST;
      if ("could".equals(codeString))
        return ActionRequiredBehavior.COULD;
      if ("must-unless-documented".equals(codeString))
        return ActionRequiredBehavior.MUSTUNLESSDOCUMENTED;
      throw new IllegalArgumentException("Unknown ActionRequiredBehavior code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, ActionRequiredBehavior.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, ActionRequiredBehavior.NULL, code);
      if ("must".equals(codeString))
        return new Enumeration(this, ActionRequiredBehavior.MUST, code);
      if ("could".equals(codeString))
        return new Enumeration(this, ActionRequiredBehavior.COULD, code);
      if ("must-unless-documented".equals(codeString))
        return new Enumeration(this, ActionRequiredBehavior.MUSTUNLESSDOCUMENTED, code);
      throw new FHIRException("Unknown ActionRequiredBehavior code '" + codeString + "'");
    }

    public String toCode(ActionRequiredBehavior code) {
      if (code == ActionRequiredBehavior.MUST)
        return "must";
      if (code == ActionRequiredBehavior.COULD)
        return "could";
      if (code == ActionRequiredBehavior.MUSTUNLESSDOCUMENTED)
        return "must-unless-documented";
      return "?";
    }

    public String toSystem(ActionRequiredBehavior code) {
      return code.getSystem();
    }
  }

  public enum ActionPrecheckBehavior {
    /**
     * 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.
     */
    YES,
    /**
     * 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.
     */
    NO,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static ActionPrecheckBehavior fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("yes".equals(codeString))
        return YES;
      if ("no".equals(codeString))
        return NO;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown ActionPrecheckBehavior code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case YES:
        return "yes";
      case NO:
        return "no";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case YES:
        return "http://hl7.org/fhir/action-precheck-behavior";
      case NO:
        return "http://hl7.org/fhir/action-precheck-behavior";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      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.";
      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.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case YES:
        return "Yes";
      case NO:
        return "No";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class ActionPrecheckBehaviorEnumFactory implements EnumFactory {
    public ActionPrecheckBehavior fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("yes".equals(codeString))
        return ActionPrecheckBehavior.YES;
      if ("no".equals(codeString))
        return ActionPrecheckBehavior.NO;
      throw new IllegalArgumentException("Unknown ActionPrecheckBehavior code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, ActionPrecheckBehavior.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, ActionPrecheckBehavior.NULL, code);
      if ("yes".equals(codeString))
        return new Enumeration(this, ActionPrecheckBehavior.YES, code);
      if ("no".equals(codeString))
        return new Enumeration(this, ActionPrecheckBehavior.NO, code);
      throw new FHIRException("Unknown ActionPrecheckBehavior code '" + codeString + "'");
    }

    public String toCode(ActionPrecheckBehavior code) {
      if (code == ActionPrecheckBehavior.YES)
        return "yes";
      if (code == ActionPrecheckBehavior.NO)
        return "no";
      return "?";
    }

    public String toSystem(ActionPrecheckBehavior code) {
      return code.getSystem();
    }
  }

  public enum ActionCardinalityBehavior {
    /**
     * The action may only be selected one time.
     */
    SINGLE,
    /**
     * The action may be selected multiple times.
     */
    MULTIPLE,
    /**
     * added to help the parsers with the generic types
     */
    NULL;

    public static ActionCardinalityBehavior fromCode(String codeString) throws FHIRException {
      if (codeString == null || "".equals(codeString))
        return null;
      if ("single".equals(codeString))
        return SINGLE;
      if ("multiple".equals(codeString))
        return MULTIPLE;
      if (Configuration.isAcceptInvalidEnums())
        return null;
      else
        throw new FHIRException("Unknown ActionCardinalityBehavior code '" + codeString + "'");
    }

    public String toCode() {
      switch (this) {
      case SINGLE:
        return "single";
      case MULTIPLE:
        return "multiple";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getSystem() {
      switch (this) {
      case SINGLE:
        return "http://hl7.org/fhir/action-cardinality-behavior";
      case MULTIPLE:
        return "http://hl7.org/fhir/action-cardinality-behavior";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDefinition() {
      switch (this) {
      case SINGLE:
        return "The action may only be selected one time.";
      case MULTIPLE:
        return "The action may be selected multiple times.";
      case NULL:
        return null;
      default:
        return "?";
      }
    }

    public String getDisplay() {
      switch (this) {
      case SINGLE:
        return "Single";
      case MULTIPLE:
        return "Multiple";
      case NULL:
        return null;
      default:
        return "?";
      }
    }
  }

  public static class ActionCardinalityBehaviorEnumFactory implements EnumFactory {
    public ActionCardinalityBehavior fromCode(String codeString) throws IllegalArgumentException {
      if (codeString == null || "".equals(codeString))
        if (codeString == null || "".equals(codeString))
          return null;
      if ("single".equals(codeString))
        return ActionCardinalityBehavior.SINGLE;
      if ("multiple".equals(codeString))
        return ActionCardinalityBehavior.MULTIPLE;
      throw new IllegalArgumentException("Unknown ActionCardinalityBehavior code '" + codeString + "'");
    }

    public Enumeration fromType(PrimitiveType code) throws FHIRException {
      if (code == null)
        return null;
      if (code.isEmpty())
        return new Enumeration(this, ActionCardinalityBehavior.NULL, code);
      String codeString = code.asStringValue();
      if (codeString == null || "".equals(codeString))
        return new Enumeration(this, ActionCardinalityBehavior.NULL, code);
      if ("single".equals(codeString))
        return new Enumeration(this, ActionCardinalityBehavior.SINGLE, code);
      if ("multiple".equals(codeString))
        return new Enumeration(this, ActionCardinalityBehavior.MULTIPLE, code);
      throw new FHIRException("Unknown ActionCardinalityBehavior code '" + codeString + "'");
    }

    public String toCode(ActionCardinalityBehavior code) {
      if (code == ActionCardinalityBehavior.SINGLE)
        return "single";
      if (code == ActionCardinalityBehavior.MULTIPLE)
        return "multiple";
      return "?";
    }

    public String toSystem(ActionCardinalityBehavior code) {
      return code.getSystem();
    }
  }

  @Block()
  public static class RequestGroupActionComponent extends BackboneElement implements IBaseBackboneElement {
    /**
     * A user-visible prefix for the action.
     */
    @Child(name = "prefix", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "User-visible prefix for the action (e.g. 1. or A.)", formalDefinition = "A user-visible prefix for the action.")
    protected StringType prefix;

    /**
     * The title of the action displayed to a user.
     */
    @Child(name = "title", type = { StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "User-visible title", formalDefinition = "The title of the action displayed to a user.")
    protected StringType title;

    /**
     * A short description of the action used to provide a summary to display to the
     * user.
     */
    @Child(name = "description", type = {
        StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
    @Description(shortDefinition = "Short description of the action", formalDefinition = "A short description of the action used to provide a summary to display to the user.")
    protected StringType description;

    /**
     * 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.
     */
    @Child(name = "textEquivalent", type = {
        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
    @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.")
    protected StringType textEquivalent;

    /**
     * Indicates how quickly the action should be addressed with respect to other
     * actions.
     */
    @Child(name = "priority", type = { CodeType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "routine | urgent | asap | stat", formalDefinition = "Indicates how quickly the action should be addressed with respect to other actions.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-priority")
    protected Enumeration priority;

    /**
     * A code that provides meaning for the action or action group. For example, a
     * section may have a LOINC code for a section of a documentation template.
     */
    @Child(name = "code", type = {
        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
    @Description(shortDefinition = "Code representing the meaning of the action or sub-actions", formalDefinition = "A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a section of a documentation template.")
    protected List code;

    /**
     * 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.
     */
    @Child(name = "documentation", type = {
        RelatedArtifact.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
    @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.")
    protected List documentation;

    /**
     * An expression that describes applicability criteria, or start/stop conditions
     * for the action.
     */
    @Child(name = "condition", type = {}, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
    @Description(shortDefinition = "Whether or not the action is applicable", formalDefinition = "An expression that describes applicability criteria, or start/stop conditions for the action.")
    protected List condition;

    /**
     * A relationship to another action such as "before" or "30-60 minutes after
     * start of".
     */
    @Child(name = "relatedAction", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
    @Description(shortDefinition = "Relationship to another action", formalDefinition = "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".")
    protected List relatedAction;

    /**
     * An optional value describing when the action should be performed.
     */
    @Child(name = "timing", type = { DateTimeType.class, Age.class, Period.class, Duration.class, Range.class,
        Timing.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "When the action should take place", formalDefinition = "An optional value describing when the action should be performed.")
    protected Type timing;

    /**
     * The participant that should perform or be responsible for this action.
     */
    @Child(name = "participant", type = { Patient.class, Practitioner.class, PractitionerRole.class,
        RelatedPerson.class,
        Device.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
    @Description(shortDefinition = "Who should perform the action", formalDefinition = "The participant that should perform or be responsible for this action.")
    protected List participant;
    /**
     * The actual objects that are the target of the reference (The participant that
     * should perform or be responsible for this action.)
     */
    protected List participantTarget;

    /**
     * The type of action to perform (create, update, remove).
     */
    @Child(name = "type", type = {
        CodeableConcept.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "create | update | remove | fire-event", formalDefinition = "The type of action to perform (create, update, remove).")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/action-type")
    protected CodeableConcept type;

    /**
     * Defines the grouping behavior for the action and its children.
     */
    @Child(name = "groupingBehavior", type = {
        CodeType.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "visual-group | logical-group | sentence-group", formalDefinition = "Defines the grouping behavior for the action and its children.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/action-grouping-behavior")
    protected Enumeration groupingBehavior;

    /**
     * Defines the selection behavior for the action and its children.
     */
    @Child(name = "selectionBehavior", type = {
        CodeType.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
    @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.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/action-selection-behavior")
    protected Enumeration selectionBehavior;

    /**
     * Defines expectations around whether an action is required.
     */
    @Child(name = "requiredBehavior", type = {
        CodeType.class }, order = 15, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "must | could | must-unless-documented", formalDefinition = "Defines expectations around whether an action is required.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/action-required-behavior")
    protected Enumeration requiredBehavior;

    /**
     * Defines whether the action should usually be preselected.
     */
    @Child(name = "precheckBehavior", type = {
        CodeType.class }, order = 16, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "yes | no", formalDefinition = "Defines whether the action should usually be preselected.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/action-precheck-behavior")
    protected Enumeration precheckBehavior;

    /**
     * Defines whether the action can be selected multiple times.
     */
    @Child(name = "cardinalityBehavior", type = {
        CodeType.class }, order = 17, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "single | multiple", formalDefinition = "Defines whether the action can be selected multiple times.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/action-cardinality-behavior")
    protected Enumeration cardinalityBehavior;

    /**
     * The resource that is the target of the action (e.g. CommunicationRequest).
     */
    @Child(name = "resource", type = {
        Reference.class }, order = 18, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "The target of the action", formalDefinition = "The resource that is the target of the action (e.g. CommunicationRequest).")
    protected Reference resource;

    /**
     * The actual object that is the target of the reference (The resource that is
     * the target of the action (e.g. CommunicationRequest).)
     */
    protected Resource resourceTarget;

    /**
     * Sub actions.
     */
    @Child(name = "action", type = {
        RequestGroupActionComponent.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
    @Description(shortDefinition = "Sub action", formalDefinition = "Sub actions.")
    protected List action;

    private static final long serialVersionUID = 296752321L;

    /**
     * Constructor
     */
    public RequestGroupActionComponent() {
      super();
    }

    /**
     * @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
     */
    public StringType getPrefixElement() {
      if (this.prefix == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.prefix");
        else if (Configuration.doAutoCreate())
          this.prefix = new StringType(); // bb
      return this.prefix;
    }

    public boolean hasPrefixElement() {
      return this.prefix != null && !this.prefix.isEmpty();
    }

    public boolean hasPrefix() {
      return this.prefix != null && !this.prefix.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionComponent setPrefixElement(StringType value) {
      this.prefix = value;
      return this;
    }

    /**
     * @return A user-visible prefix for the action.
     */
    public String getPrefix() {
      return this.prefix == null ? null : this.prefix.getValue();
    }

    /**
     * @param value A user-visible prefix for the action.
     */
    public RequestGroupActionComponent setPrefix(String value) {
      if (Utilities.noString(value))
        this.prefix = null;
      else {
        if (this.prefix == null)
          this.prefix = new StringType();
        this.prefix.setValue(value);
      }
      return this;
    }

    /**
     * @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
     */
    public StringType getTitleElement() {
      if (this.title == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.title");
        else if (Configuration.doAutoCreate())
          this.title = new StringType(); // bb
      return this.title;
    }

    public boolean hasTitleElement() {
      return this.title != null && !this.title.isEmpty();
    }

    public boolean hasTitle() {
      return this.title != null && !this.title.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionComponent setTitleElement(StringType value) {
      this.title = value;
      return this;
    }

    /**
     * @return The title of the action displayed to a user.
     */
    public String getTitle() {
      return this.title == null ? null : this.title.getValue();
    }

    /**
     * @param value The title of the action displayed to a user.
     */
    public RequestGroupActionComponent setTitle(String value) {
      if (Utilities.noString(value))
        this.title = null;
      else {
        if (this.title == null)
          this.title = new StringType();
        this.title.setValue(value);
      }
      return this;
    }

    /**
     * @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
     */
    public StringType getDescriptionElement() {
      if (this.description == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.description");
        else if (Configuration.doAutoCreate())
          this.description = new StringType(); // bb
      return this.description;
    }

    public boolean hasDescriptionElement() {
      return this.description != null && !this.description.isEmpty();
    }

    public boolean hasDescription() {
      return this.description != null && !this.description.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionComponent setDescriptionElement(StringType value) {
      this.description = value;
      return this;
    }

    /**
     * @return A short description of the action used to provide a summary to
     *         display to the user.
     */
    public String getDescription() {
      return this.description == null ? null : this.description.getValue();
    }

    /**
     * @param value A short description of the action used to provide a summary to
     *              display to the user.
     */
    public RequestGroupActionComponent setDescription(String value) {
      if (Utilities.noString(value))
        this.description = null;
      else {
        if (this.description == null)
          this.description = new StringType();
        this.description.setValue(value);
      }
      return this;
    }

    /**
     * @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
     */
    public StringType getTextEquivalentElement() {
      if (this.textEquivalent == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.textEquivalent");
        else if (Configuration.doAutoCreate())
          this.textEquivalent = new StringType(); // bb
      return this.textEquivalent;
    }

    public boolean hasTextEquivalentElement() {
      return this.textEquivalent != null && !this.textEquivalent.isEmpty();
    }

    public boolean hasTextEquivalent() {
      return this.textEquivalent != null && !this.textEquivalent.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionComponent setTextEquivalentElement(StringType value) {
      this.textEquivalent = value;
      return this;
    }

    /**
     * @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.
     */
    public String getTextEquivalent() {
      return this.textEquivalent == null ? null : this.textEquivalent.getValue();
    }

    /**
     * @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.
     */
    public RequestGroupActionComponent setTextEquivalent(String value) {
      if (Utilities.noString(value))
        this.textEquivalent = null;
      else {
        if (this.textEquivalent == null)
          this.textEquivalent = new StringType();
        this.textEquivalent.setValue(value);
      }
      return this;
    }

    /**
     * @return {@link #priority} (Indicates how quickly the action should be
     *         addressed with respect to other actions.). This is the underlying
     *         object with id, value and extensions. The accessor "getPriority"
     *         gives direct access to the value
     */
    public Enumeration getPriorityElement() {
      if (this.priority == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.priority");
        else if (Configuration.doAutoCreate())
          this.priority = new Enumeration(new RequestPriorityEnumFactory()); // bb
      return this.priority;
    }

    public boolean hasPriorityElement() {
      return this.priority != null && !this.priority.isEmpty();
    }

    public boolean hasPriority() {
      return this.priority != null && !this.priority.isEmpty();
    }

    /**
     * @param value {@link #priority} (Indicates how quickly the action should be
     *              addressed with respect to other actions.). This is the
     *              underlying object with id, value and extensions. The accessor
     *              "getPriority" gives direct access to the value
     */
    public RequestGroupActionComponent setPriorityElement(Enumeration value) {
      this.priority = value;
      return this;
    }

    /**
     * @return Indicates how quickly the action should be addressed with respect to
     *         other actions.
     */
    public RequestPriority getPriority() {
      return this.priority == null ? null : this.priority.getValue();
    }

    /**
     * @param value Indicates how quickly the action should be addressed with
     *              respect to other actions.
     */
    public RequestGroupActionComponent setPriority(RequestPriority value) {
      if (value == null)
        this.priority = null;
      else {
        if (this.priority == null)
          this.priority = new Enumeration(new RequestPriorityEnumFactory());
        this.priority.setValue(value);
      }
      return this;
    }

    /**
     * @return {@link #code} (A code that provides meaning for the action or action
     *         group. For example, a section may have a LOINC code for a section of
     *         a documentation template.)
     */
    public List getCode() {
      if (this.code == null)
        this.code = new ArrayList();
      return this.code;
    }

    /**
     * @return Returns a reference to this for easy method chaining
     */
    public RequestGroupActionComponent setCode(List theCode) {
      this.code = theCode;
      return this;
    }

    public boolean hasCode() {
      if (this.code == null)
        return false;
      for (CodeableConcept item : this.code)
        if (!item.isEmpty())
          return true;
      return false;
    }

    public CodeableConcept addCode() { // 3
      CodeableConcept t = new CodeableConcept();
      if (this.code == null)
        this.code = new ArrayList();
      this.code.add(t);
      return t;
    }

    public RequestGroupActionComponent addCode(CodeableConcept t) { // 3
      if (t == null)
        return this;
      if (this.code == null)
        this.code = new ArrayList();
      this.code.add(t);
      return this;
    }

    /**
     * @return The first repetition of repeating field {@link #code}, creating it if
     *         it does not already exist
     */
    public CodeableConcept getCodeFirstRep() {
      if (getCode().isEmpty()) {
        addCode();
      }
      return getCode().get(0);
    }

    /**
     * @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.)
     */
    public List getDocumentation() {
      if (this.documentation == null)
        this.documentation = new ArrayList();
      return this.documentation;
    }

    /**
     * @return Returns a reference to this for easy method chaining
     */
    public RequestGroupActionComponent setDocumentation(List theDocumentation) {
      this.documentation = theDocumentation;
      return this;
    }

    public boolean hasDocumentation() {
      if (this.documentation == null)
        return false;
      for (RelatedArtifact item : this.documentation)
        if (!item.isEmpty())
          return true;
      return false;
    }

    public RelatedArtifact addDocumentation() { // 3
      RelatedArtifact t = new RelatedArtifact();
      if (this.documentation == null)
        this.documentation = new ArrayList();
      this.documentation.add(t);
      return t;
    }

    public RequestGroupActionComponent addDocumentation(RelatedArtifact t) { // 3
      if (t == null)
        return this;
      if (this.documentation == null)
        this.documentation = new ArrayList();
      this.documentation.add(t);
      return this;
    }

    /**
     * @return The first repetition of repeating field {@link #documentation},
     *         creating it if it does not already exist
     */
    public RelatedArtifact getDocumentationFirstRep() {
      if (getDocumentation().isEmpty()) {
        addDocumentation();
      }
      return getDocumentation().get(0);
    }

    /**
     * @return {@link #condition} (An expression that describes applicability
     *         criteria, or start/stop conditions for the action.)
     */
    public List getCondition() {
      if (this.condition == null)
        this.condition = new ArrayList();
      return this.condition;
    }

    /**
     * @return Returns a reference to this for easy method chaining
     */
    public RequestGroupActionComponent setCondition(List theCondition) {
      this.condition = theCondition;
      return this;
    }

    public boolean hasCondition() {
      if (this.condition == null)
        return false;
      for (RequestGroupActionConditionComponent item : this.condition)
        if (!item.isEmpty())
          return true;
      return false;
    }

    public RequestGroupActionConditionComponent addCondition() { // 3
      RequestGroupActionConditionComponent t = new RequestGroupActionConditionComponent();
      if (this.condition == null)
        this.condition = new ArrayList();
      this.condition.add(t);
      return t;
    }

    public RequestGroupActionComponent addCondition(RequestGroupActionConditionComponent t) { // 3
      if (t == null)
        return this;
      if (this.condition == null)
        this.condition = new ArrayList();
      this.condition.add(t);
      return this;
    }

    /**
     * @return The first repetition of repeating field {@link #condition}, creating
     *         it if it does not already exist
     */
    public RequestGroupActionConditionComponent getConditionFirstRep() {
      if (getCondition().isEmpty()) {
        addCondition();
      }
      return getCondition().get(0);
    }

    /**
     * @return {@link #relatedAction} (A relationship to another action such as
     *         "before" or "30-60 minutes after start of".)
     */
    public List getRelatedAction() {
      if (this.relatedAction == null)
        this.relatedAction = new ArrayList();
      return this.relatedAction;
    }

    /**
     * @return Returns a reference to this for easy method chaining
     */
    public RequestGroupActionComponent setRelatedAction(
        List theRelatedAction) {
      this.relatedAction = theRelatedAction;
      return this;
    }

    public boolean hasRelatedAction() {
      if (this.relatedAction == null)
        return false;
      for (RequestGroupActionRelatedActionComponent item : this.relatedAction)
        if (!item.isEmpty())
          return true;
      return false;
    }

    public RequestGroupActionRelatedActionComponent addRelatedAction() { // 3
      RequestGroupActionRelatedActionComponent t = new RequestGroupActionRelatedActionComponent();
      if (this.relatedAction == null)
        this.relatedAction = new ArrayList();
      this.relatedAction.add(t);
      return t;
    }

    public RequestGroupActionComponent addRelatedAction(RequestGroupActionRelatedActionComponent t) { // 3
      if (t == null)
        return this;
      if (this.relatedAction == null)
        this.relatedAction = new ArrayList();
      this.relatedAction.add(t);
      return this;
    }

    /**
     * @return The first repetition of repeating field {@link #relatedAction},
     *         creating it if it does not already exist
     */
    public RequestGroupActionRelatedActionComponent getRelatedActionFirstRep() {
      if (getRelatedAction().isEmpty()) {
        addRelatedAction();
      }
      return getRelatedAction().get(0);
    }

    /**
     * @return {@link #timing} (An optional value describing when the action should
     *         be performed.)
     */
    public Type getTiming() {
      return this.timing;
    }

    /**
     * @return {@link #timing} (An optional value describing when the action should
     *         be performed.)
     */
    public DateTimeType getTimingDateTimeType() throws FHIRException {
      if (this.timing == null)
        this.timing = new DateTimeType();
      if (!(this.timing instanceof DateTimeType))
        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "
            + this.timing.getClass().getName() + " was encountered");
      return (DateTimeType) this.timing;
    }

    public boolean hasTimingDateTimeType() {
      return this != null && this.timing instanceof DateTimeType;
    }

    /**
     * @return {@link #timing} (An optional value describing when the action should
     *         be performed.)
     */
    public Age getTimingAge() throws FHIRException {
      if (this.timing == null)
        this.timing = new Age();
      if (!(this.timing instanceof Age))
        throw new FHIRException(
            "Type mismatch: the type Age was expected, but " + this.timing.getClass().getName() + " was encountered");
      return (Age) this.timing;
    }

    public boolean hasTimingAge() {
      return this != null && this.timing instanceof Age;
    }

    /**
     * @return {@link #timing} (An optional value describing when the action should
     *         be performed.)
     */
    public Period getTimingPeriod() throws FHIRException {
      if (this.timing == null)
        this.timing = new Period();
      if (!(this.timing instanceof Period))
        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.timing.getClass().getName()
            + " was encountered");
      return (Period) this.timing;
    }

    public boolean hasTimingPeriod() {
      return this != null && this.timing instanceof Period;
    }

    /**
     * @return {@link #timing} (An optional value describing when the action should
     *         be performed.)
     */
    public Duration getTimingDuration() throws FHIRException {
      if (this.timing == null)
        this.timing = new Duration();
      if (!(this.timing instanceof Duration))
        throw new FHIRException("Type mismatch: the type Duration was expected, but " + this.timing.getClass().getName()
            + " was encountered");
      return (Duration) this.timing;
    }

    public boolean hasTimingDuration() {
      return this != null && this.timing instanceof Duration;
    }

    /**
     * @return {@link #timing} (An optional value describing when the action should
     *         be performed.)
     */
    public Range getTimingRange() throws FHIRException {
      if (this.timing == null)
        this.timing = new Range();
      if (!(this.timing instanceof Range))
        throw new FHIRException(
            "Type mismatch: the type Range was expected, but " + this.timing.getClass().getName() + " was encountered");
      return (Range) this.timing;
    }

    public boolean hasTimingRange() {
      return this != null && this.timing instanceof Range;
    }

    /**
     * @return {@link #timing} (An optional value describing when the action should
     *         be performed.)
     */
    public Timing getTimingTiming() throws FHIRException {
      if (this.timing == null)
        this.timing = new Timing();
      if (!(this.timing instanceof Timing))
        throw new FHIRException("Type mismatch: the type Timing was expected, but " + this.timing.getClass().getName()
            + " was encountered");
      return (Timing) this.timing;
    }

    public boolean hasTimingTiming() {
      return this != null && this.timing instanceof Timing;
    }

    public boolean hasTiming() {
      return this.timing != null && !this.timing.isEmpty();
    }

    /**
     * @param value {@link #timing} (An optional value describing when the action
     *              should be performed.)
     */
    public RequestGroupActionComponent setTiming(Type value) {
      if (value != null && !(value instanceof DateTimeType || value instanceof Age || value instanceof Period
          || value instanceof Duration || value instanceof Range || value instanceof Timing))
        throw new Error("Not the right type for RequestGroup.action.timing[x]: " + value.fhirType());
      this.timing = value;
      return this;
    }

    /**
     * @return {@link #participant} (The participant that should perform or be
     *         responsible for this action.)
     */
    public List getParticipant() {
      if (this.participant == null)
        this.participant = new ArrayList();
      return this.participant;
    }

    /**
     * @return Returns a reference to this for easy method chaining
     */
    public RequestGroupActionComponent setParticipant(List theParticipant) {
      this.participant = theParticipant;
      return this;
    }

    public boolean hasParticipant() {
      if (this.participant == null)
        return false;
      for (Reference item : this.participant)
        if (!item.isEmpty())
          return true;
      return false;
    }

    public Reference addParticipant() { // 3
      Reference t = new Reference();
      if (this.participant == null)
        this.participant = new ArrayList();
      this.participant.add(t);
      return t;
    }

    public RequestGroupActionComponent addParticipant(Reference t) { // 3
      if (t == null)
        return this;
      if (this.participant == null)
        this.participant = new ArrayList();
      this.participant.add(t);
      return this;
    }

    /**
     * @return The first repetition of repeating field {@link #participant},
     *         creating it if it does not already exist
     */
    public Reference getParticipantFirstRep() {
      if (getParticipant().isEmpty()) {
        addParticipant();
      }
      return getParticipant().get(0);
    }

    /**
     * @deprecated Use Reference#setResource(IBaseResource) instead
     */
    @Deprecated
    public List getParticipantTarget() {
      if (this.participantTarget == null)
        this.participantTarget = new ArrayList();
      return this.participantTarget;
    }

    /**
     * @return {@link #type} (The type of action to perform (create, update,
     *         remove).)
     */
    public CodeableConcept getType() {
      if (this.type == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.type");
        else if (Configuration.doAutoCreate())
          this.type = new CodeableConcept(); // cc
      return this.type;
    }

    public boolean hasType() {
      return this.type != null && !this.type.isEmpty();
    }

    /**
     * @param value {@link #type} (The type of action to perform (create, update,
     *              remove).)
     */
    public RequestGroupActionComponent setType(CodeableConcept value) {
      this.type = value;
      return this;
    }

    /**
     * @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
     */
    public Enumeration getGroupingBehaviorElement() {
      if (this.groupingBehavior == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.groupingBehavior");
        else if (Configuration.doAutoCreate())
          this.groupingBehavior = new Enumeration(new ActionGroupingBehaviorEnumFactory()); // bb
      return this.groupingBehavior;
    }

    public boolean hasGroupingBehaviorElement() {
      return this.groupingBehavior != null && !this.groupingBehavior.isEmpty();
    }

    public boolean hasGroupingBehavior() {
      return this.groupingBehavior != null && !this.groupingBehavior.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionComponent setGroupingBehaviorElement(Enumeration value) {
      this.groupingBehavior = value;
      return this;
    }

    /**
     * @return Defines the grouping behavior for the action and its children.
     */
    public ActionGroupingBehavior getGroupingBehavior() {
      return this.groupingBehavior == null ? null : this.groupingBehavior.getValue();
    }

    /**
     * @param value Defines the grouping behavior for the action and its children.
     */
    public RequestGroupActionComponent setGroupingBehavior(ActionGroupingBehavior value) {
      if (value == null)
        this.groupingBehavior = null;
      else {
        if (this.groupingBehavior == null)
          this.groupingBehavior = new Enumeration(new ActionGroupingBehaviorEnumFactory());
        this.groupingBehavior.setValue(value);
      }
      return this;
    }

    /**
     * @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
     */
    public Enumeration getSelectionBehaviorElement() {
      if (this.selectionBehavior == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.selectionBehavior");
        else if (Configuration.doAutoCreate())
          this.selectionBehavior = new Enumeration(new ActionSelectionBehaviorEnumFactory()); // bb
      return this.selectionBehavior;
    }

    public boolean hasSelectionBehaviorElement() {
      return this.selectionBehavior != null && !this.selectionBehavior.isEmpty();
    }

    public boolean hasSelectionBehavior() {
      return this.selectionBehavior != null && !this.selectionBehavior.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionComponent setSelectionBehaviorElement(Enumeration value) {
      this.selectionBehavior = value;
      return this;
    }

    /**
     * @return Defines the selection behavior for the action and its children.
     */
    public ActionSelectionBehavior getSelectionBehavior() {
      return this.selectionBehavior == null ? null : this.selectionBehavior.getValue();
    }

    /**
     * @param value Defines the selection behavior for the action and its children.
     */
    public RequestGroupActionComponent setSelectionBehavior(ActionSelectionBehavior value) {
      if (value == null)
        this.selectionBehavior = null;
      else {
        if (this.selectionBehavior == null)
          this.selectionBehavior = new Enumeration(new ActionSelectionBehaviorEnumFactory());
        this.selectionBehavior.setValue(value);
      }
      return this;
    }

    /**
     * @return {@link #requiredBehavior} (Defines expectations around whether an
     *         action is required.). This is the underlying object with id, value
     *         and extensions. The accessor "getRequiredBehavior" gives direct
     *         access to the value
     */
    public Enumeration getRequiredBehaviorElement() {
      if (this.requiredBehavior == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.requiredBehavior");
        else if (Configuration.doAutoCreate())
          this.requiredBehavior = new Enumeration(new ActionRequiredBehaviorEnumFactory()); // bb
      return this.requiredBehavior;
    }

    public boolean hasRequiredBehaviorElement() {
      return this.requiredBehavior != null && !this.requiredBehavior.isEmpty();
    }

    public boolean hasRequiredBehavior() {
      return this.requiredBehavior != null && !this.requiredBehavior.isEmpty();
    }

    /**
     * @param value {@link #requiredBehavior} (Defines expectations around whether
     *              an action is required.). This is the underlying object with id,
     *              value and extensions. The accessor "getRequiredBehavior" gives
     *              direct access to the value
     */
    public RequestGroupActionComponent setRequiredBehaviorElement(Enumeration value) {
      this.requiredBehavior = value;
      return this;
    }

    /**
     * @return Defines expectations around whether an action is required.
     */
    public ActionRequiredBehavior getRequiredBehavior() {
      return this.requiredBehavior == null ? null : this.requiredBehavior.getValue();
    }

    /**
     * @param value Defines expectations around whether an action is required.
     */
    public RequestGroupActionComponent setRequiredBehavior(ActionRequiredBehavior value) {
      if (value == null)
        this.requiredBehavior = null;
      else {
        if (this.requiredBehavior == null)
          this.requiredBehavior = new Enumeration(new ActionRequiredBehaviorEnumFactory());
        this.requiredBehavior.setValue(value);
      }
      return this;
    }

    /**
     * @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
     */
    public Enumeration getPrecheckBehaviorElement() {
      if (this.precheckBehavior == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.precheckBehavior");
        else if (Configuration.doAutoCreate())
          this.precheckBehavior = new Enumeration(new ActionPrecheckBehaviorEnumFactory()); // bb
      return this.precheckBehavior;
    }

    public boolean hasPrecheckBehaviorElement() {
      return this.precheckBehavior != null && !this.precheckBehavior.isEmpty();
    }

    public boolean hasPrecheckBehavior() {
      return this.precheckBehavior != null && !this.precheckBehavior.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionComponent setPrecheckBehaviorElement(Enumeration value) {
      this.precheckBehavior = value;
      return this;
    }

    /**
     * @return Defines whether the action should usually be preselected.
     */
    public ActionPrecheckBehavior getPrecheckBehavior() {
      return this.precheckBehavior == null ? null : this.precheckBehavior.getValue();
    }

    /**
     * @param value Defines whether the action should usually be preselected.
     */
    public RequestGroupActionComponent setPrecheckBehavior(ActionPrecheckBehavior value) {
      if (value == null)
        this.precheckBehavior = null;
      else {
        if (this.precheckBehavior == null)
          this.precheckBehavior = new Enumeration(new ActionPrecheckBehaviorEnumFactory());
        this.precheckBehavior.setValue(value);
      }
      return this;
    }

    /**
     * @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
     */
    public Enumeration getCardinalityBehaviorElement() {
      if (this.cardinalityBehavior == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.cardinalityBehavior");
        else if (Configuration.doAutoCreate())
          this.cardinalityBehavior = new Enumeration(
              new ActionCardinalityBehaviorEnumFactory()); // bb
      return this.cardinalityBehavior;
    }

    public boolean hasCardinalityBehaviorElement() {
      return this.cardinalityBehavior != null && !this.cardinalityBehavior.isEmpty();
    }

    public boolean hasCardinalityBehavior() {
      return this.cardinalityBehavior != null && !this.cardinalityBehavior.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionComponent setCardinalityBehaviorElement(Enumeration value) {
      this.cardinalityBehavior = value;
      return this;
    }

    /**
     * @return Defines whether the action can be selected multiple times.
     */
    public ActionCardinalityBehavior getCardinalityBehavior() {
      return this.cardinalityBehavior == null ? null : this.cardinalityBehavior.getValue();
    }

    /**
     * @param value Defines whether the action can be selected multiple times.
     */
    public RequestGroupActionComponent setCardinalityBehavior(ActionCardinalityBehavior value) {
      if (value == null)
        this.cardinalityBehavior = null;
      else {
        if (this.cardinalityBehavior == null)
          this.cardinalityBehavior = new Enumeration(
              new ActionCardinalityBehaviorEnumFactory());
        this.cardinalityBehavior.setValue(value);
      }
      return this;
    }

    /**
     * @return {@link #resource} (The resource that is the target of the action
     *         (e.g. CommunicationRequest).)
     */
    public Reference getResource() {
      if (this.resource == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionComponent.resource");
        else if (Configuration.doAutoCreate())
          this.resource = new Reference(); // cc
      return this.resource;
    }

    public boolean hasResource() {
      return this.resource != null && !this.resource.isEmpty();
    }

    /**
     * @param value {@link #resource} (The resource that is the target of the action
     *              (e.g. CommunicationRequest).)
     */
    public RequestGroupActionComponent setResource(Reference value) {
      this.resource = value;
      return this;
    }

    /**
     * @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).)
     */
    public Resource getResourceTarget() {
      return this.resourceTarget;
    }

    /**
     * @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).)
     */
    public RequestGroupActionComponent setResourceTarget(Resource value) {
      this.resourceTarget = value;
      return this;
    }

    /**
     * @return {@link #action} (Sub actions.)
     */
    public List getAction() {
      if (this.action == null)
        this.action = new ArrayList();
      return this.action;
    }

    /**
     * @return Returns a reference to this for easy method chaining
     */
    public RequestGroupActionComponent setAction(List theAction) {
      this.action = theAction;
      return this;
    }

    public boolean hasAction() {
      if (this.action == null)
        return false;
      for (RequestGroupActionComponent item : this.action)
        if (!item.isEmpty())
          return true;
      return false;
    }

    public RequestGroupActionComponent addAction() { // 3
      RequestGroupActionComponent t = new RequestGroupActionComponent();
      if (this.action == null)
        this.action = new ArrayList();
      this.action.add(t);
      return t;
    }

    public RequestGroupActionComponent addAction(RequestGroupActionComponent t) { // 3
      if (t == null)
        return this;
      if (this.action == null)
        this.action = new ArrayList();
      this.action.add(t);
      return this;
    }

    /**
     * @return The first repetition of repeating field {@link #action}, creating it
     *         if it does not already exist
     */
    public RequestGroupActionComponent getActionFirstRep() {
      if (getAction().isEmpty()) {
        addAction();
      }
      return getAction().get(0);
    }

    protected void listChildren(List children) {
      super.listChildren(children);
      children.add(new Property("prefix", "string", "A user-visible prefix for the action.", 0, 1, prefix));
      children.add(new Property("title", "string", "The title of the action displayed to a user.", 0, 1, title));
      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));
      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));
      children.add(new Property("priority", "code",
          "Indicates how quickly the action should be addressed with respect to other actions.", 0, 1, priority));
      children.add(new Property("code", "CodeableConcept",
          "A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a section of a documentation template.",
          0, java.lang.Integer.MAX_VALUE, code));
      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));
      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));
      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));
      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));
      children.add(new Property("participant", "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device)",
          "The participant that should perform or be responsible for this action.", 0, java.lang.Integer.MAX_VALUE,
          participant));
      children.add(new Property("type", "CodeableConcept", "The type of action to perform (create, update, remove).", 0,
          1, type));
      children.add(new Property("groupingBehavior", "code",
          "Defines the grouping behavior for the action and its children.", 0, 1, groupingBehavior));
      children.add(new Property("selectionBehavior", "code",
          "Defines the selection behavior for the action and its children.", 0, 1, selectionBehavior));
      children.add(new Property("requiredBehavior", "code",
          "Defines expectations around whether an action is required.", 0, 1, requiredBehavior));
      children.add(new Property("precheckBehavior", "code", "Defines whether the action should usually be preselected.",
          0, 1, precheckBehavior));
      children.add(new Property("cardinalityBehavior", "code",
          "Defines whether the action can be selected multiple times.", 0, 1, cardinalityBehavior));
      children.add(new Property("resource", "Reference(Any)",
          "The resource that is the target of the action (e.g. CommunicationRequest).", 0, 1, resource));
      children
          .add(new Property("action", "@RequestGroup.action", "Sub actions.", 0, java.lang.Integer.MAX_VALUE, action));
    }

    @Override
    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
      switch (_hash) {
      case -980110702:
        /* prefix */ return new Property("prefix", "string", "A user-visible prefix for the action.", 0, 1, prefix);
      case 110371416:
        /* title */ return new Property("title", "string", "The title of the action displayed to a user.", 0, 1, title);
      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);
      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);
      case -1165461084:
        /* priority */ return new Property("priority", "code",
            "Indicates how quickly the action should be addressed with respect to other actions.", 0, 1, priority);
      case 3059181:
        /* code */ return new Property("code", "CodeableConcept",
            "A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a section of a documentation template.",
            0, java.lang.Integer.MAX_VALUE, code);
      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);
      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);
      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);
      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);
      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);
      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);
      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);
      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);
      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);
      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);
      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);
      case 767422259:
        /* participant */ return new Property("participant",
            "Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Device)",
            "The participant that should perform or be responsible for this action.", 0, java.lang.Integer.MAX_VALUE,
            participant);
      case 3575610:
        /* type */ return new Property("type", "CodeableConcept",
            "The type of action to perform (create, update, remove).", 0, 1, type);
      case 586678389:
        /* groupingBehavior */ return new Property("groupingBehavior", "code",
            "Defines the grouping behavior for the action and its children.", 0, 1, groupingBehavior);
      case 168639486:
        /* selectionBehavior */ return new Property("selectionBehavior", "code",
            "Defines the selection behavior for the action and its children.", 0, 1, selectionBehavior);
      case -1163906287:
        /* requiredBehavior */ return new Property("requiredBehavior", "code",
            "Defines expectations around whether an action is required.", 0, 1, requiredBehavior);
      case -1174249033:
        /* precheckBehavior */ return new Property("precheckBehavior", "code",
            "Defines whether the action should usually be preselected.", 0, 1, precheckBehavior);
      case -922577408:
        /* cardinalityBehavior */ return new Property("cardinalityBehavior", "code",
            "Defines whether the action can be selected multiple times.", 0, 1, cardinalityBehavior);
      case -341064690:
        /* resource */ return new Property("resource", "Reference(Any)",
            "The resource that is the target of the action (e.g. CommunicationRequest).", 0, 1, resource);
      case -1422950858:
        /* action */ return new Property("action", "@RequestGroup.action", "Sub actions.", 0,
            java.lang.Integer.MAX_VALUE, action);
      default:
        return super.getNamedProperty(_hash, _name, _checkValid);
      }

    }

    @Override
    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
      switch (hash) {
      case -980110702:
        /* prefix */ return this.prefix == null ? new Base[0] : new Base[] { this.prefix }; // StringType
      case 110371416:
        /* title */ return this.title == null ? new Base[0] : new Base[] { this.title }; // StringType
      case -1724546052:
        /* description */ return this.description == null ? new Base[0] : new Base[] { this.description }; // StringType
      case -900391049:
        /* textEquivalent */ return this.textEquivalent == null ? new Base[0] : new Base[] { this.textEquivalent }; // StringType
      case -1165461084:
        /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // Enumeration
      case 3059181:
        /* code */ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
      case 1587405498:
        /* documentation */ return this.documentation == null ? new Base[0]
            : this.documentation.toArray(new Base[this.documentation.size()]); // RelatedArtifact
      case -861311717:
        /* condition */ return this.condition == null ? new Base[0]
            : this.condition.toArray(new Base[this.condition.size()]); // RequestGroupActionConditionComponent
      case -384107967:
        /* relatedAction */ return this.relatedAction == null ? new Base[0]
            : this.relatedAction.toArray(new Base[this.relatedAction.size()]); // RequestGroupActionRelatedActionComponent
      case -873664438:
        /* timing */ return this.timing == null ? new Base[0] : new Base[] { this.timing }; // Type
      case 767422259:
        /* participant */ return this.participant == null ? new Base[0]
            : this.participant.toArray(new Base[this.participant.size()]); // Reference
      case 3575610:
        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
      case 586678389:
        /* groupingBehavior */ return this.groupingBehavior == null ? new Base[0]
            : new Base[] { this.groupingBehavior }; // Enumeration
      case 168639486:
        /* selectionBehavior */ return this.selectionBehavior == null ? new Base[0]
            : new Base[] { this.selectionBehavior }; // Enumeration
      case -1163906287:
        /* requiredBehavior */ return this.requiredBehavior == null ? new Base[0]
            : new Base[] { this.requiredBehavior }; // Enumeration
      case -1174249033:
        /* precheckBehavior */ return this.precheckBehavior == null ? new Base[0]
            : new Base[] { this.precheckBehavior }; // Enumeration
      case -922577408:
        /* cardinalityBehavior */ return this.cardinalityBehavior == null ? new Base[0]
            : new Base[] { this.cardinalityBehavior }; // Enumeration
      case -341064690:
        /* resource */ return this.resource == null ? new Base[0] : new Base[] { this.resource }; // Reference
      case -1422950858:
        /* action */ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // RequestGroupActionComponent
      default:
        return super.getProperty(hash, name, checkValid);
      }

    }

    @Override
    public Base setProperty(int hash, String name, Base value) throws FHIRException {
      switch (hash) {
      case -980110702: // prefix
        this.prefix = castToString(value); // StringType
        return value;
      case 110371416: // title
        this.title = castToString(value); // StringType
        return value;
      case -1724546052: // description
        this.description = castToString(value); // StringType
        return value;
      case -900391049: // textEquivalent
        this.textEquivalent = castToString(value); // StringType
        return value;
      case -1165461084: // priority
        value = new RequestPriorityEnumFactory().fromType(castToCode(value));
        this.priority = (Enumeration) value; // Enumeration
        return value;
      case 3059181: // code
        this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
        return value;
      case 1587405498: // documentation
        this.getDocumentation().add(castToRelatedArtifact(value)); // RelatedArtifact
        return value;
      case -861311717: // condition
        this.getCondition().add((RequestGroupActionConditionComponent) value); // RequestGroupActionConditionComponent
        return value;
      case -384107967: // relatedAction
        this.getRelatedAction().add((RequestGroupActionRelatedActionComponent) value); // RequestGroupActionRelatedActionComponent
        return value;
      case -873664438: // timing
        this.timing = castToType(value); // Type
        return value;
      case 767422259: // participant
        this.getParticipant().add(castToReference(value)); // Reference
        return value;
      case 3575610: // type
        this.type = castToCodeableConcept(value); // CodeableConcept
        return value;
      case 586678389: // groupingBehavior
        value = new ActionGroupingBehaviorEnumFactory().fromType(castToCode(value));
        this.groupingBehavior = (Enumeration) value; // Enumeration
        return value;
      case 168639486: // selectionBehavior
        value = new ActionSelectionBehaviorEnumFactory().fromType(castToCode(value));
        this.selectionBehavior = (Enumeration) value; // Enumeration
        return value;
      case -1163906287: // requiredBehavior
        value = new ActionRequiredBehaviorEnumFactory().fromType(castToCode(value));
        this.requiredBehavior = (Enumeration) value; // Enumeration
        return value;
      case -1174249033: // precheckBehavior
        value = new ActionPrecheckBehaviorEnumFactory().fromType(castToCode(value));
        this.precheckBehavior = (Enumeration) value; // Enumeration
        return value;
      case -922577408: // cardinalityBehavior
        value = new ActionCardinalityBehaviorEnumFactory().fromType(castToCode(value));
        this.cardinalityBehavior = (Enumeration) value; // Enumeration
        return value;
      case -341064690: // resource
        this.resource = castToReference(value); // Reference
        return value;
      case -1422950858: // action
        this.getAction().add((RequestGroupActionComponent) value); // RequestGroupActionComponent
        return value;
      default:
        return super.setProperty(hash, name, value);
      }

    }

    @Override
    public Base setProperty(String name, Base value) throws FHIRException {
      if (name.equals("prefix")) {
        this.prefix = castToString(value); // StringType
      } else if (name.equals("title")) {
        this.title = castToString(value); // StringType
      } else if (name.equals("description")) {
        this.description = castToString(value); // StringType
      } else if (name.equals("textEquivalent")) {
        this.textEquivalent = castToString(value); // StringType
      } else if (name.equals("priority")) {
        value = new RequestPriorityEnumFactory().fromType(castToCode(value));
        this.priority = (Enumeration) value; // Enumeration
      } else if (name.equals("code")) {
        this.getCode().add(castToCodeableConcept(value));
      } else if (name.equals("documentation")) {
        this.getDocumentation().add(castToRelatedArtifact(value));
      } else if (name.equals("condition")) {
        this.getCondition().add((RequestGroupActionConditionComponent) value);
      } else if (name.equals("relatedAction")) {
        this.getRelatedAction().add((RequestGroupActionRelatedActionComponent) value);
      } else if (name.equals("timing[x]")) {
        this.timing = castToType(value); // Type
      } else if (name.equals("participant")) {
        this.getParticipant().add(castToReference(value));
      } else if (name.equals("type")) {
        this.type = castToCodeableConcept(value); // CodeableConcept
      } else if (name.equals("groupingBehavior")) {
        value = new ActionGroupingBehaviorEnumFactory().fromType(castToCode(value));
        this.groupingBehavior = (Enumeration) value; // Enumeration
      } else if (name.equals("selectionBehavior")) {
        value = new ActionSelectionBehaviorEnumFactory().fromType(castToCode(value));
        this.selectionBehavior = (Enumeration) value; // Enumeration
      } else if (name.equals("requiredBehavior")) {
        value = new ActionRequiredBehaviorEnumFactory().fromType(castToCode(value));
        this.requiredBehavior = (Enumeration) value; // Enumeration
      } else if (name.equals("precheckBehavior")) {
        value = new ActionPrecheckBehaviorEnumFactory().fromType(castToCode(value));
        this.precheckBehavior = (Enumeration) value; // Enumeration
      } else if (name.equals("cardinalityBehavior")) {
        value = new ActionCardinalityBehaviorEnumFactory().fromType(castToCode(value));
        this.cardinalityBehavior = (Enumeration) value; // Enumeration
      } else if (name.equals("resource")) {
        this.resource = castToReference(value); // Reference
      } else if (name.equals("action")) {
        this.getAction().add((RequestGroupActionComponent) value);
      } else
        return super.setProperty(name, value);
      return value;
    }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
      if (name.equals("prefix")) {
        this.prefix = null;
      } else if (name.equals("title")) {
        this.title = null;
      } else if (name.equals("description")) {
        this.description = null;
      } else if (name.equals("textEquivalent")) {
        this.textEquivalent = null;
      } else if (name.equals("priority")) {
        this.priority = null;
      } else if (name.equals("code")) {
        this.getCode().remove(castToCodeableConcept(value));
      } else if (name.equals("documentation")) {
        this.getDocumentation().remove(castToRelatedArtifact(value));
      } else if (name.equals("condition")) {
        this.getCondition().remove((RequestGroupActionConditionComponent) value);
      } else if (name.equals("relatedAction")) {
        this.getRelatedAction().remove((RequestGroupActionRelatedActionComponent) value);
      } else if (name.equals("timing[x]")) {
        this.timing = null;
      } else if (name.equals("participant")) {
        this.getParticipant().remove(castToReference(value));
      } else if (name.equals("type")) {
        this.type = null;
      } else if (name.equals("groupingBehavior")) {
        this.groupingBehavior = null;
      } else if (name.equals("selectionBehavior")) {
        this.selectionBehavior = null;
      } else if (name.equals("requiredBehavior")) {
        this.requiredBehavior = null;
      } else if (name.equals("precheckBehavior")) {
        this.precheckBehavior = null;
      } else if (name.equals("cardinalityBehavior")) {
        this.cardinalityBehavior = null;
      } else if (name.equals("resource")) {
        this.resource = null;
      } else if (name.equals("action")) {
        this.getAction().remove((RequestGroupActionComponent) value);
      } else
        super.removeChild(name, value);
      
    }

    @Override
    public Base makeProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case -980110702:
        return getPrefixElement();
      case 110371416:
        return getTitleElement();
      case -1724546052:
        return getDescriptionElement();
      case -900391049:
        return getTextEquivalentElement();
      case -1165461084:
        return getPriorityElement();
      case 3059181:
        return addCode();
      case 1587405498:
        return addDocumentation();
      case -861311717:
        return addCondition();
      case -384107967:
        return addRelatedAction();
      case 164632566:
        return getTiming();
      case -873664438:
        return getTiming();
      case 767422259:
        return addParticipant();
      case 3575610:
        return getType();
      case 586678389:
        return getGroupingBehaviorElement();
      case 168639486:
        return getSelectionBehaviorElement();
      case -1163906287:
        return getRequiredBehaviorElement();
      case -1174249033:
        return getPrecheckBehaviorElement();
      case -922577408:
        return getCardinalityBehaviorElement();
      case -341064690:
        return getResource();
      case -1422950858:
        return addAction();
      default:
        return super.makeProperty(hash, name);
      }

    }

    @Override
    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case -980110702:
        /* prefix */ return new String[] { "string" };
      case 110371416:
        /* title */ return new String[] { "string" };
      case -1724546052:
        /* description */ return new String[] { "string" };
      case -900391049:
        /* textEquivalent */ return new String[] { "string" };
      case -1165461084:
        /* priority */ return new String[] { "code" };
      case 3059181:
        /* code */ return new String[] { "CodeableConcept" };
      case 1587405498:
        /* documentation */ return new String[] { "RelatedArtifact" };
      case -861311717:
        /* condition */ return new String[] {};
      case -384107967:
        /* relatedAction */ return new String[] {};
      case -873664438:
        /* timing */ return new String[] { "dateTime", "Age", "Period", "Duration", "Range", "Timing" };
      case 767422259:
        /* participant */ return new String[] { "Reference" };
      case 3575610:
        /* type */ return new String[] { "CodeableConcept" };
      case 586678389:
        /* groupingBehavior */ return new String[] { "code" };
      case 168639486:
        /* selectionBehavior */ return new String[] { "code" };
      case -1163906287:
        /* requiredBehavior */ return new String[] { "code" };
      case -1174249033:
        /* precheckBehavior */ return new String[] { "code" };
      case -922577408:
        /* cardinalityBehavior */ return new String[] { "code" };
      case -341064690:
        /* resource */ return new String[] { "Reference" };
      case -1422950858:
        /* action */ return new String[] { "@RequestGroup.action" };
      default:
        return super.getTypesForProperty(hash, name);
      }

    }

    @Override
    public Base addChild(String name) throws FHIRException {
      if (name.equals("prefix")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.prefix");
      } else if (name.equals("title")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.title");
      } else if (name.equals("description")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.description");
      } else if (name.equals("textEquivalent")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.textEquivalent");
      } else if (name.equals("priority")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.priority");
      } else if (name.equals("code")) {
        return addCode();
      } else if (name.equals("documentation")) {
        return addDocumentation();
      } else if (name.equals("condition")) {
        return addCondition();
      } else if (name.equals("relatedAction")) {
        return addRelatedAction();
      } else if (name.equals("timingDateTime")) {
        this.timing = new DateTimeType();
        return this.timing;
      } else if (name.equals("timingAge")) {
        this.timing = new Age();
        return this.timing;
      } else if (name.equals("timingPeriod")) {
        this.timing = new Period();
        return this.timing;
      } else if (name.equals("timingDuration")) {
        this.timing = new Duration();
        return this.timing;
      } else if (name.equals("timingRange")) {
        this.timing = new Range();
        return this.timing;
      } else if (name.equals("timingTiming")) {
        this.timing = new Timing();
        return this.timing;
      } else if (name.equals("participant")) {
        return addParticipant();
      } else if (name.equals("type")) {
        this.type = new CodeableConcept();
        return this.type;
      } else if (name.equals("groupingBehavior")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.groupingBehavior");
      } else if (name.equals("selectionBehavior")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.selectionBehavior");
      } else if (name.equals("requiredBehavior")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.requiredBehavior");
      } else if (name.equals("precheckBehavior")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.precheckBehavior");
      } else if (name.equals("cardinalityBehavior")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.cardinalityBehavior");
      } else if (name.equals("resource")) {
        this.resource = new Reference();
        return this.resource;
      } else if (name.equals("action")) {
        return addAction();
      } else
        return super.addChild(name);
    }

    public RequestGroupActionComponent copy() {
      RequestGroupActionComponent dst = new RequestGroupActionComponent();
      copyValues(dst);
      return dst;
    }

    public void copyValues(RequestGroupActionComponent dst) {
      super.copyValues(dst);
      dst.prefix = prefix == null ? null : prefix.copy();
      dst.title = title == null ? null : title.copy();
      dst.description = description == null ? null : description.copy();
      dst.textEquivalent = textEquivalent == null ? null : textEquivalent.copy();
      dst.priority = priority == null ? null : priority.copy();
      if (code != null) {
        dst.code = new ArrayList();
        for (CodeableConcept i : code)
          dst.code.add(i.copy());
      }
      ;
      if (documentation != null) {
        dst.documentation = new ArrayList();
        for (RelatedArtifact i : documentation)
          dst.documentation.add(i.copy());
      }
      ;
      if (condition != null) {
        dst.condition = new ArrayList();
        for (RequestGroupActionConditionComponent i : condition)
          dst.condition.add(i.copy());
      }
      ;
      if (relatedAction != null) {
        dst.relatedAction = new ArrayList();
        for (RequestGroupActionRelatedActionComponent i : relatedAction)
          dst.relatedAction.add(i.copy());
      }
      ;
      dst.timing = timing == null ? null : timing.copy();
      if (participant != null) {
        dst.participant = new ArrayList();
        for (Reference i : participant)
          dst.participant.add(i.copy());
      }
      ;
      dst.type = type == null ? null : type.copy();
      dst.groupingBehavior = groupingBehavior == null ? null : groupingBehavior.copy();
      dst.selectionBehavior = selectionBehavior == null ? null : selectionBehavior.copy();
      dst.requiredBehavior = requiredBehavior == null ? null : requiredBehavior.copy();
      dst.precheckBehavior = precheckBehavior == null ? null : precheckBehavior.copy();
      dst.cardinalityBehavior = cardinalityBehavior == null ? null : cardinalityBehavior.copy();
      dst.resource = resource == null ? null : resource.copy();
      if (action != null) {
        dst.action = new ArrayList();
        for (RequestGroupActionComponent i : action)
          dst.action.add(i.copy());
      }
      ;
    }

    @Override
    public boolean equalsDeep(Base other_) {
      if (!super.equalsDeep(other_))
        return false;
      if (!(other_ instanceof RequestGroupActionComponent))
        return false;
      RequestGroupActionComponent o = (RequestGroupActionComponent) other_;
      return compareDeep(prefix, o.prefix, true) && compareDeep(title, o.title, true)
          && compareDeep(description, o.description, true) && compareDeep(textEquivalent, o.textEquivalent, true)
          && compareDeep(priority, o.priority, true) && compareDeep(code, o.code, true)
          && compareDeep(documentation, o.documentation, true) && compareDeep(condition, o.condition, true)
          && compareDeep(relatedAction, o.relatedAction, true) && compareDeep(timing, o.timing, true)
          && compareDeep(participant, o.participant, true) && compareDeep(type, o.type, true)
          && compareDeep(groupingBehavior, o.groupingBehavior, true)
          && compareDeep(selectionBehavior, o.selectionBehavior, true)
          && compareDeep(requiredBehavior, o.requiredBehavior, true)
          && compareDeep(precheckBehavior, o.precheckBehavior, true)
          && compareDeep(cardinalityBehavior, o.cardinalityBehavior, true) && compareDeep(resource, o.resource, true)
          && compareDeep(action, o.action, true);
    }

    @Override
    public boolean equalsShallow(Base other_) {
      if (!super.equalsShallow(other_))
        return false;
      if (!(other_ instanceof RequestGroupActionComponent))
        return false;
      RequestGroupActionComponent o = (RequestGroupActionComponent) other_;
      return compareValues(prefix, o.prefix, true) && compareValues(title, o.title, true)
          && compareValues(description, o.description, true) && compareValues(textEquivalent, o.textEquivalent, true)
          && compareValues(priority, o.priority, true) && compareValues(groupingBehavior, o.groupingBehavior, true)
          && compareValues(selectionBehavior, o.selectionBehavior, true)
          && compareValues(requiredBehavior, o.requiredBehavior, true)
          && compareValues(precheckBehavior, o.precheckBehavior, true)
          && compareValues(cardinalityBehavior, o.cardinalityBehavior, true);
    }

    public boolean isEmpty() {
      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(prefix, title, description, textEquivalent,
          priority, code, documentation, condition, relatedAction, timing, participant, type, groupingBehavior,
          selectionBehavior, requiredBehavior, precheckBehavior, cardinalityBehavior, resource, action);
    }

    public String fhirType() {
      return "RequestGroup.action";

    }

  }

  @Block()
  public static class RequestGroupActionConditionComponent extends BackboneElement implements IBaseBackboneElement {
    /**
     * The kind of condition.
     */
    @Child(name = "kind", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "applicability | start | stop", formalDefinition = "The kind of condition.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/action-condition-kind")
    protected Enumeration kind;

    /**
     * An expression that returns true or false, indicating whether or not the
     * condition is satisfied.
     */
    @Child(name = "expression", type = {
        Expression.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "Boolean-valued expression", formalDefinition = "An expression that returns true or false, indicating whether or not the condition is satisfied.")
    protected Expression expression;

    private static final long serialVersionUID = -455150438L;

    /**
     * Constructor
     */
    public RequestGroupActionConditionComponent() {
      super();
    }

    /**
     * Constructor
     */
    public RequestGroupActionConditionComponent(Enumeration kind) {
      super();
      this.kind = kind;
    }

    /**
     * @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
     */
    public Enumeration getKindElement() {
      if (this.kind == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionConditionComponent.kind");
        else if (Configuration.doAutoCreate())
          this.kind = new Enumeration(new ActionConditionKindEnumFactory()); // bb
      return this.kind;
    }

    public boolean hasKindElement() {
      return this.kind != null && !this.kind.isEmpty();
    }

    public boolean hasKind() {
      return this.kind != null && !this.kind.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionConditionComponent setKindElement(Enumeration value) {
      this.kind = value;
      return this;
    }

    /**
     * @return The kind of condition.
     */
    public ActionConditionKind getKind() {
      return this.kind == null ? null : this.kind.getValue();
    }

    /**
     * @param value The kind of condition.
     */
    public RequestGroupActionConditionComponent setKind(ActionConditionKind value) {
      if (this.kind == null)
        this.kind = new Enumeration(new ActionConditionKindEnumFactory());
      this.kind.setValue(value);
      return this;
    }

    /**
     * @return {@link #expression} (An expression that returns true or false,
     *         indicating whether or not the condition is satisfied.)
     */
    public Expression getExpression() {
      if (this.expression == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionConditionComponent.expression");
        else if (Configuration.doAutoCreate())
          this.expression = new Expression(); // cc
      return this.expression;
    }

    public boolean hasExpression() {
      return this.expression != null && !this.expression.isEmpty();
    }

    /**
     * @param value {@link #expression} (An expression that returns true or false,
     *              indicating whether or not the condition is satisfied.)
     */
    public RequestGroupActionConditionComponent setExpression(Expression value) {
      this.expression = value;
      return this;
    }

    protected void listChildren(List children) {
      super.listChildren(children);
      children.add(new Property("kind", "code", "The kind of condition.", 0, 1, kind));
      children.add(new Property("expression", "Expression",
          "An expression that returns true or false, indicating whether or not the condition is satisfied.", 0, 1,
          expression));
    }

    @Override
    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
      switch (_hash) {
      case 3292052:
        /* kind */ return new Property("kind", "code", "The kind of condition.", 0, 1, kind);
      case -1795452264:
        /* expression */ return new Property("expression", "Expression",
            "An expression that returns true or false, indicating whether or not the condition is satisfied.", 0, 1,
            expression);
      default:
        return super.getNamedProperty(_hash, _name, _checkValid);
      }

    }

    @Override
    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
      switch (hash) {
      case 3292052:
        /* kind */ return this.kind == null ? new Base[0] : new Base[] { this.kind }; // Enumeration
      case -1795452264:
        /* expression */ return this.expression == null ? new Base[0] : new Base[] { this.expression }; // Expression
      default:
        return super.getProperty(hash, name, checkValid);
      }

    }

    @Override
    public Base setProperty(int hash, String name, Base value) throws FHIRException {
      switch (hash) {
      case 3292052: // kind
        value = new ActionConditionKindEnumFactory().fromType(castToCode(value));
        this.kind = (Enumeration) value; // Enumeration
        return value;
      case -1795452264: // expression
        this.expression = castToExpression(value); // Expression
        return value;
      default:
        return super.setProperty(hash, name, value);
      }

    }

    @Override
    public Base setProperty(String name, Base value) throws FHIRException {
      if (name.equals("kind")) {
        value = new ActionConditionKindEnumFactory().fromType(castToCode(value));
        this.kind = (Enumeration) value; // Enumeration
      } else if (name.equals("expression")) {
        this.expression = castToExpression(value); // Expression
      } else
        return super.setProperty(name, value);
      return value;
    }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
      if (name.equals("kind")) {
        this.kind = null;
      } else if (name.equals("expression")) {
        this.expression = null;
      } else
        super.removeChild(name, value);
      
    }

    @Override
    public Base makeProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case 3292052:
        return getKindElement();
      case -1795452264:
        return getExpression();
      default:
        return super.makeProperty(hash, name);
      }

    }

    @Override
    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case 3292052:
        /* kind */ return new String[] { "code" };
      case -1795452264:
        /* expression */ return new String[] { "Expression" };
      default:
        return super.getTypesForProperty(hash, name);
      }

    }

    @Override
    public Base addChild(String name) throws FHIRException {
      if (name.equals("kind")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.kind");
      } else if (name.equals("expression")) {
        this.expression = new Expression();
        return this.expression;
      } else
        return super.addChild(name);
    }

    public RequestGroupActionConditionComponent copy() {
      RequestGroupActionConditionComponent dst = new RequestGroupActionConditionComponent();
      copyValues(dst);
      return dst;
    }

    public void copyValues(RequestGroupActionConditionComponent dst) {
      super.copyValues(dst);
      dst.kind = kind == null ? null : kind.copy();
      dst.expression = expression == null ? null : expression.copy();
    }

    @Override
    public boolean equalsDeep(Base other_) {
      if (!super.equalsDeep(other_))
        return false;
      if (!(other_ instanceof RequestGroupActionConditionComponent))
        return false;
      RequestGroupActionConditionComponent o = (RequestGroupActionConditionComponent) other_;
      return compareDeep(kind, o.kind, true) && compareDeep(expression, o.expression, true);
    }

    @Override
    public boolean equalsShallow(Base other_) {
      if (!super.equalsShallow(other_))
        return false;
      if (!(other_ instanceof RequestGroupActionConditionComponent))
        return false;
      RequestGroupActionConditionComponent o = (RequestGroupActionConditionComponent) other_;
      return compareValues(kind, o.kind, true);
    }

    public boolean isEmpty() {
      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(kind, expression);
    }

    public String fhirType() {
      return "RequestGroup.action.condition";

    }

  }

  @Block()
  public static class RequestGroupActionRelatedActionComponent extends BackboneElement implements IBaseBackboneElement {
    /**
     * The element id of the action this is related to.
     */
    @Child(name = "actionId", type = { IdType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
    @Description(shortDefinition = "What action this is related to", formalDefinition = "The element id of the action this is related to.")
    protected IdType actionId;

    /**
     * The relationship of this action to the related action.
     */
    @Child(name = "relationship", type = {
        CodeType.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
    @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.")
    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/action-relationship-type")
    protected Enumeration relationship;

    /**
     * A duration or range of durations to apply to the relationship. For example,
     * 30-60 minutes before.
     */
    @Child(name = "offset", type = { Duration.class,
        Range.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
    @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.")
    protected Type offset;

    private static final long serialVersionUID = 1063306770L;

    /**
     * Constructor
     */
    public RequestGroupActionRelatedActionComponent() {
      super();
    }

    /**
     * Constructor
     */
    public RequestGroupActionRelatedActionComponent(IdType actionId, Enumeration relationship) {
      super();
      this.actionId = actionId;
      this.relationship = relationship;
    }

    /**
     * @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
     */
    public IdType getActionIdElement() {
      if (this.actionId == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionRelatedActionComponent.actionId");
        else if (Configuration.doAutoCreate())
          this.actionId = new IdType(); // bb
      return this.actionId;
    }

    public boolean hasActionIdElement() {
      return this.actionId != null && !this.actionId.isEmpty();
    }

    public boolean hasActionId() {
      return this.actionId != null && !this.actionId.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionRelatedActionComponent setActionIdElement(IdType value) {
      this.actionId = value;
      return this;
    }

    /**
     * @return The element id of the action this is related to.
     */
    public String getActionId() {
      return this.actionId == null ? null : this.actionId.getValue();
    }

    /**
     * @param value The element id of the action this is related to.
     */
    public RequestGroupActionRelatedActionComponent setActionId(String value) {
      if (this.actionId == null)
        this.actionId = new IdType();
      this.actionId.setValue(value);
      return this;
    }

    /**
     * @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
     */
    public Enumeration getRelationshipElement() {
      if (this.relationship == null)
        if (Configuration.errorOnAutoCreate())
          throw new Error("Attempt to auto-create RequestGroupActionRelatedActionComponent.relationship");
        else if (Configuration.doAutoCreate())
          this.relationship = new Enumeration(new ActionRelationshipTypeEnumFactory()); // bb
      return this.relationship;
    }

    public boolean hasRelationshipElement() {
      return this.relationship != null && !this.relationship.isEmpty();
    }

    public boolean hasRelationship() {
      return this.relationship != null && !this.relationship.isEmpty();
    }

    /**
     * @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
     */
    public RequestGroupActionRelatedActionComponent setRelationshipElement(Enumeration value) {
      this.relationship = value;
      return this;
    }

    /**
     * @return The relationship of this action to the related action.
     */
    public ActionRelationshipType getRelationship() {
      return this.relationship == null ? null : this.relationship.getValue();
    }

    /**
     * @param value The relationship of this action to the related action.
     */
    public RequestGroupActionRelatedActionComponent setRelationship(ActionRelationshipType value) {
      if (this.relationship == null)
        this.relationship = new Enumeration(new ActionRelationshipTypeEnumFactory());
      this.relationship.setValue(value);
      return this;
    }

    /**
     * @return {@link #offset} (A duration or range of durations to apply to the
     *         relationship. For example, 30-60 minutes before.)
     */
    public Type getOffset() {
      return this.offset;
    }

    /**
     * @return {@link #offset} (A duration or range of durations to apply to the
     *         relationship. For example, 30-60 minutes before.)
     */
    public Duration getOffsetDuration() throws FHIRException {
      if (this.offset == null)
        this.offset = new Duration();
      if (!(this.offset instanceof Duration))
        throw new FHIRException("Type mismatch: the type Duration was expected, but " + this.offset.getClass().getName()
            + " was encountered");
      return (Duration) this.offset;
    }

    public boolean hasOffsetDuration() {
      return this != null && this.offset instanceof Duration;
    }

    /**
     * @return {@link #offset} (A duration or range of durations to apply to the
     *         relationship. For example, 30-60 minutes before.)
     */
    public Range getOffsetRange() throws FHIRException {
      if (this.offset == null)
        this.offset = new Range();
      if (!(this.offset instanceof Range))
        throw new FHIRException(
            "Type mismatch: the type Range was expected, but " + this.offset.getClass().getName() + " was encountered");
      return (Range) this.offset;
    }

    public boolean hasOffsetRange() {
      return this != null && this.offset instanceof Range;
    }

    public boolean hasOffset() {
      return this.offset != null && !this.offset.isEmpty();
    }

    /**
     * @param value {@link #offset} (A duration or range of durations to apply to
     *              the relationship. For example, 30-60 minutes before.)
     */
    public RequestGroupActionRelatedActionComponent setOffset(Type value) {
      if (value != null && !(value instanceof Duration || value instanceof Range))
        throw new Error("Not the right type for RequestGroup.action.relatedAction.offset[x]: " + value.fhirType());
      this.offset = value;
      return this;
    }

    protected void listChildren(List children) {
      super.listChildren(children);
      children.add(new Property("actionId", "id", "The element id of the action this is related to.", 0, 1, actionId));
      children.add(new Property("relationship", "code", "The relationship of this action to the related action.", 0, 1,
          relationship));
      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));
    }

    @Override
    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
      switch (_hash) {
      case -1656172047:
        /* actionId */ return new Property("actionId", "id", "The element id of the action this is related to.", 0, 1,
            actionId);
      case -261851592:
        /* relationship */ return new Property("relationship", "code",
            "The relationship of this action to the related action.", 0, 1, relationship);
      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);
      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);
      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);
      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);
      default:
        return super.getNamedProperty(_hash, _name, _checkValid);
      }

    }

    @Override
    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
      switch (hash) {
      case -1656172047:
        /* actionId */ return this.actionId == null ? new Base[0] : new Base[] { this.actionId }; // IdType
      case -261851592:
        /* relationship */ return this.relationship == null ? new Base[0] : new Base[] { this.relationship }; // Enumeration
      case -1019779949:
        /* offset */ return this.offset == null ? new Base[0] : new Base[] { this.offset }; // Type
      default:
        return super.getProperty(hash, name, checkValid);
      }

    }

    @Override
    public Base setProperty(int hash, String name, Base value) throws FHIRException {
      switch (hash) {
      case -1656172047: // actionId
        this.actionId = castToId(value); // IdType
        return value;
      case -261851592: // relationship
        value = new ActionRelationshipTypeEnumFactory().fromType(castToCode(value));
        this.relationship = (Enumeration) value; // Enumeration
        return value;
      case -1019779949: // offset
        this.offset = castToType(value); // Type
        return value;
      default:
        return super.setProperty(hash, name, value);
      }

    }

    @Override
    public Base setProperty(String name, Base value) throws FHIRException {
      if (name.equals("actionId")) {
        this.actionId = castToId(value); // IdType
      } else if (name.equals("relationship")) {
        value = new ActionRelationshipTypeEnumFactory().fromType(castToCode(value));
        this.relationship = (Enumeration) value; // Enumeration
      } else if (name.equals("offset[x]")) {
        this.offset = castToType(value); // Type
      } else
        return super.setProperty(name, value);
      return value;
    }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
      if (name.equals("actionId")) {
        this.actionId = null;
      } else if (name.equals("relationship")) {
        this.relationship = null;
      } else if (name.equals("offset[x]")) {
        this.offset = null;
      } else
        super.removeChild(name, value);
      
    }

    @Override
    public Base makeProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case -1656172047:
        return getActionIdElement();
      case -261851592:
        return getRelationshipElement();
      case -1960684787:
        return getOffset();
      case -1019779949:
        return getOffset();
      default:
        return super.makeProperty(hash, name);
      }

    }

    @Override
    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
      switch (hash) {
      case -1656172047:
        /* actionId */ return new String[] { "id" };
      case -261851592:
        /* relationship */ return new String[] { "code" };
      case -1019779949:
        /* offset */ return new String[] { "Duration", "Range" };
      default:
        return super.getTypesForProperty(hash, name);
      }

    }

    @Override
    public Base addChild(String name) throws FHIRException {
      if (name.equals("actionId")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.actionId");
      } else if (name.equals("relationship")) {
        throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.relationship");
      } else if (name.equals("offsetDuration")) {
        this.offset = new Duration();
        return this.offset;
      } else if (name.equals("offsetRange")) {
        this.offset = new Range();
        return this.offset;
      } else
        return super.addChild(name);
    }

    public RequestGroupActionRelatedActionComponent copy() {
      RequestGroupActionRelatedActionComponent dst = new RequestGroupActionRelatedActionComponent();
      copyValues(dst);
      return dst;
    }

    public void copyValues(RequestGroupActionRelatedActionComponent dst) {
      super.copyValues(dst);
      dst.actionId = actionId == null ? null : actionId.copy();
      dst.relationship = relationship == null ? null : relationship.copy();
      dst.offset = offset == null ? null : offset.copy();
    }

    @Override
    public boolean equalsDeep(Base other_) {
      if (!super.equalsDeep(other_))
        return false;
      if (!(other_ instanceof RequestGroupActionRelatedActionComponent))
        return false;
      RequestGroupActionRelatedActionComponent o = (RequestGroupActionRelatedActionComponent) other_;
      return compareDeep(actionId, o.actionId, true) && compareDeep(relationship, o.relationship, true)
          && compareDeep(offset, o.offset, true);
    }

    @Override
    public boolean equalsShallow(Base other_) {
      if (!super.equalsShallow(other_))
        return false;
      if (!(other_ instanceof RequestGroupActionRelatedActionComponent))
        return false;
      RequestGroupActionRelatedActionComponent o = (RequestGroupActionRelatedActionComponent) other_;
      return compareValues(actionId, o.actionId, true) && compareValues(relationship, o.relationship, true);
    }

    public boolean isEmpty() {
      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(actionId, relationship, offset);
    }

    public String fhirType() {
      return "RequestGroup.action.relatedAction";

    }

  }

  /**
   * Allows a service to provide a unique, business identifier for the request.
   */
  @Child(name = "identifier", type = {
      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @Description(shortDefinition = "Business identifier", formalDefinition = "Allows a service to provide a unique, business identifier for the request.")
  protected List identifier;

  /**
   * 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.
   */
  @Child(name = "instantiatesCanonical", type = {
      CanonicalType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @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.")
  protected List instantiatesCanonical;

  /**
   * A URL referencing an externally defined protocol, guideline, orderset or
   * other definition that is adhered to in whole or in part by this request.
   */
  @Child(name = "instantiatesUri", type = {
      UriType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
  @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.")
  protected List instantiatesUri;

  /**
   * A plan, proposal or order that is fulfilled in whole or in part by this
   * request.
   */
  @Child(name = "basedOn", type = {
      Reference.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Fulfills plan, proposal, or order", formalDefinition = "A plan, proposal or order that is fulfilled in whole or in part by this request.")
  protected List basedOn;
  /**
   * 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.)
   */
  protected List basedOnTarget;

  /**
   * Completed or terminated request(s) whose function is taken by this new
   * request.
   */
  @Child(name = "replaces", type = {
      Reference.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Request(s) replaced by this request", formalDefinition = "Completed or terminated request(s) whose function is taken by this new request.")
  protected List replaces;
  /**
   * The actual objects that are the target of the reference (Completed or
   * terminated request(s) whose function is taken by this new request.)
   */
  protected List replacesTarget;

  /**
   * 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.
   */
  @Child(name = "groupIdentifier", type = {
      Identifier.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
  @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.")
  protected Identifier groupIdentifier;

  /**
   * The current state of the request. For request groups, the status reflects the
   * status of all the requests in the group.
   */
  @Child(name = "status", type = { CodeType.class }, order = 6, min = 1, max = 1, modifier = true, summary = true)
  @Description(shortDefinition = "draft | active | on-hold | revoked | completed | entered-in-error | unknown", formalDefinition = "The current state of the request. For request groups, the status reflects the status of all the requests in the group.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-status")
  protected Enumeration status;

  /**
   * Indicates the level of authority/intentionality associated with the request
   * and where the request fits into the workflow chain.
   */
  @Child(name = "intent", type = { CodeType.class }, order = 7, min = 1, max = 1, modifier = true, summary = true)
  @Description(shortDefinition = "proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition = "Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-intent")
  protected Enumeration intent;

  /**
   * Indicates how quickly the request should be addressed with respect to other
   * requests.
   */
  @Child(name = "priority", type = { CodeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "routine | urgent | asap | stat", formalDefinition = "Indicates how quickly the request should be addressed with respect to other requests.")
  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-priority")
  protected Enumeration priority;

  /**
   * A code that identifies what the overall request group is.
   */
  @Child(name = "code", type = { CodeableConcept.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
  @Description(shortDefinition = "What's being requested/ordered", formalDefinition = "A code that identifies what the overall request group is.")
  protected CodeableConcept code;

  /**
   * The subject for which the request group was created.
   */
  @Child(name = "subject", type = { Patient.class,
      Group.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Who the request group is about", formalDefinition = "The subject for which the request group was created.")
  protected Reference subject;

  /**
   * The actual object that is the target of the reference (The subject for which
   * the request group was created.)
   */
  protected Resource subjectTarget;

  /**
   * Describes the context of the request group, if any.
   */
  @Child(name = "encounter", type = {
      Encounter.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Created as part of", formalDefinition = "Describes the context of the request group, if any.")
  protected Reference encounter;

  /**
   * The actual object that is the target of the reference (Describes the context
   * of the request group, if any.)
   */
  protected Encounter encounterTarget;

  /**
   * Indicates when the request group was created.
   */
  @Child(name = "authoredOn", type = {
      DateTimeType.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "When the request group was authored", formalDefinition = "Indicates when the request group was created.")
  protected DateTimeType authoredOn;

  /**
   * Provides a reference to the author of the request group.
   */
  @Child(name = "author", type = { Device.class, Practitioner.class,
      PractitionerRole.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
  @Description(shortDefinition = "Device or practitioner that authored the request group", formalDefinition = "Provides a reference to the author of the request group.")
  protected Reference author;

  /**
   * The actual object that is the target of the reference (Provides a reference
   * to the author of the request group.)
   */
  protected Resource authorTarget;

  /**
   * Describes the reason for the request group in coded or textual form.
   */
  @Child(name = "reasonCode", type = {
      CodeableConcept.class }, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Why the request group is needed", formalDefinition = "Describes the reason for the request group in coded or textual form.")
  protected List reasonCode;

  /**
   * Indicates another resource whose existence justifies this request group.
   */
  @Child(name = "reasonReference", type = { Condition.class, Observation.class, DiagnosticReport.class,
      DocumentReference.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Why the request group is needed", formalDefinition = "Indicates another resource whose existence justifies this request group.")
  protected List reasonReference;
  /**
   * The actual objects that are the target of the reference (Indicates another
   * resource whose existence justifies this request group.)
   */
  protected List reasonReferenceTarget;

  /**
   * Provides a mechanism to communicate additional information about the
   * response.
   */
  @Child(name = "note", type = {
      Annotation.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Additional notes about the response", formalDefinition = "Provides a mechanism to communicate additional information about the response.")
  protected List note;

  /**
   * The actions, if any, produced by the evaluation of the artifact.
   */
  @Child(name = "action", type = {}, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
  @Description(shortDefinition = "Proposed actions, if any", formalDefinition = "The actions, if any, produced by the evaluation of the artifact.")
  protected List action;

  private static final long serialVersionUID = -2053492070L;

  /**
   * Constructor
   */
  public RequestGroup() {
    super();
  }

  /**
   * Constructor
   */
  public RequestGroup(Enumeration status, Enumeration intent) {
    super();
    this.status = status;
    this.intent = intent;
  }

  /**
   * @return {@link #identifier} (Allows a service to provide a unique, business
   *         identifier for the request.)
   */
  public List getIdentifier() {
    if (this.identifier == null)
      this.identifier = new ArrayList();
    return this.identifier;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setIdentifier(List theIdentifier) {
    this.identifier = theIdentifier;
    return this;
  }

  public boolean hasIdentifier() {
    if (this.identifier == null)
      return false;
    for (Identifier item : this.identifier)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Identifier addIdentifier() { // 3
    Identifier t = new Identifier();
    if (this.identifier == null)
      this.identifier = new ArrayList();
    this.identifier.add(t);
    return t;
  }

  public RequestGroup addIdentifier(Identifier t) { // 3
    if (t == null)
      return this;
    if (this.identifier == null)
      this.identifier = new ArrayList();
    this.identifier.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #identifier}, creating
   *         it if it does not already exist
   */
  public Identifier getIdentifierFirstRep() {
    if (getIdentifier().isEmpty()) {
      addIdentifier();
    }
    return getIdentifier().get(0);
  }

  /**
   * @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.)
   */
  public List getInstantiatesCanonical() {
    if (this.instantiatesCanonical == null)
      this.instantiatesCanonical = new ArrayList();
    return this.instantiatesCanonical;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setInstantiatesCanonical(List theInstantiatesCanonical) {
    this.instantiatesCanonical = theInstantiatesCanonical;
    return this;
  }

  public boolean hasInstantiatesCanonical() {
    if (this.instantiatesCanonical == null)
      return false;
    for (CanonicalType item : this.instantiatesCanonical)
      if (!item.isEmpty())
        return true;
    return false;
  }

  /**
   * @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.)
   */
  public CanonicalType addInstantiatesCanonicalElement() {// 2
    CanonicalType t = new CanonicalType();
    if (this.instantiatesCanonical == null)
      this.instantiatesCanonical = new ArrayList();
    this.instantiatesCanonical.add(t);
    return t;
  }

  /**
   * @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.)
   */
  public RequestGroup addInstantiatesCanonical(String value) { // 1
    CanonicalType t = new CanonicalType();
    t.setValue(value);
    if (this.instantiatesCanonical == null)
      this.instantiatesCanonical = new ArrayList();
    this.instantiatesCanonical.add(t);
    return this;
  }

  /**
   * @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.)
   */
  public boolean hasInstantiatesCanonical(String value) {
    if (this.instantiatesCanonical == null)
      return false;
    for (CanonicalType v : this.instantiatesCanonical)
      if (v.getValue().equals(value)) // canonical
        return true;
    return false;
  }

  /**
   * @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.)
   */
  public List getInstantiatesUri() {
    if (this.instantiatesUri == null)
      this.instantiatesUri = new ArrayList();
    return this.instantiatesUri;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setInstantiatesUri(List theInstantiatesUri) {
    this.instantiatesUri = theInstantiatesUri;
    return this;
  }

  public boolean hasInstantiatesUri() {
    if (this.instantiatesUri == null)
      return false;
    for (UriType item : this.instantiatesUri)
      if (!item.isEmpty())
        return true;
    return false;
  }

  /**
   * @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.)
   */
  public UriType addInstantiatesUriElement() {// 2
    UriType t = new UriType();
    if (this.instantiatesUri == null)
      this.instantiatesUri = new ArrayList();
    this.instantiatesUri.add(t);
    return t;
  }

  /**
   * @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.)
   */
  public RequestGroup addInstantiatesUri(String value) { // 1
    UriType t = new UriType();
    t.setValue(value);
    if (this.instantiatesUri == null)
      this.instantiatesUri = new ArrayList();
    this.instantiatesUri.add(t);
    return this;
  }

  /**
   * @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.)
   */
  public boolean hasInstantiatesUri(String value) {
    if (this.instantiatesUri == null)
      return false;
    for (UriType v : this.instantiatesUri)
      if (v.getValue().equals(value)) // uri
        return true;
    return false;
  }

  /**
   * @return {@link #basedOn} (A plan, proposal or order that is fulfilled in
   *         whole or in part by this request.)
   */
  public List getBasedOn() {
    if (this.basedOn == null)
      this.basedOn = new ArrayList();
    return this.basedOn;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setBasedOn(List theBasedOn) {
    this.basedOn = theBasedOn;
    return this;
  }

  public boolean hasBasedOn() {
    if (this.basedOn == null)
      return false;
    for (Reference item : this.basedOn)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addBasedOn() { // 3
    Reference t = new Reference();
    if (this.basedOn == null)
      this.basedOn = new ArrayList();
    this.basedOn.add(t);
    return t;
  }

  public RequestGroup addBasedOn(Reference t) { // 3
    if (t == null)
      return this;
    if (this.basedOn == null)
      this.basedOn = new ArrayList();
    this.basedOn.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #basedOn}, creating it
   *         if it does not already exist
   */
  public Reference getBasedOnFirstRep() {
    if (getBasedOn().isEmpty()) {
      addBasedOn();
    }
    return getBasedOn().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getBasedOnTarget() {
    if (this.basedOnTarget == null)
      this.basedOnTarget = new ArrayList();
    return this.basedOnTarget;
  }

  /**
   * @return {@link #replaces} (Completed or terminated request(s) whose function
   *         is taken by this new request.)
   */
  public List getReplaces() {
    if (this.replaces == null)
      this.replaces = new ArrayList();
    return this.replaces;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setReplaces(List theReplaces) {
    this.replaces = theReplaces;
    return this;
  }

  public boolean hasReplaces() {
    if (this.replaces == null)
      return false;
    for (Reference item : this.replaces)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addReplaces() { // 3
    Reference t = new Reference();
    if (this.replaces == null)
      this.replaces = new ArrayList();
    this.replaces.add(t);
    return t;
  }

  public RequestGroup addReplaces(Reference t) { // 3
    if (t == null)
      return this;
    if (this.replaces == null)
      this.replaces = new ArrayList();
    this.replaces.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #replaces}, creating
   *         it if it does not already exist
   */
  public Reference getReplacesFirstRep() {
    if (getReplaces().isEmpty()) {
      addReplaces();
    }
    return getReplaces().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getReplacesTarget() {
    if (this.replacesTarget == null)
      this.replacesTarget = new ArrayList();
    return this.replacesTarget;
  }

  /**
   * @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.)
   */
  public Identifier getGroupIdentifier() {
    if (this.groupIdentifier == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.groupIdentifier");
      else if (Configuration.doAutoCreate())
        this.groupIdentifier = new Identifier(); // cc
    return this.groupIdentifier;
  }

  public boolean hasGroupIdentifier() {
    return this.groupIdentifier != null && !this.groupIdentifier.isEmpty();
  }

  /**
   * @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.)
   */
  public RequestGroup setGroupIdentifier(Identifier value) {
    this.groupIdentifier = value;
    return this;
  }

  /**
   * @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
   */
  public Enumeration getStatusElement() {
    if (this.status == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.status");
      else if (Configuration.doAutoCreate())
        this.status = new Enumeration(new RequestStatusEnumFactory()); // bb
    return this.status;
  }

  public boolean hasStatusElement() {
    return this.status != null && !this.status.isEmpty();
  }

  public boolean hasStatus() {
    return this.status != null && !this.status.isEmpty();
  }

  /**
   * @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
   */
  public RequestGroup setStatusElement(Enumeration value) {
    this.status = value;
    return this;
  }

  /**
   * @return The current state of the request. For request groups, the status
   *         reflects the status of all the requests in the group.
   */
  public RequestStatus getStatus() {
    return this.status == null ? null : this.status.getValue();
  }

  /**
   * @param value The current state of the request. For request groups, the status
   *              reflects the status of all the requests in the group.
   */
  public RequestGroup setStatus(RequestStatus value) {
    if (this.status == null)
      this.status = new Enumeration(new RequestStatusEnumFactory());
    this.status.setValue(value);
    return this;
  }

  /**
   * @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
   */
  public Enumeration getIntentElement() {
    if (this.intent == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.intent");
      else if (Configuration.doAutoCreate())
        this.intent = new Enumeration(new RequestIntentEnumFactory()); // bb
    return this.intent;
  }

  public boolean hasIntentElement() {
    return this.intent != null && !this.intent.isEmpty();
  }

  public boolean hasIntent() {
    return this.intent != null && !this.intent.isEmpty();
  }

  /**
   * @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
   */
  public RequestGroup setIntentElement(Enumeration value) {
    this.intent = value;
    return this;
  }

  /**
   * @return Indicates the level of authority/intentionality associated with the
   *         request and where the request fits into the workflow chain.
   */
  public RequestIntent getIntent() {
    return this.intent == null ? null : this.intent.getValue();
  }

  /**
   * @param value Indicates the level of authority/intentionality associated with
   *              the request and where the request fits into the workflow chain.
   */
  public RequestGroup setIntent(RequestIntent value) {
    if (this.intent == null)
      this.intent = new Enumeration(new RequestIntentEnumFactory());
    this.intent.setValue(value);
    return this;
  }

  /**
   * @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
   */
  public Enumeration getPriorityElement() {
    if (this.priority == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.priority");
      else if (Configuration.doAutoCreate())
        this.priority = new Enumeration(new RequestPriorityEnumFactory()); // bb
    return this.priority;
  }

  public boolean hasPriorityElement() {
    return this.priority != null && !this.priority.isEmpty();
  }

  public boolean hasPriority() {
    return this.priority != null && !this.priority.isEmpty();
  }

  /**
   * @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
   */
  public RequestGroup setPriorityElement(Enumeration value) {
    this.priority = value;
    return this;
  }

  /**
   * @return Indicates how quickly the request should be addressed with respect to
   *         other requests.
   */
  public RequestPriority getPriority() {
    return this.priority == null ? null : this.priority.getValue();
  }

  /**
   * @param value Indicates how quickly the request should be addressed with
   *              respect to other requests.
   */
  public RequestGroup setPriority(RequestPriority value) {
    if (value == null)
      this.priority = null;
    else {
      if (this.priority == null)
        this.priority = new Enumeration(new RequestPriorityEnumFactory());
      this.priority.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #code} (A code that identifies what the overall request group
   *         is.)
   */
  public CodeableConcept getCode() {
    if (this.code == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.code");
      else if (Configuration.doAutoCreate())
        this.code = new CodeableConcept(); // cc
    return this.code;
  }

  public boolean hasCode() {
    return this.code != null && !this.code.isEmpty();
  }

  /**
   * @param value {@link #code} (A code that identifies what the overall request
   *              group is.)
   */
  public RequestGroup setCode(CodeableConcept value) {
    this.code = value;
    return this;
  }

  /**
   * @return {@link #subject} (The subject for which the request group was
   *         created.)
   */
  public Reference getSubject() {
    if (this.subject == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.subject");
      else if (Configuration.doAutoCreate())
        this.subject = new Reference(); // cc
    return this.subject;
  }

  public boolean hasSubject() {
    return this.subject != null && !this.subject.isEmpty();
  }

  /**
   * @param value {@link #subject} (The subject for which the request group was
   *              created.)
   */
  public RequestGroup setSubject(Reference value) {
    this.subject = value;
    return this;
  }

  /**
   * @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.)
   */
  public Resource getSubjectTarget() {
    return this.subjectTarget;
  }

  /**
   * @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.)
   */
  public RequestGroup setSubjectTarget(Resource value) {
    this.subjectTarget = value;
    return this;
  }

  /**
   * @return {@link #encounter} (Describes the context of the request group, if
   *         any.)
   */
  public Reference getEncounter() {
    if (this.encounter == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.encounter");
      else if (Configuration.doAutoCreate())
        this.encounter = new Reference(); // cc
    return this.encounter;
  }

  public boolean hasEncounter() {
    return this.encounter != null && !this.encounter.isEmpty();
  }

  /**
   * @param value {@link #encounter} (Describes the context of the request group,
   *              if any.)
   */
  public RequestGroup setEncounter(Reference value) {
    this.encounter = value;
    return this;
  }

  /**
   * @return {@link #encounter} The actual object that is the target of the
   *         reference. The reference library doesn't populate this, but you can
   *         use it to hold the resource if you resolve it. (Describes the context
   *         of the request group, if any.)
   */
  public Encounter getEncounterTarget() {
    if (this.encounterTarget == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.encounter");
      else if (Configuration.doAutoCreate())
        this.encounterTarget = new Encounter(); // aa
    return this.encounterTarget;
  }

  /**
   * @param value {@link #encounter} The actual object that is the target of the
   *              reference. The reference library doesn't use these, but you can
   *              use it to hold the resource if you resolve it. (Describes the
   *              context of the request group, if any.)
   */
  public RequestGroup setEncounterTarget(Encounter value) {
    this.encounterTarget = value;
    return this;
  }

  /**
   * @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
   */
  public DateTimeType getAuthoredOnElement() {
    if (this.authoredOn == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.authoredOn");
      else if (Configuration.doAutoCreate())
        this.authoredOn = new DateTimeType(); // bb
    return this.authoredOn;
  }

  public boolean hasAuthoredOnElement() {
    return this.authoredOn != null && !this.authoredOn.isEmpty();
  }

  public boolean hasAuthoredOn() {
    return this.authoredOn != null && !this.authoredOn.isEmpty();
  }

  /**
   * @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
   */
  public RequestGroup setAuthoredOnElement(DateTimeType value) {
    this.authoredOn = value;
    return this;
  }

  /**
   * @return Indicates when the request group was created.
   */
  public Date getAuthoredOn() {
    return this.authoredOn == null ? null : this.authoredOn.getValue();
  }

  /**
   * @param value Indicates when the request group was created.
   */
  public RequestGroup setAuthoredOn(Date value) {
    if (value == null)
      this.authoredOn = null;
    else {
      if (this.authoredOn == null)
        this.authoredOn = new DateTimeType();
      this.authoredOn.setValue(value);
    }
    return this;
  }

  /**
   * @return {@link #author} (Provides a reference to the author of the request
   *         group.)
   */
  public Reference getAuthor() {
    if (this.author == null)
      if (Configuration.errorOnAutoCreate())
        throw new Error("Attempt to auto-create RequestGroup.author");
      else if (Configuration.doAutoCreate())
        this.author = new Reference(); // cc
    return this.author;
  }

  public boolean hasAuthor() {
    return this.author != null && !this.author.isEmpty();
  }

  /**
   * @param value {@link #author} (Provides a reference to the author of the
   *              request group.)
   */
  public RequestGroup setAuthor(Reference value) {
    this.author = value;
    return this;
  }

  /**
   * @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.)
   */
  public Resource getAuthorTarget() {
    return this.authorTarget;
  }

  /**
   * @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.)
   */
  public RequestGroup setAuthorTarget(Resource value) {
    this.authorTarget = value;
    return this;
  }

  /**
   * @return {@link #reasonCode} (Describes the reason for the request group in
   *         coded or textual form.)
   */
  public List getReasonCode() {
    if (this.reasonCode == null)
      this.reasonCode = new ArrayList();
    return this.reasonCode;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setReasonCode(List theReasonCode) {
    this.reasonCode = theReasonCode;
    return this;
  }

  public boolean hasReasonCode() {
    if (this.reasonCode == null)
      return false;
    for (CodeableConcept item : this.reasonCode)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public CodeableConcept addReasonCode() { // 3
    CodeableConcept t = new CodeableConcept();
    if (this.reasonCode == null)
      this.reasonCode = new ArrayList();
    this.reasonCode.add(t);
    return t;
  }

  public RequestGroup addReasonCode(CodeableConcept t) { // 3
    if (t == null)
      return this;
    if (this.reasonCode == null)
      this.reasonCode = new ArrayList();
    this.reasonCode.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #reasonCode}, creating
   *         it if it does not already exist
   */
  public CodeableConcept getReasonCodeFirstRep() {
    if (getReasonCode().isEmpty()) {
      addReasonCode();
    }
    return getReasonCode().get(0);
  }

  /**
   * @return {@link #reasonReference} (Indicates another resource whose existence
   *         justifies this request group.)
   */
  public List getReasonReference() {
    if (this.reasonReference == null)
      this.reasonReference = new ArrayList();
    return this.reasonReference;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setReasonReference(List theReasonReference) {
    this.reasonReference = theReasonReference;
    return this;
  }

  public boolean hasReasonReference() {
    if (this.reasonReference == null)
      return false;
    for (Reference item : this.reasonReference)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Reference addReasonReference() { // 3
    Reference t = new Reference();
    if (this.reasonReference == null)
      this.reasonReference = new ArrayList();
    this.reasonReference.add(t);
    return t;
  }

  public RequestGroup addReasonReference(Reference t) { // 3
    if (t == null)
      return this;
    if (this.reasonReference == null)
      this.reasonReference = new ArrayList();
    this.reasonReference.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #reasonReference},
   *         creating it if it does not already exist
   */
  public Reference getReasonReferenceFirstRep() {
    if (getReasonReference().isEmpty()) {
      addReasonReference();
    }
    return getReasonReference().get(0);
  }

  /**
   * @deprecated Use Reference#setResource(IBaseResource) instead
   */
  @Deprecated
  public List getReasonReferenceTarget() {
    if (this.reasonReferenceTarget == null)
      this.reasonReferenceTarget = new ArrayList();
    return this.reasonReferenceTarget;
  }

  /**
   * @return {@link #note} (Provides a mechanism to communicate additional
   *         information about the response.)
   */
  public List getNote() {
    if (this.note == null)
      this.note = new ArrayList();
    return this.note;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setNote(List theNote) {
    this.note = theNote;
    return this;
  }

  public boolean hasNote() {
    if (this.note == null)
      return false;
    for (Annotation item : this.note)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public Annotation addNote() { // 3
    Annotation t = new Annotation();
    if (this.note == null)
      this.note = new ArrayList();
    this.note.add(t);
    return t;
  }

  public RequestGroup addNote(Annotation t) { // 3
    if (t == null)
      return this;
    if (this.note == null)
      this.note = new ArrayList();
    this.note.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #note}, creating it if
   *         it does not already exist
   */
  public Annotation getNoteFirstRep() {
    if (getNote().isEmpty()) {
      addNote();
    }
    return getNote().get(0);
  }

  /**
   * @return {@link #action} (The actions, if any, produced by the evaluation of
   *         the artifact.)
   */
  public List getAction() {
    if (this.action == null)
      this.action = new ArrayList();
    return this.action;
  }

  /**
   * @return Returns a reference to this for easy method chaining
   */
  public RequestGroup setAction(List theAction) {
    this.action = theAction;
    return this;
  }

  public boolean hasAction() {
    if (this.action == null)
      return false;
    for (RequestGroupActionComponent item : this.action)
      if (!item.isEmpty())
        return true;
    return false;
  }

  public RequestGroupActionComponent addAction() { // 3
    RequestGroupActionComponent t = new RequestGroupActionComponent();
    if (this.action == null)
      this.action = new ArrayList();
    this.action.add(t);
    return t;
  }

  public RequestGroup addAction(RequestGroupActionComponent t) { // 3
    if (t == null)
      return this;
    if (this.action == null)
      this.action = new ArrayList();
    this.action.add(t);
    return this;
  }

  /**
   * @return The first repetition of repeating field {@link #action}, creating it
   *         if it does not already exist
   */
  public RequestGroupActionComponent getActionFirstRep() {
    if (getAction().isEmpty()) {
      addAction();
    }
    return getAction().get(0);
  }

  protected void listChildren(List children) {
    super.listChildren(children);
    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));
    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));
    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));
    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));
    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));
    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));
    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));
    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));
    children.add(new Property("priority", "code",
        "Indicates how quickly the request should be addressed with respect to other requests.", 0, 1, priority));
    children.add(new Property("code", "CodeableConcept", "A code that identifies what the overall request group is.", 0,
        1, code));
    children.add(new Property("subject", "Reference(Patient|Group)",
        "The subject for which the request group was created.", 0, 1, subject));
    children.add(new Property("encounter", "Reference(Encounter)",
        "Describes the context of the request group, if any.", 0, 1, encounter));
    children
        .add(new Property("authoredOn", "dateTime", "Indicates when the request group was created.", 0, 1, authoredOn));
    children.add(new Property("author", "Reference(Device|Practitioner|PractitionerRole)",
        "Provides a reference to the author of the request group.", 0, 1, author));
    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));
    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));
    children.add(new Property("note", "Annotation",
        "Provides a mechanism to communicate additional information about the response.", 0,
        java.lang.Integer.MAX_VALUE, note));
    children.add(new Property("action", "", "The actions, if any, produced by the evaluation of the artifact.", 0,
        java.lang.Integer.MAX_VALUE, action));
  }

  @Override
  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
    switch (_hash) {
    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);
    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);
    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);
    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);
    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);
    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);
    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);
    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);
    case -1165461084:
      /* priority */ return new Property("priority", "code",
          "Indicates how quickly the request should be addressed with respect to other requests.", 0, 1, priority);
    case 3059181:
      /* code */ return new Property("code", "CodeableConcept",
          "A code that identifies what the overall request group is.", 0, 1, code);
    case -1867885268:
      /* subject */ return new Property("subject", "Reference(Patient|Group)",
          "The subject for which the request group was created.", 0, 1, subject);
    case 1524132147:
      /* encounter */ return new Property("encounter", "Reference(Encounter)",
          "Describes the context of the request group, if any.", 0, 1, encounter);
    case -1500852503:
      /* authoredOn */ return new Property("authoredOn", "dateTime", "Indicates when the request group was created.", 0,
          1, authoredOn);
    case -1406328437:
      /* author */ return new Property("author", "Reference(Device|Practitioner|PractitionerRole)",
          "Provides a reference to the author of the request group.", 0, 1, author);
    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);
    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);
    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);
    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);
    default:
      return super.getNamedProperty(_hash, _name, _checkValid);
    }

  }

  @Override
  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
    switch (hash) {
    case -1618432855:
      /* identifier */ return this.identifier == null ? new Base[0]
          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
    case 8911915:
      /* instantiatesCanonical */ return this.instantiatesCanonical == null ? new Base[0]
          : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
    case -1926393373:
      /* instantiatesUri */ return this.instantiatesUri == null ? new Base[0]
          : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
    case -332612366:
      /* basedOn */ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference
    case -430332865:
      /* replaces */ return this.replaces == null ? new Base[0] : this.replaces.toArray(new Base[this.replaces.size()]); // Reference
    case -445338488:
      /* groupIdentifier */ return this.groupIdentifier == null ? new Base[0] : new Base[] { this.groupIdentifier }; // Identifier
    case -892481550:
      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration
    case -1183762788:
      /* intent */ return this.intent == null ? new Base[0] : new Base[] { this.intent }; // Enumeration
    case -1165461084:
      /* priority */ return this.priority == null ? new Base[0] : new Base[] { this.priority }; // Enumeration
    case 3059181:
      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
    case -1867885268:
      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
    case 1524132147:
      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
    case -1500852503:
      /* authoredOn */ return this.authoredOn == null ? new Base[0] : new Base[] { this.authoredOn }; // DateTimeType
    case -1406328437:
      /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference
    case 722137681:
      /* reasonCode */ return this.reasonCode == null ? new Base[0]
          : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept
    case -1146218137:
      /* reasonReference */ return this.reasonReference == null ? new Base[0]
          : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference
    case 3387378:
      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
    case -1422950858:
      /* action */ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // RequestGroupActionComponent
    default:
      return super.getProperty(hash, name, checkValid);
    }

  }

  @Override
  public Base setProperty(int hash, String name, Base value) throws FHIRException {
    switch (hash) {
    case -1618432855: // identifier
      this.getIdentifier().add(castToIdentifier(value)); // Identifier
      return value;
    case 8911915: // instantiatesCanonical
      this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
      return value;
    case -1926393373: // instantiatesUri
      this.getInstantiatesUri().add(castToUri(value)); // UriType
      return value;
    case -332612366: // basedOn
      this.getBasedOn().add(castToReference(value)); // Reference
      return value;
    case -430332865: // replaces
      this.getReplaces().add(castToReference(value)); // Reference
      return value;
    case -445338488: // groupIdentifier
      this.groupIdentifier = castToIdentifier(value); // Identifier
      return value;
    case -892481550: // status
      value = new RequestStatusEnumFactory().fromType(castToCode(value));
      this.status = (Enumeration) value; // Enumeration
      return value;
    case -1183762788: // intent
      value = new RequestIntentEnumFactory().fromType(castToCode(value));
      this.intent = (Enumeration) value; // Enumeration
      return value;
    case -1165461084: // priority
      value = new RequestPriorityEnumFactory().fromType(castToCode(value));
      this.priority = (Enumeration) value; // Enumeration
      return value;
    case 3059181: // code
      this.code = castToCodeableConcept(value); // CodeableConcept
      return value;
    case -1867885268: // subject
      this.subject = castToReference(value); // Reference
      return value;
    case 1524132147: // encounter
      this.encounter = castToReference(value); // Reference
      return value;
    case -1500852503: // authoredOn
      this.authoredOn = castToDateTime(value); // DateTimeType
      return value;
    case -1406328437: // author
      this.author = castToReference(value); // Reference
      return value;
    case 722137681: // reasonCode
      this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept
      return value;
    case -1146218137: // reasonReference
      this.getReasonReference().add(castToReference(value)); // Reference
      return value;
    case 3387378: // note
      this.getNote().add(castToAnnotation(value)); // Annotation
      return value;
    case -1422950858: // action
      this.getAction().add((RequestGroupActionComponent) value); // RequestGroupActionComponent
      return value;
    default:
      return super.setProperty(hash, name, value);
    }

  }

  @Override
  public Base setProperty(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
      this.getIdentifier().add(castToIdentifier(value));
    } else if (name.equals("instantiatesCanonical")) {
      this.getInstantiatesCanonical().add(castToCanonical(value));
    } else if (name.equals("instantiatesUri")) {
      this.getInstantiatesUri().add(castToUri(value));
    } else if (name.equals("basedOn")) {
      this.getBasedOn().add(castToReference(value));
    } else if (name.equals("replaces")) {
      this.getReplaces().add(castToReference(value));
    } else if (name.equals("groupIdentifier")) {
      this.groupIdentifier = castToIdentifier(value); // Identifier
    } else if (name.equals("status")) {
      value = new RequestStatusEnumFactory().fromType(castToCode(value));
      this.status = (Enumeration) value; // Enumeration
    } else if (name.equals("intent")) {
      value = new RequestIntentEnumFactory().fromType(castToCode(value));
      this.intent = (Enumeration) value; // Enumeration
    } else if (name.equals("priority")) {
      value = new RequestPriorityEnumFactory().fromType(castToCode(value));
      this.priority = (Enumeration) value; // Enumeration
    } else if (name.equals("code")) {
      this.code = castToCodeableConcept(value); // CodeableConcept
    } else if (name.equals("subject")) {
      this.subject = castToReference(value); // Reference
    } else if (name.equals("encounter")) {
      this.encounter = castToReference(value); // Reference
    } else if (name.equals("authoredOn")) {
      this.authoredOn = castToDateTime(value); // DateTimeType
    } else if (name.equals("author")) {
      this.author = castToReference(value); // Reference
    } else if (name.equals("reasonCode")) {
      this.getReasonCode().add(castToCodeableConcept(value));
    } else if (name.equals("reasonReference")) {
      this.getReasonReference().add(castToReference(value));
    } else if (name.equals("note")) {
      this.getNote().add(castToAnnotation(value));
    } else if (name.equals("action")) {
      this.getAction().add((RequestGroupActionComponent) value);
    } else
      return super.setProperty(name, value);
    return value;
  }

  @Override
  public void removeChild(String name, Base value) throws FHIRException {
    if (name.equals("identifier")) {
      this.getIdentifier().remove(castToIdentifier(value));
    } else if (name.equals("instantiatesCanonical")) {
      this.getInstantiatesCanonical().remove(castToCanonical(value));
    } else if (name.equals("instantiatesUri")) {
      this.getInstantiatesUri().remove(castToUri(value));
    } else if (name.equals("basedOn")) {
      this.getBasedOn().remove(castToReference(value));
    } else if (name.equals("replaces")) {
      this.getReplaces().remove(castToReference(value));
    } else if (name.equals("groupIdentifier")) {
      this.groupIdentifier = null;
    } else if (name.equals("status")) {
      this.status = null;
    } else if (name.equals("intent")) {
      this.intent = null;
    } else if (name.equals("priority")) {
      this.priority = null;
    } else if (name.equals("code")) {
      this.code = null;
    } else if (name.equals("subject")) {
      this.subject = null;
    } else if (name.equals("encounter")) {
      this.encounter = null;
    } else if (name.equals("authoredOn")) {
      this.authoredOn = null;
    } else if (name.equals("author")) {
      this.author = null;
    } else if (name.equals("reasonCode")) {
      this.getReasonCode().remove(castToCodeableConcept(value));
    } else if (name.equals("reasonReference")) {
      this.getReasonReference().remove(castToReference(value));
    } else if (name.equals("note")) {
      this.getNote().remove(castToAnnotation(value));
    } else if (name.equals("action")) {
      this.getAction().remove((RequestGroupActionComponent) value);
    } else
      super.removeChild(name, value);
    
  }

  @Override
  public Base makeProperty(int hash, String name) throws FHIRException {
    switch (hash) {
    case -1618432855:
      return addIdentifier();
    case 8911915:
      return addInstantiatesCanonicalElement();
    case -1926393373:
      return addInstantiatesUriElement();
    case -332612366:
      return addBasedOn();
    case -430332865:
      return addReplaces();
    case -445338488:
      return getGroupIdentifier();
    case -892481550:
      return getStatusElement();
    case -1183762788:
      return getIntentElement();
    case -1165461084:
      return getPriorityElement();
    case 3059181:
      return getCode();
    case -1867885268:
      return getSubject();
    case 1524132147:
      return getEncounter();
    case -1500852503:
      return getAuthoredOnElement();
    case -1406328437:
      return getAuthor();
    case 722137681:
      return addReasonCode();
    case -1146218137:
      return addReasonReference();
    case 3387378:
      return addNote();
    case -1422950858:
      return addAction();
    default:
      return super.makeProperty(hash, name);
    }

  }

  @Override
  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
    switch (hash) {
    case -1618432855:
      /* identifier */ return new String[] { "Identifier" };
    case 8911915:
      /* instantiatesCanonical */ return new String[] { "canonical" };
    case -1926393373:
      /* instantiatesUri */ return new String[] { "uri" };
    case -332612366:
      /* basedOn */ return new String[] { "Reference" };
    case -430332865:
      /* replaces */ return new String[] { "Reference" };
    case -445338488:
      /* groupIdentifier */ return new String[] { "Identifier" };
    case -892481550:
      /* status */ return new String[] { "code" };
    case -1183762788:
      /* intent */ return new String[] { "code" };
    case -1165461084:
      /* priority */ return new String[] { "code" };
    case 3059181:
      /* code */ return new String[] { "CodeableConcept" };
    case -1867885268:
      /* subject */ return new String[] { "Reference" };
    case 1524132147:
      /* encounter */ return new String[] { "Reference" };
    case -1500852503:
      /* authoredOn */ return new String[] { "dateTime" };
    case -1406328437:
      /* author */ return new String[] { "Reference" };
    case 722137681:
      /* reasonCode */ return new String[] { "CodeableConcept" };
    case -1146218137:
      /* reasonReference */ return new String[] { "Reference" };
    case 3387378:
      /* note */ return new String[] { "Annotation" };
    case -1422950858:
      /* action */ return new String[] {};
    default:
      return super.getTypesForProperty(hash, name);
    }

  }

  @Override
  public Base addChild(String name) throws FHIRException {
    if (name.equals("identifier")) {
      return addIdentifier();
    } else if (name.equals("instantiatesCanonical")) {
      throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.instantiatesCanonical");
    } else if (name.equals("instantiatesUri")) {
      throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.instantiatesUri");
    } else if (name.equals("basedOn")) {
      return addBasedOn();
    } else if (name.equals("replaces")) {
      return addReplaces();
    } else if (name.equals("groupIdentifier")) {
      this.groupIdentifier = new Identifier();
      return this.groupIdentifier;
    } else if (name.equals("status")) {
      throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.status");
    } else if (name.equals("intent")) {
      throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.intent");
    } else if (name.equals("priority")) {
      throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.priority");
    } else if (name.equals("code")) {
      this.code = new CodeableConcept();
      return this.code;
    } else if (name.equals("subject")) {
      this.subject = new Reference();
      return this.subject;
    } else if (name.equals("encounter")) {
      this.encounter = new Reference();
      return this.encounter;
    } else if (name.equals("authoredOn")) {
      throw new FHIRException("Cannot call addChild on a singleton property RequestGroup.authoredOn");
    } else if (name.equals("author")) {
      this.author = new Reference();
      return this.author;
    } else if (name.equals("reasonCode")) {
      return addReasonCode();
    } else if (name.equals("reasonReference")) {
      return addReasonReference();
    } else if (name.equals("note")) {
      return addNote();
    } else if (name.equals("action")) {
      return addAction();
    } else
      return super.addChild(name);
  }

  public String fhirType() {
    return "RequestGroup";

  }

  public RequestGroup copy() {
    RequestGroup dst = new RequestGroup();
    copyValues(dst);
    return dst;
  }

  public void copyValues(RequestGroup dst) {
    super.copyValues(dst);
    if (identifier != null) {
      dst.identifier = new ArrayList();
      for (Identifier i : identifier)
        dst.identifier.add(i.copy());
    }
    ;
    if (instantiatesCanonical != null) {
      dst.instantiatesCanonical = new ArrayList();
      for (CanonicalType i : instantiatesCanonical)
        dst.instantiatesCanonical.add(i.copy());
    }
    ;
    if (instantiatesUri != null) {
      dst.instantiatesUri = new ArrayList();
      for (UriType i : instantiatesUri)
        dst.instantiatesUri.add(i.copy());
    }
    ;
    if (basedOn != null) {
      dst.basedOn = new ArrayList();
      for (Reference i : basedOn)
        dst.basedOn.add(i.copy());
    }
    ;
    if (replaces != null) {
      dst.replaces = new ArrayList();
      for (Reference i : replaces)
        dst.replaces.add(i.copy());
    }
    ;
    dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy();
    dst.status = status == null ? null : status.copy();
    dst.intent = intent == null ? null : intent.copy();
    dst.priority = priority == null ? null : priority.copy();
    dst.code = code == null ? null : code.copy();
    dst.subject = subject == null ? null : subject.copy();
    dst.encounter = encounter == null ? null : encounter.copy();
    dst.authoredOn = authoredOn == null ? null : authoredOn.copy();
    dst.author = author == null ? null : author.copy();
    if (reasonCode != null) {
      dst.reasonCode = new ArrayList();
      for (CodeableConcept i : reasonCode)
        dst.reasonCode.add(i.copy());
    }
    ;
    if (reasonReference != null) {
      dst.reasonReference = new ArrayList();
      for (Reference i : reasonReference)
        dst.reasonReference.add(i.copy());
    }
    ;
    if (note != null) {
      dst.note = new ArrayList();
      for (Annotation i : note)
        dst.note.add(i.copy());
    }
    ;
    if (action != null) {
      dst.action = new ArrayList();
      for (RequestGroupActionComponent i : action)
        dst.action.add(i.copy());
    }
    ;
  }

  protected RequestGroup typedCopy() {
    return copy();
  }

  @Override
  public boolean equalsDeep(Base other_) {
    if (!super.equalsDeep(other_))
      return false;
    if (!(other_ instanceof RequestGroup))
      return false;
    RequestGroup o = (RequestGroup) other_;
    return compareDeep(identifier, o.identifier, true)
        && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
        && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(basedOn, o.basedOn, true)
        && compareDeep(replaces, o.replaces, true) && compareDeep(groupIdentifier, o.groupIdentifier, true)
        && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true)
        && compareDeep(priority, o.priority, true) && compareDeep(code, o.code, true)
        && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
        && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(author, o.author, true)
        && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true)
        && compareDeep(note, o.note, true) && compareDeep(action, o.action, true);
  }

  @Override
  public boolean equalsShallow(Base other_) {
    if (!super.equalsShallow(other_))
      return false;
    if (!(other_ instanceof RequestGroup))
      return false;
    RequestGroup o = (RequestGroup) other_;
    return compareValues(instantiatesCanonical, o.instantiatesCanonical, true)
        && compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(status, o.status, true)
        && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true)
        && compareValues(authoredOn, o.authoredOn, true);
  }

  public boolean isEmpty() {
    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical, instantiatesUri,
        basedOn, replaces, groupIdentifier, status, intent, priority, code, subject, encounter, authoredOn, author,
        reasonCode, reasonReference, note, action);
  }

  @Override
  public ResourceType getResourceType() {
    return ResourceType.RequestGroup;
  }

  /**
   * Search parameter: authored
   * 

* Description: The date the request group was authored
* Type: date
* Path: RequestGroup.authoredOn
*

*/ @SearchParamDefinition(name = "authored", path = "RequestGroup.authoredOn", description = "The date the request group was authored", type = "date") public static final String SP_AUTHORED = "authored"; /** * Fluent Client search parameter constant for authored *

* Description: The date the request group was authored
* Type: date
* Path: RequestGroup.authoredOn
*

*/ public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHORED = new ca.uhn.fhir.rest.gclient.DateClientParam( SP_AUTHORED); /** * Search parameter: identifier *

* Description: External identifiers for the request group
* Type: token
* Path: RequestGroup.identifier
*

*/ @SearchParamDefinition(name = "identifier", path = "RequestGroup.identifier", description = "External identifiers for the request group", type = "token") public static final String SP_IDENTIFIER = "identifier"; /** * Fluent Client search parameter constant for identifier *

* Description: External identifiers for the request group
* Type: token
* Path: RequestGroup.identifier
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_IDENTIFIER); /** * Search parameter: code *

* Description: The code of the request group
* Type: token
* Path: RequestGroup.code
*

*/ @SearchParamDefinition(name = "code", path = "RequestGroup.code", description = "The code of the request group", type = "token") public static final String SP_CODE = "code"; /** * Fluent Client search parameter constant for code *

* Description: The code of the request group
* Type: token
* Path: RequestGroup.code
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_CODE); /** * Search parameter: subject *

* Description: The subject that the request group is about
* Type: reference
* Path: RequestGroup.subject
*

*/ @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 }) public static final String SP_SUBJECT = "subject"; /** * Fluent Client search parameter constant for subject *

* Description: The subject that the request group is about
* Type: reference
* Path: RequestGroup.subject
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_SUBJECT); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "RequestGroup:subject". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include( "RequestGroup:subject").toLocked(); /** * Search parameter: author *

* Description: The author of the request group
* Type: reference
* Path: RequestGroup.author
*

*/ @SearchParamDefinition(name = "author", path = "RequestGroup.author", description = "The author of the request group", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device"), @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Device.class, Practitioner.class, PractitionerRole.class }) public static final String SP_AUTHOR = "author"; /** * Fluent Client search parameter constant for author *

* Description: The author of the request group
* Type: reference
* Path: RequestGroup.author
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_AUTHOR); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "RequestGroup:author". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include( "RequestGroup:author").toLocked(); /** * Search parameter: instantiates-canonical *

* Description: The FHIR-based definition from which the request group is * realized
* Type: reference
* Path: RequestGroup.instantiatesCanonical
*

*/ @SearchParamDefinition(name = "instantiates-canonical", path = "RequestGroup.instantiatesCanonical", description = "The FHIR-based definition from which the request group is realized", type = "reference") public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical"; /** * Fluent Client search parameter constant for * instantiates-canonical *

* Description: The FHIR-based definition from which the request group is * realized
* Type: reference
* Path: RequestGroup.instantiatesCanonical
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_INSTANTIATES_CANONICAL); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "RequestGroup:instantiates-canonical". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include( "RequestGroup:instantiates-canonical").toLocked(); /** * Search parameter: encounter *

* Description: The encounter the request group applies to
* Type: reference
* Path: RequestGroup.encounter
*

*/ @SearchParamDefinition(name = "encounter", path = "RequestGroup.encounter", description = "The encounter the request group applies to", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class }) public static final String SP_ENCOUNTER = "encounter"; /** * Fluent Client search parameter constant for encounter *

* Description: The encounter the request group applies to
* Type: reference
* Path: RequestGroup.encounter
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_ENCOUNTER); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "RequestGroup:encounter". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include( "RequestGroup:encounter").toLocked(); /** * Search parameter: priority *

* Description: The priority of the request group
* Type: token
* Path: RequestGroup.priority
*

*/ @SearchParamDefinition(name = "priority", path = "RequestGroup.priority", description = "The priority of the request group", type = "token") public static final String SP_PRIORITY = "priority"; /** * Fluent Client search parameter constant for priority *

* Description: The priority of the request group
* Type: token
* Path: RequestGroup.priority
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_PRIORITY); /** * Search parameter: intent *

* Description: The intent of the request group
* Type: token
* Path: RequestGroup.intent
*

*/ @SearchParamDefinition(name = "intent", path = "RequestGroup.intent", description = "The intent of the request group", type = "token") public static final String SP_INTENT = "intent"; /** * Fluent Client search parameter constant for intent *

* Description: The intent of the request group
* Type: token
* Path: RequestGroup.intent
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_INTENT); /** * Search parameter: participant *

* Description: The participant in the requests in the group
* Type: reference
* Path: RequestGroup.action.participant
*

*/ @SearchParamDefinition(name = "participant", path = "RequestGroup.action.participant", description = "The participant in the requests in the group", type = "reference", providesMembershipIn = { @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient"), @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner"), @ca.uhn.fhir.model.api.annotation.Compartment(name = "RelatedPerson") }, target = { Device.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class }) public static final String SP_PARTICIPANT = "participant"; /** * Fluent Client search parameter constant for participant *

* Description: The participant in the requests in the group
* Type: reference
* Path: RequestGroup.action.participant
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTICIPANT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_PARTICIPANT); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "RequestGroup:participant". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTICIPANT = new ca.uhn.fhir.model.api.Include( "RequestGroup:participant").toLocked(); /** * Search parameter: group-identifier *

* Description: The group identifier for the request group
* Type: token
* Path: RequestGroup.groupIdentifier
*

*/ @SearchParamDefinition(name = "group-identifier", path = "RequestGroup.groupIdentifier", description = "The group identifier for the request group", type = "token") public static final String SP_GROUP_IDENTIFIER = "group-identifier"; /** * Fluent Client search parameter constant for group-identifier *

* Description: The group identifier for the request group
* Type: token
* Path: RequestGroup.groupIdentifier
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam GROUP_IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_GROUP_IDENTIFIER); /** * Search parameter: patient *

* Description: The identity of a patient to search for request * groups
* Type: reference
* Path: RequestGroup.subject
*

*/ @SearchParamDefinition(name = "patient", path = "RequestGroup.subject.where(resolve() is Patient)", description = "The identity of a patient to search for request groups", type = "reference", target = { Patient.class }) public static final String SP_PATIENT = "patient"; /** * Fluent Client search parameter constant for patient *

* Description: The identity of a patient to search for request * groups
* Type: reference
* Path: RequestGroup.subject
*

*/ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam( SP_PATIENT); /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "RequestGroup:patient". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include( "RequestGroup:patient").toLocked(); /** * Search parameter: instantiates-uri *

* Description: The external definition from which the request group is * realized
* Type: uri
* Path: RequestGroup.instantiatesUri
*

*/ @SearchParamDefinition(name = "instantiates-uri", path = "RequestGroup.instantiatesUri", description = "The external definition from which the request group is realized", type = "uri") public static final String SP_INSTANTIATES_URI = "instantiates-uri"; /** * Fluent Client search parameter constant for instantiates-uri *

* Description: The external definition from which the request group is * realized
* Type: uri
* Path: RequestGroup.instantiatesUri
*

*/ public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam( SP_INSTANTIATES_URI); /** * Search parameter: status *

* Description: The status of the request group
* Type: token
* Path: RequestGroup.status
*

*/ @SearchParamDefinition(name = "status", path = "RequestGroup.status", description = "The status of the request group", type = "token") public static final String SP_STATUS = "status"; /** * Fluent Client search parameter constant for status *

* Description: The status of the request group
* Type: token
* Path: RequestGroup.status
*

*/ public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam( SP_STATUS); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy