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.accrual.service;
17
18 import org.kuali.hr.time.accrual.TimeOffAccrual;
19 import org.kuali.hr.time.timeblock.TimeBlock;
20 import org.kuali.hr.time.timesheet.TimesheetDocument;
21 import org.springframework.cache.annotation.Cacheable;
22
23 import java.sql.Date;
24 import java.util.List;
25 import java.util.Map;
26
27 public interface TimeOffAccrualService {
28 /**
29 * Get a list of maps that represents a persons accrual balances
30 * @param principalId
31 * @param asOfDate
32 * @return
33 */
34 @Cacheable(value= TimeOffAccrual.CACHE_NAME, key="'{getTimeOffAccrualsCalc}' + 'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
35 public List<Map<String, Object>> getTimeOffAccrualsCalc(String principalId, Date asOfDate);
36
37 /**
38 * Validate the accrual hours for the time blocks of the given TimesheetDocument
39 * and returns a JSONArray of warning messages
40 * @param timesheetDocument
41 * @return JSONArray
42 */
43 public List<String> validateAccrualHoursLimit(TimesheetDocument timesheetDocument);
44
45 public List<String> validateAccrualHoursLimit(String pId, List<TimeBlock> tbList, Date asOfDate);
46
47 /**
48 * Validate the accrual hours for the time blocks by earncode of the given TimesheetDocument
49 * and returns a JSONArray of warning messages
50 * @param timesheetDocument
51 * @return JSONArray
52 */
53 public List<String> validateAccrualHoursLimitByEarnCode(TimesheetDocument timesheetDocument, String selectEarnCode);
54
55 /**
56 * Fetch time off accrual as of a particular unique id
57 * @param laTimeOffAccrualId
58 * @return
59 */
60 @Cacheable(value= TimeOffAccrual.CACHE_NAME, key="'laTimeOffAccrualId=' + #p0")
61 public TimeOffAccrual getTimeOffAccrual(Long laTimeOffAccrualId);
62
63 @Cacheable(value= TimeOffAccrual.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
64 public List<TimeOffAccrual> getTimeOffAccruals(String principalId, Date asOfDate);
65
66 /**
67 * get the count of TimeOffAccrual by given parameters\
68 * @param accrualCategory
69 * @param effectiveDate
70 * @param principalId
71 * @param lmAccrualId
72 * @return int
73 */
74 public int getTimeOffAccrualCount(String accrualCategory, Date effectiveDate, String principalId, String lmAccrualId);
75 }