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.balancetransfer.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 import java.util.Set; 24 25 import org.kuali.hr.lm.accrual.AccrualCategory; 26 import org.kuali.hr.lm.balancetransfer.BalanceTransfer; 27 import org.kuali.hr.lm.leaveSummary.LeaveSummaryRow; 28 import org.kuali.hr.lm.leaveblock.LeaveBlock; 29 import org.kuali.hr.lm.leavecalendar.LeaveCalendarDocument; 30 import org.kuali.hr.time.calendar.CalendarEntries; 31 import org.kuali.rice.kew.api.exception.WorkflowException; 32 33 public interface BalanceTransferService { 34 35 //Data access 36 public List<BalanceTransfer> getAllBalanceTransfersForPrincipalId(String principalId); 37 public List<BalanceTransfer> getAllBalanceTransferForPrincipalIdAsOfDate(String principalId, Date effectiveDate); 38 public List<BalanceTransfer> getAllBalanceTransferByEffectiveDate(Date effectiveDate); 39 public void saveOrUpdate(BalanceTransfer balanceTransfer); 40 41 //@Cacheable(value= LeaveDonation.CACHE_NAME, key="'balanceTransferId=' + #p0") 42 public BalanceTransfer getBalanceTransferById(String balanceTransferId); 43 44 //Use-Case specific service providers. Could be combined if max carry over applies to all use cases. 45 /** 46 * A service that instantiates and returns BalanceTransfer objects that follow the given accrual category rule. 47 * 48 * @param principalId The principal this transfer pertains to. 49 * @param accrualCategoryRule The accrual category rule that contains the max balance information. 50 * @param accruedBalance Holds balance information needed for transfer. 51 * @param effectiveDate 52 * @return A BalanceTransfer object conforming to @param accrualCategoryRule, if one exists. Null otherwise. 53 * 54 * The transfer amount will be the minimum of: 55 * 56 * 1.) the accrual category rule's maximum transfer amount, adjusted for the employees FTE. 57 * 2.) the number of time units exceeding the maximum balance 58 * 59 */ 60 public BalanceTransfer initializeTransfer(String principalId, String accrualCategoryRule, BigDecimal accruedBalance, Date effectiveDate); 61 62 /** 63 * Consumes a BalanceTransfer object, creating up to three leave blocks. 64 * @param balanceTransfer The BalanceTransfer object to use for transfer. 65 * @return The same BalanceTransfer object, but with associated leave block ids. 66 */ 67 public BalanceTransfer transfer(BalanceTransfer balanceTransfer); 68 69 /** 70 * Helper Services 71 */ 72 73 /** 74 * Determines which accrual categories within the given leave calendar document, are TRANSFERABLE for the given action frequency. 75 * Includes accrual categories for which ACTION_AT_MAX_BALANCE = LOSE. 76 * 77 * @param document The LeaveCalendarDocument to use in gathering transfer eligible accrual categories. 78 * @param actionFrequency One of LMConstants.MAX_BAL_ACTION_FREQ 79 * @return A List of accrualCategoryRuleId's in {@param document}'s leave summary with MAX_BAL_ACTION_FREQUENCY = {@param actionFrequency} 80 * @throws Exception 81 */ 82 /* public Map<String,ArrayList<String>> getEligibleTransfers(CalendarEntries calendarEntry, String principalId) throws Exception; 83 */ 84 public void submitToWorkflow(BalanceTransfer balanceTransfer) throws WorkflowException; 85 86 /** 87 * transfer system scheduled time off 88 * @param balanceTransfer 89 * @return 90 */ 91 public BalanceTransfer transferSsto(BalanceTransfer balanceTransfer); 92 93 public List<BalanceTransfer> getBalanceTransfers(String viewPrincipal, Date beginPeriodDate, Date endPeriodDate); 94 95 }