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.approval.service; 017 018 import java.math.BigDecimal; 019 import java.util.Date; 020 import java.util.List; 021 import java.util.Map; 022 import java.util.Set; 023 import java.util.SortedSet; 024 025 import org.joda.time.DateTimeZone; 026 import org.joda.time.Interval; 027 import org.kuali.hr.core.KPMEConstants; 028 import org.kuali.hr.time.approval.web.ApprovalTimeSummaryRow; 029 import org.kuali.hr.time.calendar.Calendar; 030 import org.kuali.hr.time.calendar.CalendarEntries; 031 import org.kuali.hr.time.person.TKPerson; 032 import org.kuali.hr.time.timeblock.TimeBlock; 033 import org.kuali.hr.time.workflow.TimesheetDocumentHeader; 034 import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; 035 import org.springframework.cache.annotation.Cacheable; 036 037 import com.google.common.collect.Multimap; 038 039 040 public interface TimeApproveService { 041 042 /** 043 * Obtains a Map of Lists of ApprovalTimeSummaryRows. The Key to the map is 044 * the PayCalendar Group name. 045 * 046 * @param payBeginDate 047 * @param payEndDate 048 * @param calGroup Specify a calendar group to filter by. 049 * @return A Map<String, List<ApprovalTimeSummaryRow>> container. 050 */ 051 public List<ApprovalTimeSummaryRow> getApprovalSummaryRows(Date payBeginDate, Date payEndDate, String calGroup, List<TKPerson> principalIds, List<String> payCalendarLabels, CalendarEntries payCalendarEntries); 052 053 054 055 // public List<ApprovalTimeSummaryRow> getApprovalSummaryRows(Date payBeginDate, Date payEndDate, String calGroup, List<String> principalIds); 056 057 @Cacheable(value= KPMEConstants.KPME_GLOBAL_CACHE_NAME, key="'{PayCalendarLabelsForApprovalTab}' + 'payBeginDate=' + #p0 + '|' + 'payEndDate=' + #p1") 058 public List<String> getPayCalendarLabelsForApprovalTab(Date payBeginDate, Date payEndDate); 059 060 /** 061 * Method to obtain all of the active Pay Calendar Group names for the current 062 * user / approver. 063 * We used SortedSet here since we only want unique values while keeping the order. 064 * Besides, we also need to get the first value as the default pay calendar group in some cases. 065 * There is not get() method in the Set interface. 066 * 067 * @param payBeginDate 068 * @param payEndDate 069 * @return 070 */ 071 public SortedSet<String> getApproverPayCalendarGroups(Date payBeginDate, Date payEndDate); 072 073 /** 074 * Used to determine if there are notes on a document 075 * @param documentNumber 076 * @return list of note objects 077 */ 078 @SuppressWarnings("rawtypes") 079 public List getNotesForDocument(String documentNumber); 080 081 public Map<String, BigDecimal> getHoursToPayDayMap(String principalId, Date payEndDate, List<String> payCalendarLabels, List<TimeBlock> lstTimeBlocks, Long workArea, CalendarEntries payCalendarEntries, Calendar payCalendar, DateTimeZone dateTimeZone, List<Interval> dayIntervals); 082 083 public Map<String, BigDecimal> getHoursToFlsaWeekMap(String principalId, Date payEndDate, List<String> payCalendarLabels, List<TimeBlock> lstTimeBlocks, Long workArea, CalendarEntries payCalendarEntries, Calendar payCalendar, DateTimeZone dateTimeZone, List<Interval> dayIntervals); 084 /** 085 * Method to provide a mapping of PayCalendarGroupNames to PayCalendarEntries to 086 * allow for various starting points in Approval Tab Navigation. 087 * 088 * @param currentDate The current date. This method will search for active 089 * assignments for this approver active as of this date, and 31 days prior 090 * to pull back PayCalendarEntries. 091 * 092 * @return A CalendarGroup Name to PayCalendarEntries mapping. 093 */ 094 public Map<String,CalendarEntries> getPayCalendarEntriesForApprover(String principalId, Date currentDate, String dept); 095 096 /* 097 * returns all Calendar entries with TimeSheetDocument created and can be approved by given principalId 098 */ 099 public List<CalendarEntries> getAllPayCalendarEntriesForApprover(String principalId, Date currentDate); 100 101 102 103 public boolean doesApproverHavePrincipalsForCalendarGroup(Date asOfDate, String calGroup); 104 public Map<String,CalendarEntries> getPayCalendarEntriesForDept(String dept, Date currentDate); 105 106 /** 107 * Get a list of unique pay groups 108 * @return 109 */ 110 List<String> getUniquePayGroups(); 111 112 /** 113 * Method to get a list of principal ids based on the department work areas. 114 * 115 * @param roleName 116 * @param department 117 * @param workArea 118 * @param payEndDate 119 * @param calGroup 120 * @return A list of the PrincipalIds 121 */ 122 List<String> getPrincipalIdsByDeptWorkAreaRolename(String roleName, String department, String workArea, java.sql.Date payBeginDate, java.sql.Date payEndDate, String calGroup); 123 124 /** 125 * Method to create a map that contains the principal's id and corresponding timesheet document header. 126 * 127 * @param payBeginDate 128 * @param payEndDate 129 * @return A PrincipalId to TimesheetDocumentHeader mapping. 130 */ 131 Map<String, TimesheetDocumentHeader> getPrincipalDocumehtHeader(List<TKPerson> person, Date payBeginDate, Date payEndDate); 132 133 /** 134 * Method to create a map of the depts and their associated work areas based on the given approver work areas. 135 * 136 * @param approverWorkAres 137 * @return A Dept and Work Areas mapping. 138 */ 139 Multimap<String, Long> getDeptWorkAreasByWorkAreas(Set<Long> approverWorkAres); 140 141 /** 142 * Method to create a map of the depts and their associated work areas based on the given depts. 143 * 144 * @param userDepts 145 * @return A Dept and Work Areas mapping. 146 */ 147 Multimap<String, Long> getDeptWorkAreasByDepts(Set<String> userDepts); 148 149 public DocumentRouteHeaderValue getRouteHeader(String documentId); 150 }