activiti 排他网管 :判断流程走向(十四)





package com.base.pf.m150workflow.f070task.controller;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.impl.el.FixedValue;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

import com.base.pf.m150workflow.f070task.service.TasksService;
import com.base.pf.m150workflow.f070task.service.VariableService;

/**
 * 排他网管:执行监听<br/>
 * 该类是为了根据业务ID,表名,字段,查询该业务值,来判断流程走向
 * 
 * @author ZHEN.L
 * 
 */
public class GateWayTaskListiner implements ExecutionListener {

	private static final long serialVersionUID = 102702298968012874L;

	private VariableService variableService;
	private TasksService tasksService;

	private FixedValue tableName; // 同流程图中名称
	private FixedValue tableField; // 同流程图中字段名称

	public void notify(DelegateExecution task) throws Exception {
		String table = String.valueOf(tableName.getValue(task));
		String field = String.valueOf(tableField.getValue(task));
		WebApplicationContext context = ContextLoader
				.getCurrentWebApplicationContext();
		tasksService = (TasksService) context.getBean("tasksService");
		variableService = (VariableService) context.getBean("variableService");
		String bussinessId = tasksService
				.findBussinessIdByProcessInstanceId(task.getProcessInstanceId());
		Object value = variableService.findVariable(table, field, bussinessId);
		task.setVariable(field, value);
	}

	public FixedValue getTableName() {
		return tableName;
	}

	public void setTableName(FixedValue tableName) {
		this.tableName = tableName;
	}

	public FixedValue getTableField() {
		return tableField;
	}

	public void setTableField(FixedValue tableField) {
		this.tableField = tableField;
	}

}


阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hichinamobile/article/details/51540525
个人分类: activiti
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

activiti 排他网管 :判断流程走向(十四)

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭