1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 122 (122) |
Complexity: 50 |
Complexity Density: 0.77 |
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
0
|
public RuleBaseValues getParentRule(Long ruleBaseValuesId) {... |
50 |
0
|
return null; |
51 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
52 |
0
|
public List fetchAllCurrentRulesForTemplateDocCombination(String ruleTemplateName, String documentType, boolean ignoreCache) {... |
53 |
0
|
return null; |
54 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
55 |
0
|
public Long isLockedForRouting(Long currentRuleBaseValuesId) {... |
56 |
0
|
return null; |
57 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
58 |
0
|
public Long routeRuleWithDelegate(Long routeHeaderId, RuleBaseValues parentRule, RuleBaseValues delegateRule, KimPrincipal principal, String annotation, boolean blanketApprove) throws Exception {... |
59 |
0
|
return null; |
60 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
61 |
0
|
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 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
64 |
0
|
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 |
|
} |
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
67 |
0
|
public void notifyCacheOfRuleChange(RuleBaseValues rule, DocumentType documentType) {... |
68 |
|
} |
69 |
|
|
70 |
|
|
71 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
72 |
0
|
public void flushRuleCache() {... |
73 |
|
|
74 |
|
|
75 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
76 |
0
|
public RuleBaseValues getRuleByName(String name) {... |
77 |
0
|
return rulesByName.get(name); |
78 |
|
} |
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 5 |
Complexity Density: 0.26 |
|
79 |
0
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
0
|
public void delete(Long ruleBaseValuesId) {... |
111 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
112 |
|
} |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
0
|
public RuleBaseValues findRuleBaseValuesByName(String name) {... |
115 |
0
|
return null; |
116 |
|
} |
117 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
118 |
0
|
public RuleBaseValues findRuleBaseValuesById(Long ruleBaseValuesId) {... |
119 |
0
|
return (RuleBaseValues) rules.get(ruleBaseValuesId); |
120 |
|
} |
121 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
122 |
0
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
0
|
public RuleResponsibility findRuleResponsibility(Long responsibilityId) {... |
127 |
0
|
return (RuleResponsibility) responsibilitiesById.get(responsibilityId); |
128 |
|
} |
129 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
0
|
public void deleteRuleResponsibilityById(Long ruleResponsibilityId) {... |
131 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
132 |
|
} |
133 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
134 |
0
|
public RuleResponsibility findByRuleResponsibilityId(Long ruleResponsibilityId) {... |
135 |
0
|
return (RuleResponsibility) responsibilitiesByKey.get(ruleResponsibilityId); |
136 |
|
} |
137 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
138 |
0
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
150 |
0
|
public List findByRouteHeaderId(Long routeHeaderId) {... |
151 |
0
|
return (List) rulesByRouteHeaderId.get(routeHeaderId); |
152 |
|
} |
153 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
154 |
0
|
public void makeCurrent(Long routeHeaderId) {... |
155 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
156 |
|
} |
157 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
158 |
0
|
public void makeCurrent(RuleBaseValues rule, boolean isRetroactiveUpdatePermitted) {... |
159 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
160 |
|
} |
161 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
162 |
0
|
public void makeCurrent(RuleDelegation ruleDelegation, boolean isRetroactiveUpdatePermitted) {... |
163 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
164 |
|
} |
165 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
166 |
0
|
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 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
177 |
0
|
public List fetchAllRules(boolean currentRules) {... |
178 |
0
|
return new ArrayList(rules.values()); |
179 |
|
} |
180 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
181 |
0
|
public void saveDeactivationDate(RuleBaseValues rule) {... |
182 |
|
|
183 |
|
} |
184 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
185 |
0
|
public void validate2(RuleBaseValues ruleBaseValues, RuleDelegation ruleDelegation, List errors) throws Exception {... |
186 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
187 |
|
} |
188 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
189 |
0
|
public List fetchAllCurrentRulesForTemplateDocCombination(String ruleTemplateName, String documentType, Timestamp effectiveDate) {... |
190 |
0
|
return null; |
191 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
192 |
0
|
public RuleBaseValues findDefaultRuleByRuleTemplateId(Long ruleTemplateId) {... |
193 |
0
|
return null; |
194 |
|
} |
195 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
196 |
0
|
public void save2(RuleBaseValues ruleBaseValues) throws Exception {... |
197 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
198 |
|
} |
199 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
200 |
0
|
public void loadXml(InputStream inputStream, String principalId) {... |
201 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
202 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
203 |
0
|
public Element export(ExportDataSet dataSet) {... |
204 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
205 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
206 |
0
|
@Override... |
207 |
|
public boolean supportPrettyPrint() { |
208 |
0
|
return true; |
209 |
|
} |
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
210 |
0
|
public void notifyCacheOfDocumentTypeChange(DocumentType documentType) {... |
211 |
|
|
212 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
213 |
0
|
public String getRuleDocmentTypeName(List rules) {... |
214 |
0
|
return KEWConstants.DEFAULT_RULE_DOCUMENT_NAME; |
215 |
|
} |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
@see |
220 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
221 |
0
|
public List findRuleBaseValuesByResponsibilityReviewerTemplateDoc(String ruleTemplateName, String documentType, String reviewerName, String type) {... |
222 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
223 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
224 |
0
|
public Long getDuplicateRuleId(RuleBaseValues rule) {... |
225 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
226 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
227 |
0
|
public Long findResponsibilityIdForRule(String ruleName,... |
228 |
|
String ruleResponsibilityName, String ruleResponsibilityType) { |
229 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
230 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
231 |
0
|
public RuleBaseValues saveRule(RuleBaseValues rule,... |
232 |
|
boolean isRetroactiveUpdatePermitted) { |
233 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
234 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
235 |
0
|
public RuleDelegation saveRuleDelegation(RuleDelegation ruleDelegation,... |
236 |
|
boolean isRetroactiveUpdatePermitted) { |
237 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
238 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
239 |
0
|
public List<RuleDelegation> saveRuleDelegations(... |
240 |
|
List<RuleDelegation> ruleDelegationsToSave, boolean isRetroactiveUpdatePermitted) { |
241 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
242 |
|
} |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
243 |
0
|
public List<RuleBaseValues> saveRules(List<RuleBaseValues> rulesToSave, boolean isRetroactiveUpdatePermitted) {... |
244 |
0
|
throw new UnsupportedOperationException("not implemented in MockRuleServiceImpl"); |
245 |
|
} |
246 |
|
|
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
} |