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

}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值