Package org.kie.api.runtime.process
Interface ProcessRuntime
-
- All Known Subinterfaces:
KieRuntime
,KieSession
public interface ProcessRuntime
TheProcessRuntime
is a super-interface for allKieSession
s.- See Also:
KieSession
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
abortProcessInstance(java.lang.String processInstanceId)
Aborts the process instance with the given id.ProcessInstance
createProcessInstance(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> parameters)
Creates a new process instance (but does not yet start it).ProcessInstance
getProcessInstance(java.lang.String processInstanceId)
Returns the process instance with the given id.ProcessInstance
getProcessInstance(java.lang.String processInstanceId, boolean readonly)
Returns the process instance with the given id.java.util.Collection<ProcessInstance>
getProcessInstances()
Returns a collection of currently active process instances.WorkItemManager
getWorkItemManager()
Returns theWorkItemManager
related to this session.void
signalEvent(java.lang.String type, java.lang.Object event)
Signals the engine that an event has occurred.void
signalEvent(java.lang.String type, java.lang.Object event, java.lang.String processInstanceId)
Signals the process instance that an event has occurred.ProcessInstance
startProcess(java.lang.String processId)
Start a new process instance.ProcessInstance
startProcess(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> parameters)
Start a new process instance.ProcessInstance
startProcess(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> parameters, AgendaFilter agendaFilter)
Start a new process instance.ProcessInstance
startProcess(java.lang.String processId, AgendaFilter agendaFilter)
Start a new process instance.ProcessInstance
startProcessFromNodeIds(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> params, java.lang.String... nodeIds)
Starts a new process instances starting from the nodes givenProcessInstance
startProcessInstance(java.lang.String processInstanceId)
Starts the given process instance (which was created by using createProcesInstance but not yet started).
-
-
-
Method Detail
-
startProcess
ProcessInstance startProcess(java.lang.String processId)
Start a new process instance. The process (definition) that should be used is referenced by the given process id.- Parameters:
processId
- The id of the process that should be started- Returns:
- the
ProcessInstance
that represents the instance of the process that was started
-
startProcess
ProcessInstance startProcess(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> parameters)
Start a new process instance. The process (definition) that should be used is referenced by the given process id. Parameters can be passed to the process instance (as name-value pairs), and these will be set as variables of the process instance.- Parameters:
processId
- the id of the process that should be startedparameters
- the process variables that should be set when starting the process instance- Returns:
- the
ProcessInstance
that represents the instance of the process that was started
-
startProcess
ProcessInstance startProcess(java.lang.String processId, AgendaFilter agendaFilter)
Start a new process instance. The process (definition) that should be used is referenced by the given process id.- Parameters:
processId
- The id of the process that should be startedagendaFilter
- filters the Matches that may fire- Returns:
- the
ProcessInstance
that represents the instance of the process that was started
-
startProcess
ProcessInstance startProcess(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> parameters, AgendaFilter agendaFilter)
Start a new process instance. The process (definition) that should be used is referenced by the given process id. Parameters can be passed to the process instance (as name-value pairs), and these will be set as variables of the process instance.- Parameters:
processId
- the id of the process that should be startedparameters
- the process variables that should be set when starting the process instanceagendaFilter
- filters the Matches that may fire- Returns:
- the
ProcessInstance
that represents the instance of the process that was started
-
startProcessFromNodeIds
ProcessInstance startProcessFromNodeIds(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> params, java.lang.String... nodeIds)
Starts a new process instances starting from the nodes given- Parameters:
processId
- the id of the process that should be startedparams
- the process variables that should be set when starting the process instancenodeIds
- the node id list that should be triggered- Returns:
- the
ProcessInstance
that represents the instance of the process that was started
-
createProcessInstance
ProcessInstance createProcessInstance(java.lang.String processId, java.util.Map<java.lang.String,java.lang.Object> parameters)
Creates a new process instance (but does not yet start it). The process (definition) that should be used is referenced by the given process id. Parameters can be passed to the process instance (as name-value pairs), and these will be set as variables of the process instance. You should only use this method if you need a reference to the process instance before actually starting it. Otherwise, use startProcess.- Parameters:
processId
- the id of the process that should be startedparameters
- the process variables that should be set when creating the process instance- Returns:
- the
ProcessInstance
that represents the instance of the process that was created (but not yet started)
-
startProcessInstance
ProcessInstance startProcessInstance(java.lang.String processInstanceId)
Starts the given process instance (which was created by using createProcesInstance but not yet started). This method can only be called once for each process instance. You should only use this method if you need a reference to the process instance before actually starting it. Otherwise, use startProcess.- Parameters:
processInstanceId
- the id of the process instance that needs to be started- Returns:
- the
ProcessInstance
that represents the instance of the process that was started
-
signalEvent
void signalEvent(java.lang.String type, java.lang.Object event)
Signals the engine that an event has occurred. The type parameter defines which type of event and the event parameter can contain additional information related to the event. All process instances that are listening to this type of (external) event will be notified. For performance reasons, this type of event signaling should only be used if one process instance should be able to notify other process instances. For internal event within one process instance, use the signalEvent method that also include the processInstanceId of the process instance in question.- Parameters:
type
- the type of eventevent
- the data associated with this event
-
signalEvent
void signalEvent(java.lang.String type, java.lang.Object event, java.lang.String processInstanceId)
Signals the process instance that an event has occurred. The type parameter defines which type of event and the event parameter can contain additional information related to the event. All node instances inside the given process instance that are listening to this type of (internal) event will be notified. Note that the event will only be processed inside the given process instance. All other process instances waiting for this type of event will not be notified.- Parameters:
type
- the type of eventevent
- the data associated with this eventprocessInstanceId
- the id of the process instance that should be signaled
-
getProcessInstances
java.util.Collection<ProcessInstance> getProcessInstances()
Returns a collection of currently active process instances. Note that only process instances that are currently loaded and active inside the engine will be returned. When using persistence, it is likely not all running process instances will be loaded as their state will be stored persistently. It is recommended not to use this method to collect information about the state of your process instances but to use a history log for that purpose.- Returns:
- a collection of process instances currently active in the session
-
getProcessInstance
ProcessInstance getProcessInstance(java.lang.String processInstanceId)
Returns the process instance with the given id. Note that only active process instances will be returned. If a process instance has been completed already, this method will returnnull
.- Parameters:
processInstanceId
- the id of the process instance- Returns:
- the process instance with the given id or
null
if it cannot be found
-
getProcessInstance
ProcessInstance getProcessInstance(java.lang.String processInstanceId, boolean readonly)
Returns the process instance with the given id. Note that only active process instances will be returned. If a process instance has been completed already, this method will returnnull
.- Parameters:
processInstanceId
- the id of the process instancereadonly
- if this is true and when using persistence, this process instance will not be tracked and updated by the engine- Returns:
- the process instance with the given id or
null
if it cannot be found
-
abortProcessInstance
void abortProcessInstance(java.lang.String processInstanceId)
Aborts the process instance with the given id. If the process instance has been completed (or aborted), or the process instance cannot be found, this method will throw anIllegalArgumentException
.- Parameters:
processInstanceId
- the id of the process instance
-
getWorkItemManager
WorkItemManager getWorkItemManager()
Returns theWorkItemManager
related to this session. This can be used to register newWorkItemHandler
s or to complete (or abort)WorkItem
s.- Returns:
- the
WorkItemManager
related to this session
-
-