1 /**
2 * Copyright 2004-2013 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.hr.time.calendar.service;
17
18 import java.sql.Time;
19 import java.util.Date;
20 import java.util.List;
21
22 import org.kuali.hr.time.calendar.Calendar;
23 import org.kuali.hr.time.calendar.CalendarEntries;
24 import org.springframework.cache.annotation.Cacheable;
25
26 public interface CalendarService {
27 /**
28 * Fetch a pay calendar with the given id
29 * @param hrCalendarId
30 * @return
31 */
32 @Cacheable(value= Calendar.CACHE_NAME, key="'hrCalendarId=' + #p0")
33 public Calendar getCalendar(String hrCalendarId);
34
35 /**
36 * Fetch a pay calendar by group
37 * @param calendarName
38 * @return
39 */
40 @Cacheable(value= Calendar.CACHE_NAME, key="'calendarName=' + #p0")
41 public Calendar getCalendarByGroup(String calendarName);
42
43 /**
44 * Use this method to get CalendarEntries if you are passing in a "current date"
45 * style of date, ie todays date. If you are in a logic situation where you would
46 * pass EITHER todays date or a pay calendar date, pass the Pay period BEGIN date,
47 * so that the retrieval logic will correctly place the date in the window.
48 *
49 * @param principalId
50 * @param currentDate
51 * @return
52 */
53 public CalendarEntries getCurrentCalendarDates(String principalId, Date currentDate);
54
55 /**
56 * Use this method to get CalendarEntries if you are passing in a date range
57 * ie being/end of a year.
58 *
59 * @param principalId
60 * @param beginDate
61 * @param endDate
62 * @return
63 */
64 public CalendarEntries getCurrentCalendarDates(String principalId, Date beginDate, Date endDate);
65
66 /**
67 * A method to use specifically when you have a Timesheet Documents Pay Period
68 * end date. Do not use if you are passing in a date known not to be the END period date.
69 *
70 * @param principalId
71 * @param payEndDate
72 * @return
73 */
74 @Cacheable(value= Calendar.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'payEndDate=' + #p1 + '|' + 'calendarType=' + #p2")
75 public CalendarEntries getCalendarDatesByPayEndDate(String principalId, Date payEndDate, String calendarType);
76
77 /**
78 * Returns the Pay CalendarEntry for previous pay calendar
79 * @param tkCalendarId
80 * @param beginDateCurrentCalendar
81 * @return
82 */
83 @Cacheable(value= Calendar.CACHE_NAME, key="'tkCalendarId=' + #p0 + '|' + 'beginDateCurrentCalendar=' + #p1")
84 public CalendarEntries getPreviousCalendarEntry(String tkCalendarId, Date beginDateCurrentCalendar);
85
86 /**
87 * Fetch a pay calendar with the given principalId and date, returns null if none found
88 * @param principalId
89 * @param asOfDate
90 * @return
91 */
92 public Calendar getCalendarByPrincipalIdAndDate(String principalId, Date asOfDate, boolean findLeaveCal);
93
94 /**
95 * Fetch a pay calendar with the given principalId, begin and end date, returns null if none found
96 * @param principalId
97 * @param beginDate
98 * @param endDate
99 * @return
100 */
101 public Calendar getCalendarByPrincipalIdAndDate(String principalId, Date beginDate, Date endDate, boolean findLeaveCal);
102
103 /**
104 *
105 * @param principalId
106 * @param beginDate
107 * @param endDate
108 * @return
109 */
110 @Cacheable(value= Calendar.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'beginDate=' + #p1 + '|' + 'endDate=' + #p2")
111 public CalendarEntries getCurrentCalendarDatesForLeaveCalendar(String principalId, Date beginDate, Date endDate);
112
113 /**
114 *
115 * @param principalId
116 * @param currentDate
117 * @return
118 */
119 @Cacheable(value= Calendar.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'currentDate=' + #p1")
120 public CalendarEntries getCurrentCalendarDatesForLeaveCalendar(String principalId, Date currentDate);
121
122 public List<Calendar> getCalendars(String calendarName, String calendarTypes, String flsaBeginDay, String flsaBeginTime);
123
124 }