001    /**
002     * Copyright 2005-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    package mocks;
017    
018    import java.util.List;
019    
020    import org.kuali.rice.kew.framework.postprocessor.ActionTakenEvent;
021    import org.kuali.rice.kew.framework.postprocessor.AfterProcessEvent;
022    import org.kuali.rice.kew.framework.postprocessor.BeforeProcessEvent;
023    import org.kuali.rice.kew.framework.postprocessor.DeleteEvent;
024    import org.kuali.rice.kew.framework.postprocessor.DocumentLockingEvent;
025    import org.kuali.rice.kew.framework.postprocessor.DocumentRouteLevelChange;
026    import org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange;
027    import org.kuali.rice.kew.framework.postprocessor.PostProcessor;
028    import org.kuali.rice.kew.framework.postprocessor.ProcessDocReport;
029    
030    public class MockPostProcessor implements PostProcessor {
031    
032        private boolean processDocReportResult = true;
033        private boolean actionTakenResult = true;
034        private boolean processMethodsDocReportResult = true;
035        private List<String> documentIdsToLockResult = null;
036        
037        public MockPostProcessor() {
038            this(true);
039        }
040        
041        public MockPostProcessor(boolean processDocReportResult) {
042            this(processDocReportResult, true);
043        }
044        
045        public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult) {
046            this(processDocReportResult, actionTakenResult, true);
047        }
048            
049        public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult, boolean processMethodsDocReportResult) {
050            this(processDocReportResult, actionTakenResult, processMethodsDocReportResult, null);
051        }
052        
053        public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult, boolean processMethodsDocReportResult, List<String> documentIdsToLockResult) {
054            this.processDocReportResult = processDocReportResult;
055            this.actionTakenResult = actionTakenResult;
056            this.processMethodsDocReportResult = processMethodsDocReportResult;
057            this.documentIdsToLockResult = documentIdsToLockResult;
058        }
059            
060        public ProcessDocReport doDeleteRouteHeader(DeleteEvent event) throws Exception {
061            return new ProcessDocReport(processDocReportResult, "testing");
062        }
063        public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception {
064            return new ProcessDocReport(processDocReportResult, "testing");
065        }
066        public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception {
067            return new ProcessDocReport(processDocReportResult, "testing");
068        }
069        
070        public ProcessDocReport doActionTaken(ActionTakenEvent event) throws Exception {
071            return new ProcessDocReport(actionTakenResult, "testing");
072            }
073    
074        public ProcessDocReport beforeProcess(BeforeProcessEvent event) throws Exception {
075            return new ProcessDocReport(processMethodsDocReportResult, "testing");
076        }
077    
078        public ProcessDocReport afterProcess(AfterProcessEvent event) throws Exception {
079            return new ProcessDocReport(processMethodsDocReportResult, "testing");
080        }
081    
082        public List<String> getDocumentIdsToLock(DocumentLockingEvent lockingEvent) throws Exception {
083                    return documentIdsToLockResult;
084            }
085    
086            public void setProcessDocReportResult(boolean processDocReportResult) {
087            this.processDocReportResult = processDocReportResult;
088        }
089    
090            public void setActionTakenResult(boolean actionTakenResult) {
091                    this.actionTakenResult = actionTakenResult;
092            }
093    
094        public void setProcessMethodsDocReportResult(boolean processMethodsDocReportResult) {
095            this.processMethodsDocReportResult = processMethodsDocReportResult;
096        }
097        
098        public void setDocumentIdsToLockResult(List<String> documentIdsToLockResult) {
099            this.documentIdsToLockResult = documentIdsToLockResult;
100        }
101    
102    }