Interface Variables


public interface Variables
Gives access to process execution variables. Includes factory methods for Target and Targets values.
  • Method Details

    • getBusinessKey

      String getBusinessKey()
      Returns:
      not null, business key of the current process instance
    • getCurrentActivityId

      String getCurrentActivityId()
      Returns:
      not null, id of the current activity
    • getProcessDefinitionId

      String getProcessDefinitionId()
      Returns:
      not null, id of the current process definition
    • getActivityInstanceId

      String getActivityInstanceId()
      Returns:
      not null, id of the current activity instance
    • setAlternativeBusinessKey

      void setAlternativeBusinessKey(String alternativeBusinessKey)
      Sets execution variable BpmnExecutionVariables.ALTERNATIVE_BUSINESS_KEY to the given alternativeBusinessKey
      Parameters:
      alternativeBusinessKey - may be null
      See Also:
    • getAlternativeBusinessKey

      default String getAlternativeBusinessKey()
      Returns:
      may be null
      See Also:
    • createTarget

      Target createTarget(String organizationIdentifierValue, String endpointIdentifierValue, String endpointAddress, String correlationKey)
      Creates a new Target object.

      A not null correlationKey should be used if return messages i.e. Task resources from multiple organizations with the same message-name are expected in a following multi instance message receive task or intermediate message catch event in a multi instance subprocess.
      Note: The correlationKey needs to be set as a BpmnExecutionVariables.CORRELATION_KEY variable in the message receive task or intermediate message catch event of a subprocess before incoming messages i.e. Task resources can be correlated. Within a BPMN file this can be accomplished by setting an input variable with name: BpmnExecutionVariables.CORRELATION_KEY, type:
      string or expression, and value: ${target.correlationKey}.

      A not null correlationKey should also be used when sending a message i.e. Task resource back to an organization waiting for multiple returns.

      Parameters:
      organizationIdentifierValue - not null
      endpointIdentifierValue - not null
      endpointAddress - not null
      correlationKey - not null if used for sending multiple messages and multiple messages with the same message-name are expected in return
      Returns:
      new Target object
      See Also:
    • createTarget

      default Target createTarget(String organizationIdentifierValue, String endpointIdentifierValue, String endpointAddress)
      Creates a new Target object. See createTarget(String, String, String, String) for sending a correlation-key for 1:n or n:1 relationships.
      Parameters:
      organizationIdentifierValue - not null
      endpointIdentifierValue - not null
      endpointAddress - not null
      Returns:
      new Target object
      See Also:
    • setTarget

      void setTarget(Target target) throws IllegalArgumentException
      Sets execution variable BpmnExecutionVariables.TARGET
      Parameters:
      target - may be null
      Throws:
      IllegalArgumentException - if the given target object is not supported, meaning the object was not created by this Variables implementation
      See Also:
    • getTarget

      Target getTarget()
      Retrieves execution variable BpmnExecutionVariables.TARGET
      Returns:
      Execution variable BpmnExecutionVariables.TARGET, may be null
    • createTargets

      default Targets createTargets(Target... targets)
      Creates a new target list. Use ${targets.entries} as a multi instance collection and target as the element variable to loop over this list in a multi instance task or subprocess.
      Parameters:
      targets - Target objects to incorporate into the created list
      Returns:
      a new target list
      Throws:
      IllegalArgumentException - if one of the given target objects is not supported, meaning the object was not created by this Variables implementation
      See Also:
    • createTargets

      Targets createTargets(List<? extends Target> targets)
      Creates a new target list. Use ${targets.entries} as a multi instance collection and target as the element variable to loop over this list in a multi instance task or subprocess.
      Parameters:
      targets - Target objects to incorporate into the created list, may be null
      Returns:
      a new target list
      Throws:
      IllegalArgumentException - if one of the given target objects is not supported, meaning the object was not created by this Variables implementation
      See Also:
    • setTargets

      void setTargets(Targets targets)
      Sets execution variable BpmnExecutionVariables.TARGETS. Use ${targets.entries} as a multi instance collection and
      Parameters:
      targets - may be null
      See Also:
    • getTargets

      Targets getTargets()
      Retrieves execution variable BpmnExecutionVariables.TARGETS
      Returns:
      Execution variable BpmnExecutionVariables.TARGETS, may be null
      See Also:
    • setFhirResourceList

      void setFhirResourceList(String variableName, List<? extends org.hl7.fhir.r4.model.Resource> resources)
      Sets execution variable with the given variableName to the given FHIR Resource list
      Parameters:
      variableName - not null
      resources -
    • getFhirResourceList

      <R extends org.hl7.fhir.r4.model.Resource> List<R> getFhirResourceList(String variableName)
      Retrieves FHIR Resource list execution variable with the given variableName
      Type Parameters:
      R - FHIR resource type
      Parameters:
      variableName - not null
      Returns:
      list of FHIR resources from execution variables for the given variableName, may be null
    • setFhirResource

      void setFhirResource(String variableName, org.hl7.fhir.r4.model.Resource resource)
      Sets execution variable with the given variableName to the given FHIR Resource
      Parameters:
      variableName - not null
      resource - may be null
    • getFhirResource

      <R extends org.hl7.fhir.r4.model.Resource> R getFhirResource(String variableName)
      Retrieves FHIR Resource execution variable with the given variableName
      Type Parameters:
      R - FHIR resource type
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
    • getStartTask

      org.hl7.fhir.r4.model.Task getStartTask()
      Returns the Task associated with the message start event of the process.
      Returns:
      Task that started the process instance, not null
      See Also:
    • getLatestTask

      org.hl7.fhir.r4.model.Task getLatestTask()
      Returns the latest Task received by this process or subprocess via a intermediate message catch event or message receive task.
      Returns:
      Last received Task of the current process or subprocess, not null
      See Also:
    • getTasks

      List<org.hl7.fhir.r4.model.Task> getTasks()
      Returns:
      All Task resources received
      See Also:
    • getCurrentTasks

      List<org.hl7.fhir.r4.model.Task> getCurrentTasks()
      Returns:
      All Task resources received by the current process or subprocess
      See Also:
    • updateTask

      void updateTask(org.hl7.fhir.r4.model.Task task)
      Does nothing if the given task is null. Forces an update to the Task list variable used internally to track all received Task resources if the given task object is already part of this list.
      Parameters:
      task - may be null
      See Also:
    • getLatestReceivedQuestionnaireResponse

      org.hl7.fhir.r4.model.QuestionnaireResponse getLatestReceivedQuestionnaireResponse()
      Returns:
      Last received QuestionnaireResponse, null if nothing received yet
    • setJsonVariable

      void setJsonVariable(String variableName, Object value)
      Uses ObjectMapper to serialize the given value into json. Value class needs annotations like JsonCreator, JsonProperty and JsonGetter
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getVariable

      <T> T getVariable(String variableName)
      Retrieves execution variable with the given variableName
      Type Parameters:
      T - target variable type
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the returned variable can not be cast to <T>
      See Also:
    • setInteger

      void setInteger(String variableName, Integer value)
      Sets execution variable with the given variableName to the given Integer
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getInteger

      default Integer getInteger(String variableName)
      Retrieves Integer execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not an Integer
      See Also:
    • setString

      void setString(String variableName, String value)
      Sets execution variable with the given variableName to the given String
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getString

      default String getString(String variableName)
      Retrieves String execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a String
      See Also:
    • setBoolean

      void setBoolean(String variableName, Boolean value)
      Sets execution variable with the given variableName to the given Boolean
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getBoolean

      default Boolean getBoolean(String variableName)
      Retrieves Boolean execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Boolean
      See Also:
    • setByteArray

      void setByteArray(String variableName, byte[] value)
      Sets execution variable with the given variableName to the given byte[]
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getByteArray

      default byte[] getByteArray(String variableName)
      Retrieves byte[] execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a byte[]
      See Also:
    • setDate

      void setDate(String variableName, Date value)
      Sets execution variable with the given variableName to the given Date
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getDate

      default Date getDate(String variableName)
      Retrieves Date execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Date
      See Also:
    • setLong

      void setLong(String variableName, Long value)
      Sets execution variable with the given variableName to the given Long
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getLong

      default Long getLong(String variableName)
      Retrieves Long execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Long
      See Also:
    • setShort

      void setShort(String variableName, Short value)
      Sets execution variable with the given variableName to the given Short
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getShort

      default Short getShort(String variableName)
      Retrieves Short execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Short
      See Also:
    • setDouble

      void setDouble(String variableName, Double value)
      Sets execution variable with the given variableName to the given Double
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getDouble

      default Double getDouble(String variableName)
      Retrieves Double execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Double
      See Also:
    • setNumber

      void setNumber(String variableName, Number value)
      Sets execution variable with the given variableName to the given Number
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getNumber

      default Number getNumber(String variableName)
      Retrieves Number execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Number
      See Also:
    • setFile

      void setFile(String variableName, File value)
      Sets execution variable with the given variableName to the given File
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getFile

      default File getFile(String variableName)
      Retrieves File execution variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a File
      See Also:
    • setIntegerLocal

      void setIntegerLocal(String variableName, Integer value)
      Sets local variable with the given variableName to the given Integer
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getIntegerLocal

      default Integer getIntegerLocal(String variableName)
      Retrieves Integer local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not an Integer
      See Also:
    • setStringLocal

      void setStringLocal(String variableName, String value)
      Sets local variable with the given variableName to the given String
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getStringLocal

      default String getStringLocal(String variableName)
      Retrieves String local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a String
      See Also:
    • setBooleanLocal

      void setBooleanLocal(String variableName, Boolean value)
      Sets local variable with the given variableName to the given Boolean
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getBooleanLocal

      default Boolean getBooleanLocal(String variableName)
      Retrieves Boolean local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Boolean
      See Also:
    • setByteArrayLocal

      void setByteArrayLocal(String variableName, byte[] value)
      Sets local variable with the given variableName to the given byte[]
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getByteArrayLocal

      default byte[] getByteArrayLocal(String variableName)
      Retrieves byte[] local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a byte[]
      See Also:
    • setDateLocal

      void setDateLocal(String variableName, Date value)
      Sets local variable with the given variableName to the given Date
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getDateLocal

      default Date getDateLocal(String variableName)
      Retrieves Date local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Date
      See Also:
    • setLongLocal

      void setLongLocal(String variableName, Long value)
      Sets local variable with the given variableName to the given Long
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getLongLocal

      default Long getLongLocal(String variableName)
      Retrieves Long local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Long
      See Also:
    • setShortLocal

      void setShortLocal(String variableName, Short value)
      Sets local variable with the given variableName to the given Short
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getShortLocal

      default Short getShortLocal(String variableName)
      Retrieves Short local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Short
      See Also:
    • setDoubleLocal

      void setDoubleLocal(String variableName, Double value)
      Sets local variable with the given variableName to the given Double
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getDoubleLocal

      default Double getDoubleLocal(String variableName)
      Retrieves Double local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Double
      See Also:
    • setNumberLocal

      void setNumberLocal(String variableName, Number value)
      Sets local variable with the given variableName to the given Number
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getNumberLocal

      default Number getNumberLocal(String variableName)
      Retrieves Number local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a Number
      See Also:
    • setFileLocal

      void setFileLocal(String variableName, File value)
      Sets local variable with the given variableName to the given File
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getFileLocal

      default File getFileLocal(String variableName)
      Retrieves File local variable with the given variableName
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null
      Throws:
      ClassCastException - if the stored value is not a File
      See Also:
    • setJsonVariableLocal

      void setJsonVariableLocal(String variableName, Object value)
      Uses ObjectMapper to serialize the given value into json. Value class needs annotations like JsonCreator, JsonProperty and JsonGetter
      Parameters:
      variableName - not null
      value - may be null
      See Also:
    • getVariableLocal

      <T> T getVariableLocal(String variableName)
      Retrieves local variable with the given variableName
      Type Parameters:
      T - target variable type
      Parameters:
      variableName - not null
      Returns:
      value from local variables for the given variableName, may be null
      Throws:
      ClassCastException - if the returned variable can not be cast to <T>
      See Also:
    • setFhirResourceListLocal

      void setFhirResourceListLocal(String variableName, List<? extends org.hl7.fhir.r4.model.Resource> resources)
      Sets local variable with the given variableName to the given FHIR Resource list
      Parameters:
      variableName - not null
      resources -
    • getFhirResourceListLocal

      <R extends org.hl7.fhir.r4.model.Resource> List<R> getFhirResourceListLocal(String variableName)
      Retrieves FHIR Resource list local variable with the given variableName
      Type Parameters:
      R - FHIR resource type
      Parameters:
      variableName - not null
      Returns:
      list of FHIR resources from execution variables for the given variableName, may be null
    • setFhirResourceLocal

      void setFhirResourceLocal(String variableName, org.hl7.fhir.r4.model.Resource resource)
      Sets local variable with the given variableName to the given FHIR Resource
      Parameters:
      variableName - not null
      resource - may be null
    • getFhirResourceLocal

      <R extends org.hl7.fhir.r4.model.Resource> R getFhirResourceLocal(String variableName)
      Retrieves FHIR Resource local variable with the given variableName
      Type Parameters:
      R - FHIR resource type
      Parameters:
      variableName - not null
      Returns:
      value from execution variables for the given variableName, may be null