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.clocklog.service;
17
18 import java.sql.Timestamp;
19 import java.util.List;
20
21 import org.kuali.hr.time.assignment.Assignment;
22 import org.kuali.hr.time.calendar.CalendarEntries;
23 import org.kuali.hr.time.clocklog.ClockLog;
24 import org.kuali.hr.time.timeblock.TimeBlock;
25 import org.kuali.hr.time.timesheet.TimesheetDocument;
26
27 public interface ClockLogService {
28 /**
29 * Save clock log
30 * @param clockLog
31 */
32 public void saveClockLog(ClockLog clockLog);
33 /**
34 * Fetch last clock log for principal id
35 * @param principalId
36 * @return
37 */
38 public ClockLog getLastClockLog(String principalId);
39
40 /**
41 * Fetch last clock log for principal id and clock action
42 * @param principalId
43 * @param clockAction
44 * @return
45 */
46 public ClockLog getLastClockLog(String principalId, String clockAction);
47
48 /**
49 * Fetch last clock log for principal id, assignment details, and calendar entry
50 * @param principalId
51 * @param jobNumber
52 * @param workArea
53 * @param task
54 * @param calendarEntry
55 * @return
56 */
57 public ClockLog getLastClockLog(String principalId, String jobNumber, String workArea, String task, CalendarEntries calendarEntry);
58
59 /**
60 * Build ClockLog based on criteria passed in
61 * @param clockTimestamp -- timestamp with grace rule applied if there is one
62 * @param originalTimestamp -- timestamp without grace rule applied
63 * @param assignment
64 * @param timesheetDocument
65 * @param clockAction
66 * @param ip
67 * @return
68 */
69 public ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip);
70
71 /**
72 * Process clock log created
73 * @param clockTimestamp
74 * @param assignment
75 * @param pe
76 * @param ip
77 * @param asOfDate
78 * @param td
79 * @param clockAction
80 * @param principalId
81 * @return
82 */
83 ClockLog processClockLog(Timestamp clockTimestamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId);
84
85 /**
86 * Fetch clock log by id
87 * @param tkClockLogId
88 * @return
89 */
90 public ClockLog getClockLog(String tkClockLogId);
91
92 ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip, String userPrincipalId);
93
94 ClockLog processClockLog(Timestamp clockTimeStamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId, String userPrincipalId);
95
96 /**
97 * Get warning messages for clock actions taken from unapproved IP address on given timesheet document
98 * @param timeBlocks
99 * @return List<String>
100 */
101 public List<String> getUnapprovedIPWarning(List<TimeBlock> timeBlocks);
102
103 /**
104 * Build an unapproved IP address warning message for based on given ClockLog
105 * @param cl
106 * @return
107 */
108 public String buildUnapprovedIPWarning(ClockLog cl);
109 }