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