001/**
002 * Copyright 2005-2015 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.kuali.rice.krad.service.BusinessObjectService;
024import org.kuali.rice.krad.service.DataObjectMetaDataService;
025import org.kuali.rice.krad.service.DocumentHeaderService;
026import org.kuali.rice.krad.service.KeyValuesService;
027import org.kuali.rice.krad.service.LegacyAppFrameworkAdapterService;
028import org.kuali.rice.krad.service.PersistenceService;
029import org.kuali.rice.krad.service.PersistenceStructureService;
030import org.kuali.rice.krad.service.SequenceAccessorService;
031import org.kuali.rice.krad.service.util.OjbCollectionHelper;
032import org.springframework.transaction.PlatformTransactionManager;
033import org.springframework.transaction.support.TransactionTemplate;
034
035/**
036 * Service locator for the KRAD Web module
037 *
038 * @author Kuali Rice Team (rice.collab@kuali.org)
039 * @deprecated As of release 2.0
040 */
041@Deprecated
042public class KNSServiceLocator {
043
044    public static final String BUSINESS_OBJECT_AUTHORIZATION_SERVICE = "businessObjectAuthorizationService";
045    public static final String BUSINESS_OBJECT_METADATA_SERVICE = "businessObjectMetaDataService";
046    public static final String BUSINESS_OBJECT_DICTIONARY_SERVICE = "businessObjectDictionaryService";
047    public static final String DATA_DICTIONARY_SERVICE = "dataDictionaryService";
048    public static final String DICTIONARY_VALIDATION_SERVICE = "knsDictionaryValidationService";
049    public static final String DOCUMENT_HELPER_SERVICE = "documentHelperService";
050    public static final String LOOKUP_RESULTS_SERVICE = "lookupResultsService";
051    public static final String KUALI_INQUIRABLE = "kualiInquirable";
052    public static final String KUALI_LOOKUPABLE = "kualiLookupable";
053    public static final String MAINTENANCE_DOCUMENT_DICTIONARY_SERVICE = "maintenanceDocumentDictionaryService";
054    public static final String TRANSACTIONAL_DOCUMENT_DICTIONARY_SERVICE = "transactionalDocumentDictionaryService";
055    public static final String KNS_SESSION_DOCUMENT_SERVICE = "knsSessionDocumentService";
056    public static final String WORKFLOW_ATTRIBUTE_PROPERTY_RESOLUTION_SERVICE = "workflowAttributesPropertyResolutionService";
057    public static final String TRANSACTION_MANAGER = "transactionManager";
058    public static final String TRANSACTION_TEMPLATE = "transactionTemplate";
059    public static final String MAINTENANCE_DOCUMENT_AUTHORIZATION_SERVICE = "maintenanceDocumentAuthorizationService";
060    public static final String BUSINESS_OBJECT_SERVICE = "businessObjectService";
061    public static final String DATA_OBJECT_METADATA_SERVICE = "dataObjectMetaDataService";
062    public static final String KEY_VALUES_SERVICE = "keyValuesService";
063    public static final String SESSION_DOCUMENT_SERVICE = "knsSessionDocumentService";
064    public static final String OJB_COLLECTION_HELPER = "ojbCollectionHelper";
065    public static final String PERSISTENCE_SERVICE = "persistenceService";
066    public static final String PERSISTENCE_STRUCTURE_SERVICE = "persistenceStructureService";
067    public static final String SEQUENCE_ACCESSOR_SERVICE = "sequenceAccessorService";
068    public static final String DOCUMENT_HEADER_SERVICE = "documentHeaderService";
069    public static final String LEGACY_DATA_ADAPTER_FRAMEWORK = "legacyAppFrameworkAdapter";
070
071    @Deprecated
072    public static <T extends Object> T getService(String serviceName) {
073        return GlobalResourceLoader.<T>getService(serviceName);
074    }
075
076    @Deprecated
077    public static BusinessObjectAuthorizationService getBusinessObjectAuthorizationService() {
078        return getService(BUSINESS_OBJECT_AUTHORIZATION_SERVICE);
079    }
080
081    @Deprecated
082    public static BusinessObjectMetaDataService getBusinessObjectMetaDataService() {
083        return getService(BUSINESS_OBJECT_METADATA_SERVICE);
084    }
085
086    @Deprecated
087    public static DictionaryValidationService getKNSDictionaryValidationService() {
088            return (DictionaryValidationService) getService(DICTIONARY_VALIDATION_SERVICE);
089    }
090
091    @Deprecated
092    public static LookupResultsService getLookupResultsService() {
093        return (LookupResultsService) getService(LOOKUP_RESULTS_SERVICE);
094    }
095
096    @Deprecated
097    public static Inquirable getKualiInquirable() {
098        return getService(KUALI_INQUIRABLE);
099    }
100
101    @Deprecated
102    public static Lookupable getKualiLookupable() {
103        return getService(KUALI_LOOKUPABLE);
104    }
105
106    @Deprecated
107    public static MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService() {
108        return getService(MAINTENANCE_DOCUMENT_DICTIONARY_SERVICE);
109    }
110
111    @Deprecated
112    public static TransactionalDocumentDictionaryService getTransactionalDocumentDictionaryService() {
113        return (TransactionalDocumentDictionaryService) getService(TRANSACTIONAL_DOCUMENT_DICTIONARY_SERVICE);
114    }
115
116    @Deprecated
117    public static org.kuali.rice.kns.service.SessionDocumentService getKNSSessionDocumentService() {
118        return  getService(KNS_SESSION_DOCUMENT_SERVICE);
119    }
120
121    @Deprecated
122    public static Lookupable getLookupable(String lookupableName) {
123        return getService(lookupableName);
124    }
125
126    @Deprecated
127    public static DataDictionaryService getDataDictionaryService() {
128        return getService(DATA_DICTIONARY_SERVICE);
129    }
130
131    @Deprecated
132    public static BusinessObjectDictionaryService getBusinessObjectDictionaryService() {
133        return getService(BUSINESS_OBJECT_DICTIONARY_SERVICE);
134    }
135
136    @Deprecated
137    public static DocumentHelperService getDocumentHelperService() {
138        return getService(DOCUMENT_HELPER_SERVICE);
139    }
140
141    @Deprecated
142    public static Question getQuestion(String questionName) {
143        return (Question) getService(questionName);
144    }
145
146    @Deprecated
147    public static WorkflowAttributePropertyResolutionService getWorkflowAttributePropertyResolutionService() {
148        return (WorkflowAttributePropertyResolutionService) getService(WORKFLOW_ATTRIBUTE_PROPERTY_RESOLUTION_SERVICE);
149    }
150
151    @Deprecated
152    public static PlatformTransactionManager getTransactionManager() {
153            return (PlatformTransactionManager) getService(TRANSACTION_MANAGER);
154    }
155
156    @Deprecated
157    public static TransactionTemplate getTransactionTemplate() {
158            return (TransactionTemplate) getService(TRANSACTION_TEMPLATE);
159    }
160
161    @Deprecated
162    public static BusinessObjectAuthorizationService getMaintenanceDocumentAuthorizationService() {
163        return (BusinessObjectAuthorizationService) getService(MAINTENANCE_DOCUMENT_AUTHORIZATION_SERVICE);
164    }
165
166    @Deprecated
167    public static BusinessObjectService getBusinessObjectService(){
168        return (BusinessObjectService) getService(BUSINESS_OBJECT_SERVICE);
169    }
170
171    @Deprecated
172    public static DataObjectMetaDataService getDataObjectMetaDataService() {
173        return (DataObjectMetaDataService) getService(DATA_OBJECT_METADATA_SERVICE);
174    }
175
176    @Deprecated
177    public static KeyValuesService getKeyValuesService() {
178        return getService(KEY_VALUES_SERVICE);
179    }
180
181    @Deprecated
182    public static SessionDocumentService getSessionDocumentService() {
183        return getService(SESSION_DOCUMENT_SERVICE);
184    }
185
186    @Deprecated
187    public static OjbCollectionHelper getOjbCollectionHelper() {
188        return (OjbCollectionHelper) getService(OJB_COLLECTION_HELPER);
189    }
190    @Deprecated
191    public static DocumentHeaderService getDocumentHeaderService() {
192        return getService(DOCUMENT_HEADER_SERVICE);
193    }
194
195
196    @Deprecated
197    public static PersistenceService getPersistenceService() {
198        return getService(PERSISTENCE_SERVICE);
199    }
200
201    @Deprecated
202    public static PersistenceStructureService getPersistenceStructureService() {
203        return getService(PERSISTENCE_STRUCTURE_SERVICE);
204    }
205
206    @Deprecated
207    public static SequenceAccessorService getSequenceAccessorService() {
208        return getService(SEQUENCE_ACCESSOR_SERVICE);
209    }
210
211        public static LegacyAppFrameworkAdapterService getLegacyAppFrameworkAdapterService() {
212                return (LegacyAppFrameworkAdapterService) getService(LEGACY_DATA_ADAPTER_FRAMEWORK);
213        }
214}