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.lm.leaveblock.service;
17  
18  import java.math.BigDecimal;
19  import java.sql.Timestamp;
20  import java.util.Date;
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.joda.time.DateTime;
25  import org.kuali.hr.lm.leaveblock.LeaveBlock;
26  import org.kuali.hr.time.assignment.Assignment;
27  import org.kuali.hr.time.calendar.CalendarEntries;
28  
29  public interface LeaveBlockService {
30      public LeaveBlock getLeaveBlock(String leaveBlockId);
31      public List<LeaveBlock> getLeaveBlocksForDocumentId(String documentId);
32      public List<LeaveBlock> getLeaveBlocks(String principalId, Date beginDate, Date endDate);
33      public List<LeaveBlock> getLeaveBlocksWithType(String principalId, Date beginDate, Date endDate, String leaveBlockType);
34      public List<LeaveBlock> getLeaveBlocksWithAccrualCategory(String principalId, Date beginDate, Date endDate, String accrualCategory);
35      public List<LeaveBlock> getLeaveBlocksSinceCarryOver(String principalId, Map<String, LeaveBlock> carryOverBlocks, DateTime endDate, boolean includeAllAccrualCategories);
36      public Map<String, LeaveBlock> getLastCarryOverBlocks(String principalId, Date asOfDate);
37      public void saveLeaveBlocks(List<LeaveBlock> leaveBlocks);
38  
39      public void saveLeaveBlock(LeaveBlock leaveBlock, String principalId);
40  
41      /**
42       * The deletion marks the leave block inactive instead of removing the row from the database.
43       * @param leaveBlockId
44       * @param principalId
45       */
46      public void deleteLeaveBlock(String leaveBlockId, String principalId);
47  
48      public void addLeaveBlocks(DateTime beginDate, DateTime endDate, CalendarEntries ce, String selectedEarnCode, 
49      		BigDecimal hours, String description, Assignment selectedAssignment, String spanningWeeks, String leaveBlockType, String principalId);
50      
51      public void updateLeaveBlock(LeaveBlock leaveBlock, String principalId);
52      /**
53       * 
54       * @param principalId
55       * @param leaveBlockType
56       * @param requestStatus
57       * @param currentDate currentDate to get the records for the future date, pass null when not required
58       * @return List of LeaveBlocks
59       */
60      public List<LeaveBlock> getLeaveBlocks(String principalId, String leaveBlockType, String requestStatus, Date currentDate);
61      /**
62       * Get the list of leave blocks from the given leaveDate for the principalId
63       * @param principalId
64       * @param leaveDate
65       * @return List of LeaveBlocks
66       */
67      public List<LeaveBlock> getLeaveBlocksForDate(String principalId, Date leaveDate);
68      /**
69       * Get the list of not-accrual-generated leave blocks from the given leaveDate for the principalId
70       * @param principalId
71       * @param leaveDate
72       * @return List of LeaveBlocks
73       */
74      public List<LeaveBlock> getNotAccrualGeneratedLeaveBlocksForDate(String principalId, Date leaveDate);
75      /**
76       * Get list of leave blocks to display on time sheet with given dates and principal id
77       * Only get leave blocks with type of leave calendar and time calendar
78       * the leave blocks should have assignments in the list of assignment keys
79       * @param principalId
80       * @param beginDate
81       * @param endDate
82       * @param assignmentKeys
83       * @return List of leave blocks
84       */
85      public List<LeaveBlock> getLeaveBlocksForTimeCalendar(String principalId, Date beginDate, Date endDate, List<String> assignmentKeys); 
86      /**
87       * Get list of leave blocks to display on leave calendar with given dates and principal id
88       * the leave blocks created from time calendar should have assignments in the list of assignment keys
89       * @param principalId
90       * @param beginDate
91       * @param endDate
92       * @param assignmentKeys
93       * @return List of leave blocks
94       */    
95      public List<LeaveBlock> getLeaveBlocksForLeaveCalendar(String principalId, Date beginDate, Date endDate, List<String> assignmentKeys); 
96     
97      /**
98       * Filter list of leave blocks with given list of assignmentKeys for Time Calendar
99       * @param lbs
100      * @param assignmentKeys
101      * @return List of leave blocks
102      */
103     public List<LeaveBlock> filterLeaveBlocksForTimeCalendar(List<LeaveBlock> lbs, List<String> assignmentKeys);
104     /**
105      * Filter list of leave blocks with given list of assignmentKeys for Leave Calendar
106      * @param lbs
107      * @param assignmentKeys
108      * @return List of leave blocks
109      */
110     public List<LeaveBlock> filterLeaveBlocksForLeaveCalendar(List<LeaveBlock> lbs, List<String> assignmentKeys);
111     /**
112      *  Delete time blocks for a given document id
113      *  @param documentId
114      */
115     public void deleteLeaveBlocksForDocumentId(String documentId);
116     
117     /**
118      * Retrieve list of accrual generated leave blocks for given Date range and User
119      * @param principalId 
120      * @param beginDate
121      * @param endDate
122      * @return List of leave blocks
123      */
124     public List<LeaveBlock> getAccrualGeneratedLeaveBlocks(String principalId, Date beginDate, Date endDate);
125     
126     /**
127      * Retrieve list of leave blocks generated with given system scheduled time off id, date and user
128      * @param principalId
129      * @param sstoId
130      * @param accruledDate
131      * @return
132      */
133     public List<LeaveBlock> getSSTOLeaveBlocks(String principalId, String sstoId, Date accruledDate);
134     
135     /**
136      * gets list of leave blocks created for earn codes with eligible-for-accrual=no since the given timestamp
137      * @param principalId
138      * @param lastRanTime
139      * @return
140      */
141     public List<LeaveBlock> getABELeaveBlocksSinceTime(String principalId, Timestamp lastRanTime);
142 }