Class RuntimeServiceImpl

  • All Implemented Interfaces:
    RuntimeService

    public class RuntimeServiceImpl
    extends org.flowable.common.engine.impl.service.CommonEngineServiceImpl<org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl>
    implements RuntimeService
    Author:
    Tom Baeyens, Daniel Meyer
    • Constructor Detail

      • RuntimeServiceImpl

        public RuntimeServiceImpl​(org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl configuration)
    • Method Detail

      • startProcessInstanceByKey

        public ProcessInstance startProcessInstanceByKey​(String processDefinitionKey)
        Description copied from interface: RuntimeService
        Starts a new process instance in the latest version of the process definition with the given key.
        Specified by:
        startProcessInstanceByKey in interface RuntimeService
        Parameters:
        processDefinitionKey - key of process definition, cannot be null.
      • startProcessInstanceByKey

        public ProcessInstance startProcessInstanceByKey​(String processDefinitionKey,
                                                         String businessKey)
        Description copied from interface: RuntimeService
        Starts a new process instance in the latest version of the process definition with the given key.

        A business key can be provided to associate the process instance with a certain identifier that has a clear business meaning. For example in an order process, the business key could be an order id. This business key can then be used to easily look up that process instance , see ProcessInstanceQuery.processInstanceBusinessKey(String). Providing such a business key is definitely a best practice.

        Specified by:
        startProcessInstanceByKey in interface RuntimeService
        Parameters:
        processDefinitionKey - key of process definition, cannot be null.
        businessKey - a key that identifies the process instance and can be used to retrieve the process instance later via the query API.
      • startProcessInstanceByKey

        public ProcessInstance startProcessInstanceByKey​(String processDefinitionKey,
                                                         Map<String,​Object> variables)
        Description copied from interface: RuntimeService
        Starts a new process instance in the latest version of the process definition with the given key
        Specified by:
        startProcessInstanceByKey in interface RuntimeService
        Parameters:
        processDefinitionKey - key of process definition, cannot be null.
        variables - the variables to pass, can be null.
      • startProcessInstanceByKey

        public ProcessInstance startProcessInstanceByKey​(String processDefinitionKey,
                                                         String businessKey,
                                                         Map<String,​Object> variables)
        Description copied from interface: RuntimeService
        Starts a new process instance in the latest version of the process definition with the given key.

        A business key can be provided to associate the process instance with a certain identifier that has a clear business meaning. For example in an order process, the business key could be an order id. This business key can then be used to easily look up that process instance , see ProcessInstanceQuery.processInstanceBusinessKey(String). Providing such a business key is definitely a best practice.

        Specified by:
        startProcessInstanceByKey in interface RuntimeService
        Parameters:
        processDefinitionKey - key of process definition, cannot be null.
        businessKey - a key that identifies the process instance and can be used to retrieve the process instance later via the query API.
        variables - the variables to pass, can be null.
      • startProcessInstanceById

        public ProcessInstance startProcessInstanceById​(String processDefinitionId)
        Description copied from interface: RuntimeService
        Starts a new process instance in the exactly specified version of the process definition with the given id.
        Specified by:
        startProcessInstanceById in interface RuntimeService
        Parameters:
        processDefinitionId - the id of the process definition, cannot be null.
      • startProcessInstanceById

        public ProcessInstance startProcessInstanceById​(String processDefinitionId,
                                                        String businessKey)
        Description copied from interface: RuntimeService
        Starts a new process instance in the exactly specified version of the process definition with the given id.

        A business key can be provided to associate the process instance with a certain identifier that has a clear business meaning. For example in an order process, the business key could be an order id. This business key can then be used to easily look up that process instance , see ProcessInstanceQuery.processInstanceBusinessKey(String). Providing such a business key is definitely a best practice.

        Specified by:
        startProcessInstanceById in interface RuntimeService
        Parameters:
        processDefinitionId - the id of the process definition, cannot be null.
        businessKey - a key that identifies the process instance and can be used to retrieve the process instance later via the query API.
      • startProcessInstanceById

        public ProcessInstance startProcessInstanceById​(String processDefinitionId,
                                                        Map<String,​Object> variables)
        Description copied from interface: RuntimeService
        Starts a new process instance in the exactly specified version of the process definition with the given id.
        Specified by:
        startProcessInstanceById in interface RuntimeService
        Parameters:
        processDefinitionId - the id of the process definition, cannot be null.
        variables - variables to be passed, can be null
      • startProcessInstanceById

        public ProcessInstance startProcessInstanceById​(String processDefinitionId,
                                                        String businessKey,
                                                        Map<String,​Object> variables)
        Description copied from interface: RuntimeService
        Starts a new process instance in the exactly specified version of the process definition with the given id.

        A business key can be provided to associate the process instance with a certain identifier that has a clear business meaning. For example in an order process, the business key could be an order id. This business key can then be used to easily look up that process instance , see ProcessInstanceQuery.processInstanceBusinessKey(String). Providing such a business key is definitely a best practice.

        Specified by:
        startProcessInstanceById in interface RuntimeService
        Parameters:
        processDefinitionId - the id of the process definition, cannot be null.
        variables - variables to be passed, can be null
      • startProcessInstanceWithForm

        public ProcessInstance startProcessInstanceWithForm​(String processDefinitionId,
                                                            String outcome,
                                                            Map<String,​Object> variables,
                                                            String processInstanceName)
        Description copied from interface: RuntimeService
        Starts a new process instance in the exactly specified version of the process definition with the given id.

        A business key can be provided to associate the process instance with a certain identifier that has a clear business meaning. For example in an order process, the business key could be an order id. This business key can then be used to easily look up that process instance , see ProcessInstanceQuery.processInstanceBusinessKey(String). Providing such a business key is definitely a best practice.

        Only use this method when a form definition is attached to the start event of the provided process definition. This will expect the Flowable Form Engine to be enabled. A new form instance will be created after successfully starting a new process instance.

        Specified by:
        startProcessInstanceWithForm in interface RuntimeService
        Parameters:
        processDefinitionId - the id of the process definition, cannot be null.
        outcome - the form outcome of the start form, can be null.
        variables - variables to be passed, can be null
        processInstanceName - the name of the process instance to be started, can be null.
      • getStartFormModel

        public org.flowable.form.api.FormInfo getStartFormModel​(String processDefinitionId,
                                                                String processInstanceId)
        Description copied from interface: RuntimeService
        Gets a Form model instance of the start form of a specific process definition or process instance
        Specified by:
        getStartFormModel in interface RuntimeService
        Parameters:
        processDefinitionId - id of process definition for which the start form should be retrieved.
        processInstanceId - id of process instance for which the start form should be retrieved.
      • deleteProcessInstance

        public void deleteProcessInstance​(String processInstanceId,
                                          String deleteReason)
        Description copied from interface: RuntimeService
        Delete an existing runtime process instance.
        Specified by:
        deleteProcessInstance in interface RuntimeService
        Parameters:
        processInstanceId - id of process instance to delete, cannot be null.
        deleteReason - reason for deleting, can be null.
      • createEventSubscriptionQuery

        public org.flowable.eventsubscription.api.EventSubscriptionQuery createEventSubscriptionQuery()
        Description copied from interface: RuntimeService
        Creates a new EventSubscriptionQuery instance, that can be used to query the event subscriptions.
        Specified by:
        createEventSubscriptionQuery in interface RuntimeService
      • updateBusinessKey

        public void updateBusinessKey​(String processInstanceId,
                                      String businessKey)
        Description copied from interface: RuntimeService
        Updates the business key for the provided process instance
        Specified by:
        updateBusinessKey in interface RuntimeService
        Parameters:
        processInstanceId - id of the process instance to set the business key, cannot be null
        businessKey - new businessKey value
      • getVariables

        public Map<String,​Object> getVariables​(String executionId)
        Description copied from interface: RuntimeService
        All variables visible from the given execution scope (including parent scopes).
        Specified by:
        getVariables in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        Returns:
        the variables or an empty map if no such variables are found.
      • getVariableInstances

        public Map<String,​org.flowable.variable.api.persistence.entity.VariableInstance> getVariableInstances​(String executionId)
        Description copied from interface: RuntimeService
        All variables visible from the given execution scope (including parent scopes).
        Specified by:
        getVariableInstances in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        Returns:
        the variable instances or an empty map if no such variables are found.
      • getVariableInstancesByExecutionIds

        public List<org.flowable.variable.api.persistence.entity.VariableInstance> getVariableInstancesByExecutionIds​(Set<String> executionIds)
        Description copied from interface: RuntimeService
        All variables visible from the given execution scope (including parent scopes).
        Specified by:
        getVariableInstancesByExecutionIds in interface RuntimeService
        Parameters:
        executionIds - ids of execution, cannot be null.
        Returns:
        the variables.
      • getVariablesLocal

        public Map<String,​Object> getVariablesLocal​(String executionId)
        Description copied from interface: RuntimeService
        All variable values that are defined in the execution scope, without taking outer scopes into account. If you have many task local variables and you only need a few, consider using RuntimeService.getVariablesLocal(String, Collection) for better performance.
        Specified by:
        getVariablesLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        Returns:
        the variables or an empty map if no such variables are found.
      • getVariableInstancesLocal

        public Map<String,​org.flowable.variable.api.persistence.entity.VariableInstance> getVariableInstancesLocal​(String executionId)
        Description copied from interface: RuntimeService
        All variable values that are defined in the execution scope, without taking outer scopes into account. If you have many task local variables and you only need a few, consider using RuntimeService.getVariableInstancesLocal(String, Collection) for better performance.
        Specified by:
        getVariableInstancesLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        Returns:
        the variables or an empty map if no such variables are found.
      • getVariables

        public Map<String,​Object> getVariables​(String executionId,
                                                     Collection<String> variableNames)
        Description copied from interface: RuntimeService
        The variable values for all given variableNames, takes all variables into account which are visible from the given execution scope (including parent scopes).
        Specified by:
        getVariables in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        variableNames - the collection of variable names that should be retrieved.
        Returns:
        the variables or an empty map if no such variables are found.
      • getVariableInstances

        public Map<String,​org.flowable.variable.api.persistence.entity.VariableInstance> getVariableInstances​(String executionId,
                                                                                                                    Collection<String> variableNames)
        Description copied from interface: RuntimeService
        The variable values for all given variableNames, takes all variables into account which are visible from the given execution scope (including parent scopes).
        Specified by:
        getVariableInstances in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        variableNames - the collection of variable names that should be retrieved.
        Returns:
        the variables or an empty map if no such variables are found.
      • getVariablesLocal

        public Map<String,​Object> getVariablesLocal​(String executionId,
                                                          Collection<String> variableNames)
        Description copied from interface: RuntimeService
        The variable values for the given variableNames only taking the given execution scope into account, not looking in outer scopes.
        Specified by:
        getVariablesLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        variableNames - the collection of variable names that should be retrieved.
        Returns:
        the variables or an empty map if no such variables are found.
      • getVariableInstancesLocal

        public Map<String,​org.flowable.variable.api.persistence.entity.VariableInstance> getVariableInstancesLocal​(String executionId,
                                                                                                                         Collection<String> variableNames)
        Description copied from interface: RuntimeService
        The variable values for the given variableNames only taking the given execution scope into account, not looking in outer scopes.
        Specified by:
        getVariableInstancesLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        variableNames - the collection of variable names that should be retrieved.
        Returns:
        the variables or an empty map if no such variables are found.
      • getVariable

        public Object getVariable​(String executionId,
                                  String variableName)
        Description copied from interface: RuntimeService
        The variable value. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no variable value is found with the given name or when the value is set to null.
        Specified by:
        getVariable in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        variableName - name of variable, cannot be null.
        Returns:
        the variable value or null if the variable is undefined or the value of the variable is null.
      • getVariableInstance

        public org.flowable.variable.api.persistence.entity.VariableInstance getVariableInstance​(String executionId,
                                                                                                 String variableName)
        Description copied from interface: RuntimeService
        The variable. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no variable value is found with the given name or when the value is set to null.
        Specified by:
        getVariableInstance in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        variableName - name of variable, cannot be null.
        Returns:
        the variable or null if the variable is undefined.
      • getVariable

        public <T> T getVariable​(String executionId,
                                 String variableName,
                                 Class<T> variableClass)
        Description copied from interface: RuntimeService
        The variable value. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no variable value is found with the given name or when the value is set to null. Throws ClassCastException when cannot cast variable to given class
        Specified by:
        getVariable in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        variableName - name of variable, cannot be null.
        variableClass - name of variable, cannot be null.
        Returns:
        the variable value or null if the variable is undefined or the value of the variable is null.
      • hasVariable

        public boolean hasVariable​(String executionId,
                                   String variableName)
        Description copied from interface: RuntimeService
        Check whether or not this execution has variable set with the given name, Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes).
        Specified by:
        hasVariable in interface RuntimeService
      • getVariableLocal

        public Object getVariableLocal​(String executionId,
                                       String variableName)
        Description copied from interface: RuntimeService
        The variable value for an execution. Returns the value when the variable is set for the execution (and not searching parent scopes). Returns null when no variable value is found with the given name or when the value is set to null.
        Specified by:
        getVariableLocal in interface RuntimeService
      • getVariableInstanceLocal

        public org.flowable.variable.api.persistence.entity.VariableInstance getVariableInstanceLocal​(String executionId,
                                                                                                      String variableName)
        Description copied from interface: RuntimeService
        The variable for an execution. Returns the variable when it is set for the execution (and not searching parent scopes). Returns null when no variable is found with the given name or when the value is set to null.
        Specified by:
        getVariableInstanceLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        variableName - name of variable, cannot be null.
        Returns:
        the variable or null if the variable is undefined.
      • getVariableLocal

        public <T> T getVariableLocal​(String executionId,
                                      String variableName,
                                      Class<T> variableClass)
        Description copied from interface: RuntimeService
        The variable value for an execution. Returns the value casted to given class when the variable is set for the execution (and not searching parent scopes). Returns null when no variable value is found with the given name or when the value is set to null.
        Specified by:
        getVariableLocal in interface RuntimeService
      • hasVariableLocal

        public boolean hasVariableLocal​(String executionId,
                                        String variableName)
        Description copied from interface: RuntimeService
        Check whether or not this execution has a local variable set with the given name.
        Specified by:
        hasVariableLocal in interface RuntimeService
      • setVariable

        public void setVariable​(String executionId,
                                String variableName,
                                Object value)
        Description copied from interface: RuntimeService
        Update or create a variable for an execution.

        The variable is set according to the algorithm as documented for VariableScope.setVariable(String, Object).

        Specified by:
        setVariable in interface RuntimeService
        Parameters:
        executionId - id of execution to set variable in, cannot be null.
        variableName - name of variable to set, cannot be null.
        value - value to set. When null is passed, the variable is not removed, only it's value will be set to null.
        See Also:
        VariableScope.setVariable(String, Object)
      • setVariableLocal

        public void setVariableLocal​(String executionId,
                                     String variableName,
                                     Object value)
        Description copied from interface: RuntimeService
        Update or create a variable for an execution (not considering parent scopes). If the variable is not already existing, it will be created in the given execution.
        Specified by:
        setVariableLocal in interface RuntimeService
        Parameters:
        executionId - id of execution to set variable in, cannot be null.
        variableName - name of variable to set, cannot be null.
        value - value to set. When null is passed, the variable is not removed, only it's value will be set to null.
      • setVariables

        public void setVariables​(String executionId,
                                 Map<String,​?> variables)
        Description copied from interface: RuntimeService
        Update or create given variables for an execution (including parent scopes).

        Variables are set according to the algorithm as documented for VariableScope.setVariables(Map), applied separately to each variable.

        Specified by:
        setVariables in interface RuntimeService
        Parameters:
        executionId - id of the execution, cannot be null.
        variables - map containing name (key) and value of variables, can be null.
        See Also:
        VariableScope.setVariables(Map)
      • setVariablesLocal

        public void setVariablesLocal​(String executionId,
                                      Map<String,​?> variables)
        Description copied from interface: RuntimeService
        Update or create given variables for an execution (not considering parent scopes). If the variables are not already existing, it will be created in the given execution.
        Specified by:
        setVariablesLocal in interface RuntimeService
        Parameters:
        executionId - id of the execution, cannot be null.
        variables - map containing name (key) and value of variables, can be null.
      • removeVariable

        public void removeVariable​(String executionId,
                                   String variableName)
        Description copied from interface: RuntimeService
        Removes a variable for an execution.
        Specified by:
        removeVariable in interface RuntimeService
        Parameters:
        executionId - id of execution to remove variable in.
        variableName - name of variable to remove.
      • removeVariableLocal

        public void removeVariableLocal​(String executionId,
                                        String variableName)
        Description copied from interface: RuntimeService
        Removes a variable for an execution (not considering parent scopes).
        Specified by:
        removeVariableLocal in interface RuntimeService
        Parameters:
        executionId - id of execution to remove variable in.
        variableName - name of variable to remove.
      • removeVariables

        public void removeVariables​(String executionId,
                                    Collection<String> variableNames)
        Description copied from interface: RuntimeService
        Removes variables for an execution.
        Specified by:
        removeVariables in interface RuntimeService
        Parameters:
        executionId - id of execution to remove variable in.
        variableNames - collection containing name of variables to remove.
      • removeVariablesLocal

        public void removeVariablesLocal​(String executionId,
                                         Collection<String> variableNames)
        Description copied from interface: RuntimeService
        Remove variables for an execution (not considering parent scopes).
        Specified by:
        removeVariablesLocal in interface RuntimeService
        Parameters:
        executionId - id of execution to remove variable in.
        variableNames - collection containing name of variables to remove.
      • getDataObjects

        public Map<String,​DataObject> getDataObjects​(String executionId)
        Description copied from interface: RuntimeService
        All DataObjects visible from the given execution scope (including parent scopes).
        Specified by:
        getDataObjects in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        Returns:
        the DataObjects or an empty map if no such variables are found.
      • getDataObjects

        public Map<String,​DataObject> getDataObjects​(String executionId,
                                                           String locale,
                                                           boolean withLocalizationFallback)
        Description copied from interface: RuntimeService
        All DataObjects visible from the given execution scope (including parent scopes).
        Specified by:
        getDataObjects in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        locale - locale the DataObject name and description should be returned in (if available).
        withLocalizationFallback - When true localization will fallback to more general locales if the specified locale is not found.
        Returns:
        the DataObjects or an empty map if no DataObjects are found.
      • getDataObjectsLocal

        public Map<String,​DataObject> getDataObjectsLocal​(String executionId,
                                                                String locale,
                                                                boolean withLocalizationFallback)
        Description copied from interface: RuntimeService
        All DataObject values that are defined in the execution scope, without taking outer scopes into account. If you have many local DataObjects and you only need a few, consider using RuntimeService.getDataObjectsLocal(String, Collection) for better performance.
        Specified by:
        getDataObjectsLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        locale - locale the DataObject name and description should be returned in (if available).
        withLocalizationFallback - When true localization will fallback to more general locales if the specified locale is not found.
        Returns:
        the DataObjects or an empty map if no such variables are found.
      • getDataObjects

        public Map<String,​DataObject> getDataObjects​(String executionId,
                                                           Collection<String> dataObjectNames)
        Description copied from interface: RuntimeService
        The DataObjects for all given dataObjectNames, takes all dataObjects into account which are visible from the given execution scope (including parent scopes).
        Specified by:
        getDataObjects in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        dataObjectNames - the collection of DataObject names that should be retrieved.
        Returns:
        the DataObject or an empty map if no DataObjects are found.
      • getDataObjects

        public Map<String,​DataObject> getDataObjects​(String executionId,
                                                           Collection<String> dataObjectNames,
                                                           String locale,
                                                           boolean withLocalizationFallback)
        Description copied from interface: RuntimeService
        The DataObjects for all given dataObjectNames, takes all dataObjects into account which are visible from the given execution scope (including parent scopes).
        Specified by:
        getDataObjects in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        dataObjectNames - the collection of DataObject names that should be retrieved.
        locale - locale the DataObject name and description should be returned in (if available).
        withLocalizationFallback - When true localization will fallback to more general locales if the specified locale is not found.
        Returns:
        the DataObjects or an empty map if no such dataObjects are found.
      • getDataObjectsLocal

        public Map<String,​DataObject> getDataObjectsLocal​(String executionId,
                                                                Collection<String> dataObjects)
        Description copied from interface: RuntimeService
        The DataObjects for the given dataObjectNames only taking the given execution scope into account, not looking in outer scopes.
        Specified by:
        getDataObjectsLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        dataObjects - the collection of DataObject names that should be retrieved.
        Returns:
        the DataObjects or an empty map if no DataObjects are found.
      • getDataObjectsLocal

        public Map<String,​DataObject> getDataObjectsLocal​(String executionId,
                                                                Collection<String> dataObjectNames,
                                                                String locale,
                                                                boolean withLocalizationFallback)
        Description copied from interface: RuntimeService
        The DataObjects for the given dataObjectNames only taking the given execution scope into account, not looking in outer scopes.
        Specified by:
        getDataObjectsLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        dataObjectNames - the collection of DataObject names that should be retrieved.
        locale - locale the DataObject name and description should be returned in (if available).
        withLocalizationFallback - When true localization will fallback to more general locales if the specified locale is not found.
        Returns:
        the DataObjects or an empty map if no DataObjects are found.
      • getDataObject

        public DataObject getDataObject​(String executionId,
                                        String dataObject)
        Description copied from interface: RuntimeService
        The DataObject. Searching for the DataObject is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no DataObject value is found with the given name or when the value is set to null.
        Specified by:
        getDataObject in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        dataObject - name of DataObject, cannot be null.
        Returns:
        the DataObject or null if the variable is undefined.
      • getDataObject

        public DataObject getDataObject​(String executionId,
                                        String dataObjectName,
                                        String locale,
                                        boolean withLocalizationFallback)
        Description copied from interface: RuntimeService
        The DataObject. Searching for the DataObject is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no DataObject value is found with the given name or when the value is set to null.
        Specified by:
        getDataObject in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        dataObjectName - name of DataObject, cannot be null.
        locale - locale the DataObject name and description should be returned in (if available).
        withLocalizationFallback - When true localization will fallback to more general locales including the default locale of the JVM if the specified locale is not found.
        Returns:
        the DataObject or null if the DataObject is undefined.
      • getDataObjectLocal

        public DataObject getDataObjectLocal​(String executionId,
                                             String dataObjectName)
        Description copied from interface: RuntimeService
        The DataObject for an execution. Returns the DataObject when it is set for the execution (and not searching parent scopes). Returns null when no DataObject is found with the given name.
        Specified by:
        getDataObjectLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        dataObjectName - name of DataObject, cannot be null.
        Returns:
        the DataObject or null if the DataObject is undefined.
      • getDataObjectLocal

        public DataObject getDataObjectLocal​(String executionId,
                                             String dataObjectName,
                                             String locale,
                                             boolean withLocalizationFallback)
        Description copied from interface: RuntimeService
        The DataObject for an execution. Returns the DataObject when it is set for the execution (and not searching parent scopes). Returns null when no DataObject is found with the given name.
        Specified by:
        getDataObjectLocal in interface RuntimeService
        Parameters:
        executionId - id of execution, cannot be null.
        dataObjectName - name of DataObject, cannot be null.
        locale - locale the DataObject name and description should be returned in (if available).
        withLocalizationFallback - When true localization will fallback to more general locales if the specified locale is not found.
        Returns:
        the DataObject or null if the DataObject is undefined.
      • signal

        public void signal​(String executionId)
      • trigger

        public void trigger​(String executionId)
        Description copied from interface: RuntimeService
        Sends an external trigger to an activity instance that is waiting inside the given execution.
        Specified by:
        trigger in interface RuntimeService
        Parameters:
        executionId - id of execution to signal, cannot be null.
      • triggerAsync

        public void triggerAsync​(String executionId)
        Description copied from interface: RuntimeService
        Sends an external trigger to an activity instance that is waiting inside the given execution. The waiting execution is notified asynchronously.
        Specified by:
        triggerAsync in interface RuntimeService
        Parameters:
        executionId - id of execution to signal, cannot be null.
      • trigger

        public void trigger​(String executionId,
                            Map<String,​Object> processVariables)
        Description copied from interface: RuntimeService
        Sends an external trigger to an activity instance that is waiting inside the given execution.
        Specified by:
        trigger in interface RuntimeService
        Parameters:
        executionId - id of execution to signal, cannot be null.
        processVariables - a map of process variables
      • triggerAsync

        public void triggerAsync​(String executionId,
                                 Map<String,​Object> processVariables)
        Description copied from interface: RuntimeService
        Sends an external trigger to an activity instance that is waiting inside the given execution. The waiting execution is notified asynchronously.
        Specified by:
        triggerAsync in interface RuntimeService
        Parameters:
        executionId - id of execution to signal, cannot be null.
        processVariables - a map of process variables
      • evaluateConditionalEvents

        public void evaluateConditionalEvents​(String processInstanceId)
        Description copied from interface: RuntimeService
        Evaluate waiting conditional events (boundary, intermediate catch and event sub process start events) and trigger them if a condition evaluates to true.
        Specified by:
        evaluateConditionalEvents in interface RuntimeService
        Parameters:
        processInstanceId - id of process instance, cannot be null.
      • evaluateConditionalEvents

        public void evaluateConditionalEvents​(String processInstanceId,
                                              Map<String,​Object> processVariables)
        Description copied from interface: RuntimeService
        Evaluate waiting conditional events (boundary, intermediate catch and event sub process start events) and trigger them if a condition evaluates to true.
        Specified by:
        evaluateConditionalEvents in interface RuntimeService
        Parameters:
        processInstanceId - id of process instance, cannot be null.
        processVariables - a map of process variables to be set before evaluation
      • addUserIdentityLink

        public void addUserIdentityLink​(String processInstanceId,
                                        String userId,
                                        String identityLinkType)
        Description copied from interface: RuntimeService
        Involves a user with a process instance. The type of identity link is defined by the given identityLinkType.
        Specified by:
        addUserIdentityLink in interface RuntimeService
        Parameters:
        processInstanceId - id of the process instance, cannot be null.
        userId - id of the user involve, cannot be null.
        identityLinkType - type of identityLink, cannot be null (@see IdentityLinkType).
      • addGroupIdentityLink

        public void addGroupIdentityLink​(String processInstanceId,
                                         String groupId,
                                         String identityLinkType)
        Description copied from interface: RuntimeService
        Involves a group with a process instance. The type of identityLink is defined by the given identityLink.
        Specified by:
        addGroupIdentityLink in interface RuntimeService
        Parameters:
        processInstanceId - id of the process instance, cannot be null.
        groupId - id of the group to involve, cannot be null.
        identityLinkType - type of identity, cannot be null (@see IdentityLinkType).
      • deleteUserIdentityLink

        public void deleteUserIdentityLink​(String processInstanceId,
                                           String userId,
                                           String identityLinkType)
        Description copied from interface: RuntimeService
        Removes the association between a user and a process instance for the given identityLinkType.
        Specified by:
        deleteUserIdentityLink in interface RuntimeService
        Parameters:
        processInstanceId - id of the process instance, cannot be null.
        userId - id of the user involve, cannot be null.
        identityLinkType - type of identityLink, cannot be null (@see IdentityLinkType).
      • deleteGroupIdentityLink

        public void deleteGroupIdentityLink​(String processInstanceId,
                                            String groupId,
                                            String identityLinkType)
        Description copied from interface: RuntimeService
        Removes the association between a group and a process instance for the given identityLinkType.
        Specified by:
        deleteGroupIdentityLink in interface RuntimeService
        Parameters:
        processInstanceId - id of the process instance, cannot be null.
        groupId - id of the group to involve, cannot be null.
        identityLinkType - type of identity, cannot be null (@see IdentityLinkType).
      • getIdentityLinksForProcessInstance

        public List<org.flowable.identitylink.api.IdentityLink> getIdentityLinksForProcessInstance​(String processInstanceId)
        Description copied from interface: RuntimeService
        Retrieves the IdentityLinks associated with the given process instance. Such an IdentityLink informs how a certain user is involved with a process instance.
        Specified by:
        getIdentityLinksForProcessInstance in interface RuntimeService
      • getActiveActivityIds

        public List<String> getActiveActivityIds​(String executionId)
        Description copied from interface: RuntimeService
        Finds the activity ids for all executions that are waiting in activities. This is a list because a single activity can be active multiple times.
        Specified by:
        getActiveActivityIds in interface RuntimeService
        Parameters:
        executionId - id of the execution, cannot be null.
      • getFormInstanceById

        public FormData getFormInstanceById​(String processDefinitionId)
      • suspendProcessInstanceById

        public void suspendProcessInstanceById​(String processInstanceId)
        Description copied from interface: RuntimeService
        Suspends the process instance with the given id.

        If a process instance is in state suspended, flowable will not execute jobs (timers, messages) associated with this instance.

        If you have a process instance hierarchy, suspending one process instance form the hierarchy will not suspend other process instances form that hierarchy.

        Specified by:
        suspendProcessInstanceById in interface RuntimeService
      • activateProcessInstanceById

        public void activateProcessInstanceById​(String processInstanceId)
        Description copied from interface: RuntimeService
        Activates the process instance with the given id.

        If you have a process instance hierarchy, suspending one process instance form the hierarchy will not suspend other process instances form that hierarchy.

        Specified by:
        activateProcessInstanceById in interface RuntimeService
      • startProcessInstanceByMessage

        public ProcessInstance startProcessInstanceByMessage​(String messageName)
        Description copied from interface: RuntimeService

        Signals the process engine that a message is received and starts a new ProcessInstance.

        Calling this method can have two different outcomes:

        • If the message name is associated with a message start event, a new process instance is started.
        • If no subscription to a message with the given name exists, FlowableException is thrown
        Specified by:
        startProcessInstanceByMessage in interface RuntimeService
        Parameters:
        messageName - the 'name' of the message as specified as an attribute on the bpmn20 <message name="messageName" /> element.
        Returns:
        the ProcessInstance object representing the started process instance
      • signalEventReceived

        public void signalEventReceived​(String signalName)
        Description copied from interface: RuntimeService

        Notifies the process engine that a signal event of name 'signalName' has been received. This method delivers the signal to all executions waiting on the signal.

        NOTE: The waiting executions are notified synchronously.
        Specified by:
        signalEventReceived in interface RuntimeService
        Parameters:
        signalName - the name of the signal event
      • signalEventReceivedAsync

        public void signalEventReceivedAsync​(String signalName)
        Description copied from interface: RuntimeService

        Notifies the process engine that a signal event of name 'signalName' has been received. This method delivers the signal to all executions waiting on the signal.

        Specified by:
        signalEventReceivedAsync in interface RuntimeService
        Parameters:
        signalName - the name of the signal event
      • signalEventReceived

        public void signalEventReceived​(String signalName,
                                        Map<String,​Object> processVariables)
        Description copied from interface: RuntimeService

        Notifies the process engine that a signal event of name 'signalName' has been received. This method delivers the signal to all executions waiting on the signal.

        NOTE: The waiting executions are notified synchronously.
        Specified by:
        signalEventReceived in interface RuntimeService
        Parameters:
        signalName - the name of the signal event
        processVariables - a map of variables added to the execution(s)
      • signalEventReceived

        public void signalEventReceived​(String signalName,
                                        String executionId)
        Description copied from interface: RuntimeService
        Notifies the process engine that a signal event of name 'signalName' has been received. This method delivers the signal to a single execution, being the execution referenced by 'executionId'. The waiting execution is notified synchronously.
        Specified by:
        signalEventReceived in interface RuntimeService
        Parameters:
        signalName - the name of the signal event
        executionId - the id of the execution to deliver the signal to
      • signalEventReceived

        public void signalEventReceived​(String signalName,
                                        String executionId,
                                        Map<String,​Object> processVariables)
        Description copied from interface: RuntimeService
        Notifies the process engine that a signal event of name 'signalName' has been received. This method delivers the signal to a single execution, being the execution referenced by 'executionId'. The waiting execution is notified synchronously.
        Specified by:
        signalEventReceived in interface RuntimeService
        Parameters:
        signalName - the name of the signal event
        executionId - the id of the execution to deliver the signal to
        processVariables - a map of variables added to the execution(s)
      • signalEventReceivedAsync

        public void signalEventReceivedAsync​(String signalName,
                                             String executionId)
        Description copied from interface: RuntimeService
        Notifies the process engine that a signal event of name 'signalName' has been received. This method delivers the signal to a single execution, being the execution referenced by 'executionId'. The waiting execution is notified asynchronously.
        Specified by:
        signalEventReceivedAsync in interface RuntimeService
        Parameters:
        signalName - the name of the signal event
        executionId - the id of the execution to deliver the signal to
      • messageEventReceived

        public void messageEventReceived​(String messageName,
                                         String executionId)
        Description copied from interface: RuntimeService
        Notifies the process engine that a message event with name 'messageName' has been received and has been correlated to an execution with id 'executionId'.

        The waiting execution is notified synchronously.

        Specified by:
        messageEventReceived in interface RuntimeService
        Parameters:
        messageName - the name of the message event
        executionId - the id of the execution to deliver the message to
      • messageEventReceived

        public void messageEventReceived​(String messageName,
                                         String executionId,
                                         Map<String,​Object> processVariables)
        Description copied from interface: RuntimeService
        Notifies the process engine that a message event with the name 'messageName' has been received and has been correlated to an execution with id 'executionId'.

        The waiting execution is notified synchronously.

        Variables are set for the scope of the execution of the message event subscribed to the message name. For example:

        • The scope for an intermediate message event in the main process is that of the process instance
        • The scope for an intermediate message event in a subprocess is that of the subprocess
        • The scope for a boundary message event is that of the execution for the Activity the event is attached to
        Variables are set according to the algorithm as documented for VariableScope.setVariables(Map), applied separately to each variable.
        Specified by:
        messageEventReceived in interface RuntimeService
        Parameters:
        messageName - the name of the message event
        executionId - the id of the execution to deliver the message to
        processVariables - a map of variables added to the execution
        See Also:
        VariableScope.setVariables(Map)
      • messageEventReceivedAsync

        public void messageEventReceivedAsync​(String messageName,
                                              String executionId)
        Description copied from interface: RuntimeService
        Notifies the process engine that a message event with the name 'messageName' has been received and has been correlated to an execution with id 'executionId'.

        The waiting execution is notified asynchronously.

        Specified by:
        messageEventReceivedAsync in interface RuntimeService
        Parameters:
        messageName - the name of the message event
        executionId - the id of the execution to deliver the message to
      • addEventListener

        public void addEventListener​(org.flowable.common.engine.api.delegate.event.FlowableEventListener listenerToAdd)
        Description copied from interface: RuntimeService
        Adds an event-listener which will be notified of ALL events by the dispatcher.
        Specified by:
        addEventListener in interface RuntimeService
        Parameters:
        listenerToAdd - the listener to add
      • addEventListener

        public void addEventListener​(org.flowable.common.engine.api.delegate.event.FlowableEventListener listenerToAdd,
                                     org.flowable.common.engine.api.delegate.event.FlowableEngineEventType... types)
        Description copied from interface: RuntimeService
        Adds an event-listener which will only be notified when an event occurs, which type is in the given types.
        Specified by:
        addEventListener in interface RuntimeService
        Parameters:
        listenerToAdd - the listener to add
        types - types of events the listener should be notified for
      • removeEventListener

        public void removeEventListener​(org.flowable.common.engine.api.delegate.event.FlowableEventListener listenerToRemove)
        Description copied from interface: RuntimeService
        Removes the given listener from this dispatcher. The listener will no longer be notified, regardless of the type(s) it was registered for in the first place.
        Specified by:
        removeEventListener in interface RuntimeService
        Parameters:
        listenerToRemove - listener to remove
      • dispatchEvent

        public void dispatchEvent​(org.flowable.common.engine.api.delegate.event.FlowableEvent event)
        Description copied from interface: RuntimeService
        Dispatches the given event to any listeners that are registered.
        Specified by:
        dispatchEvent in interface RuntimeService
        Parameters:
        event - event to dispatch.
      • addEventRegistryConsumer

        public void addEventRegistryConsumer​(org.flowable.eventregistry.api.EventRegistryEventConsumer eventConsumer)
        Specified by:
        addEventRegistryConsumer in interface RuntimeService
      • removeEventRegistryConsumer

        public void removeEventRegistryConsumer​(org.flowable.eventregistry.api.EventRegistryEventConsumer eventConsumer)
        Specified by:
        removeEventRegistryConsumer in interface RuntimeService
      • setProcessInstanceName

        public void setProcessInstanceName​(String processInstanceId,
                                           String name)
        Description copied from interface: RuntimeService
        Sets the name for the process instance with the given id.
        Specified by:
        setProcessInstanceName in interface RuntimeService
        Parameters:
        processInstanceId - id of the process instance to update
        name - new name for the process instance
      • getAdhocSubProcessExecutions

        public List<Execution> getAdhocSubProcessExecutions​(String processInstanceId)
        Description copied from interface: RuntimeService
        Gets executions with an adhoc sub process as current flow element
        Specified by:
        getAdhocSubProcessExecutions in interface RuntimeService
        Parameters:
        processInstanceId - id of the process instance that is used to search for child executions
        Returns:
        a list of executions
      • getEnabledActivitiesFromAdhocSubProcess

        public List<org.flowable.bpmn.model.FlowNode> getEnabledActivitiesFromAdhocSubProcess​(String executionId)
        Description copied from interface: RuntimeService
        Gets enabled activities from ad-hoc sub process
        Specified by:
        getEnabledActivitiesFromAdhocSubProcess in interface RuntimeService
        Parameters:
        executionId - id of the execution that has an ad-hoc sub process as current flow element
        Returns:
        a list of enabled activities
      • executeActivityInAdhocSubProcess

        public Execution executeActivityInAdhocSubProcess​(String executionId,
                                                          String activityId)
        Description copied from interface: RuntimeService
        Executes an activity in a ad-hoc sub process
        Specified by:
        executeActivityInAdhocSubProcess in interface RuntimeService
        Parameters:
        executionId - id of the execution that has an ad-hoc sub process as current flow element
        activityId - id of the activity id to enable
        Returns:
        the newly created execution of the enabled activity
      • completeAdhocSubProcess

        public void completeAdhocSubProcess​(String executionId)
        Description copied from interface: RuntimeService
        Completes the ad-hoc sub process
        Specified by:
        completeAdhocSubProcess in interface RuntimeService
        Parameters:
        executionId - id of the execution that has an ad-hoc sub process as current flow element
      • addMultiInstanceExecution

        public Execution addMultiInstanceExecution​(String activityId,
                                                   String parentExecutionId,
                                                   Map<String,​Object> executionVariables)
        Description copied from interface: RuntimeService
        Adds a new execution to a running multi-instance parent execution
        Specified by:
        addMultiInstanceExecution in interface RuntimeService
        Parameters:
        activityId - id of the multi-instance activity (id attribute in the BPMN XML)
        parentExecutionId - can be the process instance id, in case there's one multi-instance execution for the provided activity id. In case of multiple multi-instance executions with the same activity id this can be a specific parent execution id.
        executionVariables - variables to be set on as local variable on the newly created multi-instance execution
        Returns:
        the newly created multi-instance execution
      • deleteMultiInstanceExecution

        public void deleteMultiInstanceExecution​(String executionId,
                                                 boolean executionIsCompleted)
        Description copied from interface: RuntimeService
        Deletes a multi-instance execution
        Specified by:
        deleteMultiInstanceExecution in interface RuntimeService
        Parameters:
        executionId - id of the multi-instance execution to be deleted
        executionIsCompleted - defines if the deleted execution should be marked as completed on the parent multi-instance execution
      • startProcessInstance

        public ProcessInstance startProcessInstance​(org.flowable.engine.impl.runtime.ProcessInstanceBuilderImpl processInstanceBuilder)
      • startProcessInstanceAsync

        public ProcessInstance startProcessInstanceAsync​(org.flowable.engine.impl.runtime.ProcessInstanceBuilderImpl processInstanceBuilder)
      • changeActivityState

        public void changeActivityState​(org.flowable.engine.impl.runtime.ChangeActivityStateBuilderImpl changeActivityStateBuilder)