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 * Build ClockLog based on criteria passed in
49 * @param clockTimestamp -- timestamp with grace rule applied if there is one
50 * @param originalTimestamp -- timestamp without grace rule applied
51 * @param assignment
52 * @param timesheetDocument
53 * @param clockAction
54 * @param ip
55 * @return
56 */
57 public ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip);
58
59 /**
60 * Fetch open clock logs by pay calendar entry
61 * @param payCalendarEntry
62 * @return
63 */
64 public List<ClockLog> getOpenClockLogs(CalendarEntries payCalendarEntry);
65
66 /**
67 * Process clock log created
68 * @param clockTimestamp
69 * @param assignment
70 * @param pe
71 * @param ip
72 * @param asOfDate
73 * @param td
74 * @param clockAction
75 * @param principalId
76 * @return
77 */
78 ClockLog processClockLog(Timestamp clockTimestamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId);
79
80 /**
81 * Fetch clock log by id
82 * @param tkClockLogId
83 * @return
84 */
85 public ClockLog getClockLog(String tkClockLogId);
86
87 ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip, String userPrincipalId);
88
89 ClockLog processClockLog(Timestamp clockTimeStamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId, String userPrincipalId);
90
91 /**
92 * Get warning messages for clock actions taken from unapproved IP address on given timesheet document
93 * @param timeBlocks
94 * @return List<String>
95 */
96 public List<String> getUnapprovedIPWarning(List<TimeBlock> timeBlocks);
97
98 /**
99 * Build an unapproved IP address warning message for based on given ClockLog
100 * @param cl
101 * @return
102 */
103 public String buildUnapprovedIPWarning(ClockLog cl);
104 }