1 /**
2 * Copyright 2004-2012 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.hr.time.timesheet.service;
17
18 import java.util.Date;
19 import java.util.List;
20
21 import org.kuali.hr.time.calendar.CalendarEntries;
22 import org.kuali.hr.time.timeblock.TimeBlock;
23 import org.kuali.hr.time.timesheet.TimesheetDocument;
24 import org.kuali.rice.kew.api.exception.WorkflowException;
25
26 public interface TimesheetService {
27
28 /**
29 * Opens the timesheet document for the user at the given payEndDate provided.
30 * If the timesheet does not exist, it is created.
31 * @param principalId
32 * @return
33 */
34 public TimesheetDocument openTimesheetDocument(String principalId, CalendarEntries payCalendarDates) throws WorkflowException;
35 /**
36 * Route the given timesheet
37 * @param principalId
38 * @param timesheetDocument
39 */
40 public void routeTimesheet(String principalId, TimesheetDocument timesheetDocument);
41
42 public void approveTimesheet(String principalId, TimesheetDocument timesheetDocument);
43
44 public void disapproveTimesheet(String principalId, TimesheetDocument timesheetDocument);
45
46 /**
47 * For a given document ID, return a fully populated time sheet document.
48 *
49 * Fully populated means: TimeBlocks, Jobs, Assignments
50 *
51 * @param documentId
52 * @return
53 */
54 public TimesheetDocument getTimesheetDocument(String documentId);
55 /**
56 * Is user a Clock in/out person or do they manually enter TimeBlocks
57 * @return
58 */
59 public boolean isSynchronousUser();
60 /**
61 * Fetch TimeBlocks for previous pay periods
62 * @param principalId
63 * @param payBeginDate
64 * @return
65 */
66 public List<TimeBlock> getPrevDocumentTimeBlocks(String principalId, Date payBeginDate);
67 /**
68 * Load holidays on given timesheet
69 * @param timesheetDocument
70 * @param principalId
71 * @param beginDate
72 * @param endDate
73 */
74 public void loadHolidaysOnTimesheet(TimesheetDocument timesheetDocument, String principalId, Date beginDate, Date endDate);
75 /**
76 * Delete a timesheet(used for testing only)
77 * @param documentId
78 */
79 public void deleteTimesheet(String documentId);
80
81 public void resetTimeBlock(List<TimeBlock> timeBlock);
82
83 void approveTimesheet(String principalId, TimesheetDocument timesheetDocument, String action);
84
85 void routeTimesheet(String action, String principalId, TimesheetDocument timesheetDocument);
86 }