1 Package body ben_ecv_del as
2 /* $Header: beecvrhi.pkb 120.1 2005/07/29 09:50:17 rbingi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ecv_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< dt_delete_dml >-----------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- This procedure controls the actual dml delete logic for the datetrack
17 -- delete modes: ZAP, DELETE, FUTURE_CHANGE and DELETE_NEXT_CHANGE. The
18 -- execution is as follows:
19 -- 1) To set and unset the g_api_dml status as required (as we are about to
20 -- perform dml).
21 -- 2) If the delete mode is DELETE_NEXT_CHANGE then delete where the
22 -- effective start date is equal to the validation start date.
23 -- 3) If the delete mode is not DELETE_NEXT_CHANGE then delete
24 -- all rows for the entity where the effective start date is greater
25 -- than or equal to the validation start date.
26 -- 4) To raise any errors.
27 --
28 -- Prerequisites:
29 -- This is an internal private procedure which must be called from the
30 -- delete_dml procedure.
31 --
32 -- In Parameters:
33 -- A Pl/Sql record structre.
34 --
35 -- Post Success:
36 -- The specified row will be delete from the schema.
37 --
38 -- Post Failure:
39 -- On the delete dml failure it is important to note that we always reset the
40 -- g_api_dml status to false.
41 -- If any other error is reported, the error will be raised after the
42 -- g_api_dml status is reset.
43 --
44 -- Developer Implementation Notes:
45 -- This is an internal private procedure which must be called from the
46 -- delete_dml procedure.
47 --
48 -- Access Status:
49 -- Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure dt_delete_dml
54 (p_rec in out nocopy ben_ecv_shd.g_rec_type,
55 p_effective_date in date,
56 p_datetrack_mode in varchar2,
57 p_validation_start_date in date,
58 p_validation_end_date in date) is
59 --
60 l_proc varchar2(72) := g_package||'dt_delete_dml';
61 --
62 Begin
63 hr_utility.set_location('Entering:'||l_proc, 5);
64 If (p_datetrack_mode = 'DELETE_NEXT_CHANGE') then
65 hr_utility.set_location(l_proc, 10);
66 ben_ecv_shd.g_api_dml := true; -- Set the api dml status
67 --
68 -- Delete the where the effective start date is equal
69 -- to the validation end date.
70 --
71 delete from ben_eligy_crit_values_f
72 where eligy_crit_values_id = p_rec.eligy_crit_values_id
73 and effective_start_date = p_validation_start_date;
74 --
75 ben_ecv_shd.g_api_dml := false; -- Unset the api dml status
76 Else
77 hr_utility.set_location(l_proc, 15);
78 ben_ecv_shd.g_api_dml := true; -- Set the api dml status
79 --
80 -- Delete the row(s) where the effective start date is greater than
81 -- or equal to the validation start date.
82 --
83 delete from ben_eligy_crit_values_f
84 where eligy_crit_values_id = p_rec.eligy_crit_values_id
85 and effective_start_date >= p_validation_start_date;
86 --
87 ben_ecv_shd.g_api_dml := false; -- Unset the api dml status
88 End If;
89 --
90 hr_utility.set_location(' Leaving:'||l_proc, 20);
91 --
92 Exception
93 When Others Then
94 ben_ecv_shd.g_api_dml := false; -- Unset the api dml status
95 Raise;
96 end dt_delete_dml;
97 --
98 --
99 -- ----------------------------------------------------------------------------
100 -- |------------------------------< delete_dml >------------------------------|
101 -- ----------------------------------------------------------------------------
102 Procedure delete_dml
103 (p_rec in out nocopy ben_ecv_shd.g_rec_type,
104 p_effective_date in date,
105 p_datetrack_mode in varchar2,
106 p_validation_start_date in date,
107 p_validation_end_date in date) is
108 --
109 l_proc varchar2(72) := g_package||'delete_dml';
110 --
111 Begin
112 hr_utility.set_location('Entering:'||l_proc, 5);
113 --
114 dt_delete_dml(p_rec => p_rec,
115 p_effective_date => p_effective_date,
116 p_datetrack_mode => p_datetrack_mode,
117 p_validation_start_date => p_validation_start_date,
118 p_validation_end_date => p_validation_end_date);
119 --
120 hr_utility.set_location(' Leaving:'||l_proc, 10);
121 end delete_dml;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |----------------------------< dt_pre_delete >-----------------------------|
125 -- ----------------------------------------------------------------------------
126 -- {Start Of Comments}
127 --
128 -- Description:
129 -- The dt_pre_delete process controls the execution of dml
130 -- for the datetrack modes: DELETE, FUTURE_CHANGE
131 -- and DELETE_NEXT_CHANGE only.
132 --
133 -- Prerequisites:
134 -- This is an internal procedure which is called from the pre_delete
135 -- procedure.
136 --
137 -- In Parameters:
138 -- A Pl/Sql record structre.
139 --
140 -- Post Success:
141 -- Processing continues.
142 --
143 -- Post Failure:
144 -- If an error has occurred, an error message and exception will be raised
145 -- but not handled.
146 --
147 -- Developer Implementation Notes:
148 -- This is an internal procedure which is required by Datetrack. Don't
149 -- remove or modify.
150 --
151 -- Access Status:
152 -- Internal Row Handler Use Only.
153 --
154 -- {End Of Comments}
155 -- ----------------------------------------------------------------------------
156 Procedure dt_pre_delete
157 (p_rec in out nocopy ben_ecv_shd.g_rec_type,
158 p_effective_date in date,
159 p_datetrack_mode in varchar2,
160 p_validation_start_date in date,
161 p_validation_end_date in date) is
162 --
163 l_proc varchar2(72) := g_package||'dt_pre_delete';
164 --
165 Begin
166 hr_utility.set_location('Entering:'||l_proc, 5);
167 --
168 If (p_datetrack_mode <> 'ZAP') then
169 --
170 p_rec.effective_start_date := ben_ecv_shd.g_old_rec.effective_start_date;
171 --
172 If (p_datetrack_mode = 'DELETE') then
173 p_rec.effective_end_date := p_validation_start_date - 1;
174 Else
175 p_rec.effective_end_date := p_validation_end_date;
176 End If;
177 --
178 -- Update the current effective end date record
179 --
180 ben_ecv_shd.upd_effective_end_date
181 (p_effective_date => p_effective_date,
182 p_base_key_value => p_rec.eligy_crit_values_id,
183 p_new_effective_end_date => p_rec.effective_end_date,
184 p_validation_start_date => p_validation_start_date,
185 p_validation_end_date => p_validation_end_date,
186 p_object_version_number => p_rec.object_version_number);
187 Else
188 p_rec.effective_start_date := null;
189 p_rec.effective_end_date := null;
190 End If;
191 hr_utility.set_location(' Leaving:'||l_proc, 10);
192 End dt_pre_delete;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |------------------------------< pre_delete >------------------------------|
196 -- ----------------------------------------------------------------------------
197 -- {Start Of Comments}
198 --
199 -- Description:
200 -- This private procedure contains any processing which is required before
201 -- the delete dml.
202 --
203 -- Prerequisites:
204 -- This is an internal procedure which is called from the del procedure.
205 --
206 -- In Parameters:
207 -- A Pl/Sql record structre.
208 --
209 -- Post Success:
210 -- Processing continues.
211 --
212 -- Post Failure:
213 -- If an error has occurred, an error message and exception will be raised
214 -- but not handled.
215 --
216 -- Developer Implementation Notes:
217 -- Any pre-processing required before the delete dml is issued should be
218 -- coded within this procedure. It is important to note that any 3rd party
219 -- maintenance should be reviewed before placing in this procedure. The call
220 -- to the dt_delete_dml procedure should NOT be removed.
221 --
222 -- Access Status:
223 -- Internal Row Handler Use Only.
224 --
225 -- {End Of Comments}
226 -- ----------------------------------------------------------------------------
227 Procedure pre_delete
228 (p_rec in out nocopy ben_ecv_shd.g_rec_type,
229 p_effective_date in date,
230 p_datetrack_mode in varchar2,
231 p_validation_start_date in date,
232 p_validation_end_date in date) is
233 --
234 l_proc varchar2(72) := g_package||'pre_delete';
235 --
236 Begin
237 hr_utility.set_location('Entering:'||l_proc, 5);
238 --
239 --
240 --
241 dt_pre_delete
242 (p_rec => p_rec,
243 p_effective_date => p_effective_date,
244 p_datetrack_mode => p_datetrack_mode,
245 p_validation_start_date => p_validation_start_date,
246 p_validation_end_date => p_validation_end_date);
247 --
248 hr_utility.set_location(' Leaving:'||l_proc, 10);
249 End pre_delete;
250 --
251 -- ----------------------------------------------------------------------------
252 -- |-----------------------------< post_delete >------------------------------|
253 -- ----------------------------------------------------------------------------
254 -- {Start Of Comments}
255 --
256 -- Description:
257 -- This private procedure contains any processing which is required after the
258 -- delete dml.
259 --
260 -- Prerequisites:
261 -- This is an internal procedure which is called from the del procedure.
262 --
263 -- In Parameters:
264 -- A Pl/Sql record structre.
265 --
266 -- Post Success:
267 -- Processing continues.
268 --
269 -- Post Failure:
270 -- If an error has occurred, an error message and exception will be raised
271 -- but not handled.
272 --
273 -- Developer Implementation Notes:
274 -- Any post-processing required after the delete dml is issued should be
275 -- coded within this procedure. It is important to note that any 3rd party
276 -- maintenance should be reviewed before placing in this procedure.
277 --
278 -- Access Status:
279 -- Internal Row Handler Use Only.
280 --
281 -- {End Of Comments}
282 -- ----------------------------------------------------------------------------
283 Procedure post_delete
284 (p_rec in ben_ecv_shd.g_rec_type,
285 p_effective_date in date,
286 p_datetrack_mode in varchar2,
287 p_validation_start_date in date,
288 p_validation_end_date in date) is
289 --
290 l_proc varchar2(72) := g_package||'post_delete';
291 --
292 Begin
293 hr_utility.set_location('Entering:'||l_proc, 5);
294 --
295 --
296 -- Start of API User Hook for post_delete.
297 --
298 begin
299 --
300 ben_ecv_rkd.after_delete
301 (
302 p_eligy_crit_values_id => p_rec.eligy_crit_values_id
303 ,p_effective_start_date => p_rec.effective_start_date
304 ,p_effective_end_date => p_rec.effective_end_date
305 ,p_datetrack_mode =>p_datetrack_mode
306 ,p_validation_start_date =>p_validation_start_date
307 ,p_validation_end_date =>p_validation_end_date
308 ,p_eligy_prfl_id_o =>ben_ecv_shd.g_old_rec.eligy_prfl_id
309 ,p_eligy_criteria_id_o =>ben_ecv_shd.g_old_rec.eligy_criteria_id
310 ,p_effective_start_date_o =>ben_ecv_shd.g_old_rec.effective_start_date
311 ,p_effective_end_date_o =>ben_ecv_shd.g_old_rec.effective_end_date
312 ,p_ordr_num_o =>ben_ecv_shd.g_old_rec.ordr_num
313 ,p_number_value1_o =>ben_ecv_shd.g_old_rec.number_value1
314 ,p_number_value2_o =>ben_ecv_shd.g_old_rec.number_value2
315 ,p_char_value1_o =>ben_ecv_shd.g_old_rec.char_value1
316 ,p_char_value2_o =>ben_ecv_shd.g_old_rec.char_value2
317 ,p_date_value1_o =>ben_ecv_shd.g_old_rec.date_value1
318 ,p_date_value2_o =>ben_ecv_shd.g_old_rec.date_value2
319 ,p_excld_flag_o =>ben_ecv_shd.g_old_rec.excld_flag
320 ,p_business_group_id_o =>ben_ecv_shd.g_old_rec.business_group_id
321 ,p_legislation_code_o =>ben_ecv_shd.g_old_rec.legislation_code
322 ,p_ecv_attribute_category_o =>ben_ecv_shd.g_old_rec.ecv_attribute_category
323 ,p_ecv_attribute1_o =>ben_ecv_shd.g_old_rec.ecv_attribute1
324 ,p_ecv_attribute2_o =>ben_ecv_shd.g_old_rec.ecv_attribute2
325 ,p_ecv_attribute3_o =>ben_ecv_shd.g_old_rec.ecv_attribute3
326 ,p_ecv_attribute4_o =>ben_ecv_shd.g_old_rec.ecv_attribute4
327 ,p_ecv_attribute5_o =>ben_ecv_shd.g_old_rec.ecv_attribute5
328 ,p_ecv_attribute6_o =>ben_ecv_shd.g_old_rec.ecv_attribute6
329 ,p_ecv_attribute7_o =>ben_ecv_shd.g_old_rec.ecv_attribute7
330 ,p_ecv_attribute8_o =>ben_ecv_shd.g_old_rec.ecv_attribute8
331 ,p_ecv_attribute9_o =>ben_ecv_shd.g_old_rec.ecv_attribute9
332 ,p_ecv_attribute10_o =>ben_ecv_shd.g_old_rec.ecv_attribute10
333 ,p_ecv_attribute11_o =>ben_ecv_shd.g_old_rec.ecv_attribute11
334 ,p_ecv_attribute12_o =>ben_ecv_shd.g_old_rec.ecv_attribute12
335 ,p_ecv_attribute13_o =>ben_ecv_shd.g_old_rec.ecv_attribute13
336 ,p_ecv_attribute14_o =>ben_ecv_shd.g_old_rec.ecv_attribute14
337 ,p_ecv_attribute15_o =>ben_ecv_shd.g_old_rec.ecv_attribute15
338 ,p_ecv_attribute16_o =>ben_ecv_shd.g_old_rec.ecv_attribute16
339 ,p_ecv_attribute17_o =>ben_ecv_shd.g_old_rec.ecv_attribute17
340 ,p_ecv_attribute18_o =>ben_ecv_shd.g_old_rec.ecv_attribute18
341 ,p_ecv_attribute19_o =>ben_ecv_shd.g_old_rec.ecv_attribute19
342 ,p_ecv_attribute20_o =>ben_ecv_shd.g_old_rec.ecv_attribute20
343 ,p_ecv_attribute21_o =>ben_ecv_shd.g_old_rec.ecv_attribute21
344 ,p_ecv_attribute22_o =>ben_ecv_shd.g_old_rec.ecv_attribute22
345 ,p_ecv_attribute23_o =>ben_ecv_shd.g_old_rec.ecv_attribute23
346 ,p_ecv_attribute24_o =>ben_ecv_shd.g_old_rec.ecv_attribute24
347 ,p_ecv_attribute25_o =>ben_ecv_shd.g_old_rec.ecv_attribute25
348 ,p_ecv_attribute26_o =>ben_ecv_shd.g_old_rec.ecv_attribute26
349 ,p_ecv_attribute27_o =>ben_ecv_shd.g_old_rec.ecv_attribute27
350 ,p_ecv_attribute28_o =>ben_ecv_shd.g_old_rec.ecv_attribute28
351 ,p_ecv_attribute29_o =>ben_ecv_shd.g_old_rec.ecv_attribute29
352 ,p_ecv_attribute30_o =>ben_ecv_shd.g_old_rec.ecv_attribute30
353 ,p_object_version_number_o =>ben_ecv_shd.g_old_rec.object_version_number
354 ,p_criteria_score_o =>ben_ecv_shd.g_old_rec.criteria_score
355 ,p_criteria_weight_o =>ben_ecv_shd.g_old_rec.criteria_weight
356 ,p_Char_value3_o =>ben_ecv_shd.g_old_rec.Char_value3
357 ,p_Char_value4_o =>ben_ecv_shd.g_old_rec.Char_value4
358 ,p_Number_value3_o =>ben_ecv_shd.g_old_rec.Number_value3
359 ,p_Number_value4_o =>ben_ecv_shd.g_old_rec.Number_value4
360 ,p_Date_value3_o =>ben_ecv_shd.g_old_rec.Date_value3
361 ,p_Date_value4_o =>ben_ecv_shd.g_old_rec.Date_value4
362 );
363 --
364 --
365 exception
366 --
367 when hr_api.cannot_find_prog_unit then
368 --
369 hr_api.cannot_find_prog_unit_error
370 (p_module_name => 'ben_eligy_crit_values_f'
371 ,p_hook_type => 'AD');
372 --
373 end;
374 --
375 -- End of API User Hook for post_delete.
376 --
377 --
378 hr_utility.set_location(' Leaving:'||l_proc, 10);
379 End post_delete;
380 --
381 -- ----------------------------------------------------------------------------
382 -- |---------------------------------< del >----------------------------------|
383 -- ----------------------------------------------------------------------------
384 Procedure del
385 (
386 p_rec in out nocopy ben_ecv_shd.g_rec_type,
387 p_effective_date in date,
388 p_datetrack_mode in varchar2
389 ) is
390 --
391 l_proc varchar2(72) := g_package||'del';
392 l_validation_start_date date;
393 l_validation_end_date date;
394 --
395 Begin
396 hr_utility.set_location('Entering:'||l_proc, 5);
397 --
398 -- Ensure that the DateTrack delete mode is valid
399 --
400 dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
401 --
402 -- We must lock the row which we need to delete.
403 --
404 ben_ecv_shd.lck
405 (p_effective_date => p_effective_date,
406 p_datetrack_mode => p_datetrack_mode,
407 p_eligy_crit_values_id => p_rec.eligy_crit_values_id,
408 p_object_version_number => p_rec.object_version_number,
409 p_validation_start_date => l_validation_start_date,
410 p_validation_end_date => l_validation_end_date);
411 --
412 -- Call the supporting delete validate operation
413 --
414 ben_ecv_bus.delete_validate
415 (p_rec => p_rec,
416 p_effective_date => p_effective_date,
417 p_datetrack_mode => p_datetrack_mode,
418 p_validation_start_date => l_validation_start_date,
419 p_validation_end_date => l_validation_end_date);
420 --
421 -- Call the supporting pre-delete operation
422 --
423 pre_delete
424 (p_rec => p_rec,
425 p_effective_date => p_effective_date,
426 p_datetrack_mode => p_datetrack_mode,
427 p_validation_start_date => l_validation_start_date,
428 p_validation_end_date => l_validation_end_date);
429 --
430 -- Delete the row.
431 --
432 delete_dml
433 (p_rec => p_rec,
434 p_effective_date => p_effective_date,
435 p_datetrack_mode => p_datetrack_mode,
436 p_validation_start_date => l_validation_start_date,
437 p_validation_end_date => l_validation_end_date);
438 --
439 -- Call the supporting post-delete operation
440 --
441 post_delete
442 (p_rec => p_rec,
443 p_effective_date => p_effective_date,
444 p_datetrack_mode => p_datetrack_mode,
445 p_validation_start_date => l_validation_start_date,
446 p_validation_end_date => l_validation_end_date);
447 end del;
448 --
449 -- ----------------------------------------------------------------------------
450 -- |---------------------------------< del >----------------------------------|
451 -- ----------------------------------------------------------------------------
452 Procedure del
453 (
454 p_eligy_crit_values_id in number,
455 p_effective_start_date out nocopy date,
456 p_effective_end_date out nocopy date,
457 p_object_version_number in out nocopy number,
458 p_effective_date in date,
459 p_datetrack_mode in varchar2
460 ) is
461 --
462 l_rec ben_ecv_shd.g_rec_type;
463 l_proc varchar2(72) := g_package||'del';
464 --
465 Begin
466 hr_utility.set_location('Entering:'||l_proc, 5);
467 --
468 -- As the delete procedure accepts a plsql record structure we do need to
469 -- convert the arguments into the record structure.
470 -- We don't need to call the supplied conversion argument routine as we
471 -- only need a few attributes.
472 --
473 l_rec.eligy_crit_values_id := p_eligy_crit_values_id;
474 l_rec.object_version_number := p_object_version_number;
475 -- Having converted the arguments into the
476 -- plsql record structure we must call the corresponding entity
477 -- business process
478 --
479 del(l_rec, p_effective_date, p_datetrack_mode);
480 --
481 -- Set the out arguments
482 --
483 p_object_version_number := l_rec.object_version_number;
484 p_effective_start_date := l_rec.effective_start_date;
485 p_effective_end_date := l_rec.effective_end_date;
486 --
487 hr_utility.set_location(' Leaving:'||l_proc, 10);
488
489 end del;
490 --
491 end ben_ecv_del;