cancel
Showing results for 
Search instead for 
Did you mean: 

laneset of activiti

lykm02
Champ in-the-making
Champ in-the-making
I am looking for something like swimlane in jbpm from activiti.
But I can't find it in the user guide.
I find a attribute of process is laneset.
My question is laneset is supported now?
Or something else provided by activiti to instead of swimlane(jbpm)?
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
There is currently no counterpart of the swimlane functionality, as it does not match any of the BPMN 2.0 constructs.

The only thing you could do is store the assignment in a process variable and use it through your process.

marcus1
Champ in-the-making
Champ in-the-making
Aren't BPMN 2.0 Resources pretty much comparable to JPDL swimlanes?

The spec isnt very detailed on Resources, but it does seem similar to me:
The Resource class is used to specify resources that can be referenced by Activities. These Resources can be
Human Resources as well as any other resource assigned to Activities during Process execution time.
The definition of a Resource is “abstract,” because it only defines the Resource, without detailing how e.g., actual
user IDs are associated at runtime. Multiple Activities can utilize the same Resource.
For our prototype Activiti-implementation I'm currently using a generic TaskListener to get the old JPDL swimlane functionality:
<userTask …>
  <extensionElements>
    <activiti:taskListener event="create" expression="${taskListenerBean.onCreate(task, 'employees', 'employee')}"/>
    <activiti:taskListener event="assignment" expression="${taskListenerBean.onAssign(task, 'employees')}"/>
  </extensionElements>
</userTask>
Here 'employees' is the swimlane name and 'employee' the group name.

The TaskListener looks like this:
public class TaskListener {
public void onCreate(DelegateTask task, String swimlane, String group) {
  if (task.getAssignee() == null) {
   String varName = "sl_" + swimlane;
   String userName = (String) task.getExecution().getVariable(varName);
   if (userName == null) {
    task.addCandidateGroup(group);
   }
   else {
    task.setAssignee(userName);
   }
  }
}
public void onAssign(DelegateTask task, String swimlane) {
  String varName = "sl_" + swimlane;
  task.getExecution().setVariable(varName, task.getAssignee());
}
}
This seems to work pretty well. However it would still be nice to have a more 'declarative' way of doing this.

jbarrez
Star Contributor
Star Contributor
@Marcus: that's indeed the workaround I had in mind too. Thanks for posting!

We've had the discussion also internally: what does the resource point too? The spec is indeed not very clear there.
The big question is whether a resource is something like 'the manager', which is stateless and is recolved every time it is used. Ie 'the manager' for me is something else then 'the manager' for you, if we have different managers.
The other interpretation is that a resource has 'memory', like swimlanes.

In the end we decided that the first interpretation is the most BPMN-like. And hence it doesnt add much value, hence we didnt implement it yet.

lykm02
Champ in-the-making
Champ in-the-making
Thanks. The solution is much elegant.

Aren't BPMN 2.0 Resources pretty much comparable to JPDL swimlanes?

The spec isnt very detailed on Resources, but it does seem similar to me:
The Resource class is used to specify resources that can be referenced by Activities. These Resources can be
Human Resources as well as any other resource assigned to Activities during Process execution time.
The definition of a Resource is “abstract,” because it only defines the Resource, without detailing how e.g., actual
user IDs are associated at runtime. Multiple Activities can utilize the same Resource.
For our prototype Activiti-implementation I'm currently using a generic TaskListener to get the old JPDL swimlane functionality:
<userTask …>
  <extensionElements>
    <activiti:taskListener event="create" expression="${taskListenerBean.onCreate(task, 'employees', 'employee')}"/>
    <activiti:taskListener event="assignment" expression="${taskListenerBean.onAssign(task, 'employees')}"/>
  </extensionElements>
</userTask>
Here 'employees' is the swimlane name and 'employee' the group name.

The TaskListener looks like this:
public class TaskListener {
public void onCreate(DelegateTask task, String swimlane, String group) {
  if (task.getAssignee() == null) {
   String varName = "sl_" + swimlane;
   String userName = (String) task.getExecution().getVariable(varName);
   if (userName == null) {
    task.addCandidateGroup(group);
   }
   else {
    task.setAssignee(userName);
   }
  }
}
public void onAssign(DelegateTask task, String swimlane) {
  String varName = "sl_" + swimlane;
  task.getExecution().setVariable(varName, task.getAssignee());
}
}
This seems to work pretty well. However it would still be nice to have a more 'declarative' way of doing this.