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.time.earncode.service;
017    
018    import org.kuali.hr.time.assignment.Assignment;
019    import org.kuali.hr.time.earncode.EarnCode;
020    import org.springframework.cache.annotation.Cacheable;
021    
022    import java.math.BigDecimal;
023    import java.sql.Date;
024    import java.util.List;
025    import java.util.Map;
026    
027    public interface EarnCodeService {
028        /**
029         * Fetch a list of earn codes for Leave usage and Time usage, for a particular assignment as of a particular date
030         * @param a
031         * @param asOfDate
032         * @param isLeavePlanningCalendar
033         * @return
034         */
035        @Cacheable(value=EarnCode.CACHE_NAME, key="'{getEarnCodesForLeaveAndTime}' + 'principalId=' + T(org.kuali.hr.time.util.TKContext).getPrincipalId() + '|' + 'targetId=' + T(org.kuali.hr.time.util.TKContext).getTargetPrincipalId() + '|' + 'a=' + #p0.getTkAssignmentId() + '|' + 'asOfDate=' + #p1 + '|' + 'isLeavePlanningCalendar=' +#p2")
036        public List<EarnCode> getEarnCodesForLeaveAndTime(Assignment a, Date asOfDate, boolean isLeavePlanningCalendar);
037    
038        /**
039         * Fetch a list of earn codes for Time usage, for a particular assignment as of a particular date
040         * @param a
041         * @param asOfDate
042         * @return
043         */
044        @Cacheable(value=EarnCode.CACHE_NAME, key="'{getEarnCodesForTime}' + 'principalId=' + T(org.kuali.hr.time.util.TKContext).getPrincipalId() + '|' + 'targetId=' + T(org.kuali.hr.time.util.TKContext).getTargetPrincipalId() + '|' + 'a=' + #p0.getTkAssignmentId() + '|' + 'asOfDate=' + #p1 + '|' + 'includeRegularEarnCode=' + false")
045        public List<EarnCode> getEarnCodesForTime(Assignment a, Date asOfDate);
046    
047        /**
048         * Fetch a list of earn codes for Time usage, for a particular assignment as of a particular date
049         * @param a
050         * @param asOfDate
051         * @return
052         */
053        @Cacheable(value=EarnCode.CACHE_NAME, key="'{getEarnCodesForTime}' + 'principalId=' + T(org.kuali.hr.time.util.TKContext).getPrincipalId() + '|' + 'targetId=' + T(org.kuali.hr.time.util.TKContext).getTargetPrincipalId() + '|' + 'a=' + #p0.getTkAssignmentId() + '|' + 'asOfDate=' + #p1 + '|' + 'includeRegularEarnCode=' + #p2")
054        public List<EarnCode> getEarnCodesForTime(Assignment a, Date asOfDate, boolean includeRegularEarnCode);
055    
056            /**
057             * Fetch a list of earn codes for Leave usage, for a particular assignment as of a particular date
058         * @param a
059         * @param asOfDate
060         * @param isLeavePlanningCalendar
061             * @return
062             */
063        @Cacheable(value=EarnCode.CACHE_NAME, key="'{getEarnCodesForLeave}' + 'principalId=' + T(org.kuali.hr.time.util.TKContext).getPrincipalId() + '|' + 'targetId=' + T(org.kuali.hr.time.util.TKContext).getTargetPrincipalId() + '|' + 'a=' + #p0.getTkAssignmentId() + '|' + 'asOfDate=' + #p1 + '|' + 'isLeavePlanningCalendar=' +#p2")
064        public List<EarnCode> getEarnCodesForLeave(Assignment a, Date asOfDate, boolean isLeavePlanningCalendar);
065    
066        /**
067         * Fetch a list of earn codes based on principal ID as of a particular date
068         * @param principalId
069         * @param asOfDate
070         * @param isLeavePlanningCalendar
071         * @return
072         */
073        @Cacheable(value=EarnCode.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'asOfDate=' + #p1 + '|' + 'isLeavePlanningCalendar=' +#p2")
074        public List<EarnCode> getEarnCodesForPrincipal(String principalId, Date asOfDate, boolean isLeavePlanningCalendar);
075    
076        /**
077         * Fetch an EarnCode as of a particular date
078         * @param earnCode
079         * @param asOfDate
080         * @return
081         */
082        @Cacheable(value=EarnCode.CACHE_NAME, key="'earnCode=' + #p0 + '|' + 'asOfDate=' + #p1")
083            public EarnCode getEarnCode(String earnCode, Date asOfDate);
084    
085        /**
086         * Fetch the earn code type for a particular date
087         * @param earnCode
088         * @param asOfDate
089         * @return
090         */
091        @Cacheable(value=EarnCode.CACHE_NAME, key="'{getEarnCodeType}' + 'earnCode=' + #p0 + '|' + 'asOfDate=' + #p1")
092        String getEarnCodeType(String earnCode, Date asOfDate);
093        
094        /**
095         * Fetch earn code by id
096         * @param earnCodeId
097         * @return
098         */
099        @Cacheable(value=EarnCode.CACHE_NAME, key="'earnCodeId=' + #p0")
100        public EarnCode getEarnCodeById(String earnCodeId);
101        
102        /**
103         * Fetch list of system defined overtime earn codes
104         * @param asOfDate
105         * @return
106         */
107        @Cacheable(value=EarnCode.CACHE_NAME, key="'{getOvertimeEarnCodes}' + 'asOfDate=' + #p0")
108        public List<EarnCode> getOvertimeEarnCodes(Date asOfDate);
109    
110    
111        /**
112         * Fetch list of system defined overtime earn codes as strings
113         * @param asOfDate
114         * @return
115         */
116        @Cacheable(value=EarnCode.CACHE_NAME, key="'{getOvertimeEarnCodesStrs}' + 'asOfDate=' + #p0")
117        public List<String> getOvertimeEarnCodesStrs(Date asOfDate);
118    
119        /**
120             * get count of earn code with give earnCode
121             * @param earnCode
122             * @return int
123             */
124        public int getEarnCodeCount(String earnCode);
125    
126        /**
127             * get count of newer version of earn code with give earnCode and date
128             * @param earnCode
129             * @param effdt
130             * @return int
131             */
132        public int getNewerEarnCodeCount(String earnCode, Date effdt);
133        
134        /**
135         * roundHrsWithLEarnCode
136         * @param hours
137         * @param earnCode
138         * @return
139         */
140        public BigDecimal roundHrsWithEarnCode(BigDecimal hours, EarnCode earnCode);
141    
142        /**
143         * @param principalId
144         * @param isLeavePlanningCalendar
145         * @return
146         */
147        @Cacheable(value= EarnCode.CACHE_NAME, key="'{getEarnCodesForDisplay}' + 'principalId=' + #p0 + '|' + 'isLeavePlanningCalendar=' +#p1")
148        public Map<String, String> getEarnCodesForDisplay(String principalId, boolean isLeavePlanningCalendar);
149    
150        /**
151         * @param principalId
152         * @param asOfDate
153         * @return
154         */
155        @Cacheable(value= EarnCode.CACHE_NAME, key="'{getEarnCodesForDisplayWithEffectiveDate}' + 'principalId=' + #p0 + '|' + 'asOfDate=' + #p1 + '|' + 'isLeavePlanningCalendar=' +#p2")
156        public Map<String, String> getEarnCodesForDisplayWithEffectiveDate(String principalId, Date asOfDate, boolean isLeavePlanningCalendar);
157    
158        List<EarnCode> getEarnCodes(String earnCode, String ovtEarnCode, String leavePlan, String accrualCategory, String descr, Date fromEffdt, Date toEffdt, String active, String showHist);
159    }