View Javadoc

1   /**
2    * Copyright 2004-2012 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.approval.service;
17  
18  import java.math.BigDecimal;
19  import java.util.Date;
20  import java.util.List;
21  import java.util.Map;
22  import java.util.Set;
23  import java.util.SortedSet;
24  
25  import org.joda.time.DateTimeZone;
26  import org.joda.time.Interval;
27  import org.kuali.hr.core.KPMEConstants;
28  import org.kuali.hr.time.approval.web.ApprovalTimeSummaryRow;
29  import org.kuali.hr.time.calendar.Calendar;
30  import org.kuali.hr.time.calendar.CalendarEntries;
31  import org.kuali.hr.time.person.TKPerson;
32  import org.kuali.hr.time.timeblock.TimeBlock;
33  import org.kuali.hr.time.workflow.TimesheetDocumentHeader;
34  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
35  import org.springframework.cache.annotation.Cacheable;
36  
37  import com.google.common.collect.Multimap;
38  
39  
40  public interface TimeApproveService {
41  
42      /**
43       * Obtains a Map of Lists of ApprovalTimeSummaryRows. The Key to the map is
44       * the PayCalendar Group name.
45       *
46       * @param payBeginDate
47       * @param payEndDate
48       * @param calGroup Specify a calendar group to filter by.
49       * @return A Map<String, List<ApprovalTimeSummaryRow>> container.
50       */
51  	public List<ApprovalTimeSummaryRow> getApprovalSummaryRows(Date payBeginDate, Date payEndDate, String calGroup, List<TKPerson> principalIds, List<String> payCalendarLabels, CalendarEntries payCalendarEntries);
52  	
53  
54  
55  //	public List<ApprovalTimeSummaryRow> getApprovalSummaryRows(Date payBeginDate, Date payEndDate, String calGroup, List<String> principalIds);
56  
57      @Cacheable(value= KPMEConstants.KPME_GLOBAL_CACHE_NAME, key="'{PayCalendarLabelsForApprovalTab}' + 'payBeginDate=' + #p0 + '|' + 'payEndDate=' + #p1")
58  	public List<String> getPayCalendarLabelsForApprovalTab(Date payBeginDate, Date payEndDate);
59  
60      /**
61       * Method to obtain all of the active Pay Calendar Group names for the current
62       * user / approver.
63       * We used SortedSet here since we only want unique values while keeping the order.
64       * Besides, we also need to get the first value as the default pay calendar group in some cases.
65       * There is not get() method in the Set interface.
66       *
67       * @param payBeginDate
68       * @param payEndDate
69       * @return
70       */
71      public SortedSet<String> getApproverPayCalendarGroups(Date payBeginDate, Date payEndDate);
72  
73      /**
74       * Used to determine if there are notes on a document
75       * @param documentNumber
76       * @return list of note objects
77       */
78      @SuppressWarnings("rawtypes")
79  	public List getNotesForDocument(String documentNumber);
80  
81      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);
82  
83      /**
84       * Method to provide a mapping of PayCalendarGroupNames to PayCalendarEntries to
85       * allow for various starting points in Approval Tab Navigation.
86       *
87       * @param currentDate The current date. This method will search for active
88       * assignments for this approver active as of this date, and 31 days prior
89       * to pull back PayCalendarEntries.
90       *
91       * @return A CalendarGroup Name to PayCalendarEntries mapping.
92       */
93      public Map<String,CalendarEntries> getPayCalendarEntriesForApprover(String principalId, Date currentDate, String dept);
94      
95      /*
96       * returns all Calendar entries with TimeSheetDocument created and can be approved by given principalId
97       */
98      public List<CalendarEntries> getAllPayCalendarEntriesForApprover(String principalId, Date currentDate);
99      
100 
101     
102     public boolean doesApproverHavePrincipalsForCalendarGroup(Date asOfDate, String calGroup);
103     public Map<String,CalendarEntries> getPayCalendarEntriesForDept(String dept, Date currentDate);
104 
105     /**
106      * Get a list of unique pay groups
107      * @return
108      */
109     List<String> getUniquePayGroups();
110 
111     /**
112      * Method to get a list of principal ids based on the department work areas.
113      *
114      * @param roleName
115      * @param department
116      * @param workArea
117      * @param payEndDate
118      * @param calGroup
119      * @return A list of the PrincipalIds
120      */
121     List<String> getPrincipalIdsByDeptWorkAreaRolename(String roleName, String department, String workArea, java.sql.Date payBeginDate, java.sql.Date payEndDate, String calGroup);
122     
123     /**
124      * Method to create a map that contains the principal's id and corresponding timesheet document header.
125      *
126      * @param payBeginDate
127      * @param payEndDate
128      * @return A PrincipalId to TimesheetDocumentHeader mapping.
129      */
130     Map<String, TimesheetDocumentHeader> getPrincipalDocumehtHeader(List<TKPerson> person, Date payBeginDate, Date payEndDate);
131 
132     /**
133      * Method to create a map of the depts and their associated work areas based on the given approver work areas.
134      *
135      * @param approverWorkAres
136      * @return A Dept and Work Areas mapping.
137      */
138     Multimap<String, Long> getDeptWorkAreasByWorkAreas(Set<Long> approverWorkAres);
139 
140     /**
141      * Method to create a map of the depts and their associated work areas based on the given depts.
142      *
143      * @param userDepts
144      * @return A Dept and Work Areas mapping.
145      */
146     Multimap<String, Long> getDeptWorkAreasByDepts(Set<String> userDepts);
147     
148     public DocumentRouteHeaderValue getRouteHeader(String documentId);
149 }