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.principal.service;
017
018 import org.kuali.hr.time.principal.PrincipalHRAttributes;
019 import org.kuali.hr.time.principal.dao.PrincipalHRAttributesDao;
020 import org.kuali.hr.time.service.base.TkServiceLocator;
021
022 import java.util.Date;
023 import java.util.List;
024
025 public class PrincipalHRAttributesServiceImpl implements PrincipalHRAttributesService {
026 private PrincipalHRAttributesDao principalHRAttributesDao;
027
028 public void setPrincipalHRAttributesDao(PrincipalHRAttributesDao principalHRAttributesDao) {
029 this.principalHRAttributesDao = principalHRAttributesDao;
030 }
031
032 public PrincipalHRAttributes getPrincipalCalendar(String principalId, Date asOfDate){
033 PrincipalHRAttributes pc = this.principalHRAttributesDao.getPrincipalCalendar(principalId, asOfDate);
034 if(pc != null) {
035 pc.setCalendar(TkServiceLocator.getCalendarService().getCalendarByGroup(pc.getPayCalendar()));
036 pc.setLeaveCalObj(TkServiceLocator.getCalendarService().getCalendarByGroup(pc.getLeaveCalendar()));
037 }
038 return pc;
039 }
040
041 public List<PrincipalHRAttributes> getActiveEmployeesForPayCalendar(String payCalendarName, Date asOfDate) {
042 return principalHRAttributesDao.getActiveEmployeesForPayCalendar(payCalendarName, asOfDate);
043 }
044
045 public List<PrincipalHRAttributes> getActiveEmployeesForLeaveCalendar(String leaveCalendarName, Date asOfDate) {
046 return principalHRAttributesDao.getActiveEmployeesForLeaveCalendar(leaveCalendarName, asOfDate);
047 }
048
049 public List<String> getActiveEmployeesIdForLeaveCalendarAndIdList(String leaveCalendarName, List<String> pidList, Date asOfDate) {
050 return principalHRAttributesDao.getActiveEmployeesIdForLeaveCalendarAndIdList(leaveCalendarName, pidList, asOfDate);
051 }
052
053 public List<String> getActiveEmployeesIdForTimeCalendarAndIdList(String timeCalendarName, List<String> pidList, Date asOfDate) {
054 return principalHRAttributesDao.getActiveEmployeesIdForTimeCalendarAndIdList(timeCalendarName, pidList, asOfDate);
055 }
056
057 /**
058 * KPME-1250 Kagata
059 * Get a list of active employees based on leave plan and as of a particular date
060 */
061 @Override
062 public List<PrincipalHRAttributes> getActiveEmployeesForLeavePlan(String leavePlan, Date asOfDate) {
063 List<PrincipalHRAttributes> principals = principalHRAttributesDao.getActiveEmployeesForLeavePlan(leavePlan, asOfDate);
064
065 return principals;
066 }
067
068 // @Override
069 // public PrincipalHRAttributes getPrincipalHRAttributes(String principalId) {
070 // return this.principalHRAttributesDao.getPrincipalHRAttributes(principalId);
071 // }
072
073 @Override
074 public PrincipalHRAttributes getInactivePrincipalHRAttributes(String principalId, Date asOfDate) {
075 return this.principalHRAttributesDao.getInactivePrincipalHRAttributes(principalId, asOfDate);
076 }
077
078 @Override
079 public PrincipalHRAttributes getPrincipalHRAttributes(String hrPrincipalAttributeId) {
080 return this.principalHRAttributesDao.getPrincipalHRAttributes(hrPrincipalAttributeId);
081 }
082
083 @Override
084 public List<PrincipalHRAttributes> getAllActivePrincipalHrAttributesForPrincipalId(String principalId, Date asOfDate) {
085 return this.principalHRAttributesDao.getAllActivePrincipalHrAttributesForPrincipalId(principalId, asOfDate);
086 }
087 @Override
088 public PrincipalHRAttributes getMaxTimeStampPrincipalHRAttributes(String principalId) {
089 return principalHRAttributesDao.getMaxTimeStampPrincipalHRAttributes(principalId);
090 }
091
092 @Override
093 public List<PrincipalHRAttributes> getAllInActivePrincipalHrAttributesForPrincipalId(String principalId, Date asOfDate) {
094 return this.principalHRAttributesDao.getAllInActivePrincipalHrAttributesForPrincipalId(principalId, asOfDate);
095 }
096 @Override
097 public List<PrincipalHRAttributes> getActivePrincipalHrAttributesForRange(String principalId, Date startDate, Date endDate) {
098 return this.principalHRAttributesDao.getActivePrincipalHrAttributesForRange(principalId, startDate, endDate);
099 }
100 @Override
101 public List<PrincipalHRAttributes> getInactivePrincipalHRAttributesForRange(String principalId, Date startDate, Date endDate) {
102 return this.principalHRAttributesDao.getInactivePrincipalHRAttributesForRange(principalId, startDate, endDate);
103 }
104 @Override
105 public List<PrincipalHRAttributes> getPrincipalHrAtributes(String principalId,
106 String leavePlan, java.sql.Date fromEffdt, java.sql.Date toEffdt, String active, String showHistory) {
107 return this.principalHRAttributesDao.getPrincipalHrAtributes(principalId, leavePlan, fromEffdt, toEffdt, active, showHistory);
108 }
109 @Override
110 public List<String> getUniqueTimePayGroups() {
111 return this.principalHRAttributesDao.getUniqueTimePayGroups();
112 }
113 }