001    /**
002     * Copyright 2005-2013 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.kns.service;
017    
018    import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
019    import org.kuali.rice.kns.inquiry.Inquirable;
020    import org.kuali.rice.kns.lookup.LookupResultsService;
021    import org.kuali.rice.kns.lookup.Lookupable;
022    import org.kuali.rice.kns.question.Question;
023    
024    /**
025     * Service locator for the KRAD Web module
026     *
027     * @author Kuali Rice Team (rice.collab@kuali.org)
028     * @deprecated As of release 2.0
029     */
030    @Deprecated
031    public class KNSServiceLocator {
032    
033        public static final String BUSINESS_OBJECT_AUTHORIZATION_SERVICE = "businessObjectAuthorizationService";
034        public static final String BUSINESS_OBJECT_METADATA_SERVICE = "businessObjectMetaDataService";
035        public static final String BUSINESS_OBJECT_DICTIONARY_SERVICE = "businessObjectDictionaryService";
036        public static final String DATA_DICTIONARY_SERVICE = "dataDictionaryService";
037        public static final String DICTIONARY_VALIDATION_SERVICE = "knsDictionaryValidationService";
038        public static final String DOCUMENT_HELPER_SERVICE = "documentHelperService";
039        public static final String LOOKUP_RESULTS_SERVICE = "lookupResultsService";
040        public static final String KUALI_INQUIRABLE = "kualiInquirable";
041        public static final String KUALI_LOOKUPABLE = "kualiLookupable";
042        public static final String MAINTENANCE_DOCUMENT_DICTIONARY_SERVICE = "maintenanceDocumentDictionaryService";
043        public static final String TRANSACTIONAL_DOCUMENT_DICTIONARY_SERVICE = "transactionalDocumentDictionaryService";
044        public static final String SESSION_DOCUMENT_SERVICE = "knsSessionDocumentService";
045    
046        public static <T extends Object> T getService(String serviceName) {
047            return GlobalResourceLoader.<T>getService(serviceName);
048        }
049    
050        public static BusinessObjectAuthorizationService getBusinessObjectAuthorizationService() {
051            return getService(BUSINESS_OBJECT_AUTHORIZATION_SERVICE);
052        }
053    
054        public static BusinessObjectMetaDataService getBusinessObjectMetaDataService() {
055            return getService(BUSINESS_OBJECT_METADATA_SERVICE);
056        }
057    
058        public static DictionaryValidationService getKNSDictionaryValidationService() {
059            return (DictionaryValidationService) getService(DICTIONARY_VALIDATION_SERVICE);
060        }
061    
062        public static LookupResultsService getLookupResultsService() {
063            return (LookupResultsService) getService(LOOKUP_RESULTS_SERVICE);
064        }
065    
066        public static Inquirable getKualiInquirable() {
067            return getService(KUALI_INQUIRABLE);
068        }
069    
070        public static Lookupable getKualiLookupable() {
071            return getService(KUALI_LOOKUPABLE);
072        }
073    
074        public static MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService() {
075            return getService(MAINTENANCE_DOCUMENT_DICTIONARY_SERVICE);
076        }
077    
078        public static TransactionalDocumentDictionaryService getTransactionalDocumentDictionaryService() {
079            return (TransactionalDocumentDictionaryService) getService(TRANSACTIONAL_DOCUMENT_DICTIONARY_SERVICE);
080        }
081    
082        public static SessionDocumentService getSessionDocumentService() {
083            return  getService(SESSION_DOCUMENT_SERVICE);
084        }
085    
086        public static Lookupable getLookupable(String lookupableName) {
087            return getService(lookupableName);
088        }
089    
090        public static DataDictionaryService getDataDictionaryService() {
091            return getService(DATA_DICTIONARY_SERVICE);
092        }
093    
094        public static BusinessObjectDictionaryService getBusinessObjectDictionaryService() {
095            return getService(BUSINESS_OBJECT_DICTIONARY_SERVICE);
096        }
097    
098        public static DocumentHelperService getDocumentHelperService() {
099            return getService(DOCUMENT_HELPER_SERVICE);
100        }
101    
102        public static Question getQuestion(String questionName) {
103            return (Question) getService(questionName);
104        }
105    }