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 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarId=' + #p0 + '|' + 'endPeriodDate=' + #p1") 046 public CalendarEntries getCalendarEntriesByIdAndPeriodEndDate(String hrCalendarId, Date endPeriodDate); 047 048 public CalendarEntries getPreviousCalendarEntriesByCalendarId(String hrCalendarId, CalendarEntries pce); 049 public CalendarEntries getNextCalendarEntriesByCalendarId(String hrCalendarId, CalendarEntries pce); 050 051 /** 052 * Provides a list of CalendarEntries that are in the indicated window 053 * of time from the as of date. 054 * @param thresholdDays ± days from the asOfDate to form the window of time. 055 * @param asOfDate The central date to query from. 056 * @return A list of CalendarEntries. 057 */ 058 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'thresholdDays=' + #p0 + '|' + 'endPeriodDate=' + #p1") 059 public List<CalendarEntries> getCurrentCalendarEntryNeedsScheduled(int thresholdDays, Date asOfDate); 060 061 public CalendarEntries createNextCalendarEntry(CalendarEntries calendarEntries, CalendarEntryPeriodType type); 062 063 public List<CalendarEntries> getFutureCalendarEntries(String hrCalendarId, Date currentDate, int numberOfEntries); 064 065 public CalendarEntries getCalendarEntriesByBeginAndEndDate(Date beginPeriodDate, Date endPeriodDate); 066 067 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarId=' + #p0") 068 public List<CalendarEntries> getAllCalendarEntriesForCalendarId(String hrCalendarId); 069 @Cacheable(value= CalendarEntries.CACHE_NAME, key="'hrCalendarId=' + #p0 + '|' + 'year=' + #p1") 070 public List<CalendarEntries> getAllCalendarEntriesForCalendarIdAndYear(String hrCalendarId, String year); 071 }