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.timesheet.service; 017 018 import java.util.Date; 019 import java.util.List; 020 021 import org.kuali.hr.time.calendar.CalendarEntries; 022 import org.kuali.hr.time.timeblock.TimeBlock; 023 import org.kuali.hr.time.timesheet.TimesheetDocument; 024 import org.kuali.rice.kew.api.exception.WorkflowException; 025 026 public interface TimesheetService { 027 028 /** 029 * Opens the timesheet document for the user at the given payEndDate provided. 030 * If the timesheet does not exist, it is created. 031 * @param principalId 032 * @return 033 */ 034 public TimesheetDocument openTimesheetDocument(String principalId, CalendarEntries payCalendarDates) throws WorkflowException; 035 /** 036 * Route the given timesheet 037 * @param principalId 038 * @param timesheetDocument 039 */ 040 public void routeTimesheet(String principalId, TimesheetDocument timesheetDocument); 041 042 public void approveTimesheet(String principalId, TimesheetDocument timesheetDocument); 043 044 public void disapproveTimesheet(String principalId, TimesheetDocument timesheetDocument); 045 046 /** 047 * For a given document ID, return a fully populated time sheet document. 048 * 049 * Fully populated means: TimeBlocks, Jobs, Assignments 050 * 051 * @param documentId 052 * @return 053 */ 054 public TimesheetDocument getTimesheetDocument(String documentId); 055 /** 056 * Is user a Clock in/out person or do they manually enter TimeBlocks 057 * @return 058 */ 059 public boolean isSynchronousUser(); 060 /** 061 * Fetch TimeBlocks for previous pay periods 062 * @param principalId 063 * @param payBeginDate 064 * @return 065 */ 066 public List<TimeBlock> getPrevDocumentTimeBlocks(String principalId, Date payBeginDate); 067 /** 068 * Load holidays on given timesheet 069 * @param timesheetDocument 070 * @param principalId 071 * @param beginDate 072 * @param endDate 073 */ 074 public void loadHolidaysOnTimesheet(TimesheetDocument timesheetDocument, String principalId, Date beginDate, Date endDate); 075 /** 076 * Delete a timesheet(used for testing only) 077 * @param documentId 078 */ 079 public void deleteTimesheet(String documentId); 080 081 public void resetTimeBlock(List<TimeBlock> timeBlock); 082 083 void approveTimesheet(String principalId, TimesheetDocument timesheetDocument, String action); 084 085 void routeTimesheet(String action, String principalId, TimesheetDocument timesheetDocument); 086 }