JBPM4.3 流程处理中设置流程中变量值

1.发起时:
 Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("var1", "1");
    variables.put("var2", "Malt");
    Execution execution = executionService.startProcessInstanceByKey("流程key", variables);


2.处理时候
    variables = new HashMap<String, Object>();
    variables.put("var1", 2);
    variables.put("var2", "Malt2");
    taskService.completeTask(taskId, variables);


3.任务存在时
    variables = new HashMap<String, Object>();
    variables.put("var1", 3);
    variables.put("var2", "Malt3");    
    taskService.setVariables(taskId, variables);


4.在任何时候都可以设置全局变量
    variables = new HashMap<String, Object>();
    variables.put("var1", 4);
    variables.put("var2", "Malt4");    
    executionService.setVariable(execution.getId(),variables);

猜你喜欢

转载自tianqiushi.iteye.com/blog/2097870