Activiti如何替换已部署流程图
LD is tigger forever,CG are not brothers forever, throw the pot and shine forever.
Modesty is not false, solid is not naive, treacherous but not deceitful, stay with good people, and stay away from poor people.
talk is cheap, show others the code and KPI, Keep progress,make a better result.
Survive during the day and develop at night。
目录
概 述
第一种方法:设置流程变量
/**
* 设置流程变量数据
*/
@Test
public void setVariableValues(){
RuntimeService runtimeService=processEngine.getRuntimeService(); // 任务Service
String executionId="90001";
runtimeService.setVariable(executionId, "days", 2);
runtimeService.setVariable(executionId, "date", new Date());
runtimeService.setVariable(executionId, "reason", "发烧");
Student student=new Student();
student.setId(1);
student.setName("张三");
runtimeService.setVariable(executionId, "student", student); // 存序列化对象
}
/**
* 获取流程变量数据
*/
@Test
public void getVariableValues(){
RuntimeService runtimeService=processEngine.getRuntimeService(); // 任务Service
String executionId=“102501”;
Integer days=(Integer) runtimeService.getVariable(executionId, “days”);
Date date=(Date) runtimeService.getVariable(executionId, “date”);
String reason=(String) runtimeService.getVariable(executionId, “reason”);
Student student=(Student) runtimeService.getVariable(executionId, “student”);
System.out.println(“请假天数:”+days);
System.out.println(“请假日期:”+date);
System.out.println(“请假原因:”+reason);
System.out.println(“请假对象:”+student.getId()+","+student.getName());
}
分析:
小结
:而RuntimeService绑定的是act_ru_execution表的executionId。任务ID随着任务节点的变化而变化,而executionId一般不会改变。
同样,用RuntimeService设置的值同样在接下来的流程都可以获取,知道流程结束
通过Activiti 流程部署方式 activi 动态部署,请大家指正~
参考资料和推荐阅读
1.链接: 参考资料.