View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kns.service;
17  
18  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
19  import org.kuali.rice.kns.inquiry.Inquirable;
20  import org.kuali.rice.kns.lookup.LookupResultsService;
21  import org.kuali.rice.kns.lookup.Lookupable;
22  import org.kuali.rice.kns.question.Question;
23  import org.springframework.transaction.PlatformTransactionManager;
24  import org.springframework.transaction.support.TransactionTemplate;
25  
26  /**
27   * Service locator for the KRAD Web module
28   *
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   * @deprecated As of release 2.0
31   */
32  @Deprecated
33  public class KNSServiceLocator {
34  
35      public static final String BUSINESS_OBJECT_AUTHORIZATION_SERVICE = "businessObjectAuthorizationService";
36      public static final String BUSINESS_OBJECT_METADATA_SERVICE = "businessObjectMetaDataService";
37      public static final String BUSINESS_OBJECT_DICTIONARY_SERVICE = "businessObjectDictionaryService";
38      public static final String DATA_DICTIONARY_SERVICE = "dataDictionaryService";
39      public static final String DICTIONARY_VALIDATION_SERVICE = "knsDictionaryValidationService";
40      public static final String DOCUMENT_HELPER_SERVICE = "documentHelperService";
41      public static final String LOOKUP_RESULTS_SERVICE = "lookupResultsService";
42      public static final String KUALI_INQUIRABLE = "kualiInquirable";
43      public static final String KUALI_LOOKUPABLE = "kualiLookupable";
44      public static final String MAINTENANCE_DOCUMENT_DICTIONARY_SERVICE = "maintenanceDocumentDictionaryService";
45      public static final String TRANSACTIONAL_DOCUMENT_DICTIONARY_SERVICE = "transactionalDocumentDictionaryService";
46      public static final String SESSION_DOCUMENT_SERVICE = "knsSessionDocumentService";
47      public static final String WORKFLOW_ATTRIBUTE_PROPERTY_RESOLUTION_SERVICE = "workflowAttributesPropertyResolutionService";
48      public static final String TRANSACTION_MANAGER = "transactionManager";
49      public static final String TRANSACTION_TEMPLATE = "transactionTemplate";
50      public static final String MAINTENANCE_DOCUMENT_AUTHORIZATION_SERVICE = "maintenanceDocumentAuthorizationService";
51  
52      public static <T extends Object> T getService(String serviceName) {
53          return GlobalResourceLoader.<T>getService(serviceName);
54      }
55  
56      public static BusinessObjectAuthorizationService getBusinessObjectAuthorizationService() {
57          return getService(BUSINESS_OBJECT_AUTHORIZATION_SERVICE);
58      }
59  
60      public static BusinessObjectMetaDataService getBusinessObjectMetaDataService() {
61          return getService(BUSINESS_OBJECT_METADATA_SERVICE);
62      }
63  
64      public static DictionaryValidationService getKNSDictionaryValidationService() {
65  	return (DictionaryValidationService) getService(DICTIONARY_VALIDATION_SERVICE);
66      }
67  
68      public static LookupResultsService getLookupResultsService() {
69          return (LookupResultsService) getService(LOOKUP_RESULTS_SERVICE);
70      }
71  
72      public static Inquirable getKualiInquirable() {
73          return getService(KUALI_INQUIRABLE);
74      }
75  
76      public static Lookupable getKualiLookupable() {
77          return getService(KUALI_LOOKUPABLE);
78      }
79  
80      public static MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService() {
81          return getService(MAINTENANCE_DOCUMENT_DICTIONARY_SERVICE);
82      }
83  
84      public static TransactionalDocumentDictionaryService getTransactionalDocumentDictionaryService() {
85          return (TransactionalDocumentDictionaryService) getService(TRANSACTIONAL_DOCUMENT_DICTIONARY_SERVICE);
86      }
87  
88      public static SessionDocumentService getSessionDocumentService() {
89          return  getService(SESSION_DOCUMENT_SERVICE);
90      }
91  
92      public static Lookupable getLookupable(String lookupableName) {
93          return getService(lookupableName);
94      }
95  
96      public static DataDictionaryService getDataDictionaryService() {
97          return getService(DATA_DICTIONARY_SERVICE);
98      }
99  
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 }