Clover Coverage Report - kew-test 2.0.0-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../img/srcFileCovDistChart0.png 0% of files have more coverage
65   250   50   1.59
16   188   0.77   41
41     1.22  
1    
 
  MockRuleServiceImpl       Line # 40 65 0% 50 122 0% 0.0
 
No Tests
 
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.io.InputStream;
20    import java.sql.Timestamp;
21    import java.util.ArrayList;
22    import java.util.Collection;
23    import java.util.HashMap;
24    import java.util.Iterator;
25    import java.util.List;
26    import java.util.Map;
27   
28    import org.jdom.Element;
29    import org.kuali.rice.core.api.impex.ExportDataSet;
30    import org.kuali.rice.kew.doctype.bo.DocumentType;
31    import org.kuali.rice.kew.rule.RuleBaseValues;
32    import org.kuali.rice.kew.rule.RuleDelegation;
33    import org.kuali.rice.kew.rule.RuleResponsibility;
34    import org.kuali.rice.kew.rule.service.RuleService;
35    import org.kuali.rice.kew.util.KEWConstants;
36    import org.kuali.rice.kim.bo.entity.KimPrincipal;
37   
38   
39   
 
40    public class MockRuleServiceImpl implements RuleService {
41   
42    Map rules = new HashMap();
43    Map<String, RuleBaseValues> rulesByName = new HashMap<String, RuleBaseValues>();
44    Map responsibilitiesByKey = new HashMap();
45    Map responsibilitiesById = new HashMap();
46    Map responsibilitiesByReviewer = new HashMap();
47    Map rulesByRouteHeaderId = new HashMap();
48   
 
49  0 toggle public RuleBaseValues getParentRule(Long ruleBaseValuesId) {
50  0 return null;
51    }
 
52  0 toggle public List fetchAllCurrentRulesForTemplateDocCombination(String ruleTemplateName, String documentType, boolean ignoreCache) {
53  0 return null;
54    }
 
55  0 toggle public Long isLockedForRouting(Long currentRuleBaseValuesId) {
56  0 return null;
57    }
 
58  0 toggle public Long routeRuleWithDelegate(Long routeHeaderId, RuleBaseValues parentRule, RuleBaseValues delegateRule, KimPrincipal principal, String annotation, boolean blanketApprove) throws Exception {
59  0 return null;
60    }
 
61  0 toggle public List search(String docTypeName, Long ruleId, Long ruleTemplateId, String ruleDescription, String workgroupId, String principalId, Boolean delegateRule, Boolean activeInd, Map extensionValues, String workflowIdDirective) {
62  0 return null;
63    }
 
64  0 toggle public List search(String docTypeName, String ruleTemplateName, String ruleDescription, String groupId, String principalId, Boolean workgroupMember, Boolean delegateRule, Boolean activeInd, Map extensionValues, Collection<String> actionRequestCodes) {
65  0 return null;
66    }
 
67  0 toggle public void notifyCacheOfRuleChange(RuleBaseValues rule, DocumentType documentType) {
68    }
69   
70   
71   
 
72  0 toggle public void flushRuleCache() {
73    // TODO ewestfal - THIS METHOD NEEDS JAVADOCS
74   
75    }
 
76  0 toggle public RuleBaseValues getRuleByName(String name) {
77  0 return rulesByName.get(name);
78    }
 
79  0 toggle public void addRule(RuleBaseValues rule) {
80  0 rules.put(rule.getRuleBaseValuesId(), rule);
81  0 if (rule.getName() != null) {
82  0 rulesByName.put(rule.getName(), rule);
83    }
84   
85  0 List routeHeaderList = null;
86  0 if(rulesByRouteHeaderId.get(rule.getRouteHeaderId()) != null){
87  0 routeHeaderList = (List)rulesByRouteHeaderId.get(rule.getRouteHeaderId());
88    } else {
89  0 routeHeaderList = new ArrayList();
90    }
91  0 routeHeaderList.add(rule);
92  0 rulesByRouteHeaderId.put(rule.getRouteHeaderId(), routeHeaderList);
93   
94  0 for (Iterator iter = rule.getResponsibilities().iterator(); iter.hasNext();) {
95  0 RuleResponsibility resp = (RuleResponsibility) iter.next();
96  0 responsibilitiesByKey.put(resp.getRuleResponsibilityKey(), resp);
97  0 responsibilitiesById.put(resp.getResponsibilityId(), resp);
98   
99  0 List respList = null;
100  0 if(responsibilitiesByReviewer.get(resp.getRuleResponsibilityName()) != null){
101  0 respList = (List)responsibilitiesByReviewer.get(resp.getRuleResponsibilityName());
102    } else {
103  0 respList = new ArrayList();
104    }
105  0 respList.add(resp);
106  0 responsibilitiesByReviewer.put(resp.getRuleResponsibilityName(), respList);
107    }
108    }
109   
 
110  0 toggle public void delete(Long ruleBaseValuesId) {
111  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
112    }
113   
 
114  0 toggle public RuleBaseValues findRuleBaseValuesByName(String name) {
115  0 return null;
116    }
117   
 
118  0 toggle public RuleBaseValues findRuleBaseValuesById(Long ruleBaseValuesId) {
119  0 return (RuleBaseValues) rules.get(ruleBaseValuesId);
120    }
121   
 
122  0 toggle public List search(String docTypeName, Long ruleTemplateId, Long workgroupId, String workflowId, Boolean delegateRule, Boolean activeInd, Map extensionValues) {
123  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
124    }
125   
 
126  0 toggle public RuleResponsibility findRuleResponsibility(Long responsibilityId) {
127  0 return (RuleResponsibility) responsibilitiesById.get(responsibilityId);
128    }
129   
 
130  0 toggle public void deleteRuleResponsibilityById(Long ruleResponsibilityId) {
131  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
132    }
133   
 
134  0 toggle public RuleResponsibility findByRuleResponsibilityId(Long ruleResponsibilityId) {
135  0 return (RuleResponsibility) responsibilitiesByKey.get(ruleResponsibilityId);
136    }
137   
 
138  0 toggle public List fetchAllCurrentRulesForTemplateDocCombination(String ruleTemplateName, String documentType) {
139  0 List ruleBaseValues = new ArrayList();
140   
141  0 for (Iterator iter = rules.values().iterator(); iter.hasNext();) {
142  0 RuleBaseValues rule = (RuleBaseValues) iter.next();
143  0 if(rule.getRuleTemplate().getName().equals(ruleTemplateName) && rule.getDocTypeName().equals(documentType)){
144  0 ruleBaseValues.add(rule);
145    }
146    }
147  0 return ruleBaseValues;
148    }
149   
 
150  0 toggle public List findByRouteHeaderId(Long routeHeaderId) {
151  0 return (List) rulesByRouteHeaderId.get(routeHeaderId);
152    }
153   
 
154  0 toggle public void makeCurrent(Long routeHeaderId) {
155  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
156    }
157   
 
158  0 toggle public void makeCurrent(RuleBaseValues rule, boolean isRetroactiveUpdatePermitted) {
159  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
160    }
161   
 
162  0 toggle public void makeCurrent(RuleDelegation ruleDelegation, boolean isRetroactiveUpdatePermitted) {
163  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
164    }
165   
 
166  0 toggle public List findRuleBaseValuesByResponsibilityReviewer(String reviewerName, String type) {
167  0 List rules = new ArrayList();
168  0 for (Iterator iter = ((List) responsibilitiesByReviewer.get(reviewerName)).iterator(); iter.hasNext();) {
169  0 RuleResponsibility resp = (RuleResponsibility) iter.next();
170  0 if(resp.getRuleResponsibilityType().equals(type)){
171  0 rules.add(resp.getRuleBaseValues());
172    }
173    }
174  0 return rules;
175    }
176   
 
177  0 toggle public List fetchAllRules(boolean currentRules) {
178  0 return new ArrayList(rules.values());
179    }
180   
 
181  0 toggle public void saveDeactivationDate(RuleBaseValues rule) {
182    // do anything?
183    }
184   
 
185  0 toggle public void validate2(RuleBaseValues ruleBaseValues, RuleDelegation ruleDelegation, List errors) throws Exception {
186  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
187    }
188   
 
189  0 toggle public List fetchAllCurrentRulesForTemplateDocCombination(String ruleTemplateName, String documentType, Timestamp effectiveDate) {
190  0 return null;
191    }
 
192  0 toggle public RuleBaseValues findDefaultRuleByRuleTemplateId(Long ruleTemplateId) {
193  0 return null;
194    }
195   
 
196  0 toggle public void save2(RuleBaseValues ruleBaseValues) throws Exception {
197  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
198    }
199   
 
200  0 toggle public void loadXml(InputStream inputStream, String principalId) {
201  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
202    }
 
203  0 toggle public Element export(ExportDataSet dataSet) {
204  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
205    }
 
206  0 toggle @Override
207    public boolean supportPrettyPrint() {
208  0 return true;
209    }
 
210  0 toggle public void notifyCacheOfDocumentTypeChange(DocumentType documentType) {
211   
212    }
 
213  0 toggle public String getRuleDocmentTypeName(List rules) {
214  0 return KEWConstants.DEFAULT_RULE_DOCUMENT_NAME;
215    }
216    /**
217    * This overridden method ...
218    *
219    * @see org.kuali.rice.kew.rule.service.RuleService#findRuleBaseValuesByResponsibilityReviewerTemplateDoc(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
220    */
 
221  0 toggle public List findRuleBaseValuesByResponsibilityReviewerTemplateDoc(String ruleTemplateName, String documentType, String reviewerName, String type) {
222  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
223    }
 
224  0 toggle public Long getDuplicateRuleId(RuleBaseValues rule) {
225  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
226    }
 
227  0 toggle public Long findResponsibilityIdForRule(String ruleName,
228    String ruleResponsibilityName, String ruleResponsibilityType) {
229  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
230    }
 
231  0 toggle public RuleBaseValues saveRule(RuleBaseValues rule,
232    boolean isRetroactiveUpdatePermitted) {
233  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
234    }
 
235  0 toggle public RuleDelegation saveRuleDelegation(RuleDelegation ruleDelegation,
236    boolean isRetroactiveUpdatePermitted) {
237  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
238    }
 
239  0 toggle public List<RuleDelegation> saveRuleDelegations(
240    List<RuleDelegation> ruleDelegationsToSave, boolean isRetroactiveUpdatePermitted) {
241  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
242    }
 
243  0 toggle public List<RuleBaseValues> saveRules(List<RuleBaseValues> rulesToSave, boolean isRetroactiveUpdatePermitted) {
244  0 throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl");
245    }
246   
247   
248   
249   
250    }