- All Known Subinterfaces:
HumanTaskWorkItem
public interface WorkItem
Represents one unit of work that needs to be executed. It contains all the
information that it necessary to execute this unit of work as parameters, and
(possibly) results related to its execution.
WorkItems represent a unit of work in an abstract, high-level and
implementation-independent manner. They are created by the engine whenever an
external task needs to be performed. The engine will delegate the work item
to the appropriate
WorkItemHandler for execution. Whenever a
work item is completed (or whenever the work item cannot be executed and
should be aborted), the work item manager should be notified.
For example, a work item could be created whenever an email needs to be sent.
This work item would have a name that represents the type of work that needs
to be executed (e.g. "Email") and parameters related to its execution (e.g.
"From" = "me@mail.com", "To" = ..., "Body" = ..., ...). Result parameters can
contain results related to the execution of this work item (e.g. "Success" =
true).- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanEnforces given policies on this work item.Returns timestamp indicating the completion date of this work itemgetId()The unique id of this work itemgetName()The name of the work item.The node instance that is associated with this work itemgetParameter(String name) Returns the value of the parameter with the given name.Returns the map of parameters of this work item.The id of the parent process instance that requested the execution of this work itemReturns optional life cycle phase id associated with this work itemReturns optional life cycle phase status associated with this work itemThe id of the process that requested the execution of this work itemThe process instance that requested the execution of this work itemThe id of the process instance that requested the execution of this work itemReturns the value of the result parameter with the given name.Returns the map of result parameters of this work item.Returns timestamp indicating the start date of this work itemintgetState()The state of the work item.voidsetCompleteDate(Date date) voidsetNodeInstance(NodeInstance nodeInstance) voidsetPhaseId(String phaseId) voidsetPhaseStatus(String phaseStatus) voidsetProcessId(String id) voidsetProcessInstance(ProcessInstance processInstance) voidsetStartDate(Date date)
-
Field Details
-
PENDING
static final int PENDING- See Also:
-
ACTIVE
static final int ACTIVE- See Also:
-
COMPLETED
static final int COMPLETED- See Also:
-
ABORTED
static final int ABORTED- See Also:
-
RETRYING
static final int RETRYING- See Also:
-
FAILED
static final int FAILED- See Also:
-
-
Method Details
-
getId
String getId()The unique id of this work item- Returns:
- the id of this work item
-
getName
String getName()The name of the work item. This represents the type of work that should be executed.- Returns:
- the name of the work item
-
getState
int getState()The state of the work item.- Returns:
- the state of the work item
-
getParameter
Returns the value of the parameter with the given name. Parameters can be used to pass information necessary for the execution of this work item. Returnsnullif the parameter cannot be found.- Parameters:
name- the name of the parameter- Returns:
- the value of the parameter
-
getParameters
Returns the map of parameters of this work item. Parameters can be used to pass information necessary for the execution of this work item.- Returns:
- the map of parameters of this work item
-
getResult
Returns the value of the result parameter with the given name. Result parameters can be used to pass information related the result of the execution of this work item. Returnsnullif the result cannot be found.- Parameters:
name- the name of the result parameter- Returns:
- the value of the result parameter
-
getResults
Returns the map of result parameters of this work item. Result parameters can be used to pass information related the result of the execution of this work item.- Returns:
- the map of results of this work item
-
getProcessInstanceId
String getProcessInstanceId()The id of the process instance that requested the execution of this work item- Returns:
- the id of the related process instance
-
getParentProcessInstanceId
String getParentProcessInstanceId()The id of the parent process instance that requested the execution of this work item- Returns:
- the id of the related parent process instance or null if there is no parent process instance
-
getProcessId
String getProcessId()The id of the process that requested the execution of this work item- Returns:
- the id of the related process
-
getPhaseId
String getPhaseId()Returns optional life cycle phase id associated with this work item- Returns:
- optional life cycle phase id
-
getPhaseStatus
String getPhaseStatus()Returns optional life cycle phase status associated with this work item- Returns:
- optional life cycle phase status
-
getStartDate
Date getStartDate()Returns timestamp indicating the start date of this work item- Returns:
- start date
-
getCompleteDate
Date getCompleteDate()Returns timestamp indicating the completion date of this work item- Returns:
- completion date
-
getNodeInstance
NodeInstance getNodeInstance()The node instance that is associated with this work item- Returns:
- the related node instance
-
getProcessInstance
ProcessInstance getProcessInstance()The process instance that requested the execution of this work item- Returns:
- the related process instance
-
setPhaseId
-
setPhaseStatus
-
setStartDate
-
setCompleteDate
-
setNodeInstance
-
setProcessInstance
-
enforce
Enforces given policies on this work item. It must false in case of any policy violations.- Parameters:
policies- optional policies to be enforced- Returns:
- return true if this work item can enforce all policies otherwise false
-
setProcessId
-