1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.routemodule.service.impl; |
17 | |
|
18 | |
import org.kuali.rice.kew.engine.simulation.SimulationCriteria; |
19 | |
import org.kuali.rice.kew.engine.simulation.SimulationResults; |
20 | |
import org.kuali.rice.kew.engine.simulation.SimulationWorkflowEngine; |
21 | |
import org.kuali.rice.kew.exception.WorkflowException; |
22 | |
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
23 | |
import org.kuali.rice.kew.routemodule.service.RoutingReportService; |
24 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
25 | |
|
26 | |
|
27 | 0 | public class RoutingReportServiceImpl implements RoutingReportService { |
28 | |
|
29 | |
public DocumentRouteHeaderValue report(SimulationCriteria criteria) throws WorkflowException { |
30 | |
try { |
31 | 0 | SimulationWorkflowEngine simulationEngine = KEWServiceLocator.getSimulationEngine(); |
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 | |
|
48 | 0 | document.getSimulatedActionRequests().addAll(results.getSimulatedActionRequests()); |
49 | 0 | return document; |
50 | |
|
51 | |
} |
52 | |
} |