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 ClockLog 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 * Process clock log created 061 * @param clockTimestamp 062 * @param assignment 063 * @param pe 064 * @param ip 065 * @param asOfDate 066 * @param td 067 * @param clockAction 068 * @param principalId 069 * @return 070 */ 071 ClockLog processClockLog(Timestamp clockTimestamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, boolean runRules, String principalId); 072 073 /** 074 * Fetch clock log by id 075 * @param tkClockLogId 076 * @return 077 */ 078 public ClockLog getClockLog(String tkClockLogId); 079 080 ClockLog processClockLog(Timestamp clockTimeStamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, boolean runRules, String principalId, String userPrincipalId); 081 082 public void deleteClockLogsForDocumentId(String documentId); 083 084 /** 085 * Get warning messages for clock actions taken from unapproved IP address on given timesheet document 086 * @param timeBlocks 087 * @return List<String> 088 */ 089 public List<String> getUnapprovedIPWarning(List<TimeBlock> timeBlocks); 090 091 /** 092 * Build an unapproved IP address warning message for based on given ClockLog 093 * @param cl 094 * @return 095 */ 096 public String buildUnapprovedIPWarning(ClockLog cl); 097 }