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.uif.service.AttributeQueryService;
22  import org.kuali.rice.krad.uif.service.ExpressionEvaluatorService;
23  import org.kuali.rice.krad.uif.service.ViewDictionaryService;
24  import org.kuali.rice.krad.uif.service.ViewService;
25  import org.kuali.rice.krad.workflow.service.WorkflowDocumentService;
26  
27  /**
28   * Service locator for the KRAD Web module
29   *
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class KRADServiceLocatorWeb {
33  
34      public static final class Namespaces {
35          public static final String MODULE_NAME = "krad";
36          public static final String KRAD_NAMESPACE_PREFIX =
37                  CoreConstants.Namespaces.ROOT_NAMESPACE_PREFIX + "/" + MODULE_NAME;
38  
39          /**
40           * Namespace for the krad module which is compatible with Kuali Rice 2.0.x.
41           */
42          public static final String KRAD_NAMESPACE_2_0 =
43                  KRAD_NAMESPACE_PREFIX + "/" + CoreConstants.Versions.VERSION_2_0;
44  
45      }
46  
47      public static final String DATA_DICTIONARY_REMOTE_FIELD_SERVICE = "dataDictionaryRemoteFieldService";
48      public static final String DOCUMENT_DICTIONARY_SERVICE = "documentDictionaryService";
49      public static final String SESSION_DOCUMENT_SERVICE = "sessionDocumentService";
50      public static final String DATA_OBJECT_AUTHORIZATION_SERVICE = "dataObjectAuthorizationService";
51      public static final String MAINTENANCE_DOCUMENT_SERVICE = "maintenanceDocumentService";
52      public static final String WORKFLOW_DOCUMENT_SERVICE = "workflowDocumentService";
53      public static final String EXCEPTION_INCIDENT_REPORT_SERVICE = "kradExceptionIncidentService";
54      public static final String DATA_DICTIONARY_SERVICE = "dataDictionaryService";
55      public static final String DOCUMENT_HEADER_SERVICE = "documentHeaderService";
56      public static final String PESSIMISTIC_LOCK_SERVICE = "pessimisticLockService";
57      public static final String PERSISTENCE_SERVICE_OJB = "persistenceServiceOjb";
58      public static final String KUALI_MODULE_SERVICE = "kualiModuleService";
59      public static final String KUALI_RULE_SERVICE = "kualiRuleService";
60      public static final String DOCUMENT_SERVICE = "documentService";
61      public static final String DOCUMENT_SERIALIZER_SERVICE = "documentSerializerService";
62      public static final String LOOKUP_SERVICE = "lookupService";
63      public static final String DICTIONARY_VALIDATION_SERVICE = "dictionaryValidationService";
64      public static final String DEFAULT_INACTIVATION_BLOCKING_DETECTION_SERVICE = "inactivationBlockingDetectionService";
65      public static final String DATA_OBJECT_METADATA_SERVICE = "dataObjectMetaDataService";
66      public static final String EXPRESSION_EVALUATOR_SERVICE = "expressionEvaluatorService";
67      public static final String VIEW_SERVICE = "viewService";
68      public static final String VIEW_DICTIONARY_SERVICE = "viewDictionaryService";
69      public static final String VIEW_VALIDATION_SERVICE = "viewValidationService";
70      public static final String ATTRIBUTE_QUERY_SERVICE = "attributeQueryService";
71  
72      public static <T extends Object> T getService(String serviceName) {
73          return GlobalResourceLoader.<T>getService(serviceName);
74      }
75  
76      public static DocumentDictionaryService getDocumentDictionaryService() {
77          return getService(DOCUMENT_DICTIONARY_SERVICE);
78      }
79  
80      public static SessionDocumentService getSessionDocumentService() {
81          return getService(SESSION_DOCUMENT_SERVICE);
82      }
83  
84      public static DataObjectAuthorizationService getDataObjectAuthorizationService() {
85          return getService(DATA_OBJECT_AUTHORIZATION_SERVICE);
86      }
87  
88      public static MaintenanceDocumentService getMaintenanceDocumentService() {
89          return getService(MAINTENANCE_DOCUMENT_SERVICE);
90      }
91  
92      public static WorkflowDocumentService getWorkflowDocumentService() {
93          return getService(WORKFLOW_DOCUMENT_SERVICE);
94      }
95  
96      public static final KualiExceptionIncidentService getKualiExceptionIncidentService() {
97          return getService(EXCEPTION_INCIDENT_REPORT_SERVICE);
98      }
99  
100     public static DataDictionaryService getDataDictionaryService() {
101         return getService(DATA_DICTIONARY_SERVICE);
102     }
103 
104     public static DocumentHeaderService getDocumentHeaderService() {
105         return getService(DOCUMENT_HEADER_SERVICE);
106     }
107 
108     public static PessimisticLockService getPessimisticLockService() {
109         return getService(PESSIMISTIC_LOCK_SERVICE);
110     }
111 
112     public static Lookupable getLookupable(String lookupableName) {
113         return getService(lookupableName);
114     }
115 
116     public static PersistenceService getPersistenceServiceOjb() {
117         return getService(PERSISTENCE_SERVICE_OJB);
118     }
119 
120     public static KualiModuleService getKualiModuleService() {
121         return getService(KUALI_MODULE_SERVICE);
122     }
123 
124     public static KualiRuleService getKualiRuleService() {
125         return getService(KUALI_RULE_SERVICE);
126     }
127 
128     public static DocumentService getDocumentService() {
129         return getService(DOCUMENT_SERVICE);
130     }
131 
132     public static DocumentSerializerService getDocumentSerializerService() {
133         return (DocumentSerializerService) getService(DOCUMENT_SERIALIZER_SERVICE);
134     }
135 
136     public static LookupService getLookupService() {
137         return (LookupService) getService(LOOKUP_SERVICE);
138     }
139 
140     public static DictionaryValidationService getDictionaryValidationService() {
141         return (DictionaryValidationService) getService(DICTIONARY_VALIDATION_SERVICE);
142     }
143 
144     public static InactivationBlockingDetectionService getInactivationBlockingDetectionService(String serviceName) {
145         return (InactivationBlockingDetectionService) getService(serviceName);
146     }
147 
148     public static DataObjectMetaDataService getDataObjectMetaDataService() {
149         return (DataObjectMetaDataService) getService(DATA_OBJECT_METADATA_SERVICE);
150     }
151 
152     public static ExpressionEvaluatorService getExpressionEvaluatorService() {
153         return (ExpressionEvaluatorService) getService(EXPRESSION_EVALUATOR_SERVICE);
154     }
155 
156     public static ViewService getViewService() {
157         return (ViewService) getService(VIEW_SERVICE);
158     }
159 
160     public static ViewDictionaryService getViewDictionaryService() {
161         return (ViewDictionaryService) getService(VIEW_DICTIONARY_SERVICE);
162     }
163 
164     public static ViewValidationService getViewValidationService() {
165         return (ViewValidationService) getService(VIEW_VALIDATION_SERVICE);
166     }
167 
168     public static AttributeQueryService getAttributeQueryService() {
169         return (AttributeQueryService) getService(ATTRIBUTE_QUERY_SERVICE);
170     }
171 
172     public static DataDictionaryRemoteFieldService getDataDictionaryRemoteFieldService() {
173         return (DataDictionaryRemoteFieldService) getService(DATA_DICTIONARY_REMOTE_FIELD_SERVICE);
174     }
175 }