Module io.automatiko.engine.api
Interface ProcessInstance<T>
- All Known Subinterfaces:
CaseInstance<T>
public interface ProcessInstance<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()Aborts this process instanceReturns abort code in case process instance was abortedReturns optional data associated with abort of the instance caused by errorvoidabortWorkItem(String id, Policy<?>... policies) Aborts work item belonging to this process instanceReturns the process adHocFragmentsarchive(ArchiveBuilder builder) Archives this process instance by collecting all relevant information of it.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 instancevoidCompletes work item belonging to this process instance with given variablesReturns optional description of this process instancevoidAllows manually disconnect process instance to free up any taken resources.endDate()Returns endDate of this process instanceerrors()Returns process errors in case process instance is in error state.Set<EventDescription<?>>events()Returns all active events that this process instance is capable of acting on.Returns optional expiresAtDate of this process instancevoidfailWorkItem(String id, Throwable error) Marks work item as failure to allow triggering of error handling routines if anyid()Returns identifier of this process instanceReturns process image annotated with active nodesReturns optional initiator of the process instancedefault InstanceMetadatametadata()Returns instance metadata informationReturns the process milestonesReturns id of the parent process instance if this instance was started as subprocessprocess()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 instanceReturns id of the root process definition that this instance belongs to, if null it is then root instance itselfReturns id of the root process instance that this instance belongs to, if null it is then root instance itself<S> voidSends given signal into this process instancevoidstart()Starts process instancevoidStarts process instance with triggerReturns startDate of this process instancevoidStarts process instance from given nodevoidStarts process instance from given nodeintstatus()Returns current status of this process instanceCollection<ProcessInstance<? extends Model>>Returns collection of currently active subprocess instances where this process instance is the parent;Collection<ProcessInstance<? extends Model>>Returns collection of currently active subprocess instances where this process instance is the parent;tags()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 instanceReturns process variables of this process instanceReturns work item identified by given id if foundReturns list of currently active work items.
-
Field Details
-
STATE_RECOVERING
static final int STATE_RECOVERING- See Also:
-
STATE_PENDING
static final int STATE_PENDING- See Also:
-
STATE_ACTIVE
static final int STATE_ACTIVE- See Also:
-
STATE_COMPLETED
static final int STATE_COMPLETED- See Also:
-
STATE_ABORTED
static final int STATE_ABORTED- See Also:
-
STATE_SUSPENDED
static final int STATE_SUSPENDED- See Also:
-
STATE_ERROR
static final int STATE_ERROR- See Also:
-
-
Method Details
-
process
Returns process definition associated with this process instance- Returns:
- process definition of this process instance
-
start
void start()Starts process instance -
start
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
Starts process instance from given node- Parameters:
nodeId- node id that should be used as the first node
-
startFrom
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
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
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
-
subprocesses
Returns collection of currently active subprocess instances where this process instance is the parent;- Parameters:
mode- mode that process instance should be loaded with- Returns:
- all active subprocesses if any or empty collection
-
completeWorkItem
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
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
-
failWorkItem
Marks work item as failure to allow triggering of error handling routines if any- Parameters:
id- id of the work item to completeerror- actual error that happened during execution- Throws:
WorkItemNotFoundException- in case work item with given id does not exist
-
transitionWorkItem
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
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
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:
- date when this instance started
-
endDate
Date endDate()Returns endDate of this process instance- Returns:
- end date (completed or aborted) of this instance or null if this instance is not yet ended
-
expiresAtDate
Date expiresAtDate()Returns optional expiresAtDate of this process instance- Returns:
- calculated date when this instance expires or null
-
errors
Optional<ProcessErrors> errors()Returns process errors in case process instance is in error state.- Returns:
- returns process errors
-
initiator
Returns optional initiator of the process instance- Returns:
- initiator (user id) if present
-
abortCode
String abortCode()Returns abort code in case process instance was aborted- Returns:
- error code that led to aborting of the instance
-
abortData
Object abortData()Returns optional data associated with abort of the instance caused by error- Returns:
- data associated with the error that led to aborting of the instance
-
tags
Tags tags()Returns tags associated with this process instances- Returns:
- currently associated tags
-
metadata
Returns instance metadata information- Returns:
- metadata information about this instance
-
triggerNode
Triggers a node with given id to perform its associated logic- Parameters:
nodeId- unique id of the node to trigger
-
cancelNodeInstance
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
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. -
image
Returns process image annotated with active nodes- Parameters:
path- current path that allows to build image links- Returns:
- annotated process instance image
-
archive
Archives this process instance by collecting all relevant information of it.- Parameters:
builder- an archive build implementation- Returns:
- returns archived representation of this process instance
-