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.clocklog.service;
017
018 import java.sql.Timestamp;
019 import java.util.List;
020
021 import org.kuali.hr.time.assignment.Assignment;
022 import org.kuali.hr.time.calendar.CalendarEntries;
023 import org.kuali.hr.time.clocklog.ClockLog;
024 import org.kuali.hr.time.timeblock.TimeBlock;
025 import org.kuali.hr.time.timesheet.TimesheetDocument;
026
027 public interface ClockLogService {
028 /**
029 * Save clock log
030 * @param clockLog
031 */
032 public void saveClockLog(ClockLog clockLog);
033 /**
034 * Fetch last clock log for principal id
035 * @param principalId
036 * @return
037 */
038 public ClockLog getLastClockLog(String principalId);
039
040 /**
041 * Fetch last clock log for principal id and clock action
042 * @param principalId
043 * @param clockAction
044 * @return
045 */
046 public ClockLog getLastClockLog(String principalId, String clockAction);
047 /**
048 * Build ClockLog based on criteria passed in
049 * @param clockTimestamp -- timestamp with grace rule applied if there is one
050 * @param originalTimestamp -- timestamp without grace rule applied
051 * @param assignment
052 * @param timesheetDocument
053 * @param clockAction
054 * @param ip
055 * @return
056 */
057 public ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip);
058
059 /**
060 * Fetch open clock logs by pay calendar entry
061 * @param payCalendarEntry
062 * @return
063 */
064 public List<ClockLog> getOpenClockLogs(CalendarEntries payCalendarEntry);
065
066 /**
067 * Process clock log created
068 * @param clockTimestamp
069 * @param assignment
070 * @param pe
071 * @param ip
072 * @param asOfDate
073 * @param td
074 * @param clockAction
075 * @param principalId
076 * @return
077 */
078 ClockLog processClockLog(Timestamp clockTimestamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId);
079
080 /**
081 * Fetch clock log by id
082 * @param tkClockLogId
083 * @return
084 */
085 public ClockLog getClockLog(String tkClockLogId);
086
087 ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip, String userPrincipalId);
088
089 ClockLog processClockLog(Timestamp clockTimeStamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId, String userPrincipalId);
090
091 /**
092 * Get warning messages for clock actions taken from unapproved IP address on given timesheet document
093 * @param timeBlocks
094 * @return List<String>
095 */
096 public List<String> getUnapprovedIPWarning(List<TimeBlock> timeBlocks);
097
098 /**
099 * 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 }