01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.routetemplate;
18:
19: import edu.iu.uis.eden.DocumentRouteLevelChange;
20: import edu.iu.uis.eden.DocumentRouteStatusChange;
21: import edu.iu.uis.eden.EdenConstants;
22: import edu.iu.uis.eden.KEWServiceLocator;
23: import edu.iu.uis.eden.clientapp.DeleteEvent;
24: import edu.iu.uis.eden.postprocessor.DefaultPostProcessor;
25: import edu.iu.uis.eden.postprocessor.PostProcessor;
26: import edu.iu.uis.eden.postprocessor.ProcessDocReport;
27: import edu.iu.uis.eden.routeheader.DocumentRouteHeaderValue;
28: import edu.iu.uis.eden.routeheader.RouteHeaderService;
29:
30: /**
31: * The {@link PostProcessor} implementation for rules. Delegates to the
32: * {@link RuleService#makeCurrent(Long)} method.
33: *
34: * @see RuleService#makeCurrent(Long)
35: *
36: * @author jhopf
37: */
38: public class RulePostProcessor extends DefaultPostProcessor {
39:
40: public ProcessDocReport doRouteStatusChange(
41: DocumentRouteStatusChange statusChangeEvent)
42: throws Exception {
43: DocumentRouteHeaderValue routeHeader = getRouteHeaderService()
44: .getRouteHeader(statusChangeEvent.getRouteHeaderId());
45:
46: if (EdenConstants.ROUTE_HEADER_PROCESSED_CD.equals(routeHeader
47: .getDocRouteStatus())) {
48: getRuleService()
49: .makeCurrent(routeHeader.getRouteHeaderId());
50: }
51: return new ProcessDocReport(true, "");
52: }
53:
54: public ProcessDocReport doRouteLevelChange(
55: DocumentRouteLevelChange levelChangeEvent) throws Exception {
56: return new ProcessDocReport(true, "");
57: }
58:
59: public ProcessDocReport doDeleteRouteHeader(DeleteEvent event)
60: throws Exception {
61: return new ProcessDocReport(true, "");
62: }
63:
64: public String getVersion() throws Exception {
65: return "";
66: }
67:
68: private RouteHeaderService getRouteHeaderService() {
69: return (RouteHeaderService) KEWServiceLocator
70: .getService(KEWServiceLocator.DOC_ROUTE_HEADER_SRV);
71: }
72:
73: private RuleService getRuleService() {
74: return (RuleService) KEWServiceLocator
75: .getService(KEWServiceLocator.RULE_SERVICE);
76: }
77:
78: }
|