001 /* 002 * Copyright 2005-2007 The Kuali Foundation 003 * 004 * 005 * Licensed under the Educational Community License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.opensource.org/licenses/ecl2.php 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package mocks; 018 019 import java.util.List; 020 021 import org.kuali.rice.kew.postprocessor.ActionTakenEvent; 022 import org.kuali.rice.kew.postprocessor.AfterProcessEvent; 023 import org.kuali.rice.kew.postprocessor.BeforeProcessEvent; 024 import org.kuali.rice.kew.postprocessor.DeleteEvent; 025 import org.kuali.rice.kew.postprocessor.DocumentLockingEvent; 026 import org.kuali.rice.kew.postprocessor.DocumentRouteLevelChange; 027 import org.kuali.rice.kew.postprocessor.DocumentRouteStatusChange; 028 import org.kuali.rice.kew.postprocessor.PostProcessor; 029 import org.kuali.rice.kew.postprocessor.ProcessDocReport; 030 031 032 public class MockPostProcessor implements PostProcessor { 033 034 private boolean processDocReportResult = true; 035 private boolean actionTakenResult = true; 036 private boolean processMethodsDocReportResult = true; 037 private List<String> documentIdsToLockResult = null; 038 039 public MockPostProcessor() { 040 this(true); 041 } 042 043 public MockPostProcessor(boolean processDocReportResult) { 044 this(processDocReportResult, true); 045 } 046 047 public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult) { 048 this(processDocReportResult, actionTakenResult, true); 049 } 050 051 public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult, boolean processMethodsDocReportResult) { 052 this(processDocReportResult, actionTakenResult, processMethodsDocReportResult, null); 053 } 054 055 public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult, boolean processMethodsDocReportResult, List<String> documentIdsToLockResult) { 056 this.processDocReportResult = processDocReportResult; 057 this.actionTakenResult = actionTakenResult; 058 this.processMethodsDocReportResult = processMethodsDocReportResult; 059 this.documentIdsToLockResult = documentIdsToLockResult; 060 } 061 062 public ProcessDocReport doDeleteRouteHeader(DeleteEvent event) throws Exception { 063 return new ProcessDocReport(processDocReportResult, "testing"); 064 } 065 public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception { 066 return new ProcessDocReport(processDocReportResult, "testing"); 067 } 068 public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception { 069 return new ProcessDocReport(processDocReportResult, "testing"); 070 } 071 072 public ProcessDocReport doActionTaken(ActionTakenEvent event) throws Exception { 073 return new ProcessDocReport(actionTakenResult, "testing"); 074 } 075 076 public ProcessDocReport beforeProcess(BeforeProcessEvent event) throws Exception { 077 return new ProcessDocReport(processMethodsDocReportResult, "testing"); 078 } 079 080 public ProcessDocReport afterProcess(AfterProcessEvent event) throws Exception { 081 return new ProcessDocReport(processMethodsDocReportResult, "testing"); 082 } 083 084 public List<String> getDocumentIdsToLock(DocumentLockingEvent lockingEvent) throws Exception { 085 return documentIdsToLockResult; 086 } 087 088 public void setProcessDocReportResult(boolean processDocReportResult) { 089 this.processDocReportResult = processDocReportResult; 090 } 091 092 public void setActionTakenResult(boolean actionTakenResult) { 093 this.actionTakenResult = actionTakenResult; 094 } 095 096 public void setProcessMethodsDocReportResult(boolean processMethodsDocReportResult) { 097 this.processMethodsDocReportResult = processMethodsDocReportResult; 098 } 099 100 public void setDocumentIdsToLockResult(List<String> documentIdsToLockResult) { 101 this.documentIdsToLockResult = documentIdsToLockResult; 102 } 103 104 }