Skip to main content

Task Outcomes

A TaskElement defines its possible results as task outcomes. Each outcome is mapped to an end state by the transition that executes the task. Task outcomes replace the isBranchingTask option of the workflow componentWorkflow Component (WorkflowComponent). A component for configuring automated process execution., which indicated a task could have more than one result. This option however assumes the task implementation itself will decide the end-state of a task. The task should be independent of target state. This is solved with task outcomes. The following is an example of a task with multiple outcomes.

ValidateConstruction.xml
<taskElement name="ValidateConstruction">
<packageName>net.demo</packageName>
<targetElement component="village" name="House"/>
<taskElementType name="Standard"/>
<transactionType name="atomicInternal"/>
<outcomes>
<taskOutcome name="Safe"/>
<taskOutcome name="Unstable"/>
<taskOutcome name="Unfinished"/>
</outcomes>
</taskElement>

Not only does this clearly specify the outcome of the task, it also ensures the task implementation is decoupled from the target state. This makes it possible to reuse tasks where possible while not harming separation of state. While the naming should already be clear, a description can be added to the model as well.

ValidateConstruction.xml
<taskElement name="ValidateConstruction">
...
<outcomes>
<taskOutcome name="Safe">
<description>The construction was complete and has been deemed safe by the inspector.</description>
</taskOutcome>
</outcomes>
</taskElement>