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-2008 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 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  
      * The document returned does not have any of the simulated action requests set on it, we'll want to set them.
 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  
 }