001    /**
002     * Copyright 2004-2013 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.lm.leavepayout.service;
017    
018    import java.math.BigDecimal;
019    import java.sql.Date;
020    import java.util.List;
021    import java.util.Map;
022    import java.util.Set;
023    
024    import org.kuali.hr.lm.leaveSummary.LeaveSummary;
025    import org.kuali.hr.lm.leaveblock.LeaveBlock;
026    import org.kuali.hr.lm.leavecalendar.LeaveCalendarDocument;
027    import org.kuali.hr.lm.leavepayout.LeavePayout;
028    import org.kuali.hr.time.calendar.CalendarEntries;
029    import org.kuali.rice.kew.api.exception.WorkflowException;
030    
031    public interface LeavePayoutService {
032    
033        public List<LeavePayout> getAllLeavePayoutsForPrincipalId(String principalId);
034        public List<LeavePayout> getAllLeavePayoutsForPrincipalIdAsOfDate(String principalId, Date effectiveDate);
035        public List<LeavePayout> getAllLeavePayoutsByEffectiveDate(Date effectiveDate);
036    
037        //@Cacheable(value= LeaveDonation.CACHE_NAME, key="'lmLeavePayoutId=' + #p0")
038        public LeavePayout getLeavePayoutById(String lmLeavePayoutId);
039    
040            //Use-Case specific service providers. Could be combined if max carry over applies to all use cases.
041            /**
042             * A service that instantiates and returns LeavePayout objects that follow the given accrual category rule.
043             * 
044             * @param principalId   The principal this transfer pertains to.
045             * @param accrualCategoryRule   The accrual category rule that contains the max balance information.
046             * @param leaveSummary  Holds balance information needed for transfer.
047             * @param effectiveDate 
048             * @return A LeavePayout object conforming to @param accrualCategoryRule, if one exists. Null otherwise.
049             * 
050             * The transfer amount will be the minimum of:
051             *  
052             *      1.) the accrual category rule's maximum transfer amount, adjusted for the employees FTE.
053             *      2.) the number of time units exceeding the maximum balance 
054             *
055             */
056            public LeavePayout initializePayout(String principalId, String accrualCategoryRule, BigDecimal accruedBalance, Date effectiveDate);
057    
058            /**
059             * Consumes a LeavePayout object, creating up to three leave blocks.
060             * @param LeavePayout The LeavePayout object to use for transfer.
061             * @return The same LeavePayout object, but with associated leave block ids.
062             */
063            public LeavePayout payout(LeavePayout leavePayout);
064            
065            /**
066             * Helper Services
067             */
068            
069            public void submitToWorkflow(LeavePayout leavePayout) throws WorkflowException;
070            
071            public List<LeavePayout> getLeavePayouts(String viewPrincipal, Date beginPeriodDate, Date endPeriodDate);
072            
073            public void saveOrUpdate(LeavePayout payout);
074    
075        
076    }