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.calendar.service;
017
018 import java.sql.Time;
019 import java.util.Date;
020 import java.util.List;
021
022 import org.kuali.hr.time.calendar.Calendar;
023 import org.kuali.hr.time.calendar.CalendarEntries;
024 import org.springframework.cache.annotation.Cacheable;
025
026 public interface CalendarService {
027 /**
028 * Fetch a pay calendar with the given id
029 * @param hrCalendarId
030 * @return
031 */
032 @Cacheable(value= Calendar.CACHE_NAME, key="'hrCalendarId=' + #p0")
033 public Calendar getCalendar(String hrCalendarId);
034
035 /**
036 * Fetch a pay calendar by group
037 * @param calendarName
038 * @return
039 */
040 @Cacheable(value= Calendar.CACHE_NAME, key="'calendarName=' + #p0")
041 public Calendar getCalendarByGroup(String calendarName);
042
043 /**
044 * Use this method to get CalendarEntries if you are passing in a "current date"
045 * style of date, ie todays date. If you are in a logic situation where you would
046 * pass EITHER todays date or a pay calendar date, pass the Pay period BEGIN date,
047 * so that the retrieval logic will correctly place the date in the window.
048 *
049 * @param principalId
050 * @param currentDate
051 * @return
052 */
053 public CalendarEntries getCurrentCalendarDates(String principalId, Date currentDate);
054
055 /**
056 * Use this method to get CalendarEntries if you are passing in a date range
057 * ie being/end of a year.
058 *
059 * @param principalId
060 * @param beginDate
061 * @param endDate
062 * @return
063 */
064 public CalendarEntries getCurrentCalendarDates(String principalId, Date beginDate, Date endDate);
065
066 /**
067 * A method to use specifically when you have a Timesheet Documents Pay Period
068 * end date. Do not use if you are passing in a date known not to be the END period date.
069 *
070 * @param principalId
071 * @param payEndDate
072 * @return
073 */
074 @Cacheable(value= Calendar.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'payEndDate=' + #p1 + '|' + 'calendarType=' + #p2")
075 public CalendarEntries getCalendarDatesByPayEndDate(String principalId, Date payEndDate, String calendarType);
076
077 /**
078 * Returns the Pay CalendarEntry for previous pay calendar
079 * @param tkCalendarId
080 * @param beginDateCurrentCalendar
081 * @return
082 */
083 @Cacheable(value= Calendar.CACHE_NAME, key="'tkCalendarId=' + #p0 + '|' + 'beginDateCurrentCalendar=' + #p1")
084 public CalendarEntries getPreviousCalendarEntry(String tkCalendarId, Date beginDateCurrentCalendar);
085
086 /**
087 * Fetch a pay calendar with the given principalId and date, returns null if none found
088 * @param principalId
089 * @param asOfDate
090 * @return
091 */
092 public Calendar getCalendarByPrincipalIdAndDate(String principalId, Date asOfDate, boolean findLeaveCal);
093
094 /**
095 * Fetch a pay calendar with the given principalId, begin and end date, returns null if none found
096 * @param principalId
097 * @param beginDate
098 * @param endDate
099 * @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 }