【JBPM4】任务节点-任务分配swimlane

swimlane泳道,几个任务受理人相同的任务节点,可以划分为一个泳道

JPDL


<?xml version="1.0" encoding="UTF-8"?>

<process key="task" name="task" xmlns="http://jbpm.org/4.4/jpdl">
<swimlane assignee="U1" name="mySwim"/>
<start g="243,29,48,48" name="start1">
<transition g="-63,-11" name="提交到任务A" to="任务A"/>
</start>
<end g="242,333,48,48" name="end1"/>
<task g="224,115,92,52" name="任务A" swimlane="mySwim">
<transition g="-65,-14" name="提交到任务B" to="任务B"/>
</task>
<task assignee="U2" g="427,115,92,52" name="任务B">
<transition g="-83,-14" name="提交到任务C" to="任务C"/>
</task>
<task g="222,207,92,52" name="任务C" swimlane="mySwim">
<transition g="-62,-25" name="通过" to="end1"/>
</task>
</process>


流程操作代码与前一章相同

部署流程

repositoryService.createDeployment().addResourceFromClasspath("com/tgb/node/task/task.jpdl.xml").deploy();
创建流程实例

//流程部署KEY
ProcessInstance processInstance = executionService.startProcessInstanceByKey("task");
print("流程实例ID",processInstance.getId());

获取当前节点
//流程实例ID
String name = executionService.createProcessInstanceQuery().processInstanceId("task.290001").uniqueResult().findActiveActivityNames().toString();
print("当前节点名词:",name);

获得任务列表
List<Task> tasks = taskService.findPersonalTasks("A");
print("任务数量",tasks.size());
print("任务名词",tasks.get(0).getActivityName());
print("任务ID",tasks.get(0).getId());

完成任务
//任务ID
taskService.completeTask("290002");

posted @ 2014-03-03 09:26  濤叔  阅读(1035)  评论(0编辑  收藏  举报