Create your business process

Processes are defined by using JPDL definition language, we warmly suggest to read JBPM documentation to fully understand the module potential.

Twproject uses processes in a particular way that make possible the linearization discussed in chapter “3.11 Business processes”. In particular Twproject uses extensively “ActionHandlers” to synchronize fluxes and task trees.

Let’s examine the “sampleSimpleProjectProcess.xml”.

screen1132

First the process name. It must be unique; two processes with the same name are considered versions of the same process.

screen1133

Then the swimlane declaration. A swimlane represents the “role” played by an “actor”. In terms of Twproject “actors” are “resources” and when instantiating the process a resource will be assigne as actor for each node. Swimlane is a “local role”, so a swimlane’ name must correspond to existing local roles. In this example “Project manager”, “Customer”, “Worker” are all existing roles.

screen1134

Then we call TaskProcessFluxEndHandler when the process ends. When a process is instantiated, Twproject creates a root task and a child for every process step. This handler is responsible for closing the root on the project associated to the flux.

screen1135

This a real step of the process. Each “task-node” has a name that will be used as task name, assignments will be created for every swimlane involved in the step. Then there is the transition and two mandatory handlers, TaskProcessTaskNodeEnterHandler and TaskProcessTaskNodeLeaveHandler associated to node-enter and node-leave events respectively.

Both extend TaskProcessTaskNodeEventHandler. We will examine this class in detail.
Then the process end.
screen1136

In order to understand how Twproject and Flowork are related take a look to the TaskProcessTaskNodeEventHandler class:

screen1137
This is an abstract class that retrieves the link between “task” and “process” that is modeled via “TaskProcess” object, fills attributes and calls doTheRealAction that is implemented on TaskProcessTaskNodeEnterHandler and TaskProcessTaskNodeLeaveHandler.

screen1138

In this case when you are entering a step, the corresponding task’s status is set to “active”.

This is the minimal implementation, but if you want you can extends this classes to perform different actions. You can also add more than an action for every event.

Is it possible to also define the description of a task, not just the name?

Yes, of course. Here an example:

The first “description” tag content is used for task’s description; the second one for the assignment’s description.

Is it possible to give a default resource name that is proposed by Twproject when a process driven project is about to being created?
Yes, there are some classes that implements “ActorAssignmentHandler”.
In particular:
DefaultAssignmentHandler:  that uses the standard swimlane
DeclaredAssignmentHandler: that uses a “resource” parameter specified directly on the process definition file. Supports multiple resources comma delimited
InstantiatorSwimlaneAssignmentHandler: uses the resource that instantiate the process
ScaleToBossAssignmentHandler: uses the manager of the one executing the step

Twproject has  we added attributes to workflow descriptions that allow setting duration of tasks and estimations of assignments: