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.leaveblock.service; 017 018 import java.math.BigDecimal; 019 import java.sql.Timestamp; 020 import java.util.Date; 021 import java.util.List; 022 import java.util.Map; 023 024 import org.joda.time.DateTime; 025 import org.kuali.hr.lm.leaveblock.LeaveBlock; 026 import org.kuali.hr.time.assignment.Assignment; 027 import org.kuali.hr.time.calendar.CalendarEntries; 028 029 public interface LeaveBlockService { 030 public LeaveBlock getLeaveBlock(String leaveBlockId); 031 public List<LeaveBlock> getLeaveBlocksForDocumentId(String documentId); 032 public List<LeaveBlock> getLeaveBlocks(String principalId, Date beginDate, Date endDate); 033 public List<LeaveBlock> getLeaveBlocksWithType(String principalId, Date beginDate, Date endDate, String leaveBlockType); 034 public List<LeaveBlock> getLeaveBlocksWithAccrualCategory(String principalId, Date beginDate, Date endDate, String accrualCategory); 035 public List<LeaveBlock> getLeaveBlocksSinceCarryOver(String principalId, Map<String, LeaveBlock> carryOverBlocks, DateTime endDate, boolean includeAllAccrualCategories); 036 public Map<String, LeaveBlock> getLastCarryOverBlocks(String principalId, Date asOfDate); 037 public void saveLeaveBlocks(List<LeaveBlock> leaveBlocks); 038 039 public void saveLeaveBlock(LeaveBlock leaveBlock, String principalId); 040 041 /** 042 * The deletion marks the leave block inactive instead of removing the row from the database. 043 * @param leaveBlockId 044 * @param principalId 045 */ 046 public void deleteLeaveBlock(String leaveBlockId, String principalId); 047 048 public void addLeaveBlocks(DateTime beginDate, DateTime endDate, CalendarEntries ce, String selectedEarnCode, 049 BigDecimal hours, String description, Assignment selectedAssignment, String spanningWeeks, String leaveBlockType, String principalId); 050 051 public void updateLeaveBlock(LeaveBlock leaveBlock, String principalId); 052 /** 053 * 054 * @param principalId 055 * @param leaveBlockType 056 * @param requestStatus 057 * @param currentDate currentDate to get the records for the future date, pass null when not required 058 * @return List of LeaveBlocks 059 */ 060 public List<LeaveBlock> getLeaveBlocks(String principalId, String leaveBlockType, String requestStatus, Date currentDate); 061 062 /** 063 * 064 * @param principalId 065 * @param leaveBlockType 066 * @param requestStatus 067 * @param beginDate 068 * @param endDate 069 * @return List of LeaveBlocks 070 */ 071 public List<LeaveBlock> getLeaveBlocks(String principalId, String leaveBlockType, String requestStatus, Date beginDate, Date endDate); 072 073 /** 074 * Get the list of leave blocks from the given leaveDate for the principalId 075 * @param principalId 076 * @param leaveDate 077 * @return List of LeaveBlocks 078 */ 079 public List<LeaveBlock> getLeaveBlocksForDate(String principalId, Date leaveDate); 080 /** 081 * Get the list of not-accrual-generated leave blocks from the given leaveDate for the principalId 082 * @param principalId 083 * @param leaveDate 084 * @return List of LeaveBlocks 085 */ 086 public List<LeaveBlock> getNotAccrualGeneratedLeaveBlocksForDate(String principalId, Date leaveDate); 087 /** 088 * Get list of leave blocks to display on time sheet with given dates and principal id 089 * Only get leave blocks with type of leave calendar and time calendar 090 * the leave blocks should have assignments in the list of assignment keys 091 * @param principalId 092 * @param beginDate 093 * @param endDate 094 * @param assignmentKeys 095 * @return List of leave blocks 096 */ 097 public List<LeaveBlock> getLeaveBlocksForTimeCalendar(String principalId, Date beginDate, Date endDate, List<String> assignmentKeys); 098 /** 099 * Get list of leave blocks to display on leave calendar with given dates and principal id 100 * the leave blocks created from time calendar should have assignments in the list of assignment keys 101 * @param principalId 102 * @param beginDate 103 * @param endDate 104 * @param assignmentKeys 105 * @return List of leave blocks 106 */ 107 public List<LeaveBlock> getLeaveBlocksForLeaveCalendar(String principalId, Date beginDate, Date endDate, List<String> assignmentKeys); 108 109 /** 110 * Filter list of leave blocks with given list of assignmentKeys for Time Calendar 111 * @param lbs 112 * @param assignmentKeys 113 * @return List of leave blocks 114 */ 115 public List<LeaveBlock> filterLeaveBlocksForTimeCalendar(List<LeaveBlock> lbs, List<String> assignmentKeys); 116 /** 117 * Filter list of leave blocks with given list of assignmentKeys for Leave Calendar 118 * @param lbs 119 * @param assignmentKeys 120 * @return List of leave blocks 121 */ 122 public List<LeaveBlock> filterLeaveBlocksForLeaveCalendar(List<LeaveBlock> lbs, List<String> assignmentKeys); 123 /** 124 * Delete time blocks for a given document id 125 * @param documentId 126 */ 127 public void deleteLeaveBlocksForDocumentId(String documentId); 128 129 /** 130 * Retrieve list of accrual generated leave blocks for given Date range and User 131 * @param principalId 132 * @param beginDate 133 * @param endDate 134 * @return List of leave blocks 135 */ 136 public List<LeaveBlock> getAccrualGeneratedLeaveBlocks(String principalId, Date beginDate, Date endDate); 137 138 /** 139 * Retrieve list of leave blocks generated with given system scheduled time off id, date and user 140 * @param principalId 141 * @param sstoId 142 * @param accruledDate 143 * @return 144 */ 145 public List<LeaveBlock> getSSTOLeaveBlocks(String principalId, String sstoId, Date accruledDate); 146 147 /** 148 * gets list of leave blocks created for earn codes with eligible-for-accrual=no since the given timestamp 149 * @param principalId 150 * @param lastRanTime 151 * @return 152 */ 153 public List<LeaveBlock> getABELeaveBlocksSinceTime(String principalId, Timestamp lastRanTime); 154 }