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