1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.framework;
17
18 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
19 import org.kuali.rice.kew.api.KewApiConstants;
20 import org.kuali.rice.kew.framework.actionlist.ActionListCustomizationHandlerService;
21 import org.kuali.rice.kew.framework.document.search.DocumentSearchCustomizationHandlerService;
22 import org.kuali.rice.kew.framework.document.security.DocumentSecurityHandlerService;
23 import org.kuali.rice.kew.framework.rule.attribute.WorkflowRuleAttributeHandlerService;
24 import org.kuali.rice.kew.framework.validation.RuleValidationAttributeExporterService;
25 import org.kuali.rice.ksb.api.KsbApiServiceLocator;
26
27 import javax.xml.namespace.QName;
28
29
30
31
32 public class KewFrameworkServiceLocator {
33
34 public static final String DOCUMENT_SEARCH_CUSTOMIZATION_HANDLER_SERVICE = "documentSearchCustomizationHandlerService";
35 public static final String DOCUMENT_SECURITY_HANDLER_SERVICE = "documentSecurityHandlerService";
36 public static final String RULE_VALIDATION_ATTRIBUTE_EXPORTER_SERVICE = "ruleValidationAttributeExporterService";
37 public static final String ACTION_LIST_CUSTOMIZATION_HANDLER_SERVICE = "actionListCustomizationHandler";
38 public static final String WORKFLOW_RULE_ATTRIBUTE_HANDLER_SERVICE = "workflowRuleAttributeHandlerService";
39
40
41 static <T> T getService(String serviceName) {
42 return GlobalResourceLoader.<T>getService(serviceName);
43 }
44
45 static <T> T getServiceOnBus(String serviceName, String applicationId) {
46 return (T)KsbApiServiceLocator.getServiceBus().getService(new QName(KewApiConstants.Namespaces.KEW_NAMESPACE_2_0, serviceName), applicationId);
47 }
48
49 public static DocumentSearchCustomizationHandlerService getDocumentSearchCustomizationHandlerService() {
50 return getDocumentSearchCustomizationHandlerService(null);
51 }
52
53 public static DocumentSearchCustomizationHandlerService getDocumentSearchCustomizationHandlerService(
54 String applicationId) {
55 return getServiceOnBus(DOCUMENT_SEARCH_CUSTOMIZATION_HANDLER_SERVICE, applicationId);
56 }
57
58 public static DocumentSecurityHandlerService getDocumentSecurityHandlerService() {
59 return getDocumentSecurityHandlerService(null);
60 }
61
62 public static DocumentSecurityHandlerService getDocumentSecurityHandlerService(
63 String applicationId) {
64 return getServiceOnBus(DOCUMENT_SECURITY_HANDLER_SERVICE, applicationId);
65 }
66
67 public static RuleValidationAttributeExporterService getRuleValidationAttributeExporterService() {
68 return getRuleValidationAttributeExporterService(null);
69 }
70
71 public static RuleValidationAttributeExporterService getRuleValidationAttributeExporterService(String applicationId) {
72 return getServiceOnBus(RULE_VALIDATION_ATTRIBUTE_EXPORTER_SERVICE, applicationId);
73 }
74
75 public static WorkflowRuleAttributeHandlerService getWorkflowRuleAttributeHandlerService() {
76 return getWorkflowRuleAttributeHandlerService(null);
77 }
78
79 public static WorkflowRuleAttributeHandlerService getWorkflowRuleAttributeHandlerService(String applicationId) {
80 return getServiceOnBus(WORKFLOW_RULE_ATTRIBUTE_HANDLER_SERVICE, applicationId);
81 }
82
83 public static ActionListCustomizationHandlerService getActionListCustomizationHandlerService(
84 String applicationId) {
85 return getServiceOnBus(ACTION_LIST_CUSTOMIZATION_HANDLER_SERVICE, applicationId);
86 }
87 }