04-13-2011 04:11 AM
04-14-2011 03:36 AM
04-15-2011 08:51 AM
The Resource class is used to specify resources that can be referenced by Activities. These Resources can beFor our prototype Activiti-implementation I'm currently using a generic TaskListener to get the old JPDL swimlane functionality:
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.
<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.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.
04-18-2011 03:17 AM
04-22-2011 03:57 AM
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 beFor our prototype Activiti-implementation I'm currently using a generic TaskListener to get the old JPDL swimlane functionality:
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.<userTask …>Here 'employees' is the swimlane name and 'employee' the group name.
<extensionElements>
<activiti:taskListener event="create" expression="${taskListenerBean.onCreate(task, 'employees', 'employee')}"/>
<activiti:taskListener event="assignment" expression="${taskListenerBean.onAssign(task, 'employees')}"/>
</extensionElements>
</userTask>
The TaskListener looks like this:public class TaskListener {This seems to work pretty well. However it would still be nice to have a more 'declarative' way of doing this.
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());
}
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.