java学习

java学习

 

activiti设置流程变量的4中方案

/**
* 在启动流程实例时设置流程变量
*/
@org.junit.Test
public void testStartProcessInstanceByKey(){
String processDefinitionKey="qjlc";
Map<String,Object> variables = new HashMap<String, Object>();
variables.put("k1", 11);
variables.put("k2", 22);
ProcessInstance query = processEngine.getRuntimeService().startProcessInstanceByKey(processDefinitionKey, variables);
}
/**
* 在办理任务时设置流程变量
*/
@org.junit.Test
public void testTaskComplete(){
String taskId="6002";
Map<String,Object> variables = new HashMap<String, Object>();
variables.put("k3", 11);
variables.put("k4", 22);
processEngine.getTaskService().complete(taskId, variables);
}
/**
* RuntimeService设置流程变量
*/
@org.junit.Test
public void testRuntimeService(){
String executionId="5701";
Map<String,Object> variables = new HashMap<String, Object>();
variables.put("k5", 3);
variables.put("k6", 4);
processEngine.getRuntimeService().setVariables(executionId, variables);
}
/**
* taskService设置流程变量
*/
@org.junit.Test
public void testTaskService(){
String taskId="5804";
Map<String,Object> variables = new HashMap<String, Object>();
variables.put("k5", 31);
variables.put("k6", 41);
processEngine.getTaskService().setVariables(taskId, variables);
}

posted on 2017-08-28 17:15 杨军威 阅读(286) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜