1 /** 2 * Copyright 2004-2013 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.lm.leavepayout.service; 17 18 import java.math.BigDecimal; 19 import java.sql.Date; 20 import java.util.ArrayList; 21 import java.util.List; 22 import java.util.Map; 23 24 import org.kuali.hr.lm.leaveSummary.LeaveSummary; 25 import org.kuali.hr.lm.leavecalendar.LeaveCalendarDocument; 26 import org.kuali.hr.lm.leavepayout.LeavePayout; 27 import org.kuali.hr.time.calendar.CalendarEntries; 28 import org.kuali.rice.kew.api.exception.WorkflowException; 29 30 public interface LeavePayoutService { 31 32 public List<LeavePayout> getAllLeavePayoutsForPrincipalId(String principalId); 33 public List<LeavePayout> getAllLeavePayoutsForPrincipalIdAsOfDate(String principalId, Date effectiveDate); 34 public List<LeavePayout> getAllLeavePayoutsByEffectiveDate(Date effectiveDate); 35 36 //@Cacheable(value= LeaveDonation.CACHE_NAME, key="'lmLeavePayoutId=' + #p0") 37 public LeavePayout getLeavePayoutById(String lmLeavePayoutId); 38 39 //Use-Case specific service providers. Could be combined if max carry over applies to all use cases. 40 /** 41 * A service that instantiates and returns LeavePayout objects that follow the given accrual category rule. 42 * 43 * @param principalId The principal this transfer pertains to. 44 * @param accrualCategoryRule The accrual category rule that contains the max balance information. 45 * @param leaveSummary Holds balance information needed for transfer. 46 * @param effectiveDate 47 * @return A LeavePayout object conforming to @param accrualCategoryRule, if one exists. Null otherwise. 48 * 49 * The transfer amount will be the minimum of: 50 * 51 * 1.) the accrual category rule's maximum transfer amount, adjusted for the employees FTE. 52 * 2.) the number of time units exceeding the maximum balance 53 * 54 */ 55 public LeavePayout initializePayout(String principalId, String accrualCategoryRule, BigDecimal accruedBalance, Date effectiveDate); 56 57 /** 58 * Consumes a LeavePayout object, creating up to three leave blocks. 59 * @param LeavePayout The LeavePayout object to use for transfer. 60 * @return The same LeavePayout object, but with associated leave block ids. 61 */ 62 public LeavePayout payout(LeavePayout leavePayout); 63 64 /** 65 * Helper Services 66 */ 67 68 /** 69 * Determines which accrual categories within the given leave calendar document, are TRANSFERABLE for the given action frequency. 70 * Includes accrual categories for which ACTION_AT_MAX_BALANCE = LOSE. 71 * 72 * @param document The LeaveCalendarDocument to use in gathering transfer eligible accrual categories. 73 * @param actionFrequency One of LMConstants.MAX_BAL_ACTION_FREQ 74 * @return A List of accrualCategoryRuleId's in {@param document}'s leave summary with MAX_BAL_ACTION_FREQUENCY = {@param actionFrequency} 75 * @throws Exception 76 */ 77 public Map<String, ArrayList<String>> getEligiblePayouts(CalendarEntries calendarEntry, String principalId) throws Exception; 78 79 public void submitToWorkflow(LeavePayout leavePayout) throws WorkflowException; 80 public List<LeavePayout> getLeavePayouts(String viewPrincipal, 81 Date beginPeriodDate, Date endPeriodDate); 82 public void saveOrUpdate(LeavePayout payout); 83 84 }