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