activiti 5.10 笔记3

  今天遇到个问题,就是并行的servicetask后,马上是一个usertask,在这个usetask中,要得到servicetask中保存的变量,做法其实很简单如下:




public class Databasecheck implements JavaDelegate {
	private Logger logger = LoggerFactory.getLogger(getClass());
	public void execute(DelegateExecution execution) throws Exception {

             String str="ok";
          execution.setVariable("databasecheck", str);

}



然后在usetask中,这样获得:
 

ProcessInstance processInstance=this.activitimanager.findProcessInstanceByTaskId(taskid);

		String databasecheck=(String)this.activitimanager.getRuntimeService().getVariable(processInstance.getId(), "databasecheck");
		System.out.println("获得的参数为"+databasecheck);


   很简单吧,呵呵

你可能感兴趣的:(activiti 5.10 笔记3)