1 Package Body irc_irf_del as
2 /* $Header: irirfrhi.pkb 120.1 2008/04/16 07:34:32 vmummidi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' irc_irf_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 structure.
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 irc_irf_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
59 ) is
60 --
61 l_proc varchar2(72) := g_package||'dt_delete_dml';
62 --
63 Begin
64 hr_utility.set_location('Entering:'||l_proc, 5);
65 If (p_datetrack_mode = hr_api.g_delete_next_change) then
66 --
67 --
68 -- Delete the where the effective start date is equal
69 -- to the validation end date.
70 --
71 delete from irc_referral_info
72 where referral_info_id = p_rec.referral_info_id
73 and start_date = p_validation_start_date;
74 --
75 --
76 /*Else
77 --
78 --
79 -- Delete the row(s) where the effective start date is greater than
80 -- or equal to the validation start date.
81 --
82 delete from irc_referral_info
83 where referral_info_id = p_rec.referral_info_id
84 and start_date >= p_validation_start_date;*/
85 --
86 --
87 End If;
88 --
89 hr_utility.set_location(' Leaving:'||l_proc, 20);
90 --
91 End dt_delete_dml;
92 --
93 -- ----------------------------------------------------------------------------
94 -- |------------------------------< delete_dml >------------------------------|
95 -- ----------------------------------------------------------------------------
96 Procedure delete_dml
97 (p_rec in out nocopy irc_irf_shd.g_rec_type
98 ,p_effective_date in date
99 ,p_datetrack_mode in varchar2
100 ,p_validation_start_date in date
101 ,p_validation_end_date in date
102 ) is
103 --
104 l_proc varchar2(72) := g_package||'delete_dml';
105 --
106 Begin
107 hr_utility.set_location('Entering:'||l_proc, 5);
108 --
109 irc_irf_del.dt_delete_dml
110 (p_rec => p_rec
111 ,p_effective_date => p_effective_date
112 ,p_datetrack_mode => p_datetrack_mode
113 ,p_validation_start_date => p_validation_start_date
114 ,p_validation_end_date => p_validation_end_date
115 );
116 --
117 hr_utility.set_location(' Leaving:'||l_proc, 10);
118 End delete_dml;
119 --
120 -- ----------------------------------------------------------------------------
121 -- |----------------------------< dt_pre_delete >-----------------------------|
122 -- ----------------------------------------------------------------------------
123 -- {Start Of Comments}
124 --
125 -- Description:
126 -- The dt_pre_delete process controls the execution of dml
127 -- for the datetrack modes: DELETE, FUTURE_CHANGE
128 -- and DELETE_NEXT_CHANGE only.
129 --
130 -- Prerequisites:
131 -- This is an internal procedure which is called from the pre_delete
132 -- procedure.
133 --
134 -- In Parameters:
135 -- A Pl/Sql record structure.
136 --
137 -- Post Success:
138 -- Processing continues.
139 --
140 -- Post Failure:
141 -- If an error has occurred, an error message and exception will be raised
142 -- but not handled.
143 --
144 -- Developer Implementation Notes:
145 -- This is an internal procedure which is required by Datetrack. Don't
146 -- remove or modify.
147 --
148 -- Access Status:
149 -- Internal Row Handler Use Only.
150 --
151 -- {End Of Comments}
152 -- ----------------------------------------------------------------------------
153 Procedure dt_pre_delete
154 (p_rec in out nocopy irc_irf_shd.g_rec_type
155 ,p_effective_date in date
156 ,p_datetrack_mode in varchar2
157 ,p_validation_start_date in date
158 ,p_validation_end_date in date
159 ) is
160 --
161 l_proc varchar2(72) := g_package||'dt_pre_delete';
162 --
163 Begin
164 hr_utility.set_location('Entering:'||l_proc, 5);
165 --
166 If (p_datetrack_mode <> hr_api.g_zap) then
167 --
168 p_rec.start_date
169 := irc_irf_shd.g_old_rec.start_date;
170 --
171 If (p_datetrack_mode = hr_api.g_delete) then
172 p_rec.end_date := p_validation_start_date;
173 Else
174 p_rec.end_date := p_validation_end_date;
175 End If;
176 --
177 -- Update the current effective end date record
178 --
179 irc_irf_shd.upd_end_date
180 (p_effective_date => p_effective_date
181 ,p_referral_info_id => p_rec.referral_info_id
182 ,p_new_end_date => p_rec.end_date
183 ,p_object_version_number => p_rec.object_version_number
184 );
185 Else
186 p_rec.start_date := null;
187 p_rec.end_date := null;
188 End If;
189 hr_utility.set_location(' Leaving:'||l_proc, 10);
190 End dt_pre_delete;
191 --
192 -- ----------------------------------------------------------------------------
193 -- |------------------------------< pre_delete >------------------------------|
194 -- ----------------------------------------------------------------------------
195 -- {Start Of Comments}
196 --
197 -- Description:
198 -- This private procedure contains any processing which is required before
199 -- the delete dml.
200 --
201 -- Prerequisites:
202 -- This is an internal procedure which is called from the del procedure.
203 --
204 -- In Parameters:
205 -- A Pl/Sql record structure.
206 --
207 -- Post Success:
208 -- Processing continues.
209 --
210 -- Post Failure:
211 -- If an error has occurred, an error message and exception will be raised
212 -- but not handled.
213 --
214 -- Developer Implementation Notes:
215 -- Any pre-processing required before the delete dml is issued should be
216 -- coded within this procedure. It is important to note that any 3rd party
217 -- maintenance should be reviewed before placing in this procedure. The call
218 -- to the dt_delete_dml procedure should NOT be removed.
219 --
220 -- Access Status:
221 -- Internal Row Handler Use Only.
222 --
223 -- {End Of Comments}
224 -- ----------------------------------------------------------------------------
225 Procedure pre_delete
226 (p_rec in out nocopy irc_irf_shd.g_rec_type
227 ,p_effective_date in date
228 ,p_datetrack_mode in varchar2
229 ,p_validation_start_date in date
230 ,p_validation_end_date in date
231 ) is
232 --
233 l_proc varchar2(72) := g_package||'pre_delete';
234 --
235 --
236 --
237 Begin
238 hr_utility.set_location('Entering:'||l_proc, 5);
239 --
240 --
241 --
242 irc_irf_del.dt_pre_delete
243 (p_rec => p_rec
244 ,p_effective_date => p_effective_date
245 ,p_datetrack_mode => p_datetrack_mode
246 ,p_validation_start_date => p_validation_start_date
247 ,p_validation_end_date => p_validation_end_date
248 );
249 --
250 hr_utility.set_location(' Leaving:'||l_proc, 10);
251 End pre_delete;
252 --
253 -- ----------------------------------------------------------------------------
254 -- |----------------------------< post_delete >-------------------------------|
255 -- ----------------------------------------------------------------------------
256 -- {Start Of Comments}
257 --
258 -- Description:
259 -- This private procedure contains any processing which is required after
260 -- the delete dml.
261 --
262 -- Prerequisites:
263 -- This is an internal procedure which is called from the del procedure.
264 --
265 -- In Parameters:
266 -- A Pl/Sql record structure.
267 --
268 -- Post Success:
269 -- Processing continues.
270 --
271 -- Post Failure:
272 -- If an error has occurred, an error message and exception will be raised
273 -- but not handled.
274 --
275 -- Developer Implementation Notes:
276 -- Any post-processing required after the delete dml is issued should be
277 -- coded within this procedure. It is important to note that any 3rd party
278 -- maintenance should be reviewed before placing in this procedure.
279 --
280 -- Access Status:
281 -- Internal Row Handler Use Only.
282 --
283 -- {End Of Comments}
284 -- ----------------------------------------------------------------------------
285 Procedure post_delete
286 (p_rec in irc_irf_shd.g_rec_type
287 ,p_effective_date in date
288 ,p_datetrack_mode in varchar2
289 ,p_validation_start_date in date
290 ,p_validation_end_date in date
291 ) is
292 --
293 l_proc varchar2(72) := g_package||'post_delete';
294 --
295 Begin
296 hr_utility.set_location('Entering:'||l_proc, 5);
297 begin
298 --
299 irc_irf_rkd.after_delete
300 (p_effective_date => p_effective_date
301 ,p_datetrack_mode => p_datetrack_mode
302 ,p_validation_start_date => p_validation_start_date
303 ,p_validation_end_date => p_validation_end_date
304 ,p_referral_info_id => p_rec.referral_info_id
305 ,p_start_date => p_rec.start_date
306 ,p_end_date => p_rec.end_date
307 ,p_object_id_o => irc_irf_shd.g_old_rec.object_id
308 ,p_object_type_o => irc_irf_shd.g_old_rec.object_type
309 ,p_start_date_o => irc_irf_shd.g_old_rec.start_date
310 ,p_end_date_o => irc_irf_shd.g_old_rec.end_date
311 ,p_source_type_o => irc_irf_shd.g_old_rec.source_type
312 ,p_source_name_o => irc_irf_shd.g_old_rec.source_name
313 ,p_source_criteria1_o => irc_irf_shd.g_old_rec.source_criteria1
314 ,p_source_value1_o => irc_irf_shd.g_old_rec.source_value1
315 ,p_source_criteria2_o => irc_irf_shd.g_old_rec.source_criteria2
316 ,p_source_value2_o => irc_irf_shd.g_old_rec.source_value2
317 ,p_source_criteria3_o => irc_irf_shd.g_old_rec.source_criteria3
318 ,p_source_value3_o => irc_irf_shd.g_old_rec.source_value3
319 ,p_source_criteria4_o => irc_irf_shd.g_old_rec.source_criteria4
320 ,p_source_value4_o => irc_irf_shd.g_old_rec.source_value4
321 ,p_source_criteria5_o => irc_irf_shd.g_old_rec.source_criteria5
322 ,p_source_value5_o => irc_irf_shd.g_old_rec.source_value5
323 ,p_source_person_id_o => irc_irf_shd.g_old_rec.source_person_id
324 ,p_candidate_comment_o => irc_irf_shd.g_old_rec.candidate_comment
325 ,p_employee_comment_o => irc_irf_shd.g_old_rec.employee_comment
329 ,p_irf_attribute3_o => irc_irf_shd.g_old_rec.irf_attribute3
326 ,p_irf_attribute_category_o => irc_irf_shd.g_old_rec.irf_attribute_category
327 ,p_irf_attribute1_o => irc_irf_shd.g_old_rec.irf_attribute1
328 ,p_irf_attribute2_o => irc_irf_shd.g_old_rec.irf_attribute2
330 ,p_irf_attribute4_o => irc_irf_shd.g_old_rec.irf_attribute4
331 ,p_irf_attribute5_o => irc_irf_shd.g_old_rec.irf_attribute5
332 ,p_irf_attribute6_o => irc_irf_shd.g_old_rec.irf_attribute6
333 ,p_irf_attribute7_o => irc_irf_shd.g_old_rec.irf_attribute7
334 ,p_irf_attribute8_o => irc_irf_shd.g_old_rec.irf_attribute8
335 ,p_irf_attribute9_o => irc_irf_shd.g_old_rec.irf_attribute9
336 ,p_irf_attribute10_o => irc_irf_shd.g_old_rec.irf_attribute10
337 ,p_irf_information_category_o => irc_irf_shd.g_old_rec.irf_information_category
338 ,p_irf_information1_o => irc_irf_shd.g_old_rec.irf_information1
339 ,p_irf_information2_o => irc_irf_shd.g_old_rec.irf_information2
340 ,p_irf_information3_o => irc_irf_shd.g_old_rec.irf_information3
341 ,p_irf_information4_o => irc_irf_shd.g_old_rec.irf_information4
342 ,p_irf_information5_o => irc_irf_shd.g_old_rec.irf_information5
343 ,p_irf_information6_o => irc_irf_shd.g_old_rec.irf_information6
344 ,p_irf_information7_o => irc_irf_shd.g_old_rec.irf_information7
345 ,p_irf_information8_o => irc_irf_shd.g_old_rec.irf_information8
346 ,p_irf_information9_o => irc_irf_shd.g_old_rec.irf_information9
347 ,p_irf_information10_o => irc_irf_shd.g_old_rec.irf_information10
348 ,p_object_created_by_o => irc_irf_shd.g_old_rec.object_created_by
349 ,p_created_by_o => irc_irf_shd.g_old_rec.created_by
350 ,p_object_version_number_o => irc_irf_shd.g_old_rec.object_version_number
351 );
352 --
353 exception
354 --
355 when hr_api.cannot_find_prog_unit then
356 --
357 hr_api.cannot_find_prog_unit_error
358 (p_module_name => 'IRC_REFERRAL_INFO'
359 ,p_hook_type => 'AD');
360 --
361 end;
362 --
363 hr_utility.set_location(' Leaving:'||l_proc, 10);
364 End post_delete;
365 --
366 -- ----------------------------------------------------------------------------
367 -- |---------------------------------< del >----------------------------------|
368 -- ----------------------------------------------------------------------------
369 Procedure del
370 (p_effective_date in date
371 ,p_datetrack_mode in varchar2
372 ,p_rec in out nocopy irc_irf_shd.g_rec_type
373 ) is
374 --
375 l_proc varchar2(72) := g_package||'del';
376 l_validation_start_date date;
377 l_validation_end_date date;
378 --
379 Begin
380 hr_utility.set_location('Entering:'||l_proc, 5);
381 --
382 -- Ensure that the DateTrack delete mode is valid
383 --
384 dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
385 --
386 -- We must lock the row which we need to delete.
387 --
388 irc_irf_shd.lck
389 (p_effective_date => p_effective_date
390 ,p_datetrack_mode => p_datetrack_mode
391 ,p_referral_info_id => p_rec.referral_info_id
392 ,p_object_version_number => p_rec.object_version_number
393 ,p_validation_start_date => l_validation_start_date
394 ,p_validation_end_date => l_validation_end_date
395 );
396 --
397 -- Call to raise any errors on multi-message list
398 hr_multi_message.end_validation_set;
399 --
400 -- Call the supporting pre-delete operation
401 --
402 irc_irf_del.pre_delete
403 (p_rec => p_rec
404 ,p_effective_date => p_effective_date
405 ,p_datetrack_mode => p_datetrack_mode
406 ,p_validation_start_date => l_validation_start_date
407 ,p_validation_end_date => l_validation_end_date
408 );
409 --
410 -- Delete the row.
411 --
412 irc_irf_del.delete_dml
413 (p_rec => p_rec
414 ,p_effective_date => p_effective_date
415 ,p_datetrack_mode => p_datetrack_mode
416 ,p_validation_start_date => l_validation_start_date
417 ,p_validation_end_date => l_validation_end_date
418 );
419 -- Call the supporting post-delete operation
420 --
421 irc_irf_del.post_delete
422 (p_rec => p_rec
423 ,p_effective_date => p_effective_date
424 ,p_datetrack_mode => p_datetrack_mode
425 ,p_validation_start_date => l_validation_start_date
426 ,p_validation_end_date => l_validation_end_date
427 );
428 --
429 -- Call to raise any errors on multi-message list
430 hr_multi_message.end_validation_set;
431 --
432 hr_utility.set_location(' Leaving:'||l_proc, 5);
433 End del;
434 --
435 -- ----------------------------------------------------------------------------
436 -- |--------------------------------< del >-----------------------------------|
437 -- ----------------------------------------------------------------------------
438 Procedure del
439 (p_effective_date in date
440 ,p_datetrack_mode in varchar2
441 ,p_referral_info_id in number
442 ,p_object_version_number in out nocopy number
443 ,p_start_date out nocopy date
444 ,p_end_date out nocopy date
445 ) is
446 --
447 l_rec irc_irf_shd.g_rec_type;
448 l_proc varchar2(72) := g_package||'del';
449 --
450 Begin
451 hr_utility.set_location('Entering:'||l_proc, 5);
452 --
453 -- As the delete procedure accepts a plsql record structure we do need to
454 -- convert the arguments into the record structure.
455 -- We don't need to call the supplied conversion argument routine as we
456 -- only need a few attributes.
457 --
458 l_rec.referral_info_id := p_referral_info_id;
459 l_rec.start_date := p_start_date;
460 l_rec.end_date := p_end_date;
461 l_rec.object_version_number := p_object_version_number;
462 --
463 -- Having converted the arguments into the irc_irf_rec
464 -- plsql record structure we must call the corresponding entity
465 -- business process
466 --
467 irc_irf_del.del
468 (p_effective_date
469 ,p_datetrack_mode
470 ,l_rec
471 );
472 --
473 --
474 -- Set the out arguments
475 --
476 p_object_version_number := l_rec.object_version_number;
477 p_start_date := l_rec.start_date;
478 p_end_date := l_rec.end_date;
479 --
480 hr_utility.set_location(' Leaving:'||l_proc, 10);
481 End del;
482 --
483 end irc_irf_del;