1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.hr.time.holidaycalendar.dao;
17
18 import java.util.Date;
19 import java.util.List;
20
21 import org.apache.ojb.broker.query.Criteria;
22 import org.apache.ojb.broker.query.QueryFactory;
23 import org.kuali.hr.time.holidaycalendar.HolidayCalendar;
24 import org.kuali.hr.time.holidaycalendar.HolidayCalendarDateEntry;
25 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
26
27 public class HolidayCalendarDaoImpl extends PlatformAwareDaoBaseOjb implements HolidayCalendarDao {
28
29 @Override
30 public HolidayCalendar getHolidayCalendarByGroup(String holidayCalendarGroup) {
31 Criteria root = new Criteria();
32 root.addEqualTo("holidayCalendarGroup", holidayCalendarGroup);
33 return (HolidayCalendar) this.getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(HolidayCalendar.class, root));
34 }
35
36 @SuppressWarnings("unchecked")
37 public List<HolidayCalendarDateEntry> getHolidayCalendarDateEntriesForPayPeriod(String hrHolidayCalendarId, Date startDate, Date endDate){
38 Criteria root = new Criteria();
39 root.addEqualTo("hrHolidayCalendarId", hrHolidayCalendarId);
40 root.addBetween("holidayDate", new java.sql.Date(startDate.getTime()), new java.sql.Date(endDate.getTime()));
41 return (List<HolidayCalendarDateEntry>)this.getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(HolidayCalendarDateEntry.class, root));
42 }
43
44 @SuppressWarnings("unchecked")
45 public HolidayCalendarDateEntry getHolidayCalendarDateEntryByDate(String hrHolidayCalendarId, Date startDate){
46 Criteria root = new Criteria();
47 root.addEqualTo("hrHolidayCalendarId", hrHolidayCalendarId);
48 root.addEqualTo("holidayDate", startDate);
49 return (HolidayCalendarDateEntry)this.getPersistenceBrokerTemplate().getObjectByQuery(QueryFactory.newQuery(HolidayCalendarDateEntry.class, root));
50 }
51 }