View Javadoc
1   /*
2    * Copyright 2006-2008 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.kuali.ole.sys.document.workflow;
18  
19  import java.util.List;
20  
21  import org.apache.log4j.Logger;
22  import org.kuali.ole.sys.context.SpringContext;
23  import org.kuali.rice.kew.api.action.ActionType;
24  import org.kuali.rice.kew.framework.postprocessor.ActionTakenEvent;
25  import org.kuali.rice.kew.framework.postprocessor.AfterProcessEvent;
26  import org.kuali.rice.kew.framework.postprocessor.BeforeProcessEvent;
27  import org.kuali.rice.kew.framework.postprocessor.DeleteEvent;
28  import org.kuali.rice.kew.framework.postprocessor.DocumentLockingEvent;
29  import org.kuali.rice.kew.framework.postprocessor.DocumentRouteLevelChange;
30  import org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange;
31  import org.kuali.rice.kew.framework.postprocessor.ProcessDocReport;
32  import org.kuali.rice.krad.service.PostProcessorService;
33  
34  /**
35   * This class is the public entry point by which workflow communicates status changes, level changes, and other useful changes. Note
36   * that this class delegates all of these activities to the PostProcessorService, which does the actual work. This is done to ensure
37   * proper transaction scoping, and to resolve some issues present otherwise. Because of this, its important to understand that a
38   * transaction will be started at the PostProcessorService method call, so any work that needs to be done within the same
39   * transaction needs to happen inside that service implementation, rather than in here.
40   */
41  public class PostProcessor implements org.kuali.rice.kew.framework.postprocessor.PostProcessor {
42  
43      private static Logger LOG = Logger.getLogger(PostProcessor.class);
44  
45      public List<String> getDocumentIdsToLock(DocumentLockingEvent arg0) throws Exception {
46          return SpringContext.getBean(PostProcessorService.class).getDocumentIdsToLock(arg0);
47      }
48  
49      /**
50       * @see org.kuali.rice.kew.clientapp.PostProcessorRemote#doRouteStatusChange(org.kuali.rice.kew.clientapp.vo.DocumentRouteStatusChange)
51       */
52      public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception {
53          return SpringContext.getBean(PostProcessorService.class).doRouteStatusChange(statusChangeEvent);
54      }
55  
56      /**
57       * @see org.kuali.rice.kew.clientapp.PostProcessorRemote#doActionTaken(org.kuali.rice.kew.clientapp.vo.ActionTakenEventDTO)
58       */
59      public ProcessDocReport doActionTaken(ActionTakenEvent event) throws Exception {
60          return SpringContext.getBean(PostProcessorService.class).doActionTaken(event);
61      }
62  
63      /**
64       * @see org.kuali.rice.kew.clientapp.PostProcessorRemote#doDeleteRouteHeader(org.kuali.rice.kew.clientapp.vo.DeleteEventDTO)
65       */
66      public ProcessDocReport doDeleteRouteHeader(DeleteEvent event) throws Exception {
67          return SpringContext.getBean(PostProcessorService.class).doDeleteRouteHeader(event);
68      }
69  
70      /**
71       * @see org.kuali.rice.kew.clientapp.PostProcessorRemote#doRouteLevelChange(org.kuali.rice.kew.clientapp.vo.DocumentRouteLevelChangeDTO)
72       */
73      public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception {
74          return SpringContext.getBean(PostProcessorService.class).doRouteLevelChange(levelChangeEvent);
75      }
76  
77      public ProcessDocReport afterProcess(AfterProcessEvent arg0) throws Exception {
78          return new ProcessDocReport(true);
79      }
80  
81      public ProcessDocReport beforeProcess(BeforeProcessEvent arg0) throws Exception {
82          return new ProcessDocReport(true);
83      }
84  
85      @Override
86      public ProcessDocReport afterActionTaken(ActionType performed, ActionTakenEvent event) throws Exception {
87          return SpringContext.getBean(PostProcessorService.class).afterActionTaken(performed, event);
88      }
89  }