001 /** 002 * Copyright 2004-2013 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 */ 016 package org.kuali.hr.time.service.base; 017 018 import org.kuali.hr.earncodesec.service.EarnCodeSecurityService; 019 import org.kuali.hr.job.service.JobService; 020 import org.kuali.hr.location.service.LocationService; 021 import org.kuali.hr.paygrade.service.PayGradeService; 022 import org.kuali.hr.time.accrual.service.AccrualCategoryService; 023 import org.kuali.hr.time.accrual.service.TimeOffAccrualService; 024 import org.kuali.hr.time.approval.service.TimeApproveService; 025 import org.kuali.hr.time.assignment.dao.AssignmentDao; 026 import org.kuali.hr.time.assignment.service.AssignmentService; 027 import org.kuali.hr.time.batch.service.BatchJobEntryService; 028 import org.kuali.hr.time.batch.service.BatchJobService; 029 import org.kuali.hr.time.calendar.service.CalendarEntriesService; 030 import org.kuali.hr.time.calendar.service.CalendarService; 031 import org.kuali.hr.time.clock.location.service.ClockLocationRuleService; 032 import org.kuali.hr.time.clocklog.service.ClockLogService; 033 import org.kuali.hr.time.department.service.DepartmentService; 034 import org.kuali.hr.time.dept.lunch.service.DepartmentLunchRuleService; 035 import org.kuali.hr.time.docsearch.TkSearchableAttributeService; 036 import org.kuali.hr.time.earncode.service.EarnCodeService; 037 import org.kuali.hr.time.earngroup.service.EarnGroupService; 038 import org.kuali.hr.time.graceperiod.service.GracePeriodService; 039 import org.kuali.hr.time.holidaycalendar.service.HolidayCalendarService; 040 import org.kuali.hr.time.missedpunch.service.MissedPunchService; 041 import org.kuali.hr.time.overtime.daily.rule.service.DailyOvertimeRuleService; 042 import org.kuali.hr.time.overtime.weekly.rule.service.WeeklyOvertimeRuleService; 043 import org.kuali.hr.time.paytype.service.PayTypeService; 044 import org.kuali.hr.time.permissions.TkPermissionsService; 045 import org.kuali.hr.time.person.service.PersonService; 046 import org.kuali.hr.time.position.service.PositionService; 047 import org.kuali.hr.time.principal.service.PrincipalHRAttributesService; 048 import org.kuali.hr.time.roles.service.TkRoleGroupService; 049 import org.kuali.hr.time.roles.service.TkRoleService; 050 import org.kuali.hr.time.rule.TkRuleControllerService; 051 import org.kuali.hr.time.salgroup.service.SalGroupService; 052 import org.kuali.hr.time.shiftdiff.rule.service.ShiftDifferentialRuleService; 053 import org.kuali.hr.time.syslunch.service.SystemLunchRuleService; 054 import org.kuali.hr.time.task.service.TaskService; 055 import org.kuali.hr.time.timeblock.service.TimeBlockHistoryDetailService; 056 import org.kuali.hr.time.timeblock.service.TimeBlockHistoryService; 057 import org.kuali.hr.time.timeblock.service.TimeBlockService; 058 import org.kuali.hr.time.timecollection.rule.service.TimeCollectionRuleService; 059 import org.kuali.hr.time.timehourdetail.service.TimeHourDetailService; 060 import org.kuali.hr.time.timesheet.service.TimesheetService; 061 import org.kuali.hr.time.timesummary.service.TimeSummaryService; 062 import org.kuali.hr.time.timezone.service.TimezoneService; 063 import org.kuali.hr.time.user.pref.service.UserPreferenceService; 064 import org.kuali.hr.time.warning.TkWarningService; 065 import org.kuali.hr.time.workarea.service.WorkAreaService; 066 import org.kuali.hr.time.workflow.service.TimesheetDocumentHeaderService; 067 import org.kuali.rice.core.impl.cache.DistributedCacheManagerDecorator; 068 import org.springframework.beans.BeansException; 069 import org.springframework.context.ApplicationContext; 070 import org.springframework.context.ApplicationContextAware; 071 import org.springframework.jdbc.core.JdbcTemplate; 072 import org.springframework.transaction.PlatformTransactionManager; 073 import org.springframework.transaction.support.TransactionTemplate; 074 import org.springmodules.orm.ojb.PersistenceBrokerTemplate; 075 076 public class TkServiceLocator implements ApplicationContextAware { 077 public static String SPRING_BEANS = "classpath:SpringBeans.xml"; 078 public static ApplicationContext CONTEXT; 079 public static final String TK_PERMISSIONS_SERVICE = "permissionsService"; 080 public static final String TK_CLOCK_LOG_SERVICE = "clockLogService"; 081 public static final String TK_ASSIGNMENT_SERVICE = "assignmentService"; 082 public static final String TK_ASSIGNMENT_DAO = "assignmentDao"; 083 public static final String TK_TIME_BLOCK_SERVICE = "timeBlockService"; 084 public static final String TK_TIME_BLOCK_HISTORY_SERVICE = "timeBlockHistoryService"; 085 public static final String TK_TIME_BLOCK_HISTORY_DETAIL_SERVICE = "timeBlockHistoryDetailService"; 086 public static final String TK_JOB_SERVICE = "jobService"; 087 public static final String TK_PAY_TYPE_SERVICE = "payTypeService"; 088 public static final String TK_PAY_CALENDAR_SERVICE = "calendarService"; 089 public static final String TK_PAY_CALENDAR_ENTRIES_SERVICE = "calendarEntriesService"; 090 public static final String TK_PERSISTENCE_BROKER_TEMPLATE = "tkPersistenceBrokerTemplate"; 091 public static final String TK_CACHE_MANAGER_SERVICE = "cacheManager"; 092 public static final String TK_WORK_AREA_SERVICE = "workAreaService"; 093 public static final String TK_TIMESHEET_SERVICE = "timesheetService"; 094 public static final String TK_TIMESHEET_DOCUMENT_HEADER_SERVICE = "timesheetDocumentHeaderService"; 095 public static final String TK_DEPARTMENT_SERVICE = "departmentService"; 096 public static final String TK_EARN_CODE_SECURITY = "earnCodeSecurityService"; 097 public static final String TK_EARN_CODE = "earnCodeService"; 098 public static final String TK_TIME_COLLECTION_RULE_SERVICE = "timeCollectionRuleService"; 099 public static final String TK_ROLE_SERVICE = "tkRoleService"; 100 public static final String TK_ROLE_GROUP_SERVICE = "tkRoleGroupService"; 101 public static final String TK_TIME_SUMMARY_SERVICE = "timeSummaryService"; 102 public static final String TK_TIME_EARN_CODE_GROUP_SERVICE = "earnGroupService"; 103 public static final String TK_TIME_HOUR_DETAIL_SERVICE= "timeHourDetailService"; 104 public static final String TK_DAILY_OVERTIME_RULE_SERVICE = "dailyOvertimeRuleService"; 105 public static final String TK_WEEKLY_OVERTIME_RULE_SERVICE = "weeklyOvertimeRuleService"; 106 public static final String TK_SHIFT_DIFFERENTIAL_RULE_SERVICE = "shiftDifferentialRuleService"; 107 public static final String TK_WORK_SCHEDULE_SERVICE = "workScheduleService"; 108 public static final String TK_WORK_SCHEDULE_ASSIGNMENT_SERVICE = "workScheduleAssignmentService"; 109 public static final String TK_CLOCK_LOCATION_RULE_SERVICE = "clockLocationService"; 110 public static final String TK_GRACE_PERIOD_SERVICE = "gracePeriodService"; 111 public static final String TK_SYSTEM_LUNCH_RULE_SERVICE = "systemLunchRuleService"; 112 public static final String TK_DEPT_LUNCH_RULE_SERVICE = "deptLunchRuleService"; 113 public static final String TK_HOLIDAY_CALENDAR_SERVICE = "holidayCalendarService"; 114 public static final String TK_USER_PREF_SERVICE = "userPrefService"; 115 public static final String TK_TIME_ZONE_SERVICE = "timezoneService"; 116 public static final String TK_TIME_OFF_ACCRUAL_SERVICE = "timeOffAccrualService"; 117 public static final String hr_sal_group_SERVICE = "salGroupService"; 118 public static final String TK_ACCRUAL_CATEGORY_SERVICE = "accrualCategoryService"; 119 public static final String TK_ACCRUAL_CATEGORY_RULE_SERVICE = "accrualCategoryRuleService"; 120 public static final String TK_TASK_SERVICE = "taskService"; 121 public static final String TK_LOCATION_SERVICE = "locationService"; 122 public static final String TK_PAY_GRADE_SERVICE = "payGradeService"; 123 public static final String TK_PERSON_SERVICE = "tkPersonService"; 124 public static final String TK_APPROVE_SERVICE = "timeApproveService"; 125 public static final String TK_BATCH_JOB_SERVICE = "batchJobService"; 126 public static final String TK_MISSED_PUNCH_SERVICE = "missedPunchService"; 127 public static final String TK_BATCH_JOB_ENTRY_SERVICE = "batchJobEntryService"; 128 public static final String TK_WARNINGS_SERVICE = "tkWarningService"; 129 public static final String HR_POSITION_SERVICE = "positionService"; 130 public static final String TK_SEARCH_ATTR_SERVICE = "tkSearchableAttributeService"; 131 public static final String TK_PRINCIPAL_HR_ATTRIBUTES_SERVICE = "principalHRAttributesService"; 132 public static final String KPME_DISTRIBUTED_CACHE_MANAGER = "kpmeDistributedCacheManager"; 133 134 public static MissedPunchService getMissedPunchService() { 135 return (MissedPunchService) CONTEXT.getBean(TK_MISSED_PUNCH_SERVICE); 136 } 137 138 public static TaskService getTaskService() { 139 return (TaskService) CONTEXT.getBean(TK_TASK_SERVICE); 140 } 141 142 public static SalGroupService getSalGroupService() { 143 return (SalGroupService) CONTEXT.getBean(hr_sal_group_SERVICE); 144 } 145 146 public static DepartmentService getDepartmentService() { 147 return (DepartmentService) CONTEXT.getBean(TK_DEPARTMENT_SERVICE); 148 } 149 150 public static ShiftDifferentialRuleService getShiftDifferentialRuleService() { 151 return (ShiftDifferentialRuleService) CONTEXT.getBean(TK_SHIFT_DIFFERENTIAL_RULE_SERVICE); 152 } 153 154 public static WeeklyOvertimeRuleService getWeeklyOvertimeRuleService() { 155 return (WeeklyOvertimeRuleService) CONTEXT.getBean(TK_WEEKLY_OVERTIME_RULE_SERVICE); 156 } 157 158 public static DailyOvertimeRuleService getDailyOvertimeRuleService() { 159 return (DailyOvertimeRuleService) CONTEXT.getBean(TK_DAILY_OVERTIME_RULE_SERVICE); 160 } 161 162 public static TkRoleService getTkRoleService() { 163 return (TkRoleService) CONTEXT.getBean(TK_ROLE_SERVICE); 164 } 165 166 public static TkRoleGroupService getTkRoleGroupService() { 167 return (TkRoleGroupService) CONTEXT.getBean(TK_ROLE_GROUP_SERVICE); 168 } 169 170 public static TimesheetDocumentHeaderService getTimesheetDocumentHeaderService() { 171 return (TimesheetDocumentHeaderService) CONTEXT.getBean(TK_TIMESHEET_DOCUMENT_HEADER_SERVICE); 172 } 173 174 public static TimesheetService getTimesheetService() { 175 return (TimesheetService) CONTEXT.getBean(TK_TIMESHEET_SERVICE); 176 } 177 178 public static WorkAreaService getWorkAreaService() { 179 return (WorkAreaService)CONTEXT.getBean(TK_WORK_AREA_SERVICE); 180 } 181 182 public static ClockLogService getClockLogService(){ 183 return (ClockLogService)CONTEXT.getBean(TK_CLOCK_LOG_SERVICE); 184 } 185 186 public static TkPermissionsService getPermissionsService(){ 187 return (TkPermissionsService)CONTEXT.getBean(TK_PERMISSIONS_SERVICE); 188 } 189 190 public static DistributedCacheManagerDecorator getDistributedCacheManager() { 191 return (DistributedCacheManagerDecorator)CONTEXT.getBean(KPME_DISTRIBUTED_CACHE_MANAGER); 192 } 193 194 195 196 197 public static AssignmentService getAssignmentService(){ 198 return (AssignmentService)CONTEXT.getBean(TK_ASSIGNMENT_SERVICE); 199 } 200 201 public static TimeBlockService getTimeBlockService(){ 202 return (TimeBlockService)CONTEXT.getBean(TK_TIME_BLOCK_SERVICE); 203 } 204 205 public static TimeBlockHistoryService getTimeBlockHistoryService(){ 206 return (TimeBlockHistoryService)CONTEXT.getBean(TK_TIME_BLOCK_HISTORY_SERVICE); 207 } 208 209 public static TimeBlockHistoryDetailService getTimeBlockHistoryDetailService(){ 210 return (TimeBlockHistoryDetailService)CONTEXT.getBean(TK_TIME_BLOCK_HISTORY_DETAIL_SERVICE); 211 } 212 213 public static AssignmentDao getAssignmentDao() { 214 return (AssignmentDao)CONTEXT.getBean(TK_ASSIGNMENT_DAO); 215 } 216 217 public static JobService getJobService() { 218 return (JobService)CONTEXT.getBean(TK_JOB_SERVICE); 219 } 220 221 public static PayTypeService getPayTypeService() { 222 return (PayTypeService)CONTEXT.getBean(TK_PAY_TYPE_SERVICE); 223 } 224 225 public static PersistenceBrokerTemplate getTkPersistenceBrokerTemplate() { 226 return (PersistenceBrokerTemplate) CONTEXT.getBean(TK_PERSISTENCE_BROKER_TEMPLATE); 227 } 228 229 public static TkRuleControllerService getTkRuleControllerService(){ 230 return (TkRuleControllerService) CONTEXT.getBean("tkRuleControllerService"); 231 } 232 233 public static EarnCodeService getEarnCodeService() { 234 return (EarnCodeService) CONTEXT.getBean(TK_EARN_CODE); 235 } 236 237 public static TimeCollectionRuleService getTimeCollectionRuleService() { 238 return (TimeCollectionRuleService) CONTEXT.getBean(TK_TIME_COLLECTION_RULE_SERVICE); 239 } 240 241 public static TimeSummaryService getTimeSummaryService(){ 242 return (TimeSummaryService) CONTEXT.getBean(TK_TIME_SUMMARY_SERVICE); 243 } 244 245 public static EarnGroupService getEarnGroupService(){ 246 return (EarnGroupService) CONTEXT.getBean(TK_TIME_EARN_CODE_GROUP_SERVICE); 247 } 248 249 public static TimeHourDetailService getTimeHourDetailService(){ 250 return (TimeHourDetailService) CONTEXT.getBean(TK_TIME_HOUR_DETAIL_SERVICE); 251 } 252 253 public static ClockLocationRuleService getClockLocationRuleService(){ 254 return (ClockLocationRuleService) CONTEXT.getBean(TK_CLOCK_LOCATION_RULE_SERVICE); 255 } 256 257 public static GracePeriodService getGracePeriodService(){ 258 return (GracePeriodService) CONTEXT.getBean(TK_GRACE_PERIOD_SERVICE); 259 } 260 261 public static SystemLunchRuleService getSystemLunchRuleService(){ 262 return (SystemLunchRuleService) CONTEXT.getBean(TK_SYSTEM_LUNCH_RULE_SERVICE); 263 } 264 265 public static DepartmentLunchRuleService getDepartmentLunchRuleService(){ 266 return (DepartmentLunchRuleService) CONTEXT.getBean(TK_DEPT_LUNCH_RULE_SERVICE); 267 } 268 269 public static HolidayCalendarService getHolidayCalendarService(){ 270 return (HolidayCalendarService) CONTEXT.getBean(TK_HOLIDAY_CALENDAR_SERVICE); 271 } 272 273 public static UserPreferenceService getUserPreferenceService(){ 274 return (UserPreferenceService) CONTEXT.getBean(TK_USER_PREF_SERVICE); 275 } 276 277 public static TimezoneService getTimezoneService(){ 278 return (TimezoneService) CONTEXT.getBean(TK_TIME_ZONE_SERVICE); 279 } 280 281 public static TimeOffAccrualService getTimeOffAccrualService(){ 282 return (TimeOffAccrualService) CONTEXT.getBean(TK_TIME_OFF_ACCRUAL_SERVICE); 283 } 284 285 public static AccrualCategoryService getAccrualCategoryService() { 286 return (AccrualCategoryService)CONTEXT.getBean(TK_ACCRUAL_CATEGORY_SERVICE); 287 } 288 289 public static LocationService getLocationService() { 290 return (LocationService)CONTEXT.getBean(TK_LOCATION_SERVICE); 291 } 292 293 public static PayGradeService getPayGradeService() { 294 return (PayGradeService)CONTEXT.getBean(TK_PAY_GRADE_SERVICE); 295 } 296 297 public static PersonService getPersonService(){ 298 return (PersonService)CONTEXT.getBean(TK_PERSON_SERVICE); 299 } 300 public static TimeApproveService getTimeApproveService(){ 301 return (TimeApproveService)CONTEXT.getBean(TK_APPROVE_SERVICE); 302 } 303 304 public static BatchJobService getBatchJobService(){ 305 return (BatchJobService)CONTEXT.getBean(TK_BATCH_JOB_SERVICE); 306 } 307 308 public static BatchJobEntryService getBatchJobEntryService(){ 309 return (BatchJobEntryService)CONTEXT.getBean(TK_BATCH_JOB_ENTRY_SERVICE); 310 } 311 312 public static TkWarningService getWarningService(){ 313 return (TkWarningService) CONTEXT.getBean(TK_WARNINGS_SERVICE); 314 } 315 316 public static PositionService getPositionService(){ 317 return (PositionService) CONTEXT.getBean(HR_POSITION_SERVICE); 318 } 319 320 public static TkSearchableAttributeService getTkSearchableAttributeService(){ 321 return (TkSearchableAttributeService) CONTEXT.getBean(TK_SEARCH_ATTR_SERVICE); 322 } 323 324 public static PlatformTransactionManager getPlatformTransactionManager() { 325 return (PlatformTransactionManager)CONTEXT.getBean("transactionManager"); 326 } 327 328 public static TransactionTemplate getTransactionTemplate() { 329 return new TransactionTemplate(getPlatformTransactionManager()); 330 } 331 332 public static PrincipalHRAttributesService getPrincipalHRAttributeService(){ 333 return (PrincipalHRAttributesService)CONTEXT.getBean(TK_PRINCIPAL_HR_ATTRIBUTES_SERVICE); 334 } 335 336 public static CalendarService getCalendarService() { 337 return (CalendarService)CONTEXT.getBean(TK_PAY_CALENDAR_SERVICE); 338 } 339 340 public static CalendarEntriesService getCalendarEntriesService() { 341 return (CalendarEntriesService)CONTEXT.getBean(TK_PAY_CALENDAR_ENTRIES_SERVICE); 342 } 343 344 public static EarnCodeSecurityService getEarnCodeSecurityService() { 345 return (EarnCodeSecurityService) CONTEXT.getBean(TK_EARN_CODE_SECURITY); 346 } 347 348 @Override 349 public void setApplicationContext(ApplicationContext arg0) throws BeansException { 350 CONTEXT = arg0; 351 } 352 353 354 /** 355 * This is for the approval only 356 */ 357 public static JdbcTemplate getTkJdbcTemplate() { 358 return (JdbcTemplate) CONTEXT.getBean("tkJdbcTemplate"); 359 } 360 361 public static JdbcTemplate getRiceJdbcTemplate() { 362 return (JdbcTemplate) CONTEXT.getBean("riceJdbcTemplate"); 363 } 364 }