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