【JBPM4】任务form表单

主要是在任务节点处保存一个链接地址(表单),方便在执行到此时取值,访问。

好处是XML可随时修改,部署。


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 form="localhost:8080/myApp/index.jsp" assignee="f1" g="224,115,92,52" name="任务A" >
<transition g="-65,-14" name="提交到任务B" to="任务B"/>
</task>
<task form="localhost:8080/myApp/indexB.jsp" assignee="f2" g="427,115,92,52" name="任务B">
<transition g="-83,-14" name="提交到任务C" to="任务C"/>
</task>
<task g="222,207,92,52" name="任务C" >
<transition g="-62,-25" name="通过" to="end1"/>
</task>
</process>


流程操作代码相同。

public void deploy() {
super.startUp();
repositoryService.createDeployment().addResourceFromClasspath("com/tgb/node/task/form/task4.jpdl.xml").deploy();
}

@Override
public void createInstance() {
super.startUp();
ProcessInstance processInstance = executionService.startProcessInstanceByKey("task");
print("流程实例ID",processInstance.getId());
}

@Override
public void getCurrectActivity() {
super.startUp();
String name = executionService.createProcessInstanceQuery().processInstanceId("task.500001").uniqueResult().findActiveActivityNames().toString();
print("当前节点名词:",name);
}

@Override
public void getTask() {
super.startUp();
List<Task> tasks = taskService.findPersonalTasks("f2");
print("任务数量",tasks.size());
print("任务名词",tasks.get(0).getActivityName());
print("任务ID",tasks.get(0).getId());
print("对应表单",tasks.get(0).getFormResourceName());
}

@Override
public void completeTask() {
super.startUp();
taskService.completeTask("500002");
}

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