关闭

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

867人阅读 评论(0) 收藏 举报
分类:





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;
	}

}


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:90882次
    • 积分:1628
    • 等级:
    • 排名:千里之外
    • 原创:88篇
    • 转载:0篇
    • 译文:0篇
    • 评论:11条
    最新评论