Interface ProcessInstanceBuilder


  • public interface ProcessInstanceBuilder
    Helper for starting new ProcessInstance. An instance can be obtained through RuntimeService.createProcessInstanceBuilder(). processDefinitionId or processDefinitionKey should be set before calling start() to start a process instance.
    Author:
    Bassam Al-Sarori, Joram Barrez
    • Method Detail

      • processDefinitionKey

        ProcessInstanceBuilder processDefinitionKey​(String processDefinitionKey)
        Set the key of the process definition, latest version of the process definition with the given key. If processDefinitionId was set this will be ignored
      • processDefinitionParentDeploymentId

        ProcessInstanceBuilder processDefinitionParentDeploymentId​(String parentDeploymentId)
        When looking up for a process definition by key it would first lookup for a process definition within the given parent deployment. Then it would fallback to the latest process definition with the given key.

        This is typically needed when the ProcessInstanceBuilder is called for example from the case engine to start a process instance and it needs to look up the process definition in the same deployment as the case.

      • messageName

        ProcessInstanceBuilder messageName​(String messageName)
        Set the message name that needs to be used to look up the process definition that needs to be used to start the process instance.
      • stageInstanceId

        ProcessInstanceBuilder stageInstanceId​(String stageInstanceId)
        Set the optional instance id of the stage this process instance belongs to, if it runs in the context of a CMMN case.
      • overrideProcessDefinitionTenantId

        ProcessInstanceBuilder overrideProcessDefinitionTenantId​(String tenantId)
        Indicator to override the tenant id of the process definition with the provided value. The tenantId to lookup the process definition should still be provided if needed.
      • predefineProcessInstanceId

        ProcessInstanceBuilder predefineProcessInstanceId​(String processInstanceId)
        When starting a process instance from the CMMN engine process task, the process instance id needs to be known beforehand to store entity links and callback references before the process instance is started.
      • fallbackToDefaultTenant

        ProcessInstanceBuilder fallbackToDefaultTenant()
        Use default tenant as a fallback in the case when process definition was not found by key and tenant id
      • start

        ProcessInstance start()
        Start the process instance
        Throws:
        org.flowable.common.engine.api.FlowableIllegalArgumentException - if processDefinitionKey and processDefinitionId are null
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when no process definition is deployed with the given processDefinitionKey or processDefinitionId
      • startAsync

        ProcessInstance startAsync()
        Start the process instance asynchronously
        Throws:
        org.flowable.common.engine.api.FlowableIllegalArgumentException - if processDefinitionKey and processDefinitionId are null
        org.flowable.common.engine.api.FlowableObjectNotFoundException - when no process definition is deployed with the given processDefinitionKey or processDefinitionId