View Javadoc

1   /**
2    * Copyright 2005-2012 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.krad.service;
17  
18  import org.kuali.rice.core.api.CoreConstants;
19  import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
20  import org.kuali.rice.krad.lookup.Lookupable;
21  import org.kuali.rice.krad.messages.MessageService;
22  import org.kuali.rice.krad.uif.service.AttributeQueryService;
23  import org.kuali.rice.krad.uif.service.ExpressionEvaluatorService;
24  import org.kuali.rice.krad.uif.service.ViewDictionaryService;
25  import org.kuali.rice.krad.uif.service.ViewService;
26  import org.kuali.rice.krad.workflow.service.WorkflowDocumentService;
27  
28  /**
29   * Service locator for the KRAD Web module
30   *
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  public class KRADServiceLocatorWeb {
34  
35      public static final class Namespaces {
36          public static final String MODULE_NAME = "krad";
37          public static final String KRAD_NAMESPACE_PREFIX =
38                  CoreConstants.Namespaces.ROOT_NAMESPACE_PREFIX + "/" + MODULE_NAME;
39  
40          /**
41           * Namespace for the krad module which is compatible with Kuali Rice 2.0.x.
42           */
43          public static final String KRAD_NAMESPACE_2_0 =
44                  KRAD_NAMESPACE_PREFIX + "/" + CoreConstants.Versions.VERSION_2_0;
45  
46      }
47  
48      public static final String DATA_DICTIONARY_REMOTE_FIELD_SERVICE = "dataDictionaryRemoteFieldService";
49      public static final String DOCUMENT_DICTIONARY_SERVICE = "documentDictionaryService";
50      public static final String SESSION_DOCUMENT_SERVICE = "sessionDocumentService";
51      public static final String DATA_OBJECT_AUTHORIZATION_SERVICE = "dataObjectAuthorizationService";
52      public static final String MAINTENANCE_DOCUMENT_SERVICE = "maintenanceDocumentService";
53      public static final String WORKFLOW_DOCUMENT_SERVICE = "workflowDocumentService";
54      public static final String EXCEPTION_INCIDENT_REPORT_SERVICE = "kradExceptionIncidentService";
55      public static final String FEEDBACK_REPORT_SERVICE = "kradFeedbackService";
56      public static final String DATA_DICTIONARY_SERVICE = "dataDictionaryService";
57      public static final String DOCUMENT_HEADER_SERVICE = "documentHeaderService";
58      public static final String PESSIMISTIC_LOCK_SERVICE = "pessimisticLockService";
59      public static final String PERSISTENCE_SERVICE_OJB = "persistenceServiceOjb";
60      public static final String KUALI_MODULE_SERVICE = "kualiModuleService";
61      public static final String KUALI_RULE_SERVICE = "kualiRuleService";
62      public static final String DOCUMENT_SERVICE = "documentService";
63      public static final String DOCUMENT_SERIALIZER_SERVICE = "documentSerializerService";
64      public static final String LOOKUP_SERVICE = "lookupService";
65      public static final String DICTIONARY_VALIDATION_SERVICE = "dictionaryValidationService";
66      public static final String DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE = "inactivationBlockingDetectionService";
67      public static final String DATA_OBJECT_METADATA_SERVICE = "dataObjectMetaDataService";
68      public static final String EXPRESSION_EVALUATOR_SERVICE = "expressionEvaluatorService";
69      public static final String VIEW_SERVICE = "viewService";
70      public static final String VIEW_DICTIONARY_SERVICE = "viewDictionaryService";
71      public static final String VIEW_VALIDATION_SERVICE = "viewValidationService";
72      public static final String ATTRIBUTE_QUERY_SERVICE = "attributeQueryService";
73      public static final String MESSAGE_SERVICE = "messageService";
74  
75      public static <T extends Object> T getService(String serviceName) {
76          return GlobalResourceLoader.<T>getService(serviceName);
77      }
78  
79      public static DocumentDictionaryService getDocumentDictionaryService() {
80          return getService(DOCUMENT_DICTIONARY_SERVICE);
81      }
82  
83      public static SessionDocumentService getSessionDocumentService() {
84          return getService(SESSION_DOCUMENT_SERVICE);
85      }
86  
87      public static DataObjectAuthorizationService getDataObjectAuthorizationService() {
88          return getService(DATA_OBJECT_AUTHORIZATION_SERVICE);
89      }
90  
91      public static MaintenanceDocumentService getMaintenanceDocumentService() {
92          return getService(MAINTENANCE_DOCUMENT_SERVICE);
93      }
94  
95      public static WorkflowDocumentService getWorkflowDocumentService() {
96          return getService(WORKFLOW_DOCUMENT_SERVICE);
97      }
98  
99      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 }