package com.vci.server.workflow.server.event; import java.util.ArrayList; import java.util.List; import org.jbpm.api.listener.EventListenerExecution; import com.vci.common.objects.UserEntity; import com.vci.corba.common.VCIError; import com.vci.server.workflow.dao.FlowInstanceDaoImpl; import com.vci.server.workflow.objects.FlowInstance; import com.vci.server.workflow.objects.PLFlowObject; import com.vci.server.workflow.server.template.ProcessTemplateService; public class BaseRmStatusListener { String codeName = ""; public void doAction(EventListenerExecution eventListenerExecution, String fields, String values,String operType) throws Exception { String outcome = (String) eventListenerExecution.getProcessInstance().getVariable("OUTCOME"); String userName = (String) eventListenerExecution.getProcessInstance().getVariable("userName"); String userIP = (String) eventListenerExecution.getProcessInstance().getVariable("userIP"); String userModule = (String) eventListenerExecution.getProcessInstance().getVariable("userModule"); UserEntity user = new UserEntity(); user.setIp(userIP); user.setModule(userModule); user.setUserName(userName); if ("不同意".equals(outcome)) { return; } String id = eventListenerExecution.getId(); // String id = eventListenerExecution.getProcessInstance().getId(); FlowInstanceDaoImpl impl = new FlowInstanceDaoImpl(); String hql = "from FlowInstance t where t.executionid = ?"; FlowInstance flowInstance = impl.findEntity(hql, new Object[]{id}); String tableName = flowInstance.getTableName(); List list = new ArrayList(); List flowObjects = new ProcessTemplateService().getFlowObjectByExecutionId(id); for (PLFlowObject flowObject : flowObjects) { list.add(flowObject.getPlobjectid()); } // TemplateService service = new TemplateService(user); // for (String ploid : list) { // try{ // service.updateDynamicTable(ploid, tableName, new String[] { fields }, new String[] { values }, "", 0, 0, "",operType,"工作流"); // }catch(VCIError e) { // throw new VCIError(320215, new String[] { e.getCause().getMessage() }); // } // } // if(false){ // new TemplateClientDelegate().deleteResourceCopy(id, "normal"); // } } //恢复资源到发起流程之前的状态, 删除,启用,停用流程需要调用该方法 protected void restoreStatus(EventListenerExecution eventListenerExecution) throws Exception { String outcome = (String) eventListenerExecution.getProcessInstance().getVariable("OUTCOME"); if ("不同意".equals(outcome)) { return; } String id = eventListenerExecution.getProcessInstance().getId(); // new ProcessTemplateService().restoreStatus(id); } }