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.accrual.service;
017
018 import org.kuali.hr.time.accrual.TimeOffAccrual;
019 import org.kuali.hr.time.timeblock.TimeBlock;
020 import org.kuali.hr.time.timesheet.TimesheetDocument;
021 import org.springframework.cache.annotation.Cacheable;
022
023 import java.sql.Date;
024 import java.util.List;
025 import java.util.Map;
026
027 public interface TimeOffAccrualService {
028 /**
029 * Get a list of maps that represents a persons accrual balances
030 * @param principalId
031 * @param asOfDate
032 * @return
033 */
034 @Cacheable(value= TimeOffAccrual.CACHE_NAME, key="'{getTimeOffAccrualsCalc}' + 'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
035 public List<Map<String, Object>> getTimeOffAccrualsCalc(String principalId, Date asOfDate);
036
037 /**
038 * Validate the accrual hours for the time blocks of the given TimesheetDocument
039 * and returns a JSONArray of warning messages
040 * @param timesheetDocument
041 * @return JSONArray
042 */
043 public List<String> validateAccrualHoursLimit(TimesheetDocument timesheetDocument);
044
045 public List<String> validateAccrualHoursLimit(String pId, List<TimeBlock> tbList, Date asOfDate);
046
047 /**
048 * Validate the accrual hours for the time blocks by earncode of the given TimesheetDocument
049 * and returns a JSONArray of warning messages
050 * @param timesheetDocument
051 * @return JSONArray
052 */
053 public List<String> validateAccrualHoursLimitByEarnCode(TimesheetDocument timesheetDocument, String selectEarnCode);
054
055 /**
056 * Fetch time off accrual as of a particular unique id
057 * @param laTimeOffAccrualId
058 * @return
059 */
060 @Cacheable(value= TimeOffAccrual.CACHE_NAME, key="'laTimeOffAccrualId=' + #p0")
061 public TimeOffAccrual getTimeOffAccrual(Long laTimeOffAccrualId);
062
063 @Cacheable(value= TimeOffAccrual.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
064 public List<TimeOffAccrual> getTimeOffAccruals(String principalId, Date asOfDate);
065
066 /**
067 * get the count of TimeOffAccrual by given parameters\
068 * @param accrualCategory
069 * @param effectiveDate
070 * @param principalId
071 * @param lmAccrualId
072 * @return int
073 */
074 public int getTimeOffAccrualCount(String accrualCategory, Date effectiveDate, String principalId, String lmAccrualId);
075 }