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 org.kuali.hr.time.calendar.CalendarEntries; 019 import org.kuali.hr.time.calendar.CalendarEntryPeriodType; 020 import org.springframework.cache.annotation.Cacheable; 021 022 import java.util.Date; 023 import java.util.List; 024 025 public interface CalendarEntriesService { 026 027 /** 028 * Method to directly access the CalendarEntries object by ID. 029 * 030 * @param hrCalendarEntriesId The ID to retrieve. 031 * @return a CalendarEntries object. 032 */ 033 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarEntriesId=' + #p0") 034 public CalendarEntries getCalendarEntries(String hrCalendarEntriesId); 035 036 /** 037 * Method to obtain the current CalendarEntries object based on the 038 * indicated calendar and asOfDate. 039 * @param hrCalendarId The calendar to reference. 040 * @param asOfDate The date reference point. 041 * @return the current CalendarEntries effective by the asOfDate. 042 */ 043 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarId=' + #p0 + '|' + 'asOfDate=' + #p1") 044 public CalendarEntries getCurrentCalendarEntriesByCalendarId(String hrCalendarId, Date asOfDate); 045 046 /** 047 * Method to obtain theCalendarEntries object based in a date range 048 * @param hrCalendarId The calendar to reference. 049 * @param beginDate 050 * @param endDate 051 * @return the current CalendarEntries effective by the asOfDate. 052 */ 053 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarId=' + #p0 + '|' + 'beginDate=' + #p1 + '|' + 'endDate=' + #p2") 054 public CalendarEntries getCalendarEntriesByCalendarIdAndDateRange(String hrCalendarId, Date beginDate, Date endDate); 055 056 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarId=' + #p0 + '|' + 'endPeriodDate=' + #p1") 057 public CalendarEntries getCalendarEntriesByIdAndPeriodEndDate(String hrCalendarId, Date endPeriodDate); 058 059 public CalendarEntries getPreviousCalendarEntriesByCalendarId(String hrCalendarId, CalendarEntries pce); 060 public CalendarEntries getNextCalendarEntriesByCalendarId(String hrCalendarId, CalendarEntries pce); 061 062 /** 063 * Provides a list of CalendarEntries that are in the indicated window 064 * of time from the as of date. 065 * @param thresholdDays ± days from the asOfDate to form the window of time. 066 * @param asOfDate The central date to query from. 067 * @return A list of CalendarEntries. 068 */ 069 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'thresholdDays=' + #p0 + '|' + 'endPeriodDate=' + #p1") 070 public List<CalendarEntries> getCurrentCalendarEntryNeedsScheduled(int thresholdDays, Date asOfDate); 071 072 public CalendarEntries createNextCalendarEntry(CalendarEntries calendarEntries, CalendarEntryPeriodType type); 073 074 public List<CalendarEntries> getFutureCalendarEntries(String hrCalendarId, Date currentDate, int numberOfEntries); 075 076 public List<CalendarEntries> getCalendarEntriesEndingBetweenBeginAndEndDate(String hrCalendarId, Date beginDate, Date endDate); 077 078 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarId=' + #p0") 079 public List<CalendarEntries> getAllCalendarEntriesForCalendarId(String hrCalendarId); 080 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarId=' + #p0 + '|' + 'year=' + #p1") 081 public List<CalendarEntries> getAllCalendarEntriesForCalendarIdAndYear(String hrCalendarId, String year); 082 083 public List<CalendarEntries> getAllCalendarEntriesForCalendarIdUpToPlanningMonths(String hrCalendarId, String principalId); 084 085 public List<CalendarEntries> getAllCalendarEntriesForCalendarIdUpToCutOffTime(String hrCalendarId, Date cutOffTime); 086 087 }