User's Manual

138 Chapter 11. Services Tutorials
11.4.2. Adding a Task to a Workflow
To add a task, you call the addTask method in workflow. The task is inactive when created, and can
be set to be active by calling the setActive(true). A task is not considered part of the workflow
until it becomes active. Tasks are created in an inactive state to allow you to preview them before
altering the workflow state.
Once a task is active, it can affect the workflow and other dependent tasks. Manually setting the task
state is required only when adding a new task to an in-progress workflow. When the workflow is
started, it will automatically set all tasks as active.
11.4.3. Rolling Back a Task
Rolling back a process to a certain task is done by enabling a task early on in the workflow. For
example, to move the process to task A:
//Get reference to task A
taskA.enable();
This will set the workflow back to the state that preceded finishing task A.
11.4.4. Completing a Task
When a task is enabled, call the finish method to complete it:
//Get reference to task A and call finish method
taskA.finish();
11.5. Versioning Tutorial
For a high-level overview and the basic definition of versioning, please refer to Section 4.11 Versioning
Service.
Conceptually, versioning can be divided into two parts:
1. One part concerns PDL syntax that allows the developer to declaratively request certain object
types to be versioned.
2. The other part consists of the Java API provided by the com.arsdigita.versioning pack-
age. This API provides classes and methods for interacting with and making use of the version-
ing service.
This tutorial explains the PDL syntax first, with examples covered in Section 11.5.5 PDL Syntax. If
you wish to skip ahead, you can go directly to Section 11.5.4 Versioning service API.
The implementation and semantics of the versioning service have changed in a number of major ways
after the 5.2 release. If you are familiar with the older implementation and would like a brief summary
of the major differences between the old and current implementations, please refer to Section 11.5.6
Differences between WAF 5.2 and 6.0.
11.5.1. Data-Object-Level Service
The versioning service operates on the data object level. Putting the versioned keyword in front of
the object type definition makes all instances of this type versioned. For example: