001/**
002 * Copyright 2005-2016 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 */
016package org.kuali.rice.krad.workflow.postprocessor;
017
018import org.apache.log4j.Logger;
019import org.kuali.rice.kew.api.action.ActionType;
020import org.kuali.rice.kew.framework.postprocessor.ActionTakenEvent;
021import org.kuali.rice.kew.framework.postprocessor.AfterProcessEvent;
022import org.kuali.rice.kew.framework.postprocessor.BeforeProcessEvent;
023import org.kuali.rice.kew.framework.postprocessor.DeleteEvent;
024import org.kuali.rice.kew.framework.postprocessor.DocumentLockingEvent;
025import org.kuali.rice.kew.framework.postprocessor.DocumentRouteLevelChange;
026import org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange;
027import org.kuali.rice.kew.framework.postprocessor.PostProcessor;
028import org.kuali.rice.kew.framework.postprocessor.ProcessDocReport;
029import org.kuali.rice.krad.service.KRADServiceLocatorInternal;
030
031import java.util.List;
032
033
034/**
035 * 
036 * This class is the public entry point by which workflow communicates status changes, 
037 * level changes, and other useful changes.
038 * 
039 * Note that this class delegates all of these activities to the PostProcessorService, 
040 * which does the actual work.  This is done to ensure proper transaction scoping, and 
041 * to resolve some issues present otherwise.
042 * 
043 * Because of this, its important to understand that a transaction will be started at 
044 * the PostProcessorService method call, so any work that needs to be done within the 
045 * same transaction needs to happen inside that service implementation, rather than 
046 * in here.
047 * 
048 */
049public class KualiPostProcessor implements PostProcessor {
050
051    private static Logger LOG = Logger.getLogger(KualiPostProcessor.class);
052
053    /**
054     * 
055     * @see org.kuali.rice.kew.framework.postprocessor.PostProcessor#doRouteStatusChange(org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange)
056     */
057    @Override
058    public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception {
059        return KRADServiceLocatorInternal.getPostProcessorService().doRouteStatusChange(statusChangeEvent);
060    }
061
062    /**
063     * @see org.kuali.rice.kew.framework.postprocessor.PostProcessor#doActionTaken(org.kuali.rice.kew.framework.postprocessor.ActionTakenEvent)
064     */
065    @Override
066    public ProcessDocReport doActionTaken(ActionTakenEvent event) throws Exception {
067        return KRADServiceLocatorInternal.getPostProcessorService().doActionTaken(event);
068    }
069
070    /**
071     * @see org.kuali.rice.kew.framework.postprocessor.PostProcessor#afterActionTaken(org.kuali.rice.kew.api.action.ActionType, org.kuali.rice.kew.framework.postprocessor.ActionTakenEvent)
072     */
073    @Override
074    public ProcessDocReport afterActionTaken(ActionType performed, ActionTakenEvent event) throws Exception {
075        return KRADServiceLocatorInternal.getPostProcessorService().afterActionTaken(performed, event);
076    }
077
078    /**
079     * 
080     * @see org.kuali.rice.kew.framework.postprocessor.PostProcessor#doDeleteRouteHeader(org.kuali.rice.kew.framework.postprocessor.DeleteEvent)
081     */
082    @Override
083    public ProcessDocReport doDeleteRouteHeader(DeleteEvent event) throws Exception {
084        return KRADServiceLocatorInternal.getPostProcessorService().doDeleteRouteHeader(event);
085    }
086
087    /**
088     * 
089     * @see org.kuali.rice.kew.framework.postprocessor.PostProcessor#doRouteLevelChange(org.kuali.rice.kew.framework.postprocessor.DocumentRouteLevelChange)
090     */
091    @Override
092    public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception {
093        return KRADServiceLocatorInternal.getPostProcessorService().doRouteLevelChange(levelChangeEvent);
094    }
095
096    /**
097     * @see org.kuali.rice.kew.framework.postprocessor.PostProcessor#beforeProcess(org.kuali.rice.kew.framework.postprocessor.BeforeProcessEvent)
098     */
099    @Override
100    public ProcessDocReport beforeProcess(BeforeProcessEvent beforeProcessEvent) throws Exception {
101        return KRADServiceLocatorInternal.getPostProcessorService().beforeProcess(beforeProcessEvent);
102    }
103
104    /**
105     * @see org.kuali.rice.kew.framework.postprocessor.PostProcessor#afterProcess(org.kuali.rice.kew.framework.postprocessor.AfterProcessEvent)
106     */
107    @Override
108    public ProcessDocReport afterProcess(AfterProcessEvent afterProcessEvent) throws Exception {
109        return KRADServiceLocatorInternal.getPostProcessorService().afterProcess(afterProcessEvent);
110    }
111
112    /**
113     * @see org.kuali.rice.kew.framework.postprocessor.PostProcessor#getDocumentIdsToLock(org.kuali.rice.kew.framework.postprocessor.DocumentLockingEvent)
114     */
115    @Override
116        public List<String> getDocumentIdsToLock(DocumentLockingEvent documentLockingEvent) throws Exception {
117                return KRADServiceLocatorInternal.getPostProcessorService().getDocumentIdsToLock(documentLockingEvent);
118        }
119
120}