View Javadoc

1   /**
2    * Copyright 2004-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.hr.time.calendar.service;
17  
18  import java.util.Date;
19  
20  import org.kuali.hr.time.calendar.Calendar;
21  import org.kuali.hr.time.calendar.CalendarEntries;
22  import org.springframework.cache.annotation.Cacheable;
23  
24  public interface CalendarService {
25  	/**
26  	 * Fetch a pay calendar with the given id
27  	 * @param hrCalendarId
28  	 * @return
29  	 */
30      @Cacheable(value= Calendar.CACHE_NAME, key="'hrCalendarId=' + #p0")
31  	public Calendar getCalendar(String hrCalendarId);
32  
33  	/**
34  	 * Fetch a pay calendar by group
35  	 * @param calendarName
36  	 * @return
37  	 */
38      @Cacheable(value= Calendar.CACHE_NAME, key="'calendarName=' + #p0")
39  	public Calendar getCalendarByGroup(String calendarName);
40  
41  	/**
42       * Use this method to get CalendarEntries if you are passing in a "current date"
43       * style of date, ie todays date. If you are in a logic situation where you would
44       * pass EITHER todays date or a pay calendar date, pass the Pay period BEGIN date,
45       * so that the retrieval logic will correctly place the date in the window.
46  	 *
47  	 * @param principalId
48  	 * @param currentDate
49  	 * @return
50  	 */
51  	public CalendarEntries getCurrentCalendarDates(String principalId, Date currentDate);
52  
53      /**
54       * A method to use specifically when you have a Timesheet Documents Pay Period
55       * end date. Do not use if you are passing in a date known not to be the END period date.
56       *
57       * @param principalId
58       * @param payEndDate
59       * @return
60       */
61      @Cacheable(value= Calendar.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'payEndDate=' + #p1 + '|' + 'calendarType=' + #p2")
62      public CalendarEntries getCalendarDatesByPayEndDate(String principalId, Date payEndDate, String calendarType);
63  
64  	/**
65  	 * Returns the Pay CalendarEntry for previous pay calendar
66  	 * @param tkCalendarId
67  	 * @param beginDateCurrentCalendar
68  	 * @return
69  	 */
70      @Cacheable(value= Calendar.CACHE_NAME, key="'tkCalendarId=' + #p0 + '|' + 'beginDateCurrentCalendar=' + #p1")
71  	public CalendarEntries getPreviousCalendarEntry(String tkCalendarId, Date beginDateCurrentCalendar);
72  	
73  	/**
74  	 * Fetch a pay calendar with the given principalId and date, returns null if none found
75  	 * @param principalId
76  	 * @param asOfDate
77  	 * @return
78  	 */
79  	public Calendar getCalendarByPrincipalIdAndDate(String principalId, Date asOfDate);
80  
81  }