1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.api.time.timeblock;
17
18 import org.joda.time.DateTime;
19 import org.joda.time.Interval;
20 import org.kuali.kpme.core.api.assignment.Assignment;
21 import org.kuali.kpme.core.api.block.CalendarBlockPermissions;
22 import org.kuali.kpme.core.api.calendar.entry.CalendarEntry;
23 import org.springframework.cache.annotation.CacheEvict;
24 import org.springframework.cache.annotation.Cacheable;
25 import org.springframework.cache.annotation.Caching;
26
27 import javax.jws.WebMethod;
28 import javax.jws.WebResult;
29 import javax.xml.bind.annotation.XmlElement;
30 import javax.xml.bind.annotation.XmlElementWrapper;
31 import java.math.BigDecimal;
32 import java.util.List;
33
34
35
36 public interface TimeBlockService {
37
38
39
40
41
42
43
44 @Cacheable(value= TimeBlock.CACHE_NAME, key="'{getTimeBlock}' + 'timeBlockId=' + #p0")
45 public TimeBlock getTimeBlock(String timeBlockId);
46
47
48
49
50
51
52 @Caching(evict = {
53 @CacheEvict(value={TimeBlock.CACHE_NAME}, allEntries = true),
54 @CacheEvict(value={CalendarBlockPermissions.CACHE_NAME}, key="'{time}' + #p0.tkTimeBlockId")
55 })
56 public void deleteTimeBlock(TimeBlock timeBlock);
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77 @WebResult(name = "timeBlocks")
78 public List<TimeBlock> buildTimeBlocks(String principalId, CalendarEntry calendarEntry, Assignment assignment, String earnCode, String documentId,
79 DateTime beginDateTime, DateTime endDateTime, BigDecimal hours, BigDecimal amount,
80 Boolean getClockLogCreated, Boolean getLunchDeleted, String userPrincipalId,
81 String clockLogBeginId, String clockLogEndId);
82
83
84
85
86
87
88
89
90
91
92 @Caching(evict = {
93 @CacheEvict(value={TimeBlock.CACHE_NAME}, allEntries = true)
94 })
95 public List<TimeBlock> saveOrUpdateTimeBlocks(List<TimeBlock> oldTimeBlocks, List<TimeBlock> newTimeBlocks, String userPrincipalId);
96
97
98
99
100
101 @WebMethod(operationName = "saveTimeBlocks")
102 @XmlElementWrapper(name = "timeBlocks", required = true)
103 @XmlElement(name = "timeBlock", required = false)
104 @WebResult(name = "timeBlocks")
105 @Caching(evict = {
106 @CacheEvict(value={TimeBlock.CACHE_NAME}, allEntries = true)
107 })
108 public List<TimeBlock> saveTimeBlocks(List<TimeBlock> tbList);
109
110 void deleteTimeBlockAndHandleMissedPunch(TimeBlock timeBlock, boolean ignoreMissedPunch);
111
112
113
114
115
116
117
118
119
120 public List<TimeBlock> resetTimeHourDetail(List<TimeBlock> origTimeBlocks);
121
122
123
124
125
126
127
128
129
130
131 @Cacheable(value= TimeBlock.CACHE_NAME, key="'{getTimeBlocks}' + 'documentId=' + #p0")
132 public List<TimeBlock> getTimeBlocks(String documentId);
133
134 @Cacheable(value= TimeBlock.CACHE_NAME, key="'{getTimeBlocksWithMissedPunchInfo}' + 'documentId=' + #p0")
135 public List<TimeBlock> getTimeBlocksWithMissedPunchInfo(String documentId);
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156 public List<TimeBlock> buildTimeBlocksSpanDates(String principalId, CalendarEntry calendarEntry, Assignment assignment, String earnCode,
157 String documentId, DateTime beginDateTime, DateTime endDateTime, BigDecimal hours, BigDecimal amount,
158 Boolean clockLogCreated, Boolean lunchDeleted, String userPrincipalId,
159 String clockLogBeginId, String clockLogEndId);
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176 public TimeBlock createTimeBlock(String principalId, String documentId, DateTime beginDateTime, DateTime endDateTime,
177 Assignment assignment, String earnCode, BigDecimal hours, BigDecimal amount,
178 Boolean clockLogCreated, Boolean lunchDeleted, String userPrincipalId);
179
180
181 @Caching(evict = {
182 @CacheEvict(value={TimeBlock.CACHE_NAME}, allEntries = true),
183 @CacheEvict(value={CalendarBlockPermissions.CACHE_NAME}, allEntries = true)
184 })
185 public void deleteTimeBlocksAssociatedWithDocumentId(String documentId);
186
187
188
189 public Boolean getTimeBlockEditable(TimeBlock tb);
190
191
192
193
194
195
196
197
198
199
200 @Cacheable(value= TimeBlock.CACHE_NAME, key="'{getTimeBlocksForClockLogEndId}' + 'tkClockLogId=' + #p0")
201 public List<TimeBlock> getTimeBlocksForClockLogEndId(String tkClockLogId);
202
203
204
205
206
207
208
209
210
211
212 @Cacheable(value= TimeBlock.CACHE_NAME, key="'{getTimeBlocksForClockLogBeginId}' + 'tkClockLogId=' + #p0")
213 public List<TimeBlock> getTimeBlocksForClockLogBeginId(String tkClockLogId);
214
215
216
217
218
219 @Cacheable(value= TimeBlock.CACHE_NAME, key="'{getLatestEndTimestampForEarnCode}' + 'earnCode=' + #p0")
220 public List<TimeBlock> getLatestEndTimestampForEarnCode(String earnCode);
221
222
223
224
225
226
227
228
229
230
231 @Cacheable(value= TimeBlock.CACHE_NAME, key="'{getOvernightTimeBlocks}' + 'clockLogEndId=' + #p0")
232 public List<TimeBlock> getOvernightTimeBlocks(String clockLogEndId);
233
234
235
236 @Cacheable(value= TimeBlock.CACHE_NAME, key="'{isOvernightTimeBlock}' + 'clockLogEndId=' + #p0")
237 public boolean isOvernightTimeBlock(String clockLogEndId);
238
239
240
241 @Caching(evict = {
242 @CacheEvict(value={TimeBlock.CACHE_NAME}, allEntries = true),
243 @CacheEvict(value={CalendarBlockPermissions.CACHE_NAME}, key="'{time}' + #p0.tkTimeBlockId")
244 })
245 public TimeBlock updateTimeBlock(TimeBlock tb);
246
247
248 @Caching(evict = {
249 @CacheEvict(value={TimeBlock.CACHE_NAME}, allEntries = true)
250 })
251 void deleteLunchDeduction(String tkTimeHourDetailId);
252
253
254
255
256
257 public List<TimeBlock> applyHolidayPremiumEarnCode(String principalId, List<Assignment> timeAssignments, List<TimeBlock> appliedTimeBlocks);
258
259
260 public List<TimeBlock> getIntersectingTimeBlocks(String principalId, DateTime startTime, DateTime endTime);
261 }