Class ProcessServiceImpl

    • Constructor Detail

      • ProcessServiceImpl

        public ProcessServiceImpl()
    • Method Detail

      • setDeploymentService

        public void setDeploymentService​(DeploymentService deploymentService)
      • startProcess

        public Long startProcess​(String deploymentId,
                                 String processId)
        Description copied from interface: ProcessService
        Starts a process with no variables
        Specified by:
        startProcess in interface ProcessService
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - The process's identifier
        Returns:
        process instance identifier
      • startProcessFromNodeIds

        public Long startProcessFromNodeIds​(String deploymentId,
                                            String processId,
                                            Map<String,​Object> params,
                                            String... nodeIds)
        Description copied from interface: ProcessService
        Starts a process with the values supplied from the current nodes
        Specified by:
        startProcessFromNodeIds in interface ProcessService
        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
      • startProcessFromNodeIds

        public Long startProcessFromNodeIds​(String deploymentId,
                                            String processId,
                                            org.kie.internal.process.CorrelationKey key,
                                            Map<String,​Object> params,
                                            String... nodeIds)
        Description copied from interface: ProcessService
        Starts a process with the values supplied from the current nodes
        Specified by:
        startProcessFromNodeIds in interface ProcessService
        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
      • computeProcessOutcome

        public Map<String,​Object> computeProcessOutcome​(String deploymentId,
                                                              String processId,
                                                              Map<String,​Object> params)
        Description copied from interface: ProcessService
        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
        Specified by:
        computeProcessOutcome in interface ProcessService
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - the process identifier
        params - process variables
        Returns:
        last modification of process variables.
      • startProcess

        public Long startProcess​(String deploymentId,
                                 String processId,
                                 Map<String,​Object> params)
        Description copied from interface: ProcessService
        Starts a process with no variables
        Specified by:
        startProcess in interface ProcessService
        Parameters:
        deploymentId - deployment information for the process's kjar
        processId - The process's identifier
        params - process variables
        Returns:
        process instance identifier
      • startProcess

        public Long startProcess​(String deploymentId,
                                 String processId,
                                 org.kie.internal.process.CorrelationKey correlationKey)
        Description copied from interface: ProcessService
        Starts a process with no variables
        Specified by:
        startProcess in interface ProcessService
        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
      • startProcess

        public Long startProcess​(String deploymentId,
                                 String processId,
                                 org.kie.internal.process.CorrelationKey correlationKey,
                                 Map<String,​Object> params)
        Description copied from interface: ProcessService
        Starts a process with no variables
        Specified by:
        startProcess in interface ProcessService
        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
      • getContext

        protected org.kie.api.runtime.manager.Context<?> getContext​(Map<String,​Object> params)
      • abortProcessInstance

        public void abortProcessInstance​(Long processInstanceId)
        Description copied from interface: ProcessService
        Aborts the specified process
        Specified by:
        abortProcessInstance in interface ProcessService
        Parameters:
        processInstanceId - process instance's unique identifier
      • abortProcessInstance

        public void abortProcessInstance​(String deploymentId,
                                         Long processInstanceId)
        Description copied from interface: ProcessService
        Aborts the specified process
        Specified by:
        abortProcessInstance in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance's unique identifier
      • abortProcessInstances

        public void abortProcessInstances​(List<Long> processInstanceIds)
        Description copied from interface: ProcessService
        Aborts all specified processes
        Specified by:
        abortProcessInstances in interface ProcessService
        Parameters:
        processInstanceIds - list of process instance unique identifiers
      • abortProcessInstances

        public void abortProcessInstances​(String deploymentId,
                                          List<Long> processInstanceIds)
        Description copied from interface: ProcessService
        Aborts all specified processes
        Specified by:
        abortProcessInstances in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceIds - list of process instance unique identifiers
      • signalProcessInstance

        public void signalProcessInstance​(Long processInstanceId,
                                          String signalName,
                                          Object event)
        Description copied from interface: ProcessService
        Signal an event to a single process instance
        Specified by:
        signalProcessInstance in interface ProcessService
        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
      • signalProcessInstance

        public void signalProcessInstance​(String deploymentId,
                                          Long processInstanceId,
                                          String signalName,
                                          Object event)
        Description copied from interface: ProcessService
        Signal an event to a single process instance
        Specified by:
        signalProcessInstance in interface ProcessService
        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
      • signalProcessInstances

        public void signalProcessInstances​(List<Long> processInstanceIds,
                                           String signalName,
                                           Object event)
        Description copied from interface: ProcessService
        Signal an event to given list of process instances
        Specified by:
        signalProcessInstances in interface ProcessService
        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
      • signalProcessInstances

        public void signalProcessInstances​(String deploymentId,
                                           List<Long> processInstanceIds,
                                           String signalName,
                                           Object event)
        Description copied from interface: ProcessService
        Signal an event to given list of process instances
        Specified by:
        signalProcessInstances in interface ProcessService
        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
      • signalProcessInstanceByCorrelationKey

        public void signalProcessInstanceByCorrelationKey​(org.kie.internal.process.CorrelationKey correlationKey,
                                                          String signalName,
                                                          Object event)
        Description copied from interface: ProcessService
        Signal an event to a single process instance by correlation key
        Specified by:
        signalProcessInstanceByCorrelationKey in interface ProcessService
        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
      • signalProcessInstanceByCorrelationKey

        public void signalProcessInstanceByCorrelationKey​(String deploymentId,
                                                          org.kie.internal.process.CorrelationKey correlationKey,
                                                          String signalName,
                                                          Object event)
        Description copied from interface: ProcessService
        Signal an event to a single process instance by correlation key
        Specified by:
        signalProcessInstanceByCorrelationKey in interface ProcessService
        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
      • signalProcessInstancesByCorrelationKeys

        public void signalProcessInstancesByCorrelationKeys​(List<org.kie.internal.process.CorrelationKey> correlationKeys,
                                                            String signalName,
                                                            Object event)
        Description copied from interface: ProcessService
        Signal an event to given list of correlation keys
        Specified by:
        signalProcessInstancesByCorrelationKeys in interface ProcessService
        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
      • signalProcessInstancesByCorrelationKeys

        public void signalProcessInstancesByCorrelationKeys​(String deploymentId,
                                                            List<org.kie.internal.process.CorrelationKey> correlationKeys,
                                                            String signalName,
                                                            Object event)
        Description copied from interface: ProcessService
        Signal an event to given list of correlation keys
        Specified by:
        signalProcessInstancesByCorrelationKeys in interface ProcessService
        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
      • signalEvent

        public void signalEvent​(String deploymentId,
                                String signalName,
                                Object event)
        Description copied from interface: ProcessService
        Signal an event to a any process instance that listens to give signal that belongs to given deployment
        Specified by:
        signalEvent in interface ProcessService
        Parameters:
        deploymentId - 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
      • getProcessInstance

        public org.kie.api.runtime.process.ProcessInstance getProcessInstance​(Long processInstanceId)
        Description copied from interface: ProcessService
        Returns process instance information. Will return null if no active process with that id is found
        Specified by:
        getProcessInstance in interface ProcessService
        Parameters:
        processInstanceId - The process instance's unique identifier
        Returns:
        Process instance information
      • getProcessInstance

        public org.kie.api.runtime.process.ProcessInstance getProcessInstance​(String deploymentId,
                                                                              Long processInstanceId)
        Description copied from interface: ProcessService
        Returns process instance information. Will return null if no active process with that id is found
        Specified by:
        getProcessInstance in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - The process instance's unique identifier
        Returns:
        Process instance information
      • getProcessInstance

        public org.kie.api.runtime.process.ProcessInstance getProcessInstance​(org.kie.internal.process.CorrelationKey key)
        Description copied from interface: ProcessService
        Returns process instance information. Will return null if no active process with that correlation key is found
        Specified by:
        getProcessInstance in interface ProcessService
        Parameters:
        key - correlation key assigned to process instance
        Returns:
        Process instance information
      • getProcessInstance

        public org.kie.api.runtime.process.ProcessInstance getProcessInstance​(String deploymentId,
                                                                              org.kie.internal.process.CorrelationKey key)
        Description copied from interface: ProcessService
        Returns process instance information. Will return null if no active process with that correlation key is found
        Specified by:
        getProcessInstance in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        key - correlation key assigned to process instance
        Returns:
        Process instance information
      • setProcessVariable

        public void setProcessVariable​(Long processInstanceId,
                                       String variableId,
                                       Object value)
        Description copied from interface: ProcessService
        Sets a process variable.
        Specified by:
        setProcessVariable in interface ProcessService
        Parameters:
        processInstanceId - The process instance's unique identifier.
        variableId - The variable id to set.
        value - The variable value.
      • setProcessVariable

        public void setProcessVariable​(String deploymentId,
                                       Long processInstanceId,
                                       String variableId,
                                       Object value)
        Description copied from interface: ProcessService
        Sets a process variable.
        Specified by:
        setProcessVariable in interface ProcessService
        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.
      • setProcessVariables

        public void setProcessVariables​(Long processInstanceId,
                                        Map<String,​Object> variables)
        Description copied from interface: ProcessService
        Sets process variables.
        Specified by:
        setProcessVariables in interface ProcessService
        Parameters:
        processInstanceId - The process instance's unique identifier.
        variables - map of process variables (key - variable name, value - variable value)
      • setProcessVariables

        public void setProcessVariables​(String deploymentId,
                                        Long processInstanceId,
                                        Map<String,​Object> variables)
        Description copied from interface: ProcessService
        Sets process variables.
        Specified by:
        setProcessVariables in interface ProcessService
        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)
      • getProcessInstanceVariable

        public Object getProcessInstanceVariable​(Long processInstanceId,
                                                 String variableName)
        Description copied from interface: ProcessService
        Gets a process instance's variable.
        Specified by:
        getProcessInstanceVariable in interface ProcessService
        Parameters:
        processInstanceId - the process instance's unique identifier.
        variableName - the variable name to get from the process.
      • getProcessInstanceVariable

        public Object getProcessInstanceVariable​(String deploymentId,
                                                 Long processInstanceId,
                                                 String variableName)
        Description copied from interface: ProcessService
        Gets a process instance's variable.
        Specified by:
        getProcessInstanceVariable in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - the process instance's unique identifier.
        variableName - the variable name to get from the process.
      • getProcessInstanceVariables

        public Map<String,​Object> getProcessInstanceVariables​(String deploymentId,
                                                                    Long processInstanceId)
        Description copied from interface: ProcessService
        Gets a process instance's variable values.
        Specified by:
        getProcessInstanceVariables in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - The process instance's unique identifier.
      • getAvailableSignals

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

        public Collection<String> getAvailableSignals​(String deploymentId,
                                                      Long processInstanceId)
        Description copied from interface: ProcessService
        Returns all signals available in current state of given process instance
        Specified by:
        getAvailableSignals in interface ProcessService
        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

        public void completeWorkItem​(Long id,
                                     Map<String,​Object> results)
        Description copied from interface: ProcessService
        Completes the specified WorkItem with the given results
        Specified by:
        completeWorkItem in interface ProcessService
        Parameters:
        id - workItem id
        results - results of the workItem
      • completeWorkItem

        public void completeWorkItem​(String deploymentId,
                                     Long processInstanceId,
                                     Long id,
                                     Map<String,​Object> results)
        Description copied from interface: ProcessService
        Completes the specified WorkItem with the given results
        Specified by:
        completeWorkItem in interface ProcessService
        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
      • abortWorkItem

        public void abortWorkItem​(String deploymentId,
                                  Long processInstanceId,
                                  Long id)
        Description copied from interface: ProcessService
        Abort the specified workItem
        Specified by:
        abortWorkItem in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance id that work item belongs to
        id - workItem id
      • getWorkItem

        public org.kie.api.runtime.process.WorkItem getWorkItem​(Long id)
        Description copied from interface: ProcessService
        Returns the specified workItem
        Specified by:
        getWorkItem in interface ProcessService
        Parameters:
        id - workItem id
        Returns:
        The specified workItem
      • getWorkItem

        public org.kie.api.runtime.process.WorkItem getWorkItem​(String deploymentId,
                                                                Long processInstanceId,
                                                                Long id)
        Description copied from interface: ProcessService
        Returns the specified workItem
        Specified by:
        getWorkItem in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance id that work item belongs to
        id - workItem id
        Returns:
        The specified workItem
      • getWorkItemByProcessInstance

        public List<org.kie.api.runtime.process.WorkItem> getWorkItemByProcessInstance​(Long processInstanceId)
        Description copied from interface: ProcessService
        Returns active work items by process instance id.
        Specified by:
        getWorkItemByProcessInstance in interface ProcessService
        Parameters:
        processInstanceId - process instance id
        Returns:
        The list of active workItems for the process instance
      • getWorkItemByProcessInstance

        public List<org.kie.api.runtime.process.WorkItem> getWorkItemByProcessInstance​(String deploymentId,
                                                                                       Long processInstanceId)
        Description copied from interface: ProcessService
        Returns active work items by process instance id.
        Specified by:
        getWorkItemByProcessInstance in interface ProcessService
        Parameters:
        deploymentId - deployment that process instance belongs to
        processInstanceId - process instance id
        Returns:
        The list of active workItems for the process instance
      • execute

        public <T> T execute​(String deploymentId,
                             org.kie.api.command.Command<T> command)
        Description copied from interface: ProcessService
        Executes provided command on the underlying command executor (usually KieSession)
        Specified by:
        execute in interface ProcessService
        Parameters:
        deploymentId - deployment information for the process's kjar
        command - actual command for execution
        Returns:
        results of command execution
      • execute

        public <T> T execute​(String deploymentId,
                             org.kie.api.runtime.manager.Context<?> context,
                             org.kie.api.command.Command<T> command)
        Description copied from interface: ProcessService
        Executes provided command on the underlying command executor (usually KieSession)
        Specified by:
        execute in interface ProcessService
        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
      • disallowWhenNotActive

        protected void disallowWhenNotActive​(DeployedUnit deployedUnit,
                                             org.kie.api.command.Command<?> cmd)
      • collectActiveSignals

        protected Collection<String> collectActiveSignals​(Collection<org.kie.api.runtime.process.NodeInstance> activeNodes)
      • getActiveBoundaryNodesSignals

        protected List<String> getActiveBoundaryNodesSignals​(org.kie.api.runtime.process.ProcessInstance processInstance,
                                                             Collection<org.kie.api.runtime.process.NodeInstance> activeNodes)
      • process

        public <T> T process​(T variables,
                             ClassLoader cl)
        Description copied from interface: VariablesAware
        Generic processing method that might be simply returning same instance of variables if no processing is required.
        Specified by:
        process in interface VariablesAware
        Parameters:
        variables - object that holds varialble(s)
        cl - classloader that shall be used to operate on the variables e.g. project class loader
        Returns:
      • disposeRuntimeEngine

        protected void disposeRuntimeEngine​(org.kie.api.runtime.manager.RuntimeManager manager,
                                            org.kie.api.runtime.manager.RuntimeEngine engine)