public abstract class UserTask extends Object
The definition and life cycle of work items is detailed in the chapter Work items.
If the user task's state is set to error (see methods below), the administrator must fix the issue, then restart the token.
This class is state-less, it is instantiated before invoking any of its methods below.
Modifier and Type | Class and Description |
---|---|
static class |
UserTask.CompletionStrategy
Defines the different strategies for work items completion.
|
static class |
UserTask.UserTaskMode
Represents the user task mode.
|
static interface |
UserTask.WorkItem
Defines the resulting state of a work item.
|
Constructor and Description |
---|
UserTask() |
Modifier and Type | Method and Description |
---|---|
void |
checkBeforeWorkItemCompletion(UserTaskBeforeWorkItemCompletionContext aContext)
This method is automatically invoked when the user clicks the 'accept' or the 'reject'
button to accept or reject the underlying interaction.
|
List<UserReference> |
getUsersForAllocation(UserTaskUsersForAllocationCollectorContext aContext)
This method is automatically invoked when a workflow administrator clicks the 'allocate' or 'reallocate'
administration action
of a work item.
|
void |
handleCreate(UserTaskCreationContext aContext)
This method is automatically executed when the control
flow reaches the user task, for creating and offering
(or allocating) work item(s).
|
void |
handleWorkItemCompletion(UserTaskWorkItemCompletionContext aContext)
This method is automatically invoked at work item completion
in order to decide whether the whole user task instance has been completed.
|
public void handleCreate(UserTaskCreationContext aContext) throws OperationException
In the default user task mode (single work items) if this method has not been overridden, its default behavior is to use the properties that are specified under the 'Offered to' node on the task definition. Concretely, when a work item is created:
In the legacy mode (multi work items), if this method has not been overridden, its default behavior is to use the properties that are specified under the 'Profiles' node on the task definition. Concretely, for each specified profile under this node, a work item is created and:
OperationException
- if any problem occurs; in this case, the user task is
set to an error state.IllegalStateException
- public void checkBeforeWorkItemCompletion(UserTaskBeforeWorkItemCompletionContext aContext)
By default, this method does nothing.
This method must be overridden when blocking checks are needed before the work item is actually completed.
SessionInteraction
public void handleWorkItemCompletion(UserTaskWorkItemCompletionContext aContext) throws OperationException
accepted
.
By default, this method completes the user task. Overriding this method gives the opportunity to write specific values to the process instance context.
In the legacy user task mode (multi work items), if this method has not been overridden, its default behavior is to use the properties that are specified under the 'Termination' node on the task definition Concretely:
UserTaskWorkItemCompletionContext.checkAllWorkItemMatchStrategy()
.
OperationException
(the user task is set to an error state).
Overriding this method gives the opportunity to write specific values to the process instance context or to refine the completion/rejection criteria.
Known limitation:
the data context of the process instance is only saved
at the completion of a user task, namely when the method
completeUserTask
is invoked.
The method DataContext.setVariableString(String, String)
is supposed to write variables to the data
context
of the process instance. However, in the case of multiple work items for a single user task, only the data
context
from the last work item to finish is actually written to the process instance context.
That is, none of the data context changes from previously finished work items have any effect.
Therefore, if incremental changes between work items in the same user task are necessary,
the data context changes must be saved in a specific technical table at each
work item completion.
At the completion of the user task, all these changes must be saved manually to the process instance context.
OperationException
- if any problem occurs or if the user task is rejected; in this case, the user task is
set to an error state.public List<UserReference> getUsersForAllocation(UserTaskUsersForAllocationCollectorContext aContext) throws OperationException
It is useful to overwrite this method to dynamically build the list of users instead of using the default list.
Implementation of this method may get the default list by calling
super.getUsersForAllocation(aContext)
and then remove
or add users
If an error occurs in this method, the error reason will be displayed to the user, and the users list will be hidden.
OperationException