001    /**
002     * Copyright 2004-2012 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.timesheet.TimesheetDocument;
025    
026    public interface ClockLogService {
027            /**
028             * Save clock log 
029             * @param clockLog
030             */
031        public void saveClockLog(ClockLog clockLog);
032        /**
033         * Fetch last clock log for principal id
034         * @param principalId
035         * @return
036         */
037        public ClockLog getLastClockLog(String principalId);
038        
039        /**
040         * Fetch last clock log for principal id and clock action
041         * @param principalId
042         * @param clockAction
043         * @return
044         */
045        public ClockLog getLastClockLog(String principalId, String clockAction);
046        /**
047         * Build ClockLog based on criteria passed in
048         * @param clockTimestamp  -- timestamp with grace rule applied if there is one
049         * @param originalTimestamp  -- timestamp without grace rule applied
050         * @param assignment
051         * @param timesheetDocument
052         * @param clockAction
053         * @param ip
054         * @return
055         */
056            public ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip);
057            
058            /**
059             * Fetch open clock logs by pay calendar entry
060             * @param payCalendarEntry
061             * @return
062             */
063            public List<ClockLog> getOpenClockLogs(CalendarEntries payCalendarEntry);
064    
065            /**
066             * Process clock log created
067             * @param clockTimestamp
068             * @param assignment
069             * @param pe
070             * @param ip
071             * @param asOfDate
072             * @param td
073             * @param clockAction
074             * @param principalId
075             * @return
076             */
077        ClockLog processClockLog(Timestamp clockTimestamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId);
078        
079        /**
080         * Fetch clock log by id
081         * @param tkClockLogId
082         * @return
083         */
084        public ClockLog getClockLog(String tkClockLogId);
085    
086        ClockLog buildClockLog(Timestamp clockTimestamp, Timestamp originalTimestamp, Assignment assignment, TimesheetDocument timesheetDocument, String clockAction, String ip, String userPrincipalId);
087    
088        ClockLog processClockLog(Timestamp clockTimeStamp, Assignment assignment, CalendarEntries pe, String ip, java.sql.Date asOfDate, TimesheetDocument td, String clockAction, String principalId, String userPrincipalId);
089    }