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.kew.framework.postprocessor;
017
018import org.kuali.rice.kew.api.action.ActionType;
019
020import java.util.List;
021
022
023
024/**
025 * Hook for applications to perform logic due to workflow events from the engine.
026 * 
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029public interface PostProcessor {
030
031        /**
032         * Executed whenever the status of the document changes.
033         * 
034         * @return ProcessDocReport indicating if the status change succeeded
035         */
036    public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception;
037    
038    /**
039         * Executed whenever the document transitions from one node to another.
040         * 
041         * @return ProcessDocReport indicating if the node transition succeeded
042         */
043    public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception;
044    
045    /**
046         * Executed whenever a deletion of the document is required.
047         * 
048         * @return ProcessDocReport indicating if the deletion should be permitted to occur or not
049         */
050    public ProcessDocReport doDeleteRouteHeader(DeleteEvent event) throws Exception;
051    
052    /**
053     * Executed whenever an action is taken against the document.
054     * 
055     * @return ProcessDocReport indicating whether or not the action should succeed
056     */
057    public ProcessDocReport doActionTaken(ActionTakenEvent event) throws Exception;
058
059    /**
060     * Executed after an action is taken against the document.
061     *
062     * @return ProcessDocReport indicating whether or not the action was successful
063     * @since 2.1
064     */
065    public ProcessDocReport afterActionTaken(ActionType actionPerformed, ActionTakenEvent event) throws Exception;
066    
067    /**
068     * Executed prior to processing by the workflow engine.
069     *
070     * @return ProcessDocReport indicating whether or not the document processing should be allowed to proceed
071     */
072    public ProcessDocReport beforeProcess(BeforeProcessEvent processEvent) throws Exception;
073
074    /**
075     * Executed after processing by the workflow engine has completed.
076     *
077     * @return ProcessDocReport indicating whether or not the document was successfully processed
078     */
079    public ProcessDocReport afterProcess(AfterProcessEvent processEvent) throws Exception;
080    
081    /**
082     * Executed prior to document locking in the workflow engine.  This method returns a List of document
083     * ids to lock prior to execution of the document in the workflow engine.  If the engine processing is
084     * going to result in updates to any other documents, they should be locked at the beginning of the engine
085     * processing transaction.  This method facilitates that.
086     * 
087     * <p>Note that, by default, the id of the document that is being processed by the engine is always
088     * locked.  So there is no need to return that document id in the list of document ids to lock.
089     * 
090     * @return a List of document ids to lock prior to execution of the workflow engine
091     */
092    public List<String> getDocumentIdsToLock(DocumentLockingEvent lockingEvent) throws Exception;
093    
094}