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 /**
049 * Fetch last clock log for principal id, assignment details, and calendar entry
050 * @param principalId
051 * @param jobNumber
052 * @param workArea
053 * @param task
054 * @param calendarEntry
055 * @return
056 */
057 public ClockLog getLastClockLog(String principalId, String jobNumber, String workArea, String task, CalendarEntries calendarEntry);
058
059 /**
060 * Build ClockLog based on criteria passed in
061 * @param clockTimestamp -- timestamp with grace rule applied if there is one
062 * @param originalTimestamp -- timestamp without grace rule applied
063 * @param assignment
064 * @param timesheetDocument
065 * @param clockAction
066 * @param ip
067 * @return
068 */
069 public ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip);
070
071 /**
072 * Process clock log created
073 * @param clockTimestamp
074 * @param assignment
075 * @param pe
076 * @param ip
077 * @param asOfDate
078 * @param td
079 * @param clockAction
080 * @param principalId
081 * @return
082 */
083 ClockLog processClockLog(Timestamp clockTimestamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId);
084
085 /**
086 * Fetch clock log by id
087 * @param tkClockLogId
088 * @return
089 */
090 public ClockLog getClockLog(String tkClockLogId);
091
092 ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip, String userPrincipalId);
093
094 ClockLog processClockLog(Timestamp clockTimeStamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId, String userPrincipalId);
095
096 /**
097 * Get warning messages for clock actions taken from unapproved IP address on given timesheet document
098 * @param timeBlocks
099 * @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 }