| 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.routeheader.DocumentRouteHeaderValue; |
| 22 | |
import org.kuali.rice.kew.routemodule.service.RoutingReportService; |
| 23 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 24 | |
|
| 25 | |
|
| 26 | 0 | public class RoutingReportServiceImpl implements RoutingReportService { |
| 27 | |
|
| 28 | |
public DocumentRouteHeaderValue report(SimulationCriteria criteria) { |
| 29 | |
try { |
| 30 | 0 | SimulationWorkflowEngine simulationEngine = KEWServiceLocator.getSimulationEngine(); |
| 31 | 0 | SimulationResults results = simulationEngine.runSimulation(criteria); |
| 32 | 0 | return materializeDocument(results); |
| 33 | 0 | } catch (Exception e) { |
| 34 | 0 | if (e instanceof RuntimeException) { |
| 35 | 0 | throw (RuntimeException)e; |
| 36 | |
} |
| 37 | 0 | throw new IllegalStateException("Problem running report: " + e.getMessage(), e); |
| 38 | |
} |
| 39 | |
} |
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
|
| 44 | |
private DocumentRouteHeaderValue materializeDocument(SimulationResults results) { |
| 45 | 0 | DocumentRouteHeaderValue document = results.getDocument(); |
| 46 | |
|
| 47 | 0 | document.getSimulatedActionRequests().addAll(results.getSimulatedActionRequests()); |
| 48 | 0 | return document; |
| 49 | |
|
| 50 | |
} |
| 51 | |
} |