View Javadoc

1   /**
2    * Copyright 2005-2012 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/ecl2.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.krad.service;
17  
18  import org.kuali.rice.core.api.CoreConstants;
19  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20  import org.kuali.rice.krad.lookup.Lookupable;
21  import org.kuali.rice.krad.uif.service.AttributeQueryService;
22  import org.kuali.rice.krad.uif.service.ExpressionEvaluatorService;
23  import org.kuali.rice.krad.uif.service.ViewDictionaryService;
24  import org.kuali.rice.krad.uif.service.ViewService;
25  import org.kuali.rice.krad.workflow.service.WorkflowDocumentService;
26  
27  /**
28   * Service locator for the KRAD Web module
29   *
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class KRADServiceLocatorWeb {
33  
34      public static final class Namespaces {
35          public static final String MODULE_NAME = "krad";
36          public static final String KRAD_NAMESPACE_PREFIX = CoreConstants.Namespaces.ROOT_NAMESPACE_PREFIX + "/" + MODULE_NAME;
37  
38          /**
39           * Namespace for the krad module which is compatible with Kuali Rice 2.0.x.
40           */
41          public static final String KRAD_NAMESPACE_2_0 = KRAD_NAMESPACE_PREFIX + "/" + CoreConstants.Versions.VERSION_2_0;
42  
43      }
44  
45      public static final String DATA_DICTIONARY_REMOTE_FIELD_SERVICE = "dataDictionaryRemoteFieldService";
46      public static final String DOCUMENT_DICTIONARY_SERVICE = "documentDictionaryService";
47      public static final String SESSION_DOCUMENT_SERVICE = "sessionDocumentService";
48      public static final String DATA_OBJECT_AUTHORIZATION_SERVICE = "dataObjectAuthorizationService";
49      public static final String MAINTENANCE_DOCUMENT_SERVICE = "maintenanceDocumentService";
50      public static final String WORKFLOW_DOCUMENT_SERVICE = "workflowDocumentService";
51      public static final String EXCEPTION_INCIDENT_REPORT_SERVICE = "kradExceptionIncidentService";
52      public static final String DATA_DICTIONARY_SERVICE = "dataDictionaryService";
53      public static final String DOCUMENT_HEADER_SERVICE = "documentHeaderService";
54      public static final String PESSIMISTIC_LOCK_SERVICE = "pessimisticLockService";
55      public static final String PERSISTENCE_SERVICE_OJB = "persistenceServiceOjb";
56      public static final String KUALI_MODULE_SERVICE = "kualiModuleService";
57      public static final String KUALI_RULE_SERVICE = "kualiRuleService";
58      public static final String DOCUMENT_SERVICE = "documentService";
59      public static final String DOCUMENT_SERIALIZER_SERVICE = "documentSerializerService";
60      public static final String LOOKUP_SERVICE = "lookupService";
61      public static final String DICTIONARY_VALIDATION_SERVICE = "dictionaryValidationService";
62      public static final String DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE = "inactivationBlockingDetectionService";
63      public static final String DATA_OBJECT_METADATA_SERVICE = "dataObjectMetaDataService";
64      public static final String EXPRESSION_EVALUATOR_SERVICE = "expressionEvaluatorService";
65      public static final String VIEW_SERVICE = "viewService";
66      public static final String VIEW_DICTIONARY_SERVICE = "viewDictionaryService";
67      public static final String ATTRIBUTE_QUERY_SERVICE = "attributeQueryService";
68  
69      public static <T extends Object> T getService(String serviceName) {
70          return GlobalResourceLoader.<T>getService(serviceName);
71      }
72  
73      public static DocumentDictionaryService getDocumentDictionaryService() {
74          return  getService(DOCUMENT_DICTIONARY_SERVICE);
75      }
76  
77      public static SessionDocumentService getSessionDocumentService() {
78          return  getService(SESSION_DOCUMENT_SERVICE);
79      }
80  
81      public static DataObjectAuthorizationService getDataObjectAuthorizationService() {
82          return getService(DATA_OBJECT_AUTHORIZATION_SERVICE);
83      }
84  
85      public static MaintenanceDocumentService getMaintenanceDocumentService() {
86          return getService(MAINTENANCE_DOCUMENT_SERVICE);
87      }
88  
89      public static WorkflowDocumentService getWorkflowDocumentService() {
90          return getService(WORKFLOW_DOCUMENT_SERVICE);
91      }
92  
93      public static final KualiExceptionIncidentService getKualiExceptionIncidentService() {
94          return getService(EXCEPTION_INCIDENT_REPORT_SERVICE);
95      }
96  
97      public static DataDictionaryService getDataDictionaryService() {
98          return getService(DATA_DICTIONARY_SERVICE);
99      }
100 
101     public static DocumentHeaderService getDocumentHeaderService() {
102         return getService(DOCUMENT_HEADER_SERVICE);
103     }
104 
105     public static PessimisticLockService getPessimisticLockService() {
106         return getService(PESSIMISTIC_LOCK_SERVICE);
107     }
108 
109     public static Lookupable getLookupable(String lookupableName) {
110         return getService(lookupableName);
111     }
112 
113     public static PersistenceService getPersistenceServiceOjb() {
114         return getService(PERSISTENCE_SERVICE_OJB);
115     }
116 
117     public static KualiModuleService getKualiModuleService() {
118         return getService(KUALI_MODULE_SERVICE);
119     }
120 
121     public static KualiRuleService getKualiRuleService() {
122         return getService(KUALI_RULE_SERVICE);
123     }
124 
125     public static DocumentService getDocumentService() {
126         return getService(DOCUMENT_SERVICE);
127     }
128 
129     public static DocumentSerializerService getDocumentSerializerService() {
130         return (DocumentSerializerService) getService(DOCUMENT_SERIALIZER_SERVICE);
131     }
132 
133     public static LookupService getLookupService() {
134 	return (LookupService) getService(LOOKUP_SERVICE);
135     }
136 
137     public static DictionaryValidationService getDictionaryValidationService() {
138 	return (DictionaryValidationService) getService(DICTIONARY_VALIDATION_SERVICE);
139     }
140 
141     public static InactivationBlockingDetectionService getInactivationBlockingDetectionService(String serviceName) {
142         return (InactivationBlockingDetectionService) getService(serviceName);
143     }
144 
145 	public static DataObjectMetaDataService getDataObjectMetaDataService() {
146 		return (DataObjectMetaDataService) getService(DATA_OBJECT_METADATA_SERVICE);
147 	}
148 
149 	public static ExpressionEvaluatorService getExpressionEvaluatorService() {
150 		return (ExpressionEvaluatorService) getService(EXPRESSION_EVALUATOR_SERVICE);
151 	}
152 
153 	public static ViewService getViewService() {
154 		return (ViewService) getService(VIEW_SERVICE);
155 	}
156 
157 	public static ViewDictionaryService getViewDictionaryService() {
158 		return (ViewDictionaryService) getService(VIEW_DICTIONARY_SERVICE);
159 	}
160 
161     public static AttributeQueryService getAttributeQueryService() {
162         return (AttributeQueryService) getService(ATTRIBUTE_QUERY_SERVICE);
163     }
164 
165     public static DataDictionaryRemoteFieldService getDataDictionaryRemoteFieldService() {
166         return (DataDictionaryRemoteFieldService) getService(DATA_DICTIONARY_REMOTE_FIELD_SERVICE);
167     }
168 }