View Javadoc

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.time.earncode.service;
17  
18  import org.kuali.hr.time.assignment.Assignment;
19  import org.kuali.hr.time.earncode.EarnCode;
20  import org.springframework.cache.annotation.Cacheable;
21  
22  import java.math.BigDecimal;
23  import java.sql.Date;
24  import java.util.List;
25  import java.util.Map;
26  
27  public interface EarnCodeService {
28      /**
29       * Fetch a list of earn codes for Leave usage and Time usage, for a particular assignment as of a particular date
30       * @param a
31       * @param asOfDate
32       * @param isLeavePlanningCalendar
33       * @return
34       */
35      @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")
36      public List<EarnCode> getEarnCodesForLeaveAndTime(Assignment a, Date asOfDate, boolean isLeavePlanningCalendar);
37  
38      /**
39       * Fetch a list of earn codes for Time usage, for a particular assignment as of a particular date
40       * @param a
41       * @param asOfDate
42       * @return
43       */
44      @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")
45      public List<EarnCode> getEarnCodesForTime(Assignment a, Date asOfDate);
46  
47  	/**
48  	 * Fetch a list of earn codes for Leave usage, for a particular assignment as of a particular date
49       * @param a
50       * @param asOfDate
51       * @param isLeavePlanningCalendar
52  	 * @return
53  	 */
54      @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")
55      public List<EarnCode> getEarnCodesForLeave(Assignment a, Date asOfDate, boolean isLeavePlanningCalendar);
56  
57      /**
58       * Fetch a list of earn codes based on principal ID as of a particular date
59       * @param principalId
60       * @param asOfDate
61       * @param isLeavePlanningCalendar
62       * @return
63       */
64      @Cacheable(value=EarnCode.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'asOfDate=' + #p1 + '|' + 'isLeavePlanningCalendar=' +#p2")
65      public List<EarnCode> getEarnCodesForPrincipal(String principalId, Date asOfDate, boolean isLeavePlanningCalendar);
66  
67      /**
68       * Fetch an EarnCode as of a particular date
69       * @param earnCode
70       * @param asOfDate
71       * @return
72       */
73      @Cacheable(value=EarnCode.CACHE_NAME, key="'earnCode=' + #p0 + '|' + 'asOfDate=' + #p1")
74  	public EarnCode getEarnCode(String earnCode, Date asOfDate);
75  
76      /**
77       * Fetch the earn code type for a particular date
78       * @param earnCode
79       * @param asOfDate
80       * @return
81       */
82      @Cacheable(value=EarnCode.CACHE_NAME, key="'{getEarnCodeType}' + 'earnCode=' + #p0 + '|' + 'asOfDate=' + #p1")
83      String getEarnCodeType(String earnCode, Date asOfDate);
84      
85      /**
86       * Fetch earn code by id
87       * @param earnCodeId
88       * @return
89       */
90      @Cacheable(value=EarnCode.CACHE_NAME, key="'earnCodeId=' + #p0")
91      public EarnCode getEarnCodeById(String earnCodeId);
92      
93      /**
94       * Fetch list of system defined overtime earn codes
95       * @param asOfDate
96       * @return
97       */
98      @Cacheable(value=EarnCode.CACHE_NAME, key="'{getOvertimeEarnCodes}' + 'asOfDate=' + #p0")
99      public List<EarnCode> getOvertimeEarnCodes(Date asOfDate);
100 
101 
102     /**
103      * Fetch list of system defined overtime earn codes as strings
104      * @param asOfDate
105      * @return
106      */
107     @Cacheable(value=EarnCode.CACHE_NAME, key="'{getOvertimeEarnCodesStrs}' + 'asOfDate=' + #p0")
108     public List<String> getOvertimeEarnCodesStrs(Date asOfDate);
109 
110     /**
111 	 * get count of earn code with give earnCode
112 	 * @param earnCode
113 	 * @return int
114 	 */
115     public int getEarnCodeCount(String earnCode);
116 
117     /**
118 	 * get count of newer version of earn code with give earnCode and date
119 	 * @param earnCode
120 	 * @param effdt
121 	 * @return int
122 	 */
123     public int getNewerEarnCodeCount(String earnCode, Date effdt);
124     
125     /**
126      * roundHrsWithLEarnCode
127      * @param hours
128      * @param earnCode
129      * @return
130      */
131     public BigDecimal roundHrsWithEarnCode(BigDecimal hours, EarnCode earnCode);
132 
133     /**
134      * @param principalId
135      * @param isLeavePlanningCalendar
136      * @return
137      */
138     @Cacheable(value= EarnCode.CACHE_NAME, key="'{getEarnCodesForDisplay}' + 'principalId=' + #p0 + '|' + 'isLeavePlanningCalendar=' +#p1")
139     public Map<String, String> getEarnCodesForDisplay(String principalId, boolean isLeavePlanningCalendar);
140 
141     /**
142      * @param principalId
143      * @param asOfDate
144      * @return
145      */
146     @Cacheable(value= EarnCode.CACHE_NAME, key="'{getEarnCodesForDisplayWithEffectiveDate}' + 'principalId=' + #p0 + '|' + 'asOfDate=' + #p1 + '|' + 'isLeavePlanningCalendar=' +#p2")
147     public Map<String, String> getEarnCodesForDisplayWithEffectiveDate(String principalId, Date asOfDate, boolean isLeavePlanningCalendar);
148 
149     List<EarnCode> getEarnCodes(String earnCode, String ovtEarnCode, String leavePlan, String accrualCategory, String descr, Date fromEffdt, Date toEffdt, String active, String showHist);
150 }