/**
* 在启动流程实例时设置流程变量
*/
@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);
}