Interface ProcessService


  • public interface ProcessService
    • Method Detail

      • startProcess

        Long startProcess​(String deploymentId,
                          String processId)
        Starts a process with no variables
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - The process's identifier
        Returns:
        process instance identifier
        Throws:
        RuntimeException - in case of encountered errors
        DeploymentNotFoundException - in case deployment with given deployment id does not exist
        DeploymentNotActiveException - in case deployment with given deployment id is not active
      • startProcess

        Long startProcess​(String deploymentId,
                          String processId,
                          Map<String,​Object> params)
        Starts a process with no variables
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - The process's identifier
        params - process variables
        Returns:
        process instance identifier
        Throws:
        RuntimeException - in case of encountered errors
        DeploymentNotFoundException - in case deployment with given deployment id does not exist
        DeploymentNotActiveException - in case deployment with given deployment id is not active
      • computeProcessOutcome

        Map<String,​Object> computeProcessOutcome​(String deploymentId,
                                                       String processId,
                                                       Map<String,​Object> params)
        compute the process outcome for those process designed to start and finish in the same transaction. This functionality allows to retrieve the outcome of process variables
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - the process identifier
        params - process variables
        Returns:
        last modification of process variables.
      • startProcess

        Long startProcess​(String deploymentId,
                          String processId,
                          org.kie.internal.process.CorrelationKey correlationKey)
        Starts a process with no variables
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - The process's identifier
        correlationKey - correlation key to be assigned to process instance - must be unique
        Returns:
        process instance identifier
        Throws:
        RuntimeException - in case of encountered errors
        DeploymentNotFoundException - in case deployment with given deployment id does not exist
        DeploymentNotActiveException - in case deployment with given deployment id is not active
      • startProcess

        Long startProcess​(String deploymentId,
                          String processId,
                          org.kie.internal.process.CorrelationKey correlationKey,
                          Map<String,​Object> params)
        Starts a process with no variables
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - The process's identifier
        correlationKey - correlation key to be assigned to process instance - must be unique
        params - process variables
        Returns:
        process instance identifier
        Throws:
        RuntimeException - in case of encountered errors
        DeploymentNotFoundException - in case deployment with given deployment id does not exist
        DeploymentNotActiveException - in case deployment with given deployment id is not active
      • startProcessFromNodeIds

        Long startProcessFromNodeIds​(String deploymentId,
                                     String processId,
                                     Map<String,​Object> params,
                                     String... nodeIds)
        Starts a process with the values supplied from the current nodes
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - The process's identifier
        params - process variables
        nodeIds - list of bpmn node id list where the process is going to start
        Returns:
        process instance identifier
        Throws:
        RuntimeException - in case of encountered errors
        DeploymentNotFoundException - in case deployment with given deployment id does not exist
        DeploymentNotActiveException - in case deployment with given deployment id is not active
      • startProcessFromNodeIds

        Long startProcessFromNodeIds​(String deploymentId,
                                     String processId,
                                     org.kie.internal.process.CorrelationKey key,
                                     Map<String,​Object> params,
                                     String... nodeIds)
        Starts a process with the values supplied from the current nodes
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - The process's identifier
        key - correlation key (must be unique)
        params - process variables
        nodeIds - list of bpmn node id list where the process is going to start.
        Returns:
        process instance identifier
        Throws:
        RuntimeException - in case of encountered errors
        DeploymentNotFoundException - in case deployment with given deployment id does not exist
        DeploymentNotActiveException - in case deployment with given deployment id is not active
      • abortProcessInstance

        void abortProcessInstance​(Long processInstanceId)
        Aborts the specified process
        Parameters:
        processInstanceId - process instance's unique identifier
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • abortProcessInstance

        void abortProcessInstance​(String deploymentId,
                                  Long processInstanceId)
        Aborts the specified process
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance's unique identifier
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • abortProcessInstances

        void abortProcessInstances​(List<Long> processInstanceIds)
        Aborts all specified processes
        Parameters:
        processInstanceIds - list of process instance unique identifiers
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • abortProcessInstances

        void abortProcessInstances​(String deploymentId,
                                   List<Long> processInstanceIds)
        Aborts all specified processes
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceIds - list of process instance unique identifiers
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalProcessInstance

        void signalProcessInstance​(Long processInstanceId,
                                   String signalName,
                                   Object event)
        Signal an event to a single process instance
        Parameters:
        processInstanceId - the process instance's unique identifier
        signalName - the signal's id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalProcessInstance

        void signalProcessInstance​(String deploymentId,
                                   Long processInstanceId,
                                   String signalName,
                                   Object event)
        Signal an event to a single process instance
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - the process instance's unique identifier
        signalName - the signal's id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalProcessInstances

        void signalProcessInstances​(List<Long> processInstanceIds,
                                    String signalName,
                                    Object event)
        Signal an event to given list of process instances
        Parameters:
        processInstanceIds - list of process instance unique identifiers
        signalName - the signal's id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalProcessInstances

        void signalProcessInstances​(String deploymentId,
                                    List<Long> processInstanceIds,
                                    String signalName,
                                    Object event)
        Signal an event to given list of process instances
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceIds - list of process instance unique identifiers
        signalName - the signal's id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalProcessInstanceByCorrelationKey

        void signalProcessInstanceByCorrelationKey​(org.kie.internal.process.CorrelationKey correlationKey,
                                                   String signalName,
                                                   Object event)
        Signal an event to a single process instance by correlation key
        Parameters:
        correlationKey - the process instances unique correlation key
        signalName - the signals id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalProcessInstanceByCorrelationKey

        void signalProcessInstanceByCorrelationKey​(String deploymentId,
                                                   org.kie.internal.process.CorrelationKey correlationKey,
                                                   String signalName,
                                                   Object event)
        Signal an event to a single process instance by correlation key
        Parameters:
        deploymentId - deployment that process instance belongs to
        correlationKey - the process instances unique correlation key
        signalName - the signals id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalProcessInstancesByCorrelationKeys

        void signalProcessInstancesByCorrelationKeys​(List<org.kie.internal.process.CorrelationKey> correlationKeys,
                                                     String signalName,
                                                     Object event)
        Signal an event to given list of correlation keys
        Parameters:
        correlationKeys - list of process instance unique correlation keys
        signalName - the signal's id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalProcessInstancesByCorrelationKeys

        void signalProcessInstancesByCorrelationKeys​(String deploymentId,
                                                     List<org.kie.internal.process.CorrelationKey> correlationKeys,
                                                     String signalName,
                                                     Object event)
        Signal an event to given list of correlation keys
        Parameters:
        deploymentId - deployment that process instance belongs to
        correlationKeys - list of process instance unique correlation keys
        signalName - the signal's id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • signalEvent

        void signalEvent​(String deployment,
                         String signalName,
                         Object event)
        Signal an event to a any process instance that listens to give signal that belongs to given deployment
        Parameters:
        deployment - information for the process's kjar
        signalName - the signal's id in the process
        event - the event object to be passed in with the event
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
      • getProcessInstance

        org.kie.api.runtime.process.ProcessInstance getProcessInstance​(Long processInstanceId)
        Returns process instance information. Will return null if no active process with that id is found
        Parameters:
        processInstanceId - The process instance's unique identifier
        Returns:
        Process instance information
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
      • getProcessInstance

        org.kie.api.runtime.process.ProcessInstance getProcessInstance​(String deploymentId,
                                                                       Long processInstanceId)
        Returns process instance information. Will return null if no active process with that id is found
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - The process instance's unique identifier
        Returns:
        Process instance information
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
      • getProcessInstance

        org.kie.api.runtime.process.ProcessInstance getProcessInstance​(org.kie.internal.process.CorrelationKey correlationKey)
        Returns process instance information. Will return null if no active process with that correlation key is found
        Parameters:
        correlationKey - correlation key assigned to process instance
        Returns:
        Process instance information
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
      • getProcessInstance

        org.kie.api.runtime.process.ProcessInstance getProcessInstance​(String deploymentId,
                                                                       org.kie.internal.process.CorrelationKey correlationKey)
        Returns process instance information. Will return null if no active process with that correlation key is found
        Parameters:
        deploymentId - deployment that process instance belongs to
        correlationKey - correlation key assigned to process instance
        Returns:
        Process instance information
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
      • setProcessVariable

        void setProcessVariable​(Long processInstanceId,
                                String variableId,
                                Object value)
        Sets a process variable.
        Parameters:
        processInstanceId - The process instance's unique identifier.
        variableId - The variable id to set.
        value - The variable value.
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • setProcessVariable

        void setProcessVariable​(String deploymentId,
                                Long processInstanceId,
                                String variableId,
                                Object value)
        Sets a process variable.
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - The process instance's unique identifier.
        variableId - The variable id to set.
        value - The variable value.
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • setProcessVariables

        void setProcessVariables​(Long processInstanceId,
                                 Map<String,​Object> variables)
        Sets process variables.
        Parameters:
        processInstanceId - The process instance's unique identifier.
        variables - map of process variables (key - variable name, value - variable value)
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • setProcessVariables

        void setProcessVariables​(String deploymentId,
                                 Long processInstanceId,
                                 Map<String,​Object> variables)
        Sets process variables.
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - The process instance's unique identifier.
        variables - map of process variables (key - variable name, value - variable value)
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • getProcessInstanceVariable

        Object getProcessInstanceVariable​(Long processInstanceId,
                                          String variableName)
        Gets a process instance's variable.
        Parameters:
        processInstanceId - the process instance's unique identifier.
        variableName - the variable name to get from the process.
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • getProcessInstanceVariable

        Object getProcessInstanceVariable​(String deploymentId,
                                          Long processInstanceId,
                                          String variableName)
        Gets a process instance's variable.
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - the process instance's unique identifier.
        variableName - the variable name to get from the process.
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • getProcessInstanceVariables

        Map<String,​Object> getProcessInstanceVariables​(String deploymentId,
                                                             Long processInstanceId)
        Gets a process instance's variable values.
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - The process instance's unique identifier.
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • getAvailableSignals

        Collection<String> getAvailableSignals​(Long processInstanceId)
        Returns all signals available in current state of given process instance
        Parameters:
        processInstanceId - process instance id
        Returns:
        list of available signals or empty list if no signals are available
      • getAvailableSignals

        Collection<String> getAvailableSignals​(String deploymentId,
                                               Long processInstanceId)
        Returns all signals available in current state of given process instance
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance id
        Returns:
        list of available signals or empty list if no signals are available
      • completeWorkItem

        void completeWorkItem​(Long id,
                              Map<String,​Object> results)
        Completes the specified WorkItem with the given results
        Parameters:
        id - workItem id
        results - results of the workItem
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        WorkItemNotFoundException - in case work item with given id was not found
      • completeWorkItem

        void completeWorkItem​(String deploymentId,
                              Long processInstanceId,
                              Long id,
                              Map<String,​Object> results)
        Completes the specified WorkItem with the given results
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance id that work item belongs to
        id - workItem id
        results - results of the workItem
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        WorkItemNotFoundException - in case work item with given id was not found
      • abortWorkItem

        void abortWorkItem​(String deploymentId,
                           Long processInstanceId,
                           Long id)
        Abort the specified workItem
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance id that work item belongs to
        id - workItem id
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        WorkItemNotFoundException - in case work item with given id was not found
      • getWorkItem

        org.kie.api.runtime.process.WorkItem getWorkItem​(Long id)
        Returns the specified workItem
        Parameters:
        id - workItem id
        Returns:
        The specified workItem
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        WorkItemNotFoundException - in case work item with given id was not found
      • getWorkItem

        org.kie.api.runtime.process.WorkItem getWorkItem​(String deploymentId,
                                                         Long processInstanceId,
                                                         Long id)
        Returns the specified workItem
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance id that work item belongs to
        id - workItem id
        Returns:
        The specified workItem
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        WorkItemNotFoundException - in case work item with given id was not found
      • getWorkItemByProcessInstance

        List<org.kie.api.runtime.process.WorkItem> getWorkItemByProcessInstance​(Long processInstanceId)
        Returns active work items by process instance id.
        Parameters:
        processInstanceId - process instance id
        Returns:
        The list of active workItems for the process instance
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • getWorkItemByProcessInstance

        List<org.kie.api.runtime.process.WorkItem> getWorkItemByProcessInstance​(String deploymentId,
                                                                                Long processInstanceId)
        Returns active work items by process instance id.
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance id
        Returns:
        The list of active workItems for the process instance
        Throws:
        DeploymentNotFoundException - in case deployment unit was not found
        ProcessInstanceNotFoundException - in case process instance with given id was not found
      • execute

        <T> T execute​(String deploymentId,
                      org.kie.api.command.Command<T> command)
        Executes provided command on the underlying command executor (usually KieSession)
        Parameters:
        deploymentId - deployment information for the process's kjar
        command - actual command for execution
        Returns:
        results of command execution
        Throws:
        DeploymentNotFoundException - in case deployment with given deployment id does not exist
        DeploymentNotActiveException - in case deployment with given deployment id is not active for restricted commands (e.g. start process)
      • execute

        <T> T execute​(String deploymentId,
                      org.kie.api.runtime.manager.Context<?> context,
                      org.kie.api.command.Command<T> command)
        Executes provided command on the underlying command executor (usually KieSession)
        Parameters:
        deploymentId - deployment information for the process's kjar
        context - context implementation to be used to get runtime engine
        command - actual command for execution
        Returns:
        results of command execution
        Throws:
        DeploymentNotFoundException - in case deployment with given deployment id does not exist
        DeploymentNotActiveException - in case deployment with given deployment id is not active for restricted commands (e.g. start process)