1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
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  
26  
27  
28  
29  public class WorkflowEngineFactoryImpl implements WorkflowEngineFactory, InitializingBean {
30  
31      private RouteNodeService routeNodeService;
32      private RouteHeaderService routeHeaderService;
33      private ParameterService parameterService;
34      
35      
36      
37  
38  
39  
40  
41  
42      @Override
43      public void afterPropertiesSet() {
44          if (routeNodeService == null) {
45              throw new IllegalStateException("routeNodeService not properly injected, was null.");
46          }
47          if (routeHeaderService == null) {
48              throw new IllegalStateException("routeHeaderService not properly injected, was null.");
49          }
50          if (parameterService == null) {
51              throw new IllegalStateException("parameterService not properly injected, was null.");
52          }
53      }
54      
55      
56  
57  
58      @SuppressWarnings("unchecked")
59      @Override
60      public <E extends WorkflowEngine> E newEngine(OrchestrationConfig config) {
61          switch (config.getCapability()) {
62              case STANDARD:
63                  return (E) new StandardWorkflowEngine(routeNodeService, routeHeaderService, parameterService, config);
64              case BLANKET_APPROVAL:
65                  return (E) new BlanketApproveEngine(routeNodeService, routeHeaderService, parameterService, config);
66              case SIMULATION:
67                  return (E) new SimulationEngine(routeNodeService, routeHeaderService, parameterService, config);
68          }
69          
70          return null;
71      }
72      
73      
74  
75  
76      public RouteNodeService getRouteNodeService() {
77          return this.routeNodeService;
78      }
79  
80  
81      
82  
83  
84      public void setRouteNodeService(RouteNodeService routeNodeService) {
85          this.routeNodeService = routeNodeService;
86      }
87  
88  
89      
90  
91  
92      public RouteHeaderService getRouteHeaderService() {
93          return this.routeHeaderService;
94      }
95  
96  
97      
98  
99  
100     public void setRouteHeaderService(RouteHeaderService routeHeaderService) {
101         this.routeHeaderService = routeHeaderService;
102     }
103 
104 
105     
106 
107 
108     public ParameterService getParameterService() {
109         return this.parameterService;
110     }
111 
112 
113     
114 
115 
116     public void setParameterService(ParameterService parameterService) {
117         this.parameterService = parameterService;
118     }
119 
120 }