<?xml version="1.0" encoding="UTF-8"?>
<process-definition
xmlns="urn:jbpm.org:jpdl-3.1" name="MyRequest">
<start-state name="SS_Request">
<transition name="" to="TN_WriteRequest"></transition>
</start-state>
<task-node name="TN_WriteRequest">
<task name="Task_WriteRequest">
<controller>
<variable name="dayCount" access="read,write,required"></variable>
</controller>
<assignment class="com.myrequest.task.WriteRequestAssignmentHandler"></assignment>
</task>
<transition name="Tr_WriteLeave" to="Fork_request">
<action name="Ac_WriteLeave" class="com.myrequest.action.WriteLeaveActionHandler"></action>
</transition>
</task-node>
<fork name="Fork_request">
<transition name="Tr_Cancel" to="TN_RequesterCancel"></transition>
<transition name="Tr_Request" to="Deci_IsChiefHere">
<action name="Ac_GetChiefState" class="com.myrequest.action.GetChiefStateActionHandler"></action>
</transition>
</fork>
<decision name="Deci_IsChiefHere">
<handler class="com.myrequest.decision.IsChiefHereDecisionHandler"/>
<transition name="Tr_Chief" to="TN_ChiefDecide"></transition>
<transition name="Tr_Boss" to="TN_BossDecide"></transition>
</decision>
<task-node name="TN_RequesterCancel">
<task name="Task_CancelRequest">
<assignment class="com.myrequest.task.CancelRequestAssignmentHandler"></assignment>
</task>
<transition name="Tr_RequestCancel" to="Join_Request">
<action name="Ac_RequestCancel" class="com.myrequest.action.RequestCancelActionHandler"></action>
</transition>
</task-node>
<task-node name="TN_ChiefDecide">
<task name="Task_ChiefDecide">
<assignment class="com.myrequest.task.ChiefDecideAssignmentHandler"></assignment>
</task>
<transition name="Tr_ChiefApprove" to="Deci_NeedBossDecide">
<action name="Ac_ChiefApprove" class="com.myrequest.action.ChiefApproveActionHandler"></action>
</transition>
<transition name="Tr_ChiefNotApprove" to="Join_Request">
<action name="Ac_ChiefNotApprove" class="com.myrequest.action.ChiefNotApproveActionHandler"></action>
</transition>
</task-node>
<decision name="Deci_NeedBossDecide">
<handler class="com.myrequest.decision.NeedBossDecideDecisionHandler"/>
<transition name="Tr_Need" to="TN_BossDecide"></transition>
<transition name="Tr_NotNeed" to="Join_Request">
<action name="Ac_NotNeed" class="com.myrequest.action.NotNeedActionHandler"></action>
</transition>
</decision>
<task-node name="TN_BossDecide">
<task name="Task_BossDecide">
<assignment class="com.myrequest.task.BossDecideAssignmentHandler"></assignment>
</task>
<transition name="Tr_BossApprove" to="Join_Request">
<action name="Ac_BossApprove" class="com.myrequest.action.BossApproveActionHandler"></action>
</transition>
<transition name="Tr_BossNotApprove" to="Join_Request">
<action name="Ac_BossNotApprove" class="com.myrequest.action.BossNotApproveActionHandler"></action>
</transition>
</task-node>
<join name="Join_Request">
<transition name="Tr_Join" to="Deci_DoSomething"></transition>
</join>
<decision name="Deci_DoSomething">
<handler class="com.myrequest.decision.DoSomethingDecisionHandler"/>
<transition name="Tr_Approve" to="ES_Finished">
<action name="Ac_Approve" class="com.myrequest.action.ApproveActionHandler"></action>
</transition>
<transition name="Tr_NotApprove" to="ES_Finished">
<action name="Ac_NotApprove" class="com.myrequest.action.NotApproveActionHandler"></action>
</transition>
<transition name="Tr_Cancel" to="ES_Finished">
<action name="Ac_Cancel" class="com.myrequest.action.CancelActionHandler"></action>
</transition>
</decision>
<end-state name="ES_Finished">
<event type="node-enter">
<action name="Ac_Finished" class="com.myrequest.action.FinishedActionHandler"></action>
</event>
</end-state>
</process-definition>
下面是他的调用。。。。用JUnit 实现。分别是普通的内存数据库,和真实的数据。
下面用的是内存数据的JUNIT。。。。。
package com.myrequest;
import org.jbpm.graph.node.*;
import java.io.FileInputStream;
import java.util.*;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.taskmgmt.*;
import org.jbpm.identity.*;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.taskmgmt.exe.*;
import junit.framework.TestCase;
import com.myrequest.*;public class ApproveActionHandler extends TestCase {
ProcessDefinition pdf;
ProcessInstance pi;
String userId;boolean isChiefHere;
public void setUp() {
userId = "dust";
isChiefHere = true;
}
public void test14DayAndChiefApproveAndUserCancel() throws Exception {
this.deployProcessDefinition();
this.createProcessInstance();
System.out.println("+++++++++++++++++++++++++++++++++++++++");
this.userWriteRequest(14);
System.out.println("+++++++++++++++++++++++++++++++++++++++");
this.chiefDecide(true);
System.out.println("+++++++++++++++++++++++++++++++++++++++");
this.userCancel();
System.out.println("+++++++++++++++++++++++++++++++++++++++");
this.checkTasks();
System.out.println("+++++++++++++++++++++++++++++++++++++++");
}
/*
public void test14DayAndBossNotApprove() throws Exception {
this.deployProcessDefinition();
this.createProcessInstance();
this.userWriteRequest(14);
this.chiefDecide(true);
this.bossDecide(false);
this.checkTasks();
}
public void test4DayAndChiefApprove() throws Exception {this.deployProcessDefinition();
this.createProcessInstance();
this.userWriteRequest(4);
this.chiefDecide(true);
this.checkTasks();
}
*/
protected void deployProcessDefinition() throws Exception {System.out.println("==MyRequestProcessTest.deployProcessDefinition()==");
FileInputStream fis = new FileInputStream(
"E://JAVA_PROJECT//workspace//jbpm.3//src//java.jbpm//com//myrequest//processdefinition.xml");
pdf = ProcessDefinition.parseXmlInputStream(fis);
assertNotNull("Definition should not be null", pdf);
}protected void createProcessInstance() throws Exception {
System.out.println("==MyRequestProcessTest.createProcessInstance()==");
assertNotNull("Definition should not be null", pdf);
pi = new ProcessInstance(pdf);
assertNotNull("processInstance should not be null", pi);
Join join_Request = (Join) pi.getProcessDefinition().getNode(
"Join_Request");
assertNotNull("should find join_request node !", join_Request);
join_Request.setDiscriminator(true);
// 设置申请人
pi.getContextInstance().createVariable(RequestVariable.userId,
this.userId);
// 设置流程运行是,部门主管是否在岗
pi.getContextInstance().createVariable(RequestVariable.isChiefHere,
new Boolean(this.isChiefHere));
// 启动流程
pi.getRootToken().signal();
System.out.println("==MyRequestProcessTest.createProcessInstance()==");
}/**
*
* @param daycount
* 请假天数
*
*/protected void userWriteRequest(int daycount) {
System.out.println("++++++++++++++++++++++ MyRequestProcessTest.userWriteRequest()++++++++++++++++++++++ ");
TaskMgmtInstance taskMgmtInstance = pi.getTaskMgmtInstance();
TaskInstance wr = (TaskInstance) taskMgmtInstance
.getTaskInstances().iterator().next();
System.out.println("++++++++++++++++++++++ MyRequestProcessTest.userWriteRequest()++++++++++++++++++++++ ");
assertEquals(this.userId, wr.getActorId());
System.out.println("++++++++++++++++++++++ MyRequestProcessTest.userWriteRequest()++++++++++++++++++++++ ");
ContextInstance ci = pi.getContextInstance();
System.out.println("++++++++++++++++++++++ MyRequestProcessTest.userWriteRequest()++++++++++++++++++++++ ");
ci.setVariable("dayCount", new Integer(daycount));
System.out.println("++++++++++++++++++++++ MyRequestProcessTest.userWriteRequest()++++++++++++++++++++++ ");
wr.end();
System.out.println("++++++++++++++++++++++ userWrite Task end ++++++++++++++++++++++");
}/**
*
* @param isApprove
* 部门主管是否同意请假
*
*/protected void chiefDecide(boolean isApprove) {
System.out.println("==MyRequestProcessTest.chiefDecide()==");
// String chiefId="today123";
/**
*
* 如果后台使用数据库的话,就可以使用
*
* org.jbpm.db.TaskMgmtSession.findTaskInstances(java.lang.String
* actorId) 得到所有分配给chiefId的taskInstance
*
*/
Collection coll = pi.getTaskMgmtInstance().getTaskInstances();
Iterator it = coll.iterator();
while (it.hasNext()) {
TaskInstance ti = (TaskInstance) it.next();
if (ti.getName().equals("Task_ChiefDecide")) {
assertEquals("today123", ti.getActorId());
if (isApprove)
ti.end("Tr_ChiefApprove");
elseti.end("Tr_ChiefNotApprove");
return;
}
}
}
/**
*
* @param isApprove
* 老板是否同意请假
*
*/
protected void bossDecide(boolean isApprove) {
System.out.println("==MyRequestProcessTest.bossDecide()==");
// String bossId="elena";
/**
*
* 如果后台使用数据库的话,就可以使用
*
* org.jbpm.db.TaskMgmtSession.findTaskInstances(java.lang.String
* actorId) 得到所有分配给bossId的taskInstance
*
*/
Collection coll = pi.getTaskMgmtInstance().getTaskInstances();
Iterator it = coll.iterator();while (it.hasNext()) {
TaskInstance ti = (TaskInstance) it.next();
if (ti.getName().equals("Task_BossDecide")) {
assertEquals("elena", ti.getActorId());
if (isApprove)
ti.end("Tr_BossApprove");
else
ti.end("Tr_BossNotApprove");
return;
}
}
}protected void userCancel() {
System.out.println("==MyRequestProcessTest.userCancel()==");
/**
*
* 如果后台使用数据库的话,就可以使用
*
* org.jbpm.db.TaskMgmtSession.findTaskInstances(java.lang.String
* actorId) 得到所有分配给userid的taskInstance
*
*/
Collection coll = pi.getTaskMgmtInstance().getTaskInstances();
Iterator it = coll.iterator();while (it.hasNext()) {
TaskInstance ti = (TaskInstance) it.next();
if (ti.getName().equals("Task_CancelRequest")) {
assertEquals(this.userId, ti.getActorId());
ti.end();
return;
}
}
}protected void checkTasks() {
System.out.println("==MyRequestProcessTest.checkTasks()==");
Collection coll = pi.getTaskMgmtInstance().getTaskInstances();
Iterator it = coll.iterator();
System.out.println("====Process has task:====");while (it.hasNext()) {
TaskInstance ti = (TaskInstance) it.next();
System.out.println("==" + ti.getName() + "==");
System.out.println("==" + ti.getActorId() + "==");
System.out.println("==" + ti.getVariables().toString() + "==");
}
System.out.println("====end====");
}}
下面的使用的ORACLE 9 的数据库做为的后台。。。
package com.myrequest;
import org.jbpm.JbpmConfiguration;
import org.jbpm.JbpmContext;
import org.jbpm.graph.node.*;
import java.io.FileInputStream;
import java.util.*;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.taskmgmt.*;
import org.jbpm.identity.*;
import org.jbpm.context.exe.ContextInstance;
import org.jbpm.db.GraphSession;
import org.jbpm.taskmgmt.exe.*;
import junit.framework.TestCase;
import com.myrequest.*;public class ApproveActionHandler_db extends TestCase
{
static JbpmConfiguration jbpmConfiguration = null;static {
// An example configuration file such as this can be found in
// 'src/config.files'. Typically the configuration information is in the
// resource file 'jbpm.cfg.xml', but here we pass in the configuration
// information as an XML string.
// First we create a JbpmConfiguration statically. One JbpmConfiguration
// can be used for all threads in the system, that is why we can safely
// make it static.jbpmConfiguration = JbpmConfiguration.parseXmlString(
"<jbpm-configuration>" +
// A jbpm-context mechanism separates the jbpm core
// engine from the services that jbpm uses from
// the environment.
" <jbpm-context>" +
" <service name='persistence' " +
" factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
" </jbpm-context>" +
// Also all the resource files that are used by jbpm are
// referenced from the jbpm.cfg.xml
" <string name='resource.hibernate.cfg.xml' " +
" value='hibernate.cfg.xml' />" +
" <string name='resource.business.calendar' " +
" value='org/jbpm/calendar/jbpm.business.calendar.properties' />" +
" <string name='resource.default.modules' " +
" value='org/jbpm/graph/def/jbpm.default.modules.properties' />" +
" <string name='resource.converter' " +
" value='org/jbpm/db/hibernate/jbpm.converter.properties' />" +
" <string name='resource.action.types' " +
" value='org/jbpm/graph/action/action.types.xml' />" +
" <string name='resource.node.types' " +
" value='org/jbpm/graph/node/node.types.xml' />" +
" <string name='resource.varmapping' " +
" value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
"</jbpm-configuration>"
);
}boolean isChiefHere;
String userId = "";
long processInstant_id;
public void setUp() {
userId = "dust";
isChiefHere = true;
}public void test14DayAndBossNotApprove() throws Exception {
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
//this.deployProcessDefinition();
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
this.createProcessInstance();
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
System.out.println("----------------------------------------------------------------");
this.userWriteRequest(14);
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
System.out.println("----------------------------------------------------------------");
this.chiefDecide(true);
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
this.bossDecide(false);
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");this.checkTasks();
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
System.out.println("****************************************************************");
/*
*/
}
/*
public void test4DayAndChiefApprove() throws Exception {this.deployProcessDefinition();
this.createProcessInstance();
this.userWriteRequest(4);
this.chiefDecide(true);
this.checkTasks();
}public void test14DayAndChiefApproveAndUserCancel() throws Exception {
this.deployProcessDefinition();
this.createProcessInstance();
this.userWriteRequest(14);
this.chiefDecide(true);
this.userCancel();
this.checkTasks();
}
*/
protected void deployProcessDefinition() throws Exception {System.out.println("==MyRequestProcessTest.deployProcessDefinition()==");
ProcessDefinition processDefinition = null;
FileInputStream fis = new FileInputStream(
"E://JAVA_PROJECT//workspace//jbpm.3//src//java.jbpm//com//myrequest//processdefinition.xml");
processDefinition = ProcessDefinition.parseXmlInputStream(fis);
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
// Deploy the process definition in the database
jbpmContext.deployProcessDefinition(processDefinition);
jbpmContext.close();
assertNotNull("Definition should not be null", processDefinition);
}protected void createProcessInstance() throws Exception {
System.out.println("==MyRequestProcessTest.createProcessInstance()==");
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition =
graphSession.findLatestProcessDefinition("MyRequest");
assertNotNull("Definition should not be null", processDefinition);
ProcessInstance processInstance =
new ProcessInstance(processDefinition);
assertNotNull("processInstance should not be null", processInstance);
this.processInstant_id = processInstance.getId();
Join join_Request = (Join) processInstance.getProcessDefinition().getNode(
"Join_Request");
assertNotNull("should find join_request node !", join_Request);
join_Request.setDiscriminator(true);
// 设置申请人
processInstance.getContextInstance().createVariable(RequestVariable.userId,
this.userId);
processInstance.getContextInstance().createVariable(RequestVariable.isChiefHere,
new Boolean(this.isChiefHere));
// 启动流程
processInstance.getRootToken().signal();
jbpmContext.save(processInstance);
jbpmContext.close();
/*
System.out.println("==MyRequestProcessTest.createProcessInstance()==");
assertNotNull("Definition should not be null", pdf);
pi = new ProcessInstance(pdf);
assertNotNull("processInstance should not be null", pi);
Join join_Request = (Join) pi.getProcessDefinition().getNode(
"Join_Request");
assertNotNull("should find join_request node !", join_Request);
join_Request.setDiscriminator(true);
// 设置申请人
pi.getContextInstance().createVariable(RequestVariable.userId,
this.userId);
// 设置流程运行是,部门主管是否在岗
pi.getContextInstance().createVariable(RequestVariable.isChiefHere,
new Boolean(this.isChiefHere));
// 启动流程
pi.getRootToken().signal();
*/
}
/**
*
* @param daycount
* 请假天数
*
*/protected void userWriteRequest(int daycount) {
System.out.println("==MyRequestProcessTest.userWriteRequest()==");
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition =
graphSession.findLatestProcessDefinition("MyRequest");
assertNotNull("Definition should not be null", processDefinition);
List processInstances =
graphSession.findProcessInstances(processDefinition.getId());
ProcessInstance processInstance =
(ProcessInstance) processInstances.get(0);
long id = processInstance.getId();
System.out.println("processInstance id:" + id);
assertNotNull("processInstance should not be null", processInstance);
//System.out.println("processInstance:" + processInstance.getId());
TaskMgmtInstance taskMgmtInstance = processInstance.getTaskMgmtInstance();System.out.println("****************************************************************");
TaskInstance wr = (TaskInstance) taskMgmtInstance
.getTaskInstances().iterator().next();
System.out.println("****************************************************************");
assertEquals(this.userId, wr.getActorId());
ContextInstance ci = processInstance.getContextInstance();
ci.setVariable("dayCount", new Integer(daycount));
wr.end();
processInstance.signal();
jbpmContext.save(processInstance);
jbpmContext.close();
}/**
*
* @param isApprove
* 部门主管是否同意请假
*
*/protected void chiefDecide(boolean isApprove)
{
System.out.println("==MyRequestProcessTest.chiefDecide()==");
// String chiefId="today123";
/**
*
* 如果后台使用数据库的话,就可以使用
*
* org.jbpm.db.TaskMgmtSession.findTaskInstances(java.lang.String
* actorId) 得到所有分配给chiefId的taskInstance
*
*/
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition =
graphSession.findLatestProcessDefinition("MyRequest");
assertNotNull("Definition should not be null", processDefinition);
List processInstances =
graphSession.findProcessInstances(processDefinition.getId());
ProcessInstance processInstance =
(ProcessInstance) processInstances.get(0);assertNotNull("processInstance should not be null", processInstance);
Collection coll = processInstance.getTaskMgmtInstance().getTaskInstances();
Iterator it = coll.iterator();
while (it.hasNext()) {
TaskInstance ti = (TaskInstance) it.next();
if (ti.getName().equals("Task_ChiefDecide")) {
assertEquals("today123", ti.getActorId());
if (isApprove)
ti.end("Tr_ChiefApprove");
elseti.end("Tr_ChiefNotApprove");
return;
}
}
processInstance.signal();
jbpmContext.save(processInstance);
jbpmContext.close();
}
/**
*
* @param isApprove
* 老板是否同意请假
*
*/
protected void bossDecide(boolean isApprove) {
System.out.println("==MyRequestProcessTest.bossDecide()==");
// String bossId="elena";
/**
*
* 如果后台使用数据库的话,就可以使用
*
* org.jbpm.db.TaskMgmtSession.findTaskInstances(java.lang.String
* actorId) 得到所有分配给bossId的taskInstance
*
*/
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition =
graphSession.findLatestProcessDefinition("MyRequest");
assertNotNull("Definition should not be null", processDefinition);
ProcessInstance processInstance = graphSession.getProcessInstance(this.processInstant_id);assertNotNull("processInstance should not be null", processInstance);
Collection coll = processInstance.getTaskMgmtInstance().getTaskInstances();
Iterator it = coll.iterator();while (it.hasNext()) {
TaskInstance ti = (TaskInstance) it.next();
if (ti.getName().equals("Task_BossDecide")) {
assertEquals("elena", ti.getActorId());
if (isApprove)
ti.end("Tr_BossApprove");
else
ti.end("Tr_BossNotApprove");
break;
}
}
processInstance.signal();
jbpmContext.save(processInstance);
jbpmContext.close();
}protected void userCancel() {
System.out.println("==MyRequestProcessTest.userCancel()==");
/**
*
* 如果后台使用数据库的话,就可以使用
*
* org.jbpm.db.TaskMgmtSession.findTaskInstances(java.lang.String
* actorId) 得到所有分配给userid的taskInstance
*
*/
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition =
graphSession.findLatestProcessDefinition("MyRequest");
assertNotNull("Definition should not be null", processDefinition);
ProcessInstance processInstance = graphSession.getProcessInstance(this.processInstant_id);assertNotNull("processInstance should not be null", processInstance);
Collection coll = processInstance.getTaskMgmtInstance().getTaskInstances();
Iterator it = coll.iterator();while (it.hasNext()) {
TaskInstance ti = (TaskInstance) it.next();
if (ti.getName().equals("Task_CancelRequest")) {
assertEquals(this.userId, ti.getActorId());
ti.end();
break;
}
}
processInstance.signal();
jbpmContext.save(processInstance);
jbpmContext.close();}
protected void checkTasks() {
System.out.println("==MyRequestProcessTest.checkTasks()==");
JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition =
graphSession.findLatestProcessDefinition("MyRequest");
assertNotNull("Definition should not be null", processDefinition);
ProcessInstance processInstance = graphSession.getProcessInstance(this.processInstant_id);assertNotNull("processInstance should not be null", processInstance);
Collection coll = processInstance.getTaskMgmtInstance().getTaskInstances();
Iterator it = coll.iterator();
System.out.println("====Process has task:====");while (it.hasNext()) {
TaskInstance ti = (TaskInstance) it.next();
System.out.println("==" + ti.getName() + "==");
System.out.println("==" + ti.getActorId() + "==");
System.out.println("==" + ti.getVariables().toString() + "==");
}
processInstance.signal();
jbpmContext.save(processInstance);
jbpmContext.close();
System.out.println("====end====");
}
}