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