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 * A method to use specifically when you have a Timesheet Documents Pay Period 057 * end date. Do not use if you are passing in a date known not to be the END period date. 058 * 059 * @param principalId 060 * @param payEndDate 061 * @return 062 */ 063 @Cacheable(value= Calendar.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'payEndDate=' + #p1 + '|' + 'calendarType=' + #p2") 064 public CalendarEntries getCalendarDatesByPayEndDate(String principalId, Date payEndDate, String calendarType); 065 066 /** 067 * Returns the Pay CalendarEntry for previous pay calendar 068 * @param tkCalendarId 069 * @param beginDateCurrentCalendar 070 * @return 071 */ 072 @Cacheable(value= Calendar.CACHE_NAME, key="'tkCalendarId=' + #p0 + '|' + 'beginDateCurrentCalendar=' + #p1") 073 public CalendarEntries getPreviousCalendarEntry(String tkCalendarId, Date beginDateCurrentCalendar); 074 075 /** 076 * Fetch a pay calendar with the given principalId and date, returns null if none found 077 * @param principalId 078 * @param asOfDate 079 * @return 080 */ 081 public Calendar getCalendarByPrincipalIdAndDate(String principalId, Date asOfDate); 082 083 public List<Calendar> getCalendars(String calendarName, String flsaBeginDay, String flsaBeginTime); 084 085 }