Difference between revisions of "Use of task node"
Line 18: | Line 18: | ||
* '''Handler''': Here you can specify a class which implements the [http://docs.jboss.com/jbpm/v3.2/javadoc-jpdl/org/jbpm/taskmgmt/def/AssignmentHandler.html AssignmentHandler] interface. This class assigns a [http://docs.jboss.com/jbpm/v3.2/javadoc-jpdl/org/jbpm/taskmgmt/exe/TaskInstance.html TaskInstance] or a [http://docs.jboss.com/jbpm/v3.2/javadoc-jpdl/org/jbpm/taskmgmt/exe/SwimlaneInstance.html SwimlaneInstance] to an swimlaneActorId or a set of [http://docs.jboss.com/jbpm/v3.2/javadoc-jpdl/org/jbpm/taskmgmt/exe/PooledActor.html PooledActors]. | * '''Handler''': Here you can specify a class which implements the [http://docs.jboss.com/jbpm/v3.2/javadoc-jpdl/org/jbpm/taskmgmt/def/AssignmentHandler.html AssignmentHandler] interface. This class assigns a [http://docs.jboss.com/jbpm/v3.2/javadoc-jpdl/org/jbpm/taskmgmt/exe/TaskInstance.html TaskInstance] or a [http://docs.jboss.com/jbpm/v3.2/javadoc-jpdl/org/jbpm/taskmgmt/exe/SwimlaneInstance.html SwimlaneInstance] to an swimlaneActorId or a set of [http://docs.jboss.com/jbpm/v3.2/javadoc-jpdl/org/jbpm/taskmgmt/exe/PooledActor.html PooledActors]. | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <?xml version="1.0" encoding="UTF-8"?> | ||
+ | <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="task"> | ||
+ | |||
+ | <start-state name="start"> | ||
+ | <transition to="task"></transition> | ||
+ | </start-state> | ||
+ | |||
+ | <task-node name="task"> | ||
+ | <task name="something_to_do"> | ||
+ | <assignment actor-id="yoda"></assignment> | ||
+ | </task> | ||
+ | <transition to="end"></transition> | ||
+ | </task-node> | ||
+ | |||
+ | <end-state name="end"></end-state> | ||
+ | |||
+ | </process-definition> | ||
+ | </source> | ||
[[Category: Workflow Guide]] | [[Category: Workflow Guide]] | ||
[[Category: OKM Network]] | [[Category: OKM Network]] |
Revision as of 19:32, 15 January 2012
Now we are going to see how you can create task in jBPM and assign them to actors who will perfom the task. Actors also can select a pending task and assign to himself.
First of let's create a process definition called "task" with an initial node, a task node and a end node:
As seen previously, a task node represents one or many tasks executed by a human person. When the process execution arrives to a task node, an task instance is created in the workflow member list. This node will enter in a wait state until the user notify the conclusion of the task.
In order to create a task in a task node, go to the properties of this node. In the tasks table click on the right mouse button and select New Task. Give a name to this task, for example "something_to_do" and a optional description. In the Assignment tab we can see different ways to assign a task:
- Actor: Here we put the actorId. This is a String which identify the actor who will perform the task. When the process flow enters in the task node, the task is created and is added to the list of this actor's pending task.
- Pooled Actor:
- Swimlane: A swimlane defines an asigment which is the same for several tasks in a process.
- Expression: This is an assignment expression evalued by the jBPM identity component. Can make assignment by user or role.
- Handler: Here you can specify a class which implements the AssignmentHandler interface. This class assigns a TaskInstance or a SwimlaneInstance to an swimlaneActorId or a set of PooledActors.
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="task">
<start-state name="start">
<transition to="task"></transition>
</start-state>
<task-node name="task">
<task name="something_to_do">
<assignment actor-id="yoda"></assignment>
</task>
<transition to="end"></transition>
</task-node>
<end-state name="end"></end-state>
</process-definition>