package com.vci.server.workflow.event; import java.io.Serializable; import org.jbpm.api.listener.EventListener; import org.jbpm.api.listener.EventListenerExecution; import org.jbpm.api.model.OpenProcessInstance; import com.vci.common.log.ServerWithLog4j; import com.vci.corba.common.VCIError; import com.vci.corba.omd.data.BusinessObject; import com.vci.server.base.utility.ServerServiceProvider; /** * 流程事件基础结构 * @author xiongchao * */ public abstract class BaseEvent implements EventListener, Serializable{ /** * */ private static final long serialVersionUID = 7558509386989455685L; private EventListenerExecution ele = null; private OpenProcessInstance opi = null; private String[] objIds = null; private String btmName = null; @Override public void notify(EventListenerExecution e) throws Exception { try{ setEle(e); setOpi(e.getProcessInstance()); setObjIds((String[])e.getProcessInstance().getVariable("objId")); setBtmName((String)e.getProcessInstance().getVariable("boType")); doEvent(e); }catch(VCIError ex){ ServerWithLog4j.logger.error(ex); throw ex; }catch(Exception ex){ ServerWithLog4j.logger.error(ex); throw ex; } } public abstract void doEvent(EventListenerExecution e) throws Exception; public BusinessObject[] getBusinessObjects() throws VCIError{ return ServerServiceProvider.getBOFService().getBatchBusinessObject(objIds, btmName); } public EventListenerExecution getEle() { return ele; } public void setEle(EventListenerExecution ele) { this.ele = ele; } public OpenProcessInstance getOpi() { return opi; } public void setOpi(OpenProcessInstance opi) { this.opi = opi; } public String[] getObjIds() { return objIds; } public void setObjIds(String[] objIds) { this.objIds = objIds; } public String getBtmName() { return btmName; } public void setBtmName(String btmName) { this.btmName = btmName; } }