1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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);
    }
 
}