Coverage Report - org.kuali.rice.kew.engine.WorkflowEngineFactoryImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
WorkflowEngineFactoryImpl
22%
5/22
30%
3/10
2.5
WorkflowEngineFactoryImpl$1
100%
1/1
N/A
2.5
 
 1  
 /*
 2  
  * Copyright 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/ecl1.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.engine;
 17  
 
 18  
 import org.kuali.rice.core.framework.parameter.ParameterService;
 19  
 import org.kuali.rice.kew.engine.node.service.RouteNodeService;
 20  
 import org.kuali.rice.kew.engine.simulation.SimulationEngine;
 21  
 import org.kuali.rice.kew.routeheader.service.RouteHeaderService;
 22  
 import org.springframework.beans.factory.InitializingBean;
 23  
 
 24  
 /**
 25  
  * An implementation of the {@link WorkflowEngineFactory}. 
 26  
  * 
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 28  
  */
 29  5
 public class WorkflowEngineFactoryImpl implements WorkflowEngineFactory, InitializingBean {
 30  
 
 31  
     private RouteNodeService routeNodeService;
 32  
     private RouteHeaderService routeHeaderService;
 33  
     private ParameterService parameterService;
 34  
     
 35  
     
 36  
     /**
 37  
      * Ensures that all dependencies were injected into this factory.
 38  
      * 
 39  
      * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 40  
      * @throws IllegalStateException if any of the required services are null
 41  
      */
 42  
     @Override
 43  
     public void afterPropertiesSet() {
 44  0
         if (routeNodeService == null) {
 45  0
             throw new IllegalStateException("routeNodeService not properly injected, was null.");
 46  
         }
 47  0
         if (routeHeaderService == null) {
 48  0
             throw new IllegalStateException("routeHeaderService not properly injected, was null.");
 49  
         }
 50  0
         if (parameterService == null) {
 51  0
             throw new IllegalStateException("parameterService not properly injected, was null.");
 52  
         }
 53  0
     }
 54  
     
 55  
     /**
 56  
      * @see org.kuali.rice.kew.engine.WorkflowEngineFactory#newEngine(org.kuali.rice.kew.engine.OrchestrationConfig)
 57  
      */
 58  
     @SuppressWarnings("unchecked")
 59  
     @Override
 60  
     public <E extends WorkflowEngine> E newEngine(OrchestrationConfig config) {
 61  1
         switch (config.getCapability()) {
 62  
             case STANDARD:
 63  3
                 return (E) new StandardWorkflowEngine(routeNodeService, routeHeaderService, parameterService, config);
 64  
             case BLANKET_APPROVAL:
 65  1
                 return (E) new BlanketApproveEngine(routeNodeService, routeHeaderService, parameterService, config);
 66  
             case SIMULATION:
 67  6
                 return (E) new SimulationEngine(routeNodeService, routeHeaderService, parameterService, config);
 68  
         }
 69  
         
 70  0
         return null;
 71  
     }
 72  
     
 73  
     /**
 74  
      * @return the routeNodeService
 75  
      */
 76  
     public RouteNodeService getRouteNodeService() {
 77  0
         return this.routeNodeService;
 78  
     }
 79  
 
 80  
 
 81  
     /**
 82  
      * @param routeNodeService the routeNodeService to set
 83  
      */
 84  
     public void setRouteNodeService(RouteNodeService routeNodeService) {
 85  0
         this.routeNodeService = routeNodeService;
 86  0
     }
 87  
 
 88  
 
 89  
     /**
 90  
      * @return the routeHeaderService
 91  
      */
 92  
     public RouteHeaderService getRouteHeaderService() {
 93  0
         return this.routeHeaderService;
 94  
     }
 95  
 
 96  
 
 97  
     /**
 98  
      * @param routeHeaderService the routeHeaderService to set
 99  
      */
 100  
     public void setRouteHeaderService(RouteHeaderService routeHeaderService) {
 101  0
         this.routeHeaderService = routeHeaderService;
 102  0
     }
 103  
 
 104  
 
 105  
     /**
 106  
      * @return the parameterService
 107  
      */
 108  
     public ParameterService getParameterService() {
 109  0
         return this.parameterService;
 110  
     }
 111  
 
 112  
 
 113  
     /**
 114  
      * @param parameterService the parameterService to set
 115  
      */
 116  
     public void setParameterService(ParameterService parameterService) {
 117  0
         this.parameterService = parameterService;
 118  0
     }
 119  
 
 120  
 }