001    /**
002     * Copyright 2005-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krad.service;
017    
018    import org.kuali.rice.core.api.CoreConstants;
019    import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
020    import org.kuali.rice.krad.lookup.Lookupable;
021    import org.kuali.rice.krad.uif.service.AttributeQueryService;
022    import org.kuali.rice.krad.uif.service.ExpressionEvaluatorService;
023    import org.kuali.rice.krad.uif.service.ViewDictionaryService;
024    import org.kuali.rice.krad.uif.service.ViewService;
025    import org.kuali.rice.krad.workflow.service.WorkflowDocumentService;
026    
027    /**
028     * Service locator for the KRAD Web module
029     *
030     * @author Kuali Rice Team (rice.collab@kuali.org)
031     */
032    public class KRADServiceLocatorWeb {
033    
034        public static final class Namespaces {
035            public static final String MODULE_NAME = "krad";
036            public static final String KRAD_NAMESPACE_PREFIX =
037                    CoreConstants.Namespaces.ROOT_NAMESPACE_PREFIX + "/" + MODULE_NAME;
038    
039            /**
040             * Namespace for the krad module which is compatible with Kuali Rice 2.0.x.
041             */
042            public static final String KRAD_NAMESPACE_2_0 =
043                    KRAD_NAMESPACE_PREFIX + "/" + CoreConstants.Versions.VERSION_2_0;
044    
045        }
046    
047        public static final String DATA_DICTIONARY_REMOTE_FIELD_SERVICE = "dataDictionaryRemoteFieldService";
048        public static final String DOCUMENT_DICTIONARY_SERVICE = "documentDictionaryService";
049        public static final String SESSION_DOCUMENT_SERVICE = "sessionDocumentService";
050        public static final String DATA_OBJECT_AUTHORIZATION_SERVICE = "dataObjectAuthorizationService";
051        public static final String MAINTENANCE_DOCUMENT_SERVICE = "maintenanceDocumentService";
052        public static final String WORKFLOW_DOCUMENT_SERVICE = "workflowDocumentService";
053        public static final String EXCEPTION_INCIDENT_REPORT_SERVICE = "kradExceptionIncidentService";
054        public static final String DATA_DICTIONARY_SERVICE = "dataDictionaryService";
055        public static final String DOCUMENT_HEADER_SERVICE = "documentHeaderService";
056        public static final String PESSIMISTIC_LOCK_SERVICE = "pessimisticLockService";
057        public static final String PERSISTENCE_SERVICE_OJB = "persistenceServiceOjb";
058        public static final String KUALI_MODULE_SERVICE = "kualiModuleService";
059        public static final String KUALI_RULE_SERVICE = "kualiRuleService";
060        public static final String DOCUMENT_SERVICE = "documentService";
061        public static final String DOCUMENT_SERIALIZER_SERVICE = "documentSerializerService";
062        public static final String LOOKUP_SERVICE = "lookupService";
063        public static final String DICTIONARY_VALIDATION_SERVICE = "dictionaryValidationService";
064        public static final String DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE = "inactivationBlockingDetectionService";
065        public static final String DATA_OBJECT_METADATA_SERVICE = "dataObjectMetaDataService";
066        public static final String EXPRESSION_EVALUATOR_SERVICE = "expressionEvaluatorService";
067        public static final String VIEW_SERVICE = "viewService";
068        public static final String VIEW_DICTIONARY_SERVICE = "viewDictionaryService";
069        public static final String VIEW_VALIDATION_SERVICE = "viewValidationService";
070        public static final String ATTRIBUTE_QUERY_SERVICE = "attributeQueryService";
071    
072        public static <T extends Object> T getService(String serviceName) {
073            return GlobalResourceLoader.<T>getService(serviceName);
074        }
075    
076        public static DocumentDictionaryService getDocumentDictionaryService() {
077            return getService(DOCUMENT_DICTIONARY_SERVICE);
078        }
079    
080        public static SessionDocumentService getSessionDocumentService() {
081            return getService(SESSION_DOCUMENT_SERVICE);
082        }
083    
084        public static DataObjectAuthorizationService getDataObjectAuthorizationService() {
085            return getService(DATA_OBJECT_AUTHORIZATION_SERVICE);
086        }
087    
088        public static MaintenanceDocumentService getMaintenanceDocumentService() {
089            return getService(MAINTENANCE_DOCUMENT_SERVICE);
090        }
091    
092        public static WorkflowDocumentService getWorkflowDocumentService() {
093            return getService(WORKFLOW_DOCUMENT_SERVICE);
094        }
095    
096        public static final KualiExceptionIncidentService getKualiExceptionIncidentService() {
097            return getService(EXCEPTION_INCIDENT_REPORT_SERVICE);
098        }
099    
100        public static DataDictionaryService getDataDictionaryService() {
101            return getService(DATA_DICTIONARY_SERVICE);
102        }
103    
104        public static DocumentHeaderService getDocumentHeaderService() {
105            return getService(DOCUMENT_HEADER_SERVICE);
106        }
107    
108        public static PessimisticLockService getPessimisticLockService() {
109            return getService(PESSIMISTIC_LOCK_SERVICE);
110        }
111    
112        public static Lookupable getLookupable(String lookupableName) {
113            return getService(lookupableName);
114        }
115    
116        public static PersistenceService getPersistenceServiceOjb() {
117            return getService(PERSISTENCE_SERVICE_OJB);
118        }
119    
120        public static KualiModuleService getKualiModuleService() {
121            return getService(KUALI_MODULE_SERVICE);
122        }
123    
124        public static KualiRuleService getKualiRuleService() {
125            return getService(KUALI_RULE_SERVICE);
126        }
127    
128        public static DocumentService getDocumentService() {
129            return getService(DOCUMENT_SERVICE);
130        }
131    
132        public static DocumentSerializerService getDocumentSerializerService() {
133            return (DocumentSerializerService) getService(DOCUMENT_SERIALIZER_SERVICE);
134        }
135    
136        public static LookupService getLookupService() {
137            return (LookupService) getService(LOOKUP_SERVICE);
138        }
139    
140        public static DictionaryValidationService getDictionaryValidationService() {
141            return (DictionaryValidationService) getService(DICTIONARY_VALIDATION_SERVICE);
142        }
143    
144        public static InactivationBlockingDetectionService getInactivationBlockingDetectionService(String serviceName) {
145            return (InactivationBlockingDetectionService) getService(serviceName);
146        }
147    
148        public static DataObjectMetaDataService getDataObjectMetaDataService() {
149            return (DataObjectMetaDataService) getService(DATA_OBJECT_METADATA_SERVICE);
150        }
151    
152        public static ExpressionEvaluatorService getExpressionEvaluatorService() {
153            return (ExpressionEvaluatorService) getService(EXPRESSION_EVALUATOR_SERVICE);
154        }
155    
156        public static ViewService getViewService() {
157            return (ViewService) getService(VIEW_SERVICE);
158        }
159    
160        public static ViewDictionaryService getViewDictionaryService() {
161            return (ViewDictionaryService) getService(VIEW_DICTIONARY_SERVICE);
162        }
163    
164        public static ViewValidationService getViewValidationService() {
165            return (ViewValidationService) getService(VIEW_VALIDATION_SERVICE);
166        }
167    
168        public static AttributeQueryService getAttributeQueryService() {
169            return (AttributeQueryService) getService(ATTRIBUTE_QUERY_SERVICE);
170        }
171    
172        public static DataDictionaryRemoteFieldService getDataDictionaryRemoteFieldService() {
173            return (DataDictionaryRemoteFieldService) getService(DATA_DICTIONARY_REMOTE_FIELD_SERVICE);
174        }
175    }