View Javadoc

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