View Javadoc
1   /**
2    * Copyright 2004-2014 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.kpme.tklm.leave.service;
17  
18  import org.kuali.kpme.tklm.api.leave.accrual.AccrualCategoryMaxBalanceService;
19  import org.kuali.kpme.tklm.api.leave.accrual.AccrualCategoryMaxCarryOverService;
20  import org.kuali.kpme.tklm.api.leave.accrual.AccrualService;
21  import org.kuali.kpme.tklm.api.leave.accrual.PrincipalAccrualRanService;
22  import org.kuali.kpme.tklm.api.leave.adjustment.LeaveAdjustmentService;
23  import org.kuali.kpme.tklm.api.leave.approval.LeaveApprovalService;
24  import org.kuali.kpme.tklm.leave.block.service.LeaveBlockHistoryService;
25  import org.kuali.kpme.tklm.api.leave.block.LeaveBlockService;
26  import org.kuali.kpme.tklm.leave.calendar.service.LeaveCalendarService;
27  import org.kuali.kpme.tklm.leave.donation.service.LeaveDonationService;
28  import org.kuali.kpme.tklm.api.leave.override.EmployeeOverrideService;
29  import org.kuali.kpme.tklm.leave.payout.service.LeavePayoutService;
30  import org.kuali.kpme.tklm.leave.request.service.LeaveRequestDocumentService;
31  import org.kuali.kpme.tklm.api.permission.LMPermissionService;
32  import org.kuali.kpme.tklm.api.leave.summary.LeaveSummaryService;
33  import org.kuali.kpme.tklm.api.leave.timeoff.SystemScheduledTimeOffService;
34  import org.kuali.kpme.tklm.leave.transfer.service.BalanceTransferService;
35  import org.kuali.kpme.tklm.leave.workflow.service.LeaveCalendarDocumentHeaderService;
36  import org.springframework.beans.BeansException;
37  import org.springframework.context.ApplicationContext;
38  import org.springframework.context.ApplicationContextAware;
39  
40  public class LmServiceLocator implements ApplicationContextAware {
41  
42  	public static String SPRING_BEANS = "classpath:org/kuali/kpme/tklm/config/TKLMSpringBeans.xml";
43  	private static ApplicationContext CONTEXT;
44  
45      public static final String LM_ACCRUAL_SERVICE = "accrualService";
46      public static final String LM_LEAVE_DONATION_SERVICE = "leaveDonationService";
47      public static final String LM_SYS_SCH_TIMEOFF_SERVICE = "systemScheduledTimeOffService";
48      public static final String LM_LEAVE_BLOCK_SERVICE = "leaveBlockService";
49      public static final String LM_LEAVE_CALENDAR_SERVICE = "leaveCalendarService";
50      public static final String LM_LEAVE_CALENDAR_DOCUMENT_HEADER_SERVICE = "leaveCalendarDocumentHeaderService";
51      public static final String LM_EMPLOYEE_OVERRIDE_SERVICE = "employeeOverrideService";
52  	public static final String LM_LEAVE_ADJUSTMENT_SERVICE = "leaveAdjustmentService";
53  	public static final String LM_LEAVE_BLOCK_HISTORY_SERVICE = "leaveBlockHistoryService";
54  	public static final String LM_PRINCIPAL_ACCRUAL_RAN_SERVICE = "principalAccrualRanService";
55  	public static final String LM_LEAVE_SUMMARY_SERVICE = "leaveSummaryService";
56  	public static final String LM_LEAVE_APPROVAL_SERVICE = "leaveApprovalService";
57      public static final String LM_BALANCE_TRANSFER_SERVICE = "balanceTransferService";
58      public static final String LM_ACCRUAL_CATEGORY_MAX_BALANCE_SERVICE = "accrualCategoryMaxBalanceService";
59      public static final String LM_LEAVE_REQUEST_DOC_SERVICE = "leaveRequestDocumentService";
60  	public static final String LM_ACCRUAL_CATEGORY_MAX_CARRY_OVER_SERVICE = "accrualCategoryMaxCarryOverService";
61      public static final String LM_LEAVE_PAYOUT_SERVICE = "leavePayoutService";
62  	
63      public static final String LM_ROLE_SERVICE = "lmRoleService";
64      public static final String LM_PERMISSION_SERVICE = "lmPermissionService";
65      
66  	public static AccrualService getLeaveAccrualService(){
67  		return (AccrualService) CONTEXT.getBean(LM_ACCRUAL_SERVICE);
68  	}
69  	public static LeaveDonationService getLeaveDonationService(){
70  		return (LeaveDonationService)CONTEXT.getBean(LM_LEAVE_DONATION_SERVICE);
71  	}
72  	
73  	public static SystemScheduledTimeOffService getSysSchTimeOffService(){
74  		return (SystemScheduledTimeOffService)CONTEXT.getBean(LM_SYS_SCH_TIMEOFF_SERVICE);
75  	}
76  
77      public static LeaveBlockService getLeaveBlockService(){
78  		return (LeaveBlockService)CONTEXT.getBean(LM_LEAVE_BLOCK_SERVICE);
79  	}
80  
81      public static LeaveBlockHistoryService getLeaveBlockHistoryService(){
82  		return (LeaveBlockHistoryService)CONTEXT.getBean(LM_LEAVE_BLOCK_HISTORY_SERVICE);
83  	}
84      
85      public static LeaveCalendarService getLeaveCalendarService(){
86  		return (LeaveCalendarService)CONTEXT.getBean(LM_LEAVE_CALENDAR_SERVICE);
87  	}
88  
89      public static LeaveCalendarDocumentHeaderService getLeaveCalendarDocumentHeaderService(){
90  		return (LeaveCalendarDocumentHeaderService)CONTEXT.getBean(LM_LEAVE_CALENDAR_DOCUMENT_HEADER_SERVICE);
91  	}
92      
93      public static EmployeeOverrideService getEmployeeOverrideService(){
94  		return (EmployeeOverrideService)CONTEXT.getBean(LM_EMPLOYEE_OVERRIDE_SERVICE);
95  	}
96      
97      public static LeaveAdjustmentService getLeaveAdjustmentService(){
98  		return (LeaveAdjustmentService)CONTEXT.getBean(LM_LEAVE_ADJUSTMENT_SERVICE);
99  	}
100 	
101 	public static PrincipalAccrualRanService getPrincipalAccrualRanService() {
102 		return (PrincipalAccrualRanService)CONTEXT.getBean(LM_PRINCIPAL_ACCRUAL_RAN_SERVICE);
103 	}
104 	public static LeaveSummaryService getLeaveSummaryService() {
105 		return (LeaveSummaryService)CONTEXT.getBean(LM_LEAVE_SUMMARY_SERVICE);
106 	}
107 	public static LeaveApprovalService getLeaveApprovalService() {
108 		return (LeaveApprovalService)CONTEXT.getBean(LM_LEAVE_APPROVAL_SERVICE);
109 	}
110     public static BalanceTransferService getBalanceTransferService() {
111     	return (BalanceTransferService) CONTEXT.getBean(LM_BALANCE_TRANSFER_SERVICE);
112     }
113     public static AccrualCategoryMaxBalanceService getAccrualCategoryMaxBalanceService() {
114     	return (AccrualCategoryMaxBalanceService) CONTEXT.getBean(LM_ACCRUAL_CATEGORY_MAX_BALANCE_SERVICE);
115     }
116     public static LeavePayoutService getLeavePayoutService() {
117         return (LeavePayoutService) CONTEXT.getBean(LM_LEAVE_PAYOUT_SERVICE);
118     }
119 	public static AccrualService getAccrualService() {
120 	    return (AccrualService)CONTEXT.getBean(LM_ACCRUAL_SERVICE);
121 	}
122     public static LeaveRequestDocumentService getLeaveRequestDocumentService() {
123         return (LeaveRequestDocumentService) CONTEXT.getBean(LM_LEAVE_REQUEST_DOC_SERVICE);
124     }
125     public static AccrualCategoryMaxCarryOverService getAccrualCategoryMaxCarryOverService() {
126     	return (AccrualCategoryMaxCarryOverService) CONTEXT.getBean(LM_ACCRUAL_CATEGORY_MAX_CARRY_OVER_SERVICE);
127     }
128     public static LMPermissionService getLMPermissionService() {
129     	return (LMPermissionService) CONTEXT.getBean(LM_PERMISSION_SERVICE);
130     }
131 
132 	@Override
133 	public void setApplicationContext(ApplicationContext arg0)
134 			throws BeansException {
135 		CONTEXT = arg0;
136 	}
137 
138 }