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.assignment.service;
17  
18  import org.kuali.hr.lm.leavecalendar.LeaveCalendarDocument;
19  import org.kuali.hr.time.assignment.Assignment;
20  import org.kuali.hr.time.assignment.AssignmentDescriptionKey;
21  import org.kuali.hr.time.calendar.CalendarEntries;
22  import org.kuali.hr.time.timesheet.TimesheetDocument;
23  import org.springframework.cache.annotation.Cacheable;
24  
25  import java.sql.Date;
26  import java.util.List;
27  import java.util.Map;
28  
29  public interface AssignmentService {
30  	/**
31  	 * Fetches a list of Assignments for a given principal Id as of a particular date
32  	 * @param principalId
33  	 * @param asOfDate
34  	 * @return
35  	 */
36      @Cacheable(value= Assignment.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
37      public List<Assignment> getAssignments(String principalId, Date asOfDate);
38      /**
39       * Reverse lookup of an assignment based on the assignment key and the document
40       * @param timesheetDocument
41       * @param assignmentKey
42       * @return
43       */
44      public Assignment getAssignment(TimesheetDocument timesheetDocument, String assignmentKey);
45      /**
46       * Reverse lookup of an assignment based on the assignment id
47       * @param tkAssignmentId
48       * @return
49       */
50      @Cacheable(value= Assignment.CACHE_NAME, key="'tkAssignmentId=' + #p0")
51      public Assignment getAssignment(String tkAssignmentId);
52      /**
53       * Get Assignment Description key based off of description
54       * @param assignmentDesc
55       * @return
56       */
57      public AssignmentDescriptionKey getAssignmentDescriptionKey(String assignmentDesc);
58      /**
59       * Get all assignment descriptions for a document
60       * @param td
61       * @param clockOnlyAssignments
62       * @return
63       */
64      public Map<String,String> getAssignmentDescriptions(TimesheetDocument td, boolean clockOnlyAssignments);
65      /**
66       * Get all assignment descriptions for an assignment
67       * @param assignment
68       * @return
69       */
70  	public Map<String,String> getAssignmentDescriptions(Assignment assignment);
71  	/**
72  	 * Get all active assignments for a work area
73  	 * @param workArea
74  	 * @param asOfDate
75  	 * @return
76  	 */
77      @Cacheable(value= Assignment.CACHE_NAME, key="'workArea=' + #p0 + '|' + 'asOfDate=' + #p1")
78  	public List<Assignment> getActiveAssignmentsForWorkArea(Long workArea, Date asOfDate);
79  
80  	/**
81  	 * Get active assignments for all users for the current date
82  	 * CAUTION this method will return a lot of data in a normal production env
83  	 * It is intended to only be used in a batch setting
84  	 * @param asOfDate
85  	 * @return
86  	 */
87      @Cacheable(value= Assignment.CACHE_NAME, key="'asOfDate=' + #p0")
88  	public List<Assignment> getActiveAssignments(Date asOfDate);
89  
90  
91      /**
92       * For a given AssignmentDescriptionKey return the matching assignment.
93       * @param key
94       * @return
95       */
96      public Assignment getAssignment(AssignmentDescriptionKey key, Date asOfDate);
97  
98      
99      /**
100      * Fetch principal id and key as of a particular date
101      * @param principalId
102      * @param key
103      * @param asOfDate
104      * @return
105      */
106     public Assignment getAssignment(String principalId, AssignmentDescriptionKey key, Date asOfDate);
107     
108     /**
109      * Get assignments by pay calendar entry
110      * @param principalId
111      * @param payCalendarEntry
112      * @return
113      */
114     public List<Assignment> getAssignmentsByPayEntry(String principalId, CalendarEntries payCalendarEntry);
115     /**
116      * Get assignments for Time Calendar by calendar entry
117      * @param principalId
118      * @param calendarEntry
119      * @return
120      */
121     public List<Assignment> getAssignmentsByCalEntryForTimeCalendar(String principalId, CalendarEntries calendarEntry);
122     /**
123      * Get assignments for Leave Calendar by calendar entry
124      * @param principalId
125      * @param calendarEntry
126      * @return
127      */
128     public List<Assignment> getAssignmentsByCalEntryForLeaveCalendar(String principalId, CalendarEntries calendarEntry);
129     
130     /**
131 	 * KPME-1129 Kagata
132 	 * Get a list of active assignments based on principalId and jobNumber as of a particular date 
133 	 * @param principalId
134 	 * @param jobNumber
135 	 * @param asOfDate
136 	 * @return
137 	 */
138     @Cacheable(value= Assignment.CACHE_NAME, key="'principalId=' + #p0 + '|' + 'jobNumber=' + #p1 + '|' + 'asOfDate=' + #p2")
139     public List<Assignment> getActiveAssignmentsForJob(String principalId, Long jobNumber, Date asOfDate);
140 
141     List<Assignment> searchAssignments(Date fromEffdt, Date toEffdt, String principalId, String jobNumber,
142                                     String dept, String workArea, String active, String showHistory);
143     
144     
145     /**
146      * Get all assignment descriptions for a document
147      * @param td
148      * @param clockOnlyAssignments
149      * @return
150      */
151     public Map<String,String> getAssignmentDescriptions(LeaveCalendarDocument lcd);
152     
153     /**
154      * Get all assignment descriptions for given list of Assignments
155      * @param assignments
156      * @return
157      */
158     public Map<String, String> getAssignmentDescriptionsForAssignments(List<Assignment>  assignments);
159     
160     public Assignment getAssignment(LeaveCalendarDocument leaveCalendarDocument, String assignmentKey);
161     
162     public Assignment getAssignment(List<Assignment> assignments, String assignmentKey, Date beginDate);
163     
164     public Assignment getMaxTimestampAssignment(String principalId);
165     
166     /**
167      * Filter the given list of assignments with given criteria
168      * @param assignments
169      * @param flsaStatus
170      * @param chkForLeaveEligible
171      * @return List<Assignment>
172      */
173     public List<Assignment> filterAssignments(List<Assignment> assignments, String flsaStatus, boolean chkForLeaveEligible);
174     
175     /**
176      * Get assignment that applies to primary job of employee
177      * to be used in calculating system scheduled time off
178      * @param timesheetDocument
179      * @param payEndDate
180      * @return
181      */
182 	public Assignment getAssignmentToApplyScheduledTimeOff(TimesheetDocument timesheetDocument, java.sql.Date payEndDate);
183 	/**
184 	 * Get list of unique principalIds with given workarea list and dates
185 	 * @param workAreaList
186 	 * @param effdt
187 	 * @param startDate
188 	 * @param endDate
189 	 * @return
190 	 */
191 	public List<String> getPrincipalIds(List<String> workAreaList, Date effdt, Date startDate, Date endDate);
192 	
193 	 public List<Assignment> getAssignments(List<String> workAreaList, Date effdt, Date startDate, Date endDate);
194 }