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