001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    
017    package org.kuali.kfs.sys.document.workflow;
018    
019    import java.rmi.RemoteException;
020    
021    import org.apache.log4j.Logger;
022    import org.kuali.kfs.sys.context.SpringContext;
023    import org.kuali.rice.kew.dto.ActionTakenEventDTO;
024    import org.kuali.rice.kew.dto.AfterProcessEventDTO;
025    import org.kuali.rice.kew.dto.BeforeProcessEventDTO;
026    import org.kuali.rice.kew.dto.DeleteEventDTO;
027    import org.kuali.rice.kew.dto.DocumentLockingEventDTO;
028    import org.kuali.rice.kew.dto.DocumentRouteLevelChangeDTO;
029    import org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO;
030    import org.kuali.rice.kew.postprocessor.PostProcessorRemote;
031    import org.kuali.rice.kns.service.PostProcessorService;
032    
033    /**
034     * This class is the public entry point by which workflow communicates status changes, level changes, and other useful changes. Note
035     * that this class delegates all of these activities to the PostProcessorService, which does the actual work. This is done to ensure
036     * proper transaction scoping, and to resolve some issues present otherwise. Because of this, its important to understand that a
037     * transaction will be started at the PostProcessorService method call, so any work that needs to be done within the same
038     * transaction needs to happen inside that service implementation, rather than in here.
039     */
040    public class PostProcessor implements PostProcessorRemote {
041    
042        private static Logger LOG = Logger.getLogger(PostProcessor.class);
043    
044        public Long[] getDocumentIdsToLock(DocumentLockingEventDTO arg0) throws Exception {
045            return SpringContext.getBean(PostProcessorService.class).getDocumentIdsToLock(arg0);
046        }
047    
048        /**
049         * @see org.kuali.rice.kew.clientapp.PostProcessorRemote#doRouteStatusChange(org.kuali.rice.kew.clientapp.vo.DocumentRouteStatusChangeDTO)
050         */
051        public boolean doRouteStatusChange(DocumentRouteStatusChangeDTO statusChangeEvent) throws RemoteException {
052            return SpringContext.getBean(PostProcessorService.class).doRouteStatusChange(statusChangeEvent);
053        }
054    
055        /**
056         * @see org.kuali.rice.kew.clientapp.PostProcessorRemote#doActionTaken(org.kuali.rice.kew.clientapp.vo.ActionTakenEventDTO)
057         */
058        public boolean doActionTaken(ActionTakenEventDTO event) throws RemoteException {
059            return SpringContext.getBean(PostProcessorService.class).doActionTaken(event);
060        }
061    
062        /**
063         * @see org.kuali.rice.kew.clientapp.PostProcessorRemote#doDeleteRouteHeader(org.kuali.rice.kew.clientapp.vo.DeleteEventDTO)
064         */
065        public boolean doDeleteRouteHeader(DeleteEventDTO event) throws RemoteException {
066            return SpringContext.getBean(PostProcessorService.class).doDeleteRouteHeader(event);
067        }
068    
069        /**
070         * @see org.kuali.rice.kew.clientapp.PostProcessorRemote#doRouteLevelChange(org.kuali.rice.kew.clientapp.vo.DocumentRouteLevelChangeDTO)
071         */
072        public boolean doRouteLevelChange(DocumentRouteLevelChangeDTO levelChangeEvent) throws RemoteException {
073            return SpringContext.getBean(PostProcessorService.class).doRouteLevelChange(levelChangeEvent);
074        }
075    
076        public boolean afterProcess(AfterProcessEventDTO arg0) throws Exception {
077            return true;
078        }
079    
080        public boolean beforeProcess(BeforeProcessEventDTO arg0) throws Exception {
081            return true;
082        }
083    }