View Javadoc

1   /**
2    * Copyright 2005-2011 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package mocks;
17  
18  import java.util.List;
19  
20  import org.kuali.rice.kew.framework.postprocessor.ActionTakenEvent;
21  import org.kuali.rice.kew.framework.postprocessor.AfterProcessEvent;
22  import org.kuali.rice.kew.framework.postprocessor.BeforeProcessEvent;
23  import org.kuali.rice.kew.framework.postprocessor.DeleteEvent;
24  import org.kuali.rice.kew.framework.postprocessor.DocumentLockingEvent;
25  import org.kuali.rice.kew.framework.postprocessor.DocumentRouteLevelChange;
26  import org.kuali.rice.kew.framework.postprocessor.DocumentRouteStatusChange;
27  import org.kuali.rice.kew.framework.postprocessor.PostProcessor;
28  import org.kuali.rice.kew.framework.postprocessor.ProcessDocReport;
29  
30  public class MockPostProcessor implements PostProcessor {
31  
32      private boolean processDocReportResult = true;
33      private boolean actionTakenResult = true;
34      private boolean processMethodsDocReportResult = true;
35      private List<String> documentIdsToLockResult = null;
36      
37      public MockPostProcessor() {
38          this(true);
39      }
40      
41      public MockPostProcessor(boolean processDocReportResult) {
42      	this(processDocReportResult, true);
43      }
44      
45      public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult) {
46          this(processDocReportResult, actionTakenResult, true);
47      }
48          
49      public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult, boolean processMethodsDocReportResult) {
50      	this(processDocReportResult, actionTakenResult, processMethodsDocReportResult, null);
51      }
52      
53      public MockPostProcessor(boolean processDocReportResult, boolean actionTakenResult, boolean processMethodsDocReportResult, List<String> documentIdsToLockResult) {
54          this.processDocReportResult = processDocReportResult;
55          this.actionTakenResult = actionTakenResult;
56          this.processMethodsDocReportResult = processMethodsDocReportResult;
57          this.documentIdsToLockResult = documentIdsToLockResult;
58      }
59          
60      public ProcessDocReport doDeleteRouteHeader(DeleteEvent event) throws Exception {
61          return new ProcessDocReport(processDocReportResult, "testing");
62      }
63      public ProcessDocReport doRouteLevelChange(DocumentRouteLevelChange levelChangeEvent) throws Exception {
64          return new ProcessDocReport(processDocReportResult, "testing");
65      }
66      public ProcessDocReport doRouteStatusChange(DocumentRouteStatusChange statusChangeEvent) throws Exception {
67          return new ProcessDocReport(processDocReportResult, "testing");
68      }
69      
70      public ProcessDocReport doActionTaken(ActionTakenEvent event) throws Exception {
71      	return new ProcessDocReport(actionTakenResult, "testing");
72  	}
73  
74      public ProcessDocReport beforeProcess(BeforeProcessEvent event) throws Exception {
75          return new ProcessDocReport(processMethodsDocReportResult, "testing");
76      }
77  
78      public ProcessDocReport afterProcess(AfterProcessEvent event) throws Exception {
79          return new ProcessDocReport(processMethodsDocReportResult, "testing");
80      }
81  
82      public List<String> getDocumentIdsToLock(DocumentLockingEvent lockingEvent) throws Exception {
83  		return documentIdsToLockResult;
84  	}
85  
86  	public void setProcessDocReportResult(boolean processDocReportResult) {
87          this.processDocReportResult = processDocReportResult;
88      }
89  
90  	public void setActionTakenResult(boolean actionTakenResult) {
91  		this.actionTakenResult = actionTakenResult;
92  	}
93  
94      public void setProcessMethodsDocReportResult(boolean processMethodsDocReportResult) {
95          this.processMethodsDocReportResult = processMethodsDocReportResult;
96      }
97      
98      public void setDocumentIdsToLockResult(List<String> documentIdsToLockResult) {
99      	this.documentIdsToLockResult = documentIdsToLockResult;
100     }
101 
102 }