| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
package org.kuali.rice.kew.service; |
| 18 | |
|
| 19 | |
import javax.persistence.EntityManagerFactory; |
| 20 | |
import javax.sql.DataSource; |
| 21 | |
import javax.transaction.TransactionManager; |
| 22 | |
import javax.transaction.UserTransaction; |
| 23 | |
import javax.xml.namespace.QName; |
| 24 | |
|
| 25 | |
import org.apache.log4j.Logger; |
| 26 | |
import org.kuali.rice.core.api.config.module.RunMode; |
| 27 | |
import org.kuali.rice.core.api.config.property.ConfigContext; |
| 28 | |
import org.kuali.rice.core.api.encryption.EncryptionService; |
| 29 | |
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 30 | |
import org.kuali.rice.core.mail.Mailer; |
| 31 | |
import org.kuali.rice.edl.framework.extract.ExtractService; |
| 32 | |
import org.kuali.rice.kew.actionlist.service.ActionListService; |
| 33 | |
import org.kuali.rice.kew.actionrequest.service.ActionRequestService; |
| 34 | |
import org.kuali.rice.kew.actions.ActionRegistry; |
| 35 | |
import org.kuali.rice.kew.actiontaken.service.ActionTakenService; |
| 36 | |
import org.kuali.rice.kew.batch.XmlPollerService; |
| 37 | |
import org.kuali.rice.kew.docsearch.DocumentSearchCustomizationMediator; |
| 38 | |
import org.kuali.rice.kew.docsearch.service.DocumentSearchService; |
| 39 | |
import org.kuali.rice.kew.doctype.service.DocumentSecurityService; |
| 40 | |
import org.kuali.rice.kew.doctype.service.DocumentTypePermissionService; |
| 41 | |
import org.kuali.rice.kew.doctype.service.DocumentTypeService; |
| 42 | |
import org.kuali.rice.kew.documentlink.service.DocumentLinkService; |
| 43 | |
import org.kuali.rice.kew.engine.WorkflowEngineFactory; |
| 44 | |
import org.kuali.rice.kew.engine.node.service.BranchService; |
| 45 | |
import org.kuali.rice.kew.engine.node.service.RouteNodeService; |
| 46 | |
import org.kuali.rice.kew.engine.simulation.SimulationWorkflowEngine; |
| 47 | |
import org.kuali.rice.kew.exception.WorkflowDocumentExceptionRoutingService; |
| 48 | |
import org.kuali.rice.kew.identity.service.IdentityHelperService; |
| 49 | |
import org.kuali.rice.kew.impl.document.WorkflowDocumentPrototype; |
| 50 | |
import org.kuali.rice.kew.mail.service.ActionListEmailService; |
| 51 | |
import org.kuali.rice.kew.mail.service.EmailContentService; |
| 52 | |
import org.kuali.rice.kew.notes.service.NoteService; |
| 53 | |
import org.kuali.rice.kew.notification.service.NotificationService; |
| 54 | |
import org.kuali.rice.kew.preferences.service.PreferencesService; |
| 55 | |
import org.kuali.rice.kew.responsibility.service.ResponsibilityIdService; |
| 56 | |
import org.kuali.rice.kew.role.service.RoleService; |
| 57 | |
import org.kuali.rice.kew.routeheader.service.RouteHeaderService; |
| 58 | |
import org.kuali.rice.kew.routeheader.service.WorkflowDocumentService; |
| 59 | |
import org.kuali.rice.kew.routemodule.service.RouteModuleService; |
| 60 | |
import org.kuali.rice.kew.routemodule.service.RoutingReportService; |
| 61 | |
import org.kuali.rice.kew.rule.service.RuleAttributeService; |
| 62 | |
import org.kuali.rice.kew.rule.service.RuleDelegationService; |
| 63 | |
import org.kuali.rice.kew.rule.service.RuleService; |
| 64 | |
import org.kuali.rice.kew.rule.service.RuleTemplateService; |
| 65 | |
import org.kuali.rice.kew.useroptions.UserOptionsService; |
| 66 | |
import org.kuali.rice.kew.util.KEWConstants; |
| 67 | |
import org.springframework.transaction.PlatformTransactionManager; |
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
|
| 77 | |
|
| 78 | |
|
| 79 | 0 | public final class KEWServiceLocator { |
| 80 | |
|
| 81 | 0 | private static final Logger LOG = Logger.getLogger(KEWServiceLocator.class); |
| 82 | |
|
| 83 | |
public static final String KEW_RUN_MODE_PROPERTY = "kew.mode"; |
| 84 | |
|
| 85 | |
public static final String DATASOURCE = "enWorkflowDataSource"; |
| 86 | |
|
| 87 | |
public static final String QUICK_LINKS_SERVICE = "enQuickLinksService"; |
| 88 | |
|
| 89 | |
public static final String DOCUMENT_SEARCH_SERVICE = "enDocumentSearchService"; |
| 90 | |
|
| 91 | |
public static final String ACTION_TAKEN_SRV = "enActionTakenService"; |
| 92 | |
|
| 93 | |
public static final String ACTION_REQUEST_SRV = "enActionRequestService"; |
| 94 | |
|
| 95 | |
public static final String ACTION_LIST_SRV = "enActionListService"; |
| 96 | |
|
| 97 | |
public static final String DOC_ROUTE_HEADER_SRV = "enDocumentRouteHeaderService"; |
| 98 | |
|
| 99 | |
public static final String DOCUMENT_TYPE_GROUP_SERVICE = "enDocumentTypeGroupService"; |
| 100 | |
|
| 101 | |
public static final String DOCUMENT_TYPE_SERVICE = "enDocumentTypeService"; |
| 102 | |
|
| 103 | |
public static final String DOCUMENT_TYPE_PERMISSION_SERVICE = "enDocumentTypePermissionService"; |
| 104 | |
|
| 105 | |
public static final String DOCUMENT_SECURITY_SERVICE = "enDocumentSecurityService"; |
| 106 | |
|
| 107 | |
public static final String USER_OPTIONS_SRV = "enUserOptionsService"; |
| 108 | |
|
| 109 | |
public static final String DOCUMENT_CHANGE_HISTORY_SRV = "enDocumentChangeHistoryService"; |
| 110 | |
|
| 111 | |
public static final String DOCUMENT_VALUE_INDEX_SRV = "enDocumentValueIndexService"; |
| 112 | |
|
| 113 | |
public static final String ROUTE_LEVEL_SERVICE = "enRouteLevelService"; |
| 114 | |
|
| 115 | |
public static final String CONSTANTS_SERVICE = "enApplicationConstantsService"; |
| 116 | |
|
| 117 | |
public static final String PREFERENCES_SERVICE = "enPreferencesService"; |
| 118 | |
|
| 119 | |
public static final String ROUTE_LOG_SERVICE = "enRouteLogService"; |
| 120 | |
|
| 121 | |
public static final String RULE_TEMPLATE_SERVICE = "enRuleTemplateService"; |
| 122 | |
|
| 123 | |
public static final String RULE_SERVICE = "enRuleService"; |
| 124 | |
|
| 125 | |
public static final String RULE_ATTRIBUTE_SERVICE = "enRuleAttributeService"; |
| 126 | |
|
| 127 | |
public static final String RULE_TEMPLATE_ATTRIBUTE_SERVICE = "enRuleTemplateAttributeService"; |
| 128 | |
|
| 129 | |
public static final String ROLE_SERVICE = "enRoleService"; |
| 130 | |
|
| 131 | |
public static final String RESPONSIBILITY_ID_SERVICE = "enResponsibilityIdService"; |
| 132 | |
|
| 133 | |
public static final String STATS_SERVICE = "enStatsService"; |
| 134 | |
|
| 135 | |
public static final String ROUTE_MANAGER_QUEUE_SERVICE = "enRouteManagerQueueService"; |
| 136 | |
|
| 137 | |
public static final String ROUTE_MANAGER_CONTROLLER = "enRouteManagerController"; |
| 138 | |
|
| 139 | |
public static final String RULE_DELEGATION_SERVICE = "enRuleDelegationService"; |
| 140 | |
|
| 141 | |
public static final String ROUTE_MANAGER_DRIVER = "enRouteManagerDriver"; |
| 142 | |
|
| 143 | |
public static final String OPTIMISTIC_LOCK_FAILURE_SERVICE = "enOptimisticLockFailureService"; |
| 144 | |
|
| 145 | |
public static final String NOTE_SERVICE = "enNoteService"; |
| 146 | |
|
| 147 | |
public static final String ROUTING_REPORT_SERVICE = "enRoutingReportService"; |
| 148 | |
|
| 149 | |
public static final String ROUTE_MODULE_SERVICE = "enRouteModuleService"; |
| 150 | |
|
| 151 | |
public static final String EXCEPTION_ROUTING_SERVICE = "enExceptionRoutingService"; |
| 152 | |
|
| 153 | |
public static final String ACTION_REGISTRY = "enActionRegistry"; |
| 154 | |
|
| 155 | |
public static final String BRANCH_SERVICE = "enBranchService"; |
| 156 | |
|
| 157 | |
public static final String WORKFLOW_MBEAN = "workflowMBean"; |
| 158 | |
|
| 159 | |
public static final String APPLICATION_CONSTANTS_CACHE = "applicationConstantsCache"; |
| 160 | |
|
| 161 | |
public static final String JTA_TRANSACTION_MANAGER = "jtaTransactionManager"; |
| 162 | |
|
| 163 | |
public static final String USER_TRANSACTION = "userTransaction"; |
| 164 | |
|
| 165 | |
public static final String SCHEDULER = "enScheduler"; |
| 166 | |
|
| 167 | |
public static final String DOCUMENT_LINK_SERVICE = "enDocumentLinkService"; |
| 168 | |
|
| 169 | |
|
| 170 | |
|
| 171 | |
|
| 172 | |
public static final String XML_POLLER_SERVICE = "enXmlPollerService"; |
| 173 | |
|
| 174 | |
public static final String DB_TABLES_LOADER = "enDbTablesLoader"; |
| 175 | |
|
| 176 | |
public static final String ROUTE_NODE_SERVICE = "enRouteNodeService"; |
| 177 | |
|
| 178 | |
public static final String SIMULATION_ENGINE = "simulationEngine"; |
| 179 | |
|
| 180 | |
public static final String WORKFLOW_ENGINE_FACTORY = "workflowEngineFactory"; |
| 181 | |
|
| 182 | |
public static final String ACTION_LIST_EMAIL_SERVICE = "enActionListEmailService"; |
| 183 | |
|
| 184 | |
public static final String IMMEDIATE_EMAIL_REMINDER_SERVICE = "enImmediateEmailReminderService"; |
| 185 | |
|
| 186 | |
public static final String EMAIL_CONTENT_SERVICE = "enEmailContentService"; |
| 187 | |
|
| 188 | |
public static final String NOTIFICATION_SERVICE = "enNotificationService"; |
| 189 | |
|
| 190 | |
public static final String TRANSACTION_MANAGER = "transactionManager"; |
| 191 | |
|
| 192 | |
public static final String TRANSACTION_TEMPLATE = "transactionTemplate"; |
| 193 | |
|
| 194 | |
public static final String WORKFLOW_DOCUMENT_SERVICE = "enWorkflowDocumentService"; |
| 195 | |
|
| 196 | |
public static final String EXTENSION_SERVICE = "enExtensionService"; |
| 197 | |
|
| 198 | |
public static final String TRANSFORMATION_SERVICE = "enTransformationService"; |
| 199 | |
|
| 200 | |
public static final String ENCRYPTION_SERVICE = "enEncryptionService"; |
| 201 | |
|
| 202 | |
public static final String REMOVE_REPLACE_DOCUMENT_SERVICE = "enRemoveReplaceDocumentService"; |
| 203 | |
|
| 204 | |
public static final String EXTRACT_SERVICE = "enExtractService"; |
| 205 | |
|
| 206 | |
public static final String IDENTITY_HELPER_SERVICE = "kewIdentityHelperService"; |
| 207 | |
|
| 208 | |
public static final String ENTITY_MANAGER_FACTORY = "kewEntityManagerFactory"; |
| 209 | |
|
| 210 | |
public static final String MAILER = "mailer"; |
| 211 | |
|
| 212 | |
public static final String WORKFLOW_DOCUMENT_PROTOTYPE = "rice.kew.workflowDocumentPrototype"; |
| 213 | |
|
| 214 | |
public static final String DOCUMENT_SEARCH_CUSTOMIZATION_MEDIATOR = "rice.kew.documentSearchCustomizationMediator"; |
| 215 | |
|
| 216 | |
public static EntityManagerFactory getEntityManagerFactory() { |
| 217 | 0 | return (EntityManagerFactory) getService(ENTITY_MANAGER_FACTORY); |
| 218 | |
} |
| 219 | |
|
| 220 | |
|
| 221 | |
|
| 222 | |
|
| 223 | |
|
| 224 | |
|
| 225 | |
public static <T> T getService(String serviceName) { |
| 226 | 0 | return KEWServiceLocator.<T>getBean(serviceName); |
| 227 | |
} |
| 228 | |
|
| 229 | |
public static <T> T getBean(String serviceName) { |
| 230 | 0 | if ( LOG.isDebugEnabled() ) { |
| 231 | 0 | LOG.debug("Fetching service " + serviceName); |
| 232 | |
} |
| 233 | 0 | return GlobalResourceLoader.getResourceLoader().<T>getService( |
| 234 | |
(RunMode.REMOTE.equals(RunMode.valueOf(ConfigContext.getCurrentContextConfig().getProperty(KEW_RUN_MODE_PROPERTY)))) ? |
| 235 | |
new QName(KEWConstants.KEW_MODULE_NAMESPACE, serviceName) : new QName(serviceName)); |
| 236 | |
} |
| 237 | |
|
| 238 | |
public static WorkflowUtility getWorkflowUtilityService() { |
| 239 | 0 | if ( LOG.isDebugEnabled() ) { |
| 240 | 0 | LOG.debug("Fetching service " + KEWConstants.WORKFLOW_UTILITY_SERVICE); |
| 241 | |
} |
| 242 | 0 | return (WorkflowUtility) GlobalResourceLoader.getResourceLoader().getService(new QName(KEWConstants.WORKFLOW_UTILITY_SERVICE)); |
| 243 | |
} |
| 244 | |
|
| 245 | |
public static DocumentTypeService getDocumentTypeService() { |
| 246 | 0 | return (DocumentTypeService) getBean(DOCUMENT_TYPE_SERVICE); |
| 247 | |
} |
| 248 | |
|
| 249 | |
public static DocumentTypePermissionService getDocumentTypePermissionService() { |
| 250 | 0 | return (DocumentTypePermissionService) getBean(DOCUMENT_TYPE_PERMISSION_SERVICE); |
| 251 | |
} |
| 252 | |
|
| 253 | |
public static DocumentSecurityService getDocumentSecurityService() { |
| 254 | 0 | return (DocumentSecurityService) getBean(DOCUMENT_SECURITY_SERVICE); |
| 255 | |
} |
| 256 | |
|
| 257 | |
|
| 258 | |
public static ActionRequestService getActionRequestService() { |
| 259 | 0 | return (ActionRequestService) getBean(ACTION_REQUEST_SRV); |
| 260 | |
} |
| 261 | |
|
| 262 | |
public static ActionTakenService getActionTakenService() { |
| 263 | 0 | return (ActionTakenService) getBean(ACTION_TAKEN_SRV); |
| 264 | |
} |
| 265 | |
|
| 266 | |
public static ResponsibilityIdService getResponsibilityIdService() { |
| 267 | 0 | return (ResponsibilityIdService) getBean(RESPONSIBILITY_ID_SERVICE); |
| 268 | |
} |
| 269 | |
|
| 270 | |
public static RouteHeaderService getRouteHeaderService() { |
| 271 | 0 | return (RouteHeaderService) getBean(DOC_ROUTE_HEADER_SRV); |
| 272 | |
} |
| 273 | |
|
| 274 | |
public static RuleTemplateService getRuleTemplateService() { |
| 275 | 0 | return (RuleTemplateService) getBean(RULE_TEMPLATE_SERVICE); |
| 276 | |
} |
| 277 | |
|
| 278 | |
public static RuleAttributeService getRuleAttributeService() { |
| 279 | 0 | return (RuleAttributeService) getBean(RULE_ATTRIBUTE_SERVICE); |
| 280 | |
} |
| 281 | |
|
| 282 | |
public static WorkflowDocumentService getWorkflowDocumentService() { |
| 283 | 0 | return (WorkflowDocumentService) getBean(WORKFLOW_DOCUMENT_SERVICE); |
| 284 | |
} |
| 285 | |
|
| 286 | |
public static RouteModuleService getRouteModuleService() { |
| 287 | 0 | return (RouteModuleService) getBean(ROUTE_MODULE_SERVICE); |
| 288 | |
} |
| 289 | |
|
| 290 | |
public static RoleService getRoleService() { |
| 291 | 0 | return (RoleService) getBean(ROLE_SERVICE); |
| 292 | |
} |
| 293 | |
|
| 294 | |
public static RuleService getRuleService() { |
| 295 | 0 | return (RuleService) getBean(RULE_SERVICE); |
| 296 | |
} |
| 297 | |
|
| 298 | |
public static RuleDelegationService getRuleDelegationService() { |
| 299 | 0 | return (RuleDelegationService) getBean(RULE_DELEGATION_SERVICE); |
| 300 | |
} |
| 301 | |
|
| 302 | |
public static RoutingReportService getRoutingReportService() { |
| 303 | 0 | return (RoutingReportService) getBean(ROUTING_REPORT_SERVICE); |
| 304 | |
} |
| 305 | |
|
| 306 | |
public static PreferencesService getPreferencesService() { |
| 307 | 0 | return (PreferencesService) getBean(PREFERENCES_SERVICE); |
| 308 | |
} |
| 309 | |
|
| 310 | |
public static XmlPollerService getXmlPollerService() { |
| 311 | 0 | return (XmlPollerService) getBean(XML_POLLER_SERVICE); |
| 312 | |
} |
| 313 | |
|
| 314 | |
public static UserOptionsService getUserOptionsService() { |
| 315 | 0 | return (UserOptionsService) getBean(USER_OPTIONS_SRV); |
| 316 | |
} |
| 317 | |
|
| 318 | |
public static ActionListService getActionListService() { |
| 319 | 0 | return (ActionListService) getBean(ACTION_LIST_SRV); |
| 320 | |
} |
| 321 | |
|
| 322 | |
public static RouteNodeService getRouteNodeService() { |
| 323 | 0 | return (RouteNodeService) getBean(ROUTE_NODE_SERVICE); |
| 324 | |
} |
| 325 | |
|
| 326 | |
public static SimulationWorkflowEngine getSimulationEngine() { |
| 327 | 0 | return (SimulationWorkflowEngine) getBean(SIMULATION_ENGINE); |
| 328 | |
} |
| 329 | |
|
| 330 | |
public static WorkflowEngineFactory getWorkflowEngineFactory() { |
| 331 | 0 | return (WorkflowEngineFactory) getBean(WORKFLOW_ENGINE_FACTORY); |
| 332 | |
} |
| 333 | |
|
| 334 | |
public static WorkflowDocumentExceptionRoutingService getExceptionRoutingService() { |
| 335 | 0 | return (WorkflowDocumentExceptionRoutingService) getBean(EXCEPTION_ROUTING_SERVICE); |
| 336 | |
} |
| 337 | |
|
| 338 | |
public static ActionListEmailService getActionListEmailService() { |
| 339 | 0 | return (ActionListEmailService) getBean(KEWServiceLocator.ACTION_LIST_EMAIL_SERVICE); |
| 340 | |
} |
| 341 | |
|
| 342 | |
public static EmailContentService getEmailContentService() { |
| 343 | 0 | return (EmailContentService) getBean(KEWServiceLocator.EMAIL_CONTENT_SERVICE); |
| 344 | |
} |
| 345 | |
|
| 346 | |
public static NotificationService getNotificationService() { |
| 347 | 0 | return (NotificationService) getBean(KEWServiceLocator.NOTIFICATION_SERVICE); |
| 348 | |
} |
| 349 | |
|
| 350 | |
public static TransactionManager getTransactionManager() { |
| 351 | 0 | return (TransactionManager) getBean(JTA_TRANSACTION_MANAGER); |
| 352 | |
} |
| 353 | |
|
| 354 | |
public static UserTransaction getUserTransaction() { |
| 355 | 0 | return (UserTransaction) getBean(USER_TRANSACTION); |
| 356 | |
} |
| 357 | |
|
| 358 | |
public static NoteService getNoteService() { |
| 359 | 0 | return (NoteService) getBean(NOTE_SERVICE); |
| 360 | |
} |
| 361 | |
|
| 362 | |
public static ActionRegistry getActionRegistry() { |
| 363 | 0 | return (ActionRegistry) getBean(ACTION_REGISTRY); |
| 364 | |
} |
| 365 | |
|
| 366 | |
public static EncryptionService getEncryptionService() { |
| 367 | 0 | return (EncryptionService) getBean(ENCRYPTION_SERVICE); |
| 368 | |
} |
| 369 | |
|
| 370 | |
public static BranchService getBranchService() { |
| 371 | 0 | return (BranchService) getBean(BRANCH_SERVICE); |
| 372 | |
} |
| 373 | |
|
| 374 | |
public static DocumentSearchService getDocumentSearchService() { |
| 375 | 0 | return (DocumentSearchService) getBean(DOCUMENT_SEARCH_SERVICE); |
| 376 | |
} |
| 377 | |
|
| 378 | |
public static ExtractService getExtractService() { |
| 379 | 0 | return (ExtractService) getBean(EXTRACT_SERVICE); |
| 380 | |
} |
| 381 | |
|
| 382 | |
public static IdentityHelperService getIdentityHelperService() { |
| 383 | 0 | return (IdentityHelperService) getBean(IDENTITY_HELPER_SERVICE); |
| 384 | |
} |
| 385 | |
|
| 386 | |
public static DocumentLinkService getDocumentLinkService(){ |
| 387 | 0 | return (DocumentLinkService) getBean(DOCUMENT_LINK_SERVICE); |
| 388 | |
} |
| 389 | |
|
| 390 | |
public static Mailer getMailer(){ |
| 391 | 0 | return (Mailer) getBean(MAILER); |
| 392 | |
} |
| 393 | |
|
| 394 | |
|
| 395 | |
|
| 396 | |
|
| 397 | |
|
| 398 | |
|
| 399 | |
public static DataSource getDataSource() { |
| 400 | 0 | return (DataSource) getBean(DATASOURCE); |
| 401 | |
} |
| 402 | |
|
| 403 | |
public static PlatformTransactionManager getPlatformTransactionManager() { |
| 404 | 0 | return (PlatformTransactionManager) getBean(TRANSACTION_MANAGER); |
| 405 | |
} |
| 406 | |
|
| 407 | |
public static WorkflowDocumentPrototype getWorkflowDocumentPrototype() { |
| 408 | 0 | return getBean(WORKFLOW_DOCUMENT_PROTOTYPE); |
| 409 | |
} |
| 410 | |
|
| 411 | |
public static DocumentSearchCustomizationMediator getDocumentSearchCustomizationMediator() { |
| 412 | 0 | return getBean(DOCUMENT_SEARCH_CUSTOMIZATION_MEDIATOR); |
| 413 | |
} |
| 414 | |
} |