Coverage Report - org.kuali.rice.kew.routemodule.service.impl.RoutingReportServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
RoutingReportServiceImpl
0%
0/11
0%
0/2
3.5
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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  
      * The document returned does not have any of the simulated action requests set on it, we'll want to set them.
 43  
      */
 44  
     private DocumentRouteHeaderValue materializeDocument(SimulationResults results) {
 45  0
             DocumentRouteHeaderValue document = results.getDocument();
 46  
                 //document.getActionRequests().addAll(results.getSimulatedActionRequests());
 47  0
             document.getSimulatedActionRequests().addAll(results.getSimulatedActionRequests());
 48  0
         return document;
 49  
 
 50  
     }
 51  
 }