1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.routemodule.service.impl; |
18 | |
|
19 | |
import org.kuali.rice.kew.engine.simulation.SimulationCriteria; |
20 | |
import org.kuali.rice.kew.engine.simulation.SimulationEngine; |
21 | |
import org.kuali.rice.kew.engine.simulation.SimulationResults; |
22 | |
import org.kuali.rice.kew.exception.WorkflowException; |
23 | |
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
24 | |
import org.kuali.rice.kew.routemodule.service.RoutingReportService; |
25 | |
|
26 | |
|
27 | 0 | public class RoutingReportServiceImpl implements RoutingReportService { |
28 | |
|
29 | |
public DocumentRouteHeaderValue report(SimulationCriteria criteria) throws WorkflowException { |
30 | |
try { |
31 | 0 | SimulationEngine simulationEngine = new SimulationEngine(); |
32 | 0 | SimulationResults results = simulationEngine.runSimulation(criteria); |
33 | 0 | return materializeDocument(results); |
34 | 0 | } catch (Exception e) { |
35 | 0 | if (e instanceof RuntimeException) { |
36 | 0 | throw (RuntimeException)e; |
37 | |
} |
38 | 0 | throw new WorkflowException("Problem running report: " + e.getMessage(), e); |
39 | |
} |
40 | |
} |
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
private DocumentRouteHeaderValue materializeDocument(SimulationResults results) { |
46 | 0 | DocumentRouteHeaderValue document = results.getDocument(); |
47 | 0 | document.getActionRequests().addAll(results.getSimulatedActionRequests()); |
48 | 0 | return document; |
49 | |
|
50 | |
} |
51 | |
} |