public abstract class WorkflowTriggerBean extends Object
This abstract class must be extended to define a custom workflow trigger.
Extended versions of this class need to be registered in file module.xml
using a <bean>
element located at /module/beans
.
A workflow model can be associated to a registered custom trigger class using the workflow model configuration user interface.
At each main event concerning a workflow instance, the system checks if the corresponding workflow model is associated to a trigger class.
If yes, the trigger object is automatically instantiated and the method corresponding to the event type is called.
The trigger object is then discarded.
When a sub-workflow is executed, only the trigger of the sub-workflow is called (not the trigger of the parent workflow).
Constructor and Description |
---|
WorkflowTriggerBean() |
Modifier and Type | Method and Description |
---|---|
abstract void |
handleAfterProcessInstanceStart(WorkflowTriggerAfterProcessInstanceStartContext aContext)
This method is called to notify the creation of a workflow instance.
|
abstract void |
handleAfterWorkItemCreation(WorkflowTriggerAfterWorkItemCreationContext aContext)
This method is called when the workflow reaches a user task and creates its work items.
|
abstract void |
handleBeforeProcessInstanceTermination(WorkflowTriggerBeforeProcessInstanceTerminationContext aContext)
This method is called to notify the completion of a workflow instance.
|
abstract void |
handleBeforeWorkItemAllocation(WorkflowTriggerBeforeWorkItemAllocationContext aContext)
This method is called to notify the allocation of a work item.
|
abstract void |
handleBeforeWorkItemDeallocation(WorkflowTriggerBeforeWorkItemDeallocationContext aContext)
This method is called to notify the deallocation of a work item.
|
abstract void |
handleBeforeWorkItemReallocation(WorkflowTriggerBeforeWorkItemReallocationContext aContext)
This method is called to notify the reallocation of a work item.
|
abstract void |
handleBeforeWorkItemStart(WorkflowTriggerBeforeWorkItemStartContext aContext)
This method is called to notify the start of a work item.
|
abstract void |
handleBeforeWorkItemTermination(WorkflowTriggerBeforeWorkItemTerminationContext aContext)
This method is called to notify the termination of a work item.
|
public abstract void handleAfterProcessInstanceStart(WorkflowTriggerAfterProcessInstanceStartContext aContext) throws OperationException
When this method is called, workflow instance is fully initialized and the token is in the "to execute" state (this means that the workflow instance has not yet begun the first step).
aContext
- the context of the workflow instance.OperationException
- This exception may be thrown to notify an error. The workflow instance and
token are then deleted. If the workflow is a sub-workflow, the parent workflow is set
to the
"error" state and all its other sub-workflows are also deleted.public abstract void handleBeforeProcessInstanceTermination(WorkflowTriggerBeforeProcessInstanceTerminationContext aContext) throws OperationException
More specifically, this method is called when one of the following occurs:
If the workflow termination is forced by an administration action all its sub-workflows triggers will be recursively called.
aContext
- the context of the workflow instance.OperationException
- This exception may be thrown to notify an error. The workflow instance's
token is then set to the "error" state and the workflow is not terminated.
An administrator can correct the issue and the force termination using menus "Force termination" or "Terminate and clean". This method will then be called again. The workflow instance will not terminate until this method executes normally.
public abstract void handleAfterWorkItemCreation(WorkflowTriggerAfterWorkItemCreationContext aContext) throws OperationException
aContext
- the context of the work item.OperationException
- This exception may be thrown to notify an error.
In this case, all work items already created for the current user task are deleted.
The action menu "Replay the step" must be used to relaunch the user task. Until then,
the workflow will
be halted.public abstract void handleBeforeWorkItemStart(WorkflowTriggerBeforeWorkItemStartContext aContext) throws OperationException
More specifically, this method is called when a user opens a work item for the first time using the button "Take and Start" (if the work item is offered to the user) or "Start" (if the work item is allocated to the user).
aContext
- the context of the work item.OperationException
- This exception may be thrown to notify an error. If an error occurs, the work item
is not started and stays in the current state. It will need to be started again until
this
method succeeds.public abstract void handleBeforeWorkItemAllocation(WorkflowTriggerBeforeWorkItemAllocationContext aContext) throws OperationException
More specifically, this method is called when one of the following occurs:
aContext
- the context of the work item.OperationException
- This exception may be thrown to notify an error. If an error occurs, the work item
is not allocated and stays in the current state. It will need to be
allocated again until this method succeeds.public abstract void handleBeforeWorkItemDeallocation(WorkflowTriggerBeforeWorkItemDeallocationContext aContext) throws OperationException
More specifically, this method is called when an administrator deallocates a work item using the administration action "Deallocate".
aContext
- the context of the work item.OperationException
- This exception may be thrown to notify an error. If an error occurs, the work item
is not deallocated and stays in the current state. The work item needs to be
deallocated again
until this method succeeds.public abstract void handleBeforeWorkItemReallocation(WorkflowTriggerBeforeWorkItemReallocationContext aContext) throws OperationException
More specifically, this method is called when an administrator reallocates a work item using the administration action "Reallocate".
aContext
- the context of the work item.OperationException
- This exception may be thrown to notify an error. If an error occurs, the work item
is not reallocated and stays in the current state. The work item needs to be
reallocated again
until this method succeeds.public abstract void handleBeforeWorkItemTermination(WorkflowTriggerBeforeWorkItemTerminationContext aContext) throws OperationException
More specifically, this method is called when a user completes a work item using the button "Accept" or 'Reject".
aContext
- the context of the work item.OperationException
- This exception may be thrown to notify an error. If an error occurs, the work item
is not terminated and stays in the current state. Previous action needs to be
resubmitted
until this method succeeds.