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.messages.MessageService;
022    import org.kuali.rice.krad.uif.service.AttributeQueryService;
023    import org.kuali.rice.krad.uif.service.ExpressionEvaluatorService;
024    import org.kuali.rice.krad.uif.service.ViewDictionaryService;
025    import org.kuali.rice.krad.uif.service.ViewService;
026    import org.kuali.rice.krad.workflow.service.WorkflowDocumentService;
027    
028    /**
029     * Service locator for the KRAD Web module
030     *
031     * @author Kuali Rice Team (rice.collab@kuali.org)
032     */
033    public class KRADServiceLocatorWeb {
034    
035        public static final class Namespaces {
036            public static final String MODULE_NAME = "krad";
037            public static final String KRAD_NAMESPACE_PREFIX =
038                    CoreConstants.Namespaces.ROOT_NAMESPACE_PREFIX + "/" + MODULE_NAME;
039    
040            /**
041             * Namespace for the krad module which is compatible with Kuali Rice 2.0.x.
042             */
043            public static final String KRAD_NAMESPACE_2_0 =
044                    KRAD_NAMESPACE_PREFIX + "/" + CoreConstants.Versions.VERSION_2_0;
045    
046        }
047    
048        public static final String DATA_DICTIONARY_REMOTE_FIELD_SERVICE = "dataDictionaryRemoteFieldService";
049        public static final String DOCUMENT_DICTIONARY_SERVICE = "documentDictionaryService";
050        public static final String SESSION_DOCUMENT_SERVICE = "sessionDocumentService";
051        public static final String DATA_OBJECT_AUTHORIZATION_SERVICE = "dataObjectAuthorizationService";
052        public static final String MAINTENANCE_DOCUMENT_SERVICE = "maintenanceDocumentService";
053        public static final String WORKFLOW_DOCUMENT_SERVICE = "workflowDocumentService";
054        public static final String EXCEPTION_INCIDENT_REPORT_SERVICE = "kradExceptionIncidentService";
055        public static final String FEEDBACK_REPORT_SERVICE = "kradFeedbackService";
056        public static final String DATA_DICTIONARY_SERVICE = "dataDictionaryService";
057        public static final String DOCUMENT_HEADER_SERVICE = "documentHeaderService";
058        public static final String PESSIMISTIC_LOCK_SERVICE = "pessimisticLockService";
059        public static final String PERSISTENCE_SERVICE_OJB = "persistenceServiceOjb";
060        public static final String KUALI_MODULE_SERVICE = "kualiModuleService";
061        public static final String KUALI_RULE_SERVICE = "kualiRuleService";
062        public static final String DOCUMENT_SERVICE = "documentService";
063        public static final String DOCUMENT_SERIALIZER_SERVICE = "documentSerializerService";
064        public static final String LOOKUP_SERVICE = "lookupService";
065        public static final String DICTIONARY_VALIDATION_SERVICE = "dictionaryValidationService";
066        public static final String DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE = "inactivationBlockingDetectionService";
067        public static final String DATA_OBJECT_METADATA_SERVICE = "dataObjectMetaDataService";
068        public static final String EXPRESSION_EVALUATOR_SERVICE = "expressionEvaluatorService";
069        public static final String VIEW_SERVICE = "viewService";
070        public static final String VIEW_DICTIONARY_SERVICE = "viewDictionaryService";
071        public static final String VIEW_VALIDATION_SERVICE = "viewValidationService";
072        public static final String ATTRIBUTE_QUERY_SERVICE = "attributeQueryService";
073        public static final String MESSAGE_SERVICE = "messageService";
074    
075        public static <T extends Object> T getService(String serviceName) {
076            return GlobalResourceLoader.<T>getService(serviceName);
077        }
078    
079        public static DocumentDictionaryService getDocumentDictionaryService() {
080            return getService(DOCUMENT_DICTIONARY_SERVICE);
081        }
082    
083        public static SessionDocumentService getSessionDocumentService() {
084            return getService(SESSION_DOCUMENT_SERVICE);
085        }
086    
087        public static DataObjectAuthorizationService getDataObjectAuthorizationService() {
088            return getService(DATA_OBJECT_AUTHORIZATION_SERVICE);
089        }
090    
091        public static MaintenanceDocumentService getMaintenanceDocumentService() {
092            return getService(MAINTENANCE_DOCUMENT_SERVICE);
093        }
094    
095        public static WorkflowDocumentService getWorkflowDocumentService() {
096            return getService(WORKFLOW_DOCUMENT_SERVICE);
097        }
098    
099        public static final KualiExceptionIncidentService getKualiExceptionIncidentService() {
100            return getService(EXCEPTION_INCIDENT_REPORT_SERVICE);
101        }
102    
103        public static final KualiFeedbackService getKualiFeedbackService() {
104            return getService(FEEDBACK_REPORT_SERVICE);
105        }
106    
107        public static DataDictionaryService getDataDictionaryService() {
108            return getService(DATA_DICTIONARY_SERVICE);
109        }
110    
111        public static DocumentHeaderService getDocumentHeaderService() {
112            return getService(DOCUMENT_HEADER_SERVICE);
113        }
114    
115        public static PessimisticLockService getPessimisticLockService() {
116            return getService(PESSIMISTIC_LOCK_SERVICE);
117        }
118    
119        public static Lookupable getLookupable(String lookupableName) {
120            return getService(lookupableName);
121        }
122    
123        public static PersistenceService getPersistenceServiceOjb() {
124            return getService(PERSISTENCE_SERVICE_OJB);
125        }
126    
127        public static KualiModuleService getKualiModuleService() {
128            return getService(KUALI_MODULE_SERVICE);
129        }
130    
131        public static KualiRuleService getKualiRuleService() {
132            return getService(KUALI_RULE_SERVICE);
133        }
134    
135        public static DocumentService getDocumentService() {
136            return getService(DOCUMENT_SERVICE);
137        }
138    
139        public static DocumentSerializerService getDocumentSerializerService() {
140            return (DocumentSerializerService) getService(DOCUMENT_SERIALIZER_SERVICE);
141        }
142    
143        public static LookupService getLookupService() {
144            return (LookupService) getService(LOOKUP_SERVICE);
145        }
146    
147        public static DictionaryValidationService getDictionaryValidationService() {
148            return (DictionaryValidationService) getService(DICTIONARY_VALIDATION_SERVICE);
149        }
150    
151        public static InactivationBlockingDetectionService getInactivationBlockingDetectionService(String serviceName) {
152            return (InactivationBlockingDetectionService) getService(serviceName);
153        }
154    
155        public static DataObjectMetaDataService getDataObjectMetaDataService() {
156            return (DataObjectMetaDataService) getService(DATA_OBJECT_METADATA_SERVICE);
157        }
158    
159        public static ExpressionEvaluatorService getExpressionEvaluatorService() {
160            return (ExpressionEvaluatorService) getService(EXPRESSION_EVALUATOR_SERVICE);
161        }
162    
163        public static ViewService getViewService() {
164            return (ViewService) getService(VIEW_SERVICE);
165        }
166    
167        public static ViewDictionaryService getViewDictionaryService() {
168            return (ViewDictionaryService) getService(VIEW_DICTIONARY_SERVICE);
169        }
170    
171        public static ViewValidationService getViewValidationService() {
172            return (ViewValidationService) getService(VIEW_VALIDATION_SERVICE);
173        }
174    
175        public static AttributeQueryService getAttributeQueryService() {
176            return (AttributeQueryService) getService(ATTRIBUTE_QUERY_SERVICE);
177        }
178    
179        public static DataDictionaryRemoteFieldService getDataDictionaryRemoteFieldService() {
180            return (DataDictionaryRemoteFieldService) getService(DATA_DICTIONARY_REMOTE_FIELD_SERVICE);
181        }
182    
183        public static MessageService getMessageService() {
184            return getService(MESSAGE_SERVICE);
185        }
186    }