1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.lm.timeoff.service;
17
18 import org.apache.log4j.Logger;
19 import org.kuali.hr.job.Job;
20 import org.kuali.hr.lm.timeoff.SystemScheduledTimeOff;
21 import org.kuali.hr.lm.timeoff.dao.SystemScheduledTimeOffDao;
22 import org.kuali.hr.time.assignment.Assignment;
23 import org.kuali.hr.time.service.base.TkServiceLocator;
24 import org.kuali.hr.time.timesheet.TimesheetDocument;
25 import org.kuali.hr.time.util.TkConstants;
26
27 import java.math.BigDecimal;
28 import java.util.Date;
29 import java.util.List;
30
31 public class SystemScheduledTimeOffServiceImpl implements SystemScheduledTimeOffService {
32
33 private static final Logger LOG = Logger.getLogger(SystemScheduledTimeOffServiceImpl.class);
34 private SystemScheduledTimeOffDao systemScheduledTimeOffDao;
35
36 public SystemScheduledTimeOffDao getSystemScheduledTimeOffDao() {
37 return systemScheduledTimeOffDao;
38 }
39
40 public void setSystemScheduledTimeOffDao(
41 SystemScheduledTimeOffDao systemScheduledTimeOffDao) {
42 this.systemScheduledTimeOffDao = systemScheduledTimeOffDao;
43 }
44
45 @Override
46 public SystemScheduledTimeOff getSystemScheduledTimeOff(String lmSystemScheduledTimeOffId) {
47 return getSystemScheduledTimeOffDao().getSystemScheduledTimeOff(lmSystemScheduledTimeOffId);
48 }
49
50 @Override
51 public List<SystemScheduledTimeOff> getSystemScheduledTimeOffForPayPeriod(
52 String leavePlan, Date startDate, Date endDate) {
53 return getSystemScheduledTimeOffDao().getSystemScheduledTimeOffForPayPeriod(leavePlan, startDate, endDate);
54 }
55
56 @Override
57 public SystemScheduledTimeOff getSystemScheduledTimeOffByDate(
58 String leavePlan, Date startDate) {
59 return getSystemScheduledTimeOffDao().getSystemScheduledTimeOffByDate(leavePlan, startDate);
60 }
61 @Override
62 public Assignment getAssignmentToApplyHolidays(TimesheetDocument timesheetDocument, java.sql.Date payEndDate) {
63 Job primaryJob = TkServiceLocator.getJobService().getPrimaryJob(timesheetDocument.getPrincipalId(), payEndDate);
64 for(Assignment assign : timesheetDocument.getAssignments()){
65 if(assign.getJobNumber().equals(primaryJob.getJobNumber())){
66 return assign;
67 }
68 }
69 return null;
70 }
71
72 @Override
73 public BigDecimal calculateSysSchTimeOffHours(Job job, BigDecimal sstoHours) {
74 BigDecimal fte = job.getStandardHours().divide(new BigDecimal(40.0),TkConstants.BIG_DECIMAL_SCALE);
75 return fte.multiply(sstoHours).setScale(TkConstants.BIG_DECIMAL_SCALE);
76 }
77
78 @Override
79 public List<SystemScheduledTimeOff> getSystemScheduledTimeOffs(Date fromEffdt, Date toEffdt, String earnCode, Date fromAccruedDate, Date toAccruedDate,
80 Date fromSchTimeOffDate, Date toSchTimeOffDate, String active, String showHist) {
81 return systemScheduledTimeOffDao.getSystemScheduledTimeOffs(fromEffdt, toEffdt, earnCode, fromAccruedDate, toAccruedDate, fromSchTimeOffDate,
82 toSchTimeOffDate, active, showHist);
83 }
84
85 @Override
86 public List<SystemScheduledTimeOff> getSystemScheduledTimeOffsForLeavePlan(Date fromAccruedDate,Date toAccruedDate, String leavePlan) {
87 return systemScheduledTimeOffDao.getSystemScheduledTimeOffsForLeavePlan(fromAccruedDate, toAccruedDate, leavePlan);
88 }
89
90 }