1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.rule;
17
18 import org.kuali.rice.kew.framework.postprocessor.DeleteEvent;
19 import org.kuali.rice.kew.framework.postprocessor.DocumentRouteLevelChange;
20 import org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange;
21 import org.kuali.rice.kew.framework.postprocessor.ProcessDocReport;
22 import org.kuali.rice.kew.postprocessor.DefaultPostProcessor;
23 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
24 import org.kuali.rice.kew.routeheader.service.RouteHeaderService;
25 import org.kuali.rice.kew.rule.service.RuleServiceInternal;
26 import org.kuali.rice.kew.service.KEWServiceLocator;
27 import org.kuali.rice.kew.api.KewApiConstants;
28
29
30
31
32
33
34
35
36
37
38 public class RulePostProcessor extends DefaultPostProcessor {
39
40 public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception {
41 DocumentRouteHeaderValue routeHeader = getRouteHeaderService().getRouteHeader(statusChangeEvent.getDocumentId());
42
43 if (KewApiConstants.ROUTE_HEADER_PROCESSED_CD.equals(routeHeader.getDocRouteStatus())) {
44 getRuleService().makeCurrent(routeHeader.getDocumentId());
45 }
46 return new ProcessDocReport(true, "");
47 }
48
49 public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception {
50 return new ProcessDocReport(true, "");
51 }
52
53 public ProcessDocReport doDeleteRouteHeader(DeleteEvent event) throws Exception {
54 return new ProcessDocReport(true, "");
55 }
56
57 public String getVersion() throws Exception {
58 return "";
59 }
60
61 private RouteHeaderService getRouteHeaderService() {
62 return (RouteHeaderService) KEWServiceLocator.getService(KEWServiceLocator.DOC_ROUTE_HEADER_SRV);
63 }
64
65 private RuleServiceInternal getRuleService() {
66 return (RuleServiceInternal) KEWServiceLocator.getService(KEWServiceLocator.RULE_SERVICE);
67 }
68
69 }