use of org.activiti.engine.RuntimeService in project tutorials-java by Artister.
the class RuntimeServiceTests method testVariables.
/**
* 测试修改参数
*/
@Deployment(resources = { "my-process.bpmn20.xml" })
@Test
public void testVariables() {
RuntimeService runtimeService = activitiRule.getRuntimeService();
Map<String, Object> variables = Maps.newHashMap();
variables.put("key1", "value1");
variables.put("key2", "value2");
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("my-process", variables);
logger.info("processInstance = {}", processInstance);
// 添加及修改变量
runtimeService.setVariable(processInstance.getId(), "key1", "change1");
runtimeService.setVariable(processInstance.getId(), "key3", "value3");
Map<String, Object> map = runtimeService.getVariables(processInstance.getId());
logger.info("map = {}", map);
}
use of org.activiti.engine.RuntimeService in project tutorials-java by Artister.
the class RuntimeServiceTests method testExecutionQuery.
/**
* 查询流程执行对象
*/
@Deployment(resources = { "my-process.bpmn20.xml" })
@Test
public void testExecutionQuery() {
RuntimeService runtimeService = activitiRule.getRuntimeService();
Map<String, Object> variables = Maps.newHashMap();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("my-process", variables);
logger.info("processInstance = {}", processInstance);
// 查询流程执行对象
ExecutionQuery executionQuery = runtimeService.createExecutionQuery();
List<Execution> executions = executionQuery.list();
for (Execution execution : executions) {
logger.info("execution = {}", execution);
}
}
Aggregations