View Javadoc

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.timeblock.service;
17  
18  import org.kuali.hr.time.assignment.Assignment;
19  import org.kuali.hr.time.timeblock.TimeBlock;
20  import org.kuali.hr.time.timeblock.TimeBlockHistory;
21  import org.kuali.hr.time.timesheet.TimesheetDocument;
22  
23  import java.math.BigDecimal;
24  import java.sql.Date;
25  import java.sql.Timestamp;
26  import java.util.List;
27  
28  public interface TimeBlockService {
29  	/**
30  	 * Fetch a TimeBlock by a given ID
31  	 * @param timeBlockId
32  	 * @return
33  	 */
34  	public TimeBlock getTimeBlock(String timeBlockId);
35  
36  	/**
37  	 * Delete a given TimeBlock
38  	 * @param timeBlock
39  	 */
40  	public void deleteTimeBlock(TimeBlock timeBlock);
41  	/**
42  	 * Build a TimeBlock with the given criteria
43  	 * @param assignment
44  	 * @param earnCode
45  	 * @param timesheetDocument
46  	 * @param beginTimestamp
47  	 * @param endTimestamp
48  	 * @param hours
49       * @param amount
50  	 * @param isClockLogCreated
51       * @param isLunchDeleted
52  	 * @return
53  	 */
54  	public List<TimeBlock> buildTimeBlocks(Assignment assignment, String earnCode, TimesheetDocument timesheetDocument,
55  											Timestamp beginTimestamp, Timestamp endTimestamp, BigDecimal hours, BigDecimal amount,
56                                              Boolean isClockLogCreated, Boolean isLunchDeleted);
57  	/**
58  	 * Save a list of new TimeBlocks
59  	 * does a comparison for the old versus the new and only saves changed/new/deleted TimeBlocks
60  	 * @param oldTimeBlocks
61  	 * @param newTimeBlocks
62  	 */
63  	public void saveTimeBlocks(List<TimeBlock> oldTimeBlocks, List<TimeBlock> newTimeBlocks);
64  
65  	/**
66  	 * Save a list of new TimeBlocks
67  	 * @param tbList
68  	 */
69  	public void saveTimeBlocks(List<TimeBlock> tbList);
70  	/**
71  	 * Reset the TimeHourDetail object associated with the TimeBlock object on a List of TimeBlocks
72  	 * @param origTimeBlocks
73  	 */
74  	public void resetTimeHourDetail(List<TimeBlock> origTimeBlocks);
75  	/**
76  	 * Get the List of TimeBlock of a given document id
77  	 * @param documentId
78  	 * @return
79  	 */
80  	public List<TimeBlock> getTimeBlocks(String documentId);	
81  	/**
82  	 * Get the List of TimeBlock of a given Assignment
83  	 * @param assign
84  	 * @return List<TimeBlock>
85  	 */
86  	 public List<TimeBlock> getTimeBlocksForAssignment(Assignment assign);
87  	/**
88  	 * Build a List of TimeBlocks over a span of multiple days
89  	 * @param assignment
90  	 * @param earnCode
91  	 * @param timesheetDocument
92  	 * @param beginTimestamp
93  	 * @param endTimestamp
94  	 * @param hours
95       * @param amount
96  	 * @param isClockLogCreated
97       * @param isLunchDeleted
98       * @param spanningWeeks
99  	 * @return
100 	 */
101 	public List<TimeBlock> buildTimeBlocksSpanDates(Assignment assignment, String earnCode, TimesheetDocument timesheetDocument,
102 												Timestamp beginTimestamp, Timestamp endTimestamp, BigDecimal hours, BigDecimal amount,
103                                                 Boolean isClockLogCreated, Boolean isLunchDeleted, String spanningWeeks);
104 	/**
105 	 * Create a TimeBlock for the given criteria
106 	 * @param timesheetDocument
107 	 * @param beginTime
108 	 * @param endTime
109 	 * @param assignment
110 	 * @param earnCode
111 	 * @param hours
112      * @param amount
113 	 * @param isClockLogCreated
114 	 * @param isLunchDeleted
115 	 * @return
116 	 */
117 	public TimeBlock createTimeBlock(TimesheetDocument timesheetDocument, Timestamp beginTime, Timestamp endTime,
118 										Assignment assignment, String earnCode, BigDecimal hours, BigDecimal amount,
119                                         Boolean isClockLogCreated, Boolean isLunchDeleted);
120 
121 	public void deleteTimeBlocksAssociatedWithDocumentId(String documentId);
122 
123 	public Boolean isTimeBlockEditable(TimeBlock tb);
124 	
125 	/*
126 	 * Get all the time blocks with the given Clock Log id as the clockLogEndId
127 	 * @param tkClockLogId
128 	 * @return List<TimeBlock>	 * 
129 	 */
130 	public List<TimeBlock> getTimeBlocksForClockLogEndId(String tkClockLogId);
131 	/*
132 	 * Get all the time blocks with the given Clock Log id as the clockLogBeginId
133 	 * @param tkClockLogId
134 	 * @return List<TimeBlock>	 * 
135 	 */
136 	public List<TimeBlock> getTimeBlocksForClockLogBeginId(String tkClockLogId);
137 	
138 	public List<TimeBlock> getTimeBlocks();
139 	public List<TimeBlock> getLatestEndTimestamp();
140 
141     /**
142      * Get overnight timeblocks by the clock log begin id
143      * @param clockLogEndId
144      * @return
145      */
146     public List<TimeBlock> getOvernightTimeBlocks(String clockLogEndId);
147 
148 	public void updateTimeBlock(TimeBlock tb);
149 	
150 	public List<TimeBlockHistory> createTimeBlockHistories(TimeBlock tb, String actionHistory);
151 
152     void deleteLunchDeduction(String tkTimeHourDetailId);
153 	/*
154 	 * Get all the active time blocks with the given earn code and effectiveDate
155 	 * @param earnCode
156 	 * @param effDate
157 	 * @return List<TimeBlock>	 * 
158 	 */
159     public List<TimeBlock> getTimeBlocksWithEarnCode(String earnCode, Date effDate);
160 }