Interface ProcessInstance<T>
-
- All Known Subinterfaces:
CaseInstance<T>
public interface ProcessInstance<T>
-
-
Field Summary
Fields Modifier and Type Field Description static intSTATE_ABORTEDstatic intSTATE_ACTIVEstatic intSTATE_COMPLETEDstatic intSTATE_ERRORstatic intSTATE_PENDINGstatic intSTATE_SUSPENDED
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidabort()Aborts this process instancevoidabortWorkItem(String id, Policy<?>... policies)Aborts work item belonging to this process instanceCollection<AdHocFragment>adHocFragments()Returns the process adHocFragmentsStringbusinessKey()Returns optional business key associated with this process instancevoidcancelNodeInstance(String nodeInstanceId)Cancels node instance with given nodeInstanceId which results in abort of any work being done by this node instancevoidcompleteWorkItem(String id, Map<String,Object> variables, Policy<?>... policies)Completes work item belonging to this process instance with given variablesStringdescription()Returns optional description of this process instancevoiddisconnect()Allows manually disconnect process instance to free up any taken resources.Optional<ProcessError>error()Returns process error in case process instance is in error state.Set<EventDescription<?>>events()Returns all active events that this process instance is capable of acting on.Stringid()Returns identifier of this process instanceStringimage(String path)Returns process image annotated with active nodesOptional<String>initiator()Returns optional initiator of the process instanceCollection<Milestone>milestones()Returns the process milestonesStringparentProcessInstanceId()Returns id of the parent process instance if this instance was started as subprocessProcess<T>process()Returns process definition associated with this process instancevoidretriggerNodeInstance(String nodeInstanceId)Retriggers (canceling and triggering again) node instance with given nodeInstanceId This results in redoing the logic associated with given node instanceStringrootProcessId()Returns id of the root process definition that this instance belongs to, if null it is then root instance itselfStringrootProcessInstanceId()Returns id of the root process instance that this instance belongs to, if null it is then root instance itself<S> voidsend(Signal<S> signal)Sends given signal into this process instancevoidstart()Starts process instancevoidstart(String trigger, String referenceId, Object data)Starts process instance with triggerDatestartDate()Returns startDate of this process instancevoidstartFrom(String nodeId)Starts process instance from given nodevoidstartFrom(String nodeId, String referenceId)Starts process instance from given nodeintstatus()Returns current status of this process instanceCollection<ProcessInstance<? extends Model>>subprocesses()Returns collection of currently active subprocess instances where this process instance is the parent;Tagstags()Returns tags associated with this process instancesvoidtransitionWorkItem(String id, Transition<?> transition)Transition work item belonging to this process instance not another life cycle phasevoidtriggerNode(String nodeId)Triggers a node with given id to perform its associated logicvoidupdateVariables(T updates)Updates process variables of this process instanceTvariables()Returns process variables of this process instanceWorkItemworkItem(String workItemId, Policy<?>... policies)Returns work item identified by given id if foundList<WorkItem>workItems(Policy<?>... policies)Returns list of currently active work items.
-
-
-
Field Detail
-
STATE_PENDING
static final int STATE_PENDING
- See Also:
- Constant Field Values
-
STATE_ACTIVE
static final int STATE_ACTIVE
- See Also:
- Constant Field Values
-
STATE_COMPLETED
static final int STATE_COMPLETED
- See Also:
- Constant Field Values
-
STATE_ABORTED
static final int STATE_ABORTED
- See Also:
- Constant Field Values
-
STATE_SUSPENDED
static final int STATE_SUSPENDED
- See Also:
- Constant Field Values
-
STATE_ERROR
static final int STATE_ERROR
- See Also:
- Constant Field Values
-
-
Method Detail
-
process
Process<T> process()
Returns process definition associated with this process instance- Returns:
- process definition of this process instance
-
start
void start()
Starts process instance
-
start
void start(String trigger, String referenceId, Object data)
Starts process instance with trigger- Parameters:
trigger- name of the trigger that will indicate what start node to triggerreferenceId- optional reference id that points to a another component triggering this instance
-
startFrom
void startFrom(String nodeId)
Starts process instance from given node- Parameters:
nodeId- node id that should be used as the first node
-
startFrom
void startFrom(String nodeId, String referenceId)
Starts process instance from given node- Parameters:
nodeId- node id that should be used as the first nodereferenceId- optional reference id that points to a another component triggering this instance
-
send
<S> void send(Signal<S> signal)
Sends given signal into this process instance- Parameters:
signal- signal to be processed
-
abort
void abort()
Aborts this process instance
-
variables
T variables()
Returns process variables of this process instance- Returns:
- variables of the process instance
-
updateVariables
void updateVariables(T updates)
Updates process variables of this process instance
-
status
int status()
Returns current status of this process instance- Returns:
- the current status
-
subprocesses
Collection<ProcessInstance<? extends Model>> subprocesses()
Returns collection of currently active subprocess instances where this process instance is the parent;- Returns:
- all active subprocesses if any or empty collection
-
completeWorkItem
void completeWorkItem(String id, Map<String,Object> variables, Policy<?>... policies)
Completes work item belonging to this process instance with given variables- Parameters:
id- id of the work item to completevariables- optional variablespolicies- optional list of policies to be enforced- Throws:
WorkItemNotFoundException- in case work item with given id does not exist
-
abortWorkItem
void abortWorkItem(String id, Policy<?>... policies)
Aborts work item belonging to this process instance- Parameters:
id- id of the work item to completepolicies- optional list of policies to be enforced- Throws:
WorkItemNotFoundException- in case work item with given id does not exist
-
transitionWorkItem
void transitionWorkItem(String id, Transition<?> transition)
Transition work item belonging to this process instance not another life cycle phase- Parameters:
id- id of the work item to completetransition- target transition including phase, identity and data- Throws:
WorkItemNotFoundException- in case work item with given id does not exist
-
workItem
WorkItem workItem(String workItemId, Policy<?>... policies)
Returns work item identified by given id if found- Parameters:
workItemId- id of the work itempolicies- optional list of policies to be enforced- Returns:
- work item with its parameters if found
- Throws:
WorkItemNotFoundException- in case work item with given id does not exist
-
workItems
List<WorkItem> workItems(Policy<?>... policies)
Returns list of currently active work items.- Parameters:
policies- optional list of policies to be enforced- Returns:
- non empty list of identifiers of currently active tasks.
-
id
String id()
Returns identifier of this process instance- Returns:
- id of the process instance
-
businessKey
String businessKey()
Returns optional business key associated with this process instance- Returns:
- business key if available otherwise null
-
description
String description()
Returns optional description of this process instance- Returns:
- description of the process instance
-
parentProcessInstanceId
String parentProcessInstanceId()
Returns id of the parent process instance if this instance was started as subprocess- Returns:
- instance id of the parent instance if available otherwise null
-
rootProcessInstanceId
String rootProcessInstanceId()
Returns id of the root process instance that this instance belongs to, if null it is then root instance itself- Returns:
- instance id of the root instance if available otherwise null
-
rootProcessId
String rootProcessId()
Returns id of the root process definition that this instance belongs to, if null it is then root instance itself- Returns:
- definition id of the root process if available otherwise null
-
startDate
Date startDate()
Returns startDate of this process instance- Returns:
-
error
Optional<ProcessError> error()
Returns process error in case process instance is in error state.- Returns:
- returns process error
-
initiator
Optional<String> initiator()
Returns optional initiator of the process instance- Returns:
- initiator (user id) if present
-
tags
Tags tags()
Returns tags associated with this process instances- Returns:
- currently associated tags
-
triggerNode
void triggerNode(String nodeId)
Triggers a node with given id to perform its associated logic- Parameters:
nodeId- unique id of the node to trigger
-
cancelNodeInstance
void cancelNodeInstance(String nodeInstanceId)
Cancels node instance with given nodeInstanceId which results in abort of any work being done by this node instance- Parameters:
nodeInstanceId- unique id of the node instance to be cancelled
-
retriggerNodeInstance
void retriggerNodeInstance(String nodeInstanceId)
Retriggers (canceling and triggering again) node instance with given nodeInstanceId This results in redoing the logic associated with given node instance- Parameters:
nodeInstanceId- unique id of the node instance to be cancelled
-
events
Set<EventDescription<?>> events()
Returns all active events that this process instance is capable of acting on.- Returns:
- set of event descriptions for this process instance
-
milestones
Collection<Milestone> milestones()
Returns the process milestones- Returns:
- All the process milestones with their current status
-
adHocFragments
Collection<AdHocFragment> adHocFragments()
Returns the process adHocFragments- Returns:
- All the
AdHocFragmentin the process
-
disconnect
void disconnect()
Allows manually disconnect process instance to free up any taken resources. It is only required if unit of work is not used.
-
-