package com.vci.server.workflow.server.event;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import org.jbpm.api.listener.EventListener;
|
import org.jbpm.api.listener.EventListenerExecution;
|
import org.jbpm.api.model.OpenProcessInstance;
|
|
import com.vci.common.objects.UserEntity;
|
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 RmDeleteStatusListener implements EventListener {
|
|
/**
|
* 删除
|
*/
|
private static final long serialVersionUID = 1L;
|
|
public void notify(EventListenerExecution eventlistenerexecution) throws Exception {
|
// restoreStatus(eventlistenerexecution);
|
// doAction(eventlistenerexecution, "PLISDEL", "1");
|
OpenProcessInstance processInstance = eventlistenerexecution.getProcessInstance();
|
String outcome = (String) processInstance.getVariable("OUTCOME");
|
String userName = (String) processInstance.getVariable("userName");
|
String userIP = (String) processInstance.getVariable("userIP");
|
String userModule = (String) processInstance.getVariable("userModule");
|
String deploymentId = (String) processInstance.getVariable("deploymentId");
|
UserEntity user = new UserEntity();
|
user.setIp(userIP);
|
user.setModule(userModule);
|
user.setUserName(userName);
|
|
FlowInstanceDaoImpl impl = new FlowInstanceDaoImpl();
|
|
if ("不同意".equals(outcome)) {
|
return;
|
}
|
|
|
|
|
String id = processInstance.getId();
|
|
String hql = "from FlowInstance t where t.executionid = ?";
|
FlowInstance flowInstance = impl.findEntity(hql, new Object[]{id});
|
String tableName = flowInstance.getTableName();
|
|
List<String> list = new ArrayList<String>();
|
List<PLFlowObject> flowObjects = new ProcessTemplateService().getFlowObjectByExecutionId(id);
|
for (PLFlowObject flowObject : flowObjects) {
|
list.add(flowObject.getPlobjectid());
|
}
|
|
|
/*TemplateService service = new TemplateService(user);
|
for (String ploid : list) {
|
// service.updateDynamicTable(ploid, tableName, new String[] { fields }, new String[] { values }, "", 0, 0, "");
|
// String tableName = (String)JbpmEngine.getProcessEngine().getExecutionService().getVariable(id, "TABLENAME");
|
int nValue = service.deleteDateDynamicTable(ploid, tableName,true);
|
int a =1;
|
}*/
|
// new TemplateClientDelegate().deleteResourceCopy(id, "normal");
|
// new OAListenerENDCommon().notifyOA(eventlistenerexecution);
|
}
|
|
}
|