1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.tklm.api.leave.block;
17
18 import org.joda.time.DateTime;
19 import org.joda.time.LocalDate;
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 java.math.BigDecimal;
28 import java.util.List;
29 import java.util.Map;
30
31 public interface LeaveBlockService {
32 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlock}' + 'leaveBlockId=' + #p0")
33 public LeaveBlock getLeaveBlock(String leaveBlockId);
34
35 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocksForDocumentId}' + 'documentId=' + #p0")
36 public List<LeaveBlock> getLeaveBlocksForDocumentId(String documentId);
37
38 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocks}' + 'principalId=' + #p0 + '|' + 'beginDate=' + #p1 + '|' + 'endDate=' + #p2")
39 public List<LeaveBlock> getLeaveBlocks(String principalId, LocalDate beginDate, LocalDate endDate);
40
41 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocksWithType}' + 'principalId=' + #p0 + '|' + 'beginDate=' + #p1 + '|' + 'endDate=' + #p2 + '|' + 'leaveBlockType=' + #p3")
42 public List<LeaveBlock> getLeaveBlocksWithType(String principalId, LocalDate beginDate, LocalDate endDate, String leaveBlockType);
43
44 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocksWithAccrualCategory}' + 'principalId=' + #p0 + '|' + 'beginDate=' + #p1 + '|' + 'endDate=' + #p2 + '|' + 'accrualCategory=' + #p3")
45 public List<LeaveBlock> getLeaveBlocksWithAccrualCategory(String principalId, LocalDate beginDate, LocalDate endDate, String accrualCategory);
46
47 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocksSinceCarryOver}' + 'principalId=' + #p0 + '|' + 'carryOverBlocks=' + #p1 + '|' + 'endDate=' + #p2 + '|' + 'includeAllAccrualCategories=' + #p3")
48 public List<LeaveBlock> getLeaveBlocksSinceCarryOver(String principalId, Map<String, LeaveBlock> carryOverBlocks, LocalDate endDate, boolean includeAllAccrualCategories);
49
50 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLastCarryOverBlocks}' + 'principalId=' + #p0 + '|' + 'asOfDate=' + #p1")
51 public Map<String, LeaveBlock> getLastCarryOverBlocks(String principalId, LocalDate asOfDate);
52
53 @CacheEvict(value={LeaveBlock.CACHE_NAME}, allEntries = true)
54 public List<LeaveBlock> saveLeaveBlocks(List<LeaveBlock> leaveBlocks);
55
56
57 @CacheEvict(value={LeaveBlock.CACHE_NAME}, allEntries = true)
58 @Caching(evict = {
59 @CacheEvict(value={LeaveBlock.CACHE_NAME}, allEntries = true),
60 @CacheEvict(value={CalendarBlockPermissions.CACHE_NAME}, key="#p0.blockId")
61 })
62 public LeaveBlock saveLeaveBlock(LeaveBlock leaveBlock, String principalId);
63
64
65
66
67
68
69 @Caching(evict = {
70 @CacheEvict(value={LeaveBlock.CACHE_NAME}, allEntries = true),
71 @CacheEvict(value={CalendarBlockPermissions.CACHE_NAME}, key="'{leave}' + #p0")
72 })
73 public void deleteLeaveBlock(String leaveBlockId, String principalId);
74
75
76 @CacheEvict(value={LeaveBlock.CACHE_NAME}, allEntries = true)
77 public List<LeaveBlock> addLeaveBlocks(DateTime beginDate, DateTime endDate, CalendarEntry ce, String selectedEarnCode,
78 BigDecimal hours, String description, Assignment selectedAssignment, String spanningWeeks, String leaveBlockType, String principalId);
79
80 @Caching(evict = {
81 @CacheEvict(value={LeaveBlock.CACHE_NAME}, allEntries = true),
82 @CacheEvict(value={CalendarBlockPermissions.CACHE_NAME}, key="#p0.getLmLeaveBlockId()")
83 })
84 public void updateLeaveBlock(LeaveBlock leaveBlock, String principalId);
85
86
87
88
89
90
91
92
93 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocks}' + 'principalId=' + #p0 + '|' + 'leaveBlocktype=' + #p1 + '|' + 'requestStatus=' + #p2 + '|' + 'currentDate=' + #p3")
94 public List<LeaveBlock> getLeaveBlocks(String principalId, String leaveBlockType, String requestStatus, LocalDate currentDate);
95
96
97
98
99
100
101
102
103
104
105 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocks}' + 'principalId=' + #p0 + '|' + 'leaveBlocktype=' + #p1 + '|' + 'requestStatus=' + #p2 + '|' + 'beginDate=' + #p3 + '|' + 'endDate=' + #p4")
106 public List<LeaveBlock> getLeaveBlocks(String principalId, String leaveBlockType, String requestStatus, LocalDate beginDate, LocalDate endDate);
107
108
109
110
111
112
113
114 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocksForDate}' + 'principalId=' + #p0 + '|' + 'leaveDate=' + #p1")
115 public List<LeaveBlock> getLeaveBlocksForDate(String principalId, LocalDate leaveDate);
116
117
118
119
120
121
122 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getNotAccrualGeneratedLeaveBlocksForDate}' + 'principalId=' + #p0 + '|' + 'leaveDate=' + #p1")
123 public List<LeaveBlock> getNotAccrualGeneratedLeaveBlocksForDate(String principalId, LocalDate leaveDate);
124
125
126
127
128
129
130
131
132
133
134 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocksForTimeCalendar}' + 'principalId=' + #p0 + '|' + 'beginDate=' + #p1 + '|' + 'endDate=' + #p2 + '|' + 'assignmentKeys=' + #p3")
135 public List<LeaveBlock> getLeaveBlocksForTimeCalendar(String principalId, LocalDate beginDate, LocalDate endDate, List<String> assignmentKeys);
136
137
138
139
140
141
142
143
144
145 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getLeaveBlocksForLeaveCalendar}' + 'principalId=' + #p0 + '|' + 'beginDate=' + #p1 + '|' + 'endDate=' + #p2 + '|' + 'assignmentKeys=' + #p3")
146 public List<LeaveBlock> getLeaveBlocksForLeaveCalendar(String principalId, LocalDate beginDate, LocalDate endDate, List<String> assignmentKeys);
147
148
149
150
151
152
153
154 public List<LeaveBlock> filterLeaveBlocksForTimeCalendar(List<LeaveBlock> lbs, List<String> assignmentKeys);
155
156
157
158
159
160
161 public List<LeaveBlock> filterLeaveBlocksForLeaveCalendar(List<LeaveBlock> lbs, List<String> assignmentKeys);
162
163
164
165
166 public void deleteLeaveBlocksForDocumentId(String documentId);
167
168
169
170
171
172
173
174
175 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getAccrualGeneratedLeaveBlocks}' + 'principalId=' + #p0 + '|' + 'beginDate=' + #p1 + '|' + 'endDate=' + #p2")
176 public List<LeaveBlock> getAccrualGeneratedLeaveBlocks(String principalId, LocalDate beginDate, LocalDate endDate);
177
178
179
180
181
182
183
184
185 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getSSTOLeaveBlocks}' + 'principalId=' + #p0 + '|' + 'sstoId=' + #p1 + '|' + 'accruleDate=' + #p2")
186 public List<LeaveBlock> getSSTOLeaveBlocks(String principalId, String sstoId, LocalDate accruledDate);
187
188
189
190
191
192
193
194
195 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getABELeaveBlocksSinceTime}' + 'principalId=' + #p0 + '|' + 'lastRanTime=' + #p1")
196 public List<LeaveBlock> getABELeaveBlocksSinceTime(String principalId, DateTime lastRanDateTime);
197
198
199
200
201
202
203
204
205
206
207
208 @Cacheable(value= LeaveBlock.CACHE_NAME, key="'{getTimeCalendarLeaveBlocksForTimeBlockLookup}' + 'principalId=' + #p0 + '|' + 'lastRanTime=' + #p1")
209 public List<LeaveBlock> getTimeCalendarLeaveBlocksForTimeBlockLookup(
210 String documentId, String principalId, String userPrincipalId,
211 LocalDate fromDate, LocalDate toDate);
212
213
214
215
216
217
218
219
220
221
222
223
224
225 public List<LeaveBlock> getLeaveBlocksForLookup(
226 String documentId, String principalId, String userPrincipalId,
227 LocalDate fromDate, LocalDate toDate, String leaveBlockType);
228 }