1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.calendar;
17
18 import org.kuali.hr.core.cache.CacheUtils;
19 import org.kuali.hr.time.service.base.TkServiceLocator;
20 import org.kuali.rice.kns.maintenance.KualiMaintainableImpl;
21 import org.kuali.rice.krad.bo.PersistableBusinessObject;
22
23 public class CalendarEntryMaintainableImpl extends KualiMaintainableImpl {
24
25 private static final long serialVersionUID = -5910605947104384549L;
26
27 @Override
28 public PersistableBusinessObject getBusinessObject() {
29 CalendarEntries calendarEntry = (CalendarEntries) super.getBusinessObject();
30
31 if (calendarEntry.getBeginPeriodDateTime() != null) {
32 calendarEntry.setBeginPeriodDate(new java.sql.Date(calendarEntry.getBeginPeriodDateTime().getTime()));
33 calendarEntry.setBeginPeriodTime(new java.sql.Time(calendarEntry.getBeginPeriodDateTime().getTime()));
34 }
35
36 if (calendarEntry.getEndPeriodDateTime() != null) {
37 calendarEntry.setEndPeriodDate(new java.sql.Date(calendarEntry.getEndPeriodDateTime().getTime()));
38 calendarEntry.setEndPeriodTime(new java.sql.Time(calendarEntry.getEndPeriodDateTime().getTime()));
39 }
40
41 if (calendarEntry.getBatchInitiateDateTime() != null) {
42 calendarEntry.setBatchInitiateDate(new java.sql.Date(calendarEntry.getBatchInitiateDateTime().getTime()));
43 calendarEntry.setBatchInitiateTime(new java.sql.Time(calendarEntry.getBatchInitiateDateTime().getTime()));
44 }
45
46 if (calendarEntry.getBatchEndPayPeriodDateTime() != null) {
47 calendarEntry.setBatchEndPayPeriodDate(new java.sql.Date(calendarEntry.getBatchEndPayPeriodDateTime().getTime()));
48 calendarEntry.setBatchEndPayPeriodTime(new java.sql.Time(calendarEntry.getBatchEndPayPeriodDateTime().getTime()));
49 }
50
51 if (calendarEntry.getBatchEmployeeApprovalDateTime() != null) {
52 calendarEntry.setBatchEmployeeApprovalDate(new java.sql.Date(calendarEntry.getBatchEmployeeApprovalDateTime().getTime()));
53 calendarEntry.setBatchEmployeeApprovalTime(new java.sql.Time(calendarEntry.getBatchEmployeeApprovalDateTime().getTime()));
54 }
55
56 if (calendarEntry.getBatchSupervisorApprovalDateTime() != null) {
57 calendarEntry.setBatchSupervisorApprovalDate(new java.sql.Date(calendarEntry.getBatchSupervisorApprovalDateTime().getTime()));
58 calendarEntry.setBatchSupervisorApprovalTime(new java.sql.Time(calendarEntry.getBatchSupervisorApprovalDateTime().getTime()));
59 }
60
61 return calendarEntry;
62 }
63
64 @Override
65 public void saveBusinessObject() {
66 CalendarEntries calendarEntry = (CalendarEntries) super.getBusinessObject();
67
68 Calendar calendar = TkServiceLocator.getCalendarService().getCalendarByGroup(calendarEntry.getCalendarName());
69 calendarEntry.setHrCalendarId(calendar.getHrCalendarId());
70
71 super.saveBusinessObject();
72
73 CacheUtils.flushCache(CalendarEntries.CACHE_NAME);
74 }
75
76 }