[Home] [Help]
PACKAGE BODY: APPS.PER_PTU_DEL
Source
1 Package Body per_ptu_del as
2 /* $Header: pepturhi.pkb 120.0 2005/05/31 15:57:51 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_ptu_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) If the delete mode is DELETE_NEXT_CHANGE then delete where the
20 -- effective start date is equal to the validation start date.
21 -- 2) If the delete mode is not DELETE_NEXT_CHANGE then delete
22 -- all rows for the entity where the effective start date is greater
23 -- than or equal to the validation start date.
24 -- 3) To raise any errors.
25 --
26 -- Prerequisites:
27 -- This is an internal private procedure which must be called from the
28 -- delete_dml procedure.
29 --
30 -- In Parameters:
31 -- A Pl/Sql record structre.
32 --
33 -- Post Success:
34 -- The specified row will be delete from the schema.
35 --
36 -- Post Failure:
37 --
38 -- Developer Implementation Notes:
39 -- This is an internal private procedure which must be called from the
40 -- delete_dml procedure.
41 --
42 -- Access Status:
43 -- Internal Row Handler Use Only.
44 --
45 -- {End Of Comments}
46 -- ----------------------------------------------------------------------------
47 Procedure dt_delete_dml
48 (p_rec in out nocopy per_ptu_shd.g_rec_type,
49 p_effective_date in date,
50 p_datetrack_mode in varchar2,
51 p_validation_start_date in date,
52 p_validation_end_date in date) is
53 --
54 l_proc varchar2(72) := g_package||'dt_delete_dml';
55 --
56 Begin
57 hr_utility.set_location('Entering:'||l_proc, 5);
58 If (p_datetrack_mode = 'DELETE_NEXT_CHANGE') then
59 hr_utility.set_location(l_proc, 10);
60 --
61 -- Delete the where the effective start date is equal
62 -- to the validation end date.
63 --
64 delete from per_person_type_usages_f
65 where person_type_usage_id = p_rec.person_type_usage_id
66 and effective_start_date = p_validation_start_date;
67 --
68 Else
69 hr_utility.set_location(l_proc, 15);
70 --
71 -- Delete the row(s) where the effective start date is greater than
72 -- or equal to the validation start date.
73 --
74 delete from per_person_type_usages_f
75 where person_type_usage_id = p_rec.person_type_usage_id
76 and effective_start_date >= p_validation_start_date;
77 --
78 End If;
79 --
80 hr_utility.set_location(' Leaving:'||l_proc, 20);
81 --
82 Exception
83 When Others Then
84 Raise;
85 End dt_delete_dml;
86 --
87 -- ----------------------------------------------------------------------------
88 -- |------------------------------< delete_dml >------------------------------|
89 -- ----------------------------------------------------------------------------
90 Procedure delete_dml
91 (p_rec in out nocopy per_ptu_shd.g_rec_type,
92 p_effective_date in date,
93 p_datetrack_mode in varchar2,
94 p_validation_start_date in date,
95 p_validation_end_date in date) is
96 --
97 l_proc varchar2(72) := g_package||'delete_dml';
98 --
99 Begin
100 hr_utility.set_location('Entering:'||l_proc, 5);
101 --
102 dt_delete_dml(p_rec => p_rec,
103 p_effective_date => p_effective_date,
104 p_datetrack_mode => p_datetrack_mode,
105 p_validation_start_date => p_validation_start_date,
106 p_validation_end_date => p_validation_end_date);
107 --
108 hr_utility.set_location(' Leaving:'||l_proc, 10);
109 End delete_dml;
110 --
111 -- ----------------------------------------------------------------------------
112 -- |----------------------------< dt_pre_delete >-----------------------------|
113 -- ----------------------------------------------------------------------------
114 -- {Start Of Comments}
115 --
116 -- Description:
117 -- The dt_pre_delete process controls the execution of dml
118 -- for the datetrack modes: DELETE, FUTURE_CHANGE
119 -- and DELETE_NEXT_CHANGE only.
120 --
121 -- Prerequisites:
122 -- This is an internal procedure which is called from the pre_delete
123 -- procedure.
124 --
125 -- In Parameters:
126 -- A Pl/Sql record structre.
127 --
128 -- Post Success:
129 -- Processing continues.
130 --
131 -- Post Failure:
132 -- If an error has occurred, an error message and exception will be raised
133 -- but not handled.
134 --
135 -- Developer Implementation Notes:
136 -- This is an internal procedure which is required by Datetrack. Don't
137 -- remove or modify.
138 --
139 -- Access Status:
140 -- Internal Row Handler Use Only.
141 --
142 -- {End Of Comments}
143 -- ----------------------------------------------------------------------------
144 Procedure dt_pre_delete
145 (p_rec in out nocopy per_ptu_shd.g_rec_type,
146 p_effective_date in date,
147 p_datetrack_mode in varchar2,
148 p_validation_start_date in date,
149 p_validation_end_date in date) is
150 --
151 l_proc varchar2(72) := g_package||'dt_pre_delete';
152 --
153 Begin
154 hr_utility.set_location('Entering:'||l_proc, 5);
155 --
156 If (p_datetrack_mode <> 'ZAP') then
157 --
158 p_rec.effective_start_date := per_ptu_shd.g_old_rec.effective_start_date;
159 --
160 If (p_datetrack_mode = 'DELETE') then
161 p_rec.effective_end_date := p_validation_start_date - 1;
162 Else
163 p_rec.effective_end_date := p_validation_end_date;
164 End If;
165 --
166 -- Update the current effective end date record
167 --
168 per_ptu_shd.upd_effective_end_date
169 (p_effective_date => p_effective_date,
170 p_base_key_value => p_rec.person_type_usage_id,
171 p_new_effective_end_date => p_rec.effective_end_date,
172 p_validation_start_date => p_validation_start_date,
173 p_validation_end_date => p_validation_end_date,
174 p_object_version_number => p_rec.object_version_number);
175 Else
176 p_rec.effective_start_date := null;
177 p_rec.effective_end_date := null;
178 End If;
179 hr_utility.set_location(' Leaving:'||l_proc, 10);
180 End dt_pre_delete;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |------------------------------< pre_delete >------------------------------|
184 -- ----------------------------------------------------------------------------
185 -- {Start Of Comments}
186 --
187 -- Description:
188 -- This private procedure contains any processing which is required before
189 -- the delete dml.
190 --
191 -- Prerequisites:
192 -- This is an internal procedure which is called from the del procedure.
193 --
194 -- In Parameters:
195 -- A Pl/Sql record structre.
196 --
197 -- Post Success:
198 -- Processing continues.
199 --
200 -- Post Failure:
201 -- If an error has occurred, an error message and exception will be raised
202 -- but not handled.
203 --
204 -- Developer Implementation Notes:
205 -- Any pre-processing required before the delete dml is issued should be
206 -- coded within this procedure. It is important to note that any 3rd party
207 -- maintenance should be reviewed before placing in this procedure. The call
208 -- to the dt_delete_dml procedure should NOT be removed.
209 --
210 -- Access Status:
211 -- Internal Row Handler Use Only.
212 --
213 -- {End Of Comments}
214 -- ----------------------------------------------------------------------------
215 Procedure pre_delete
216 (p_rec in out nocopy per_ptu_shd.g_rec_type,
217 p_effective_date in date,
218 p_datetrack_mode in varchar2,
219 p_validation_start_date in date,
220 p_validation_end_date in date) is
221 --
222 l_proc varchar2(72) := g_package||'pre_delete';
223 --
224 --
225 --
226 Begin
227 hr_utility.set_location('Entering:'||l_proc, 5);
228 --
229 --
230 --
231 dt_pre_delete
232 (p_rec => p_rec,
233 p_effective_date => p_effective_date,
234 p_datetrack_mode => p_datetrack_mode,
235 p_validation_start_date => p_validation_start_date,
236 p_validation_end_date => p_validation_end_date);
237 --
238 hr_utility.set_location(' Leaving:'||l_proc, 10);
239 End pre_delete;
240 --
241 -- ----------------------------------------------------------------------------
242 -- |-----------------------------< post_delete >------------------------------|
243 -- ----------------------------------------------------------------------------
244 -- {Start Of Comments}
245 --
246 -- Description:
247 -- This private procedure contains any processing which is required after the
248 -- delete dml.
249 --
250 -- Prerequisites:
251 -- This is an internal procedure which is called from the del procedure.
252 --
253 -- In Parameters:
254 -- A Pl/Sql record structre.
255 --
256 -- Post Success:
257 -- Processing continues.
258 --
259 -- Post Failure:
260 -- If an error has occurred, an error message and exception will be raised
261 -- but not handled.
262 --
263 -- Developer Implementation Notes:
264 -- Any post-processing required after the delete dml is issued should be
265 -- coded within this procedure. It is important to note that any 3rd party
266 -- maintenance should be reviewed before placing in this procedure.
267 --
268 -- Access Status:
269 -- Internal Row Handler Use Only.
270 --
271 -- {End Of Comments}
272 -- ----------------------------------------------------------------------------
273 Procedure post_delete
274 (p_rec in per_ptu_shd.g_rec_type,
275 p_effective_date in date,
276 p_datetrack_mode in varchar2,
277 p_validation_start_date in date,
278 p_validation_end_date in date) is
279 --
280 l_proc varchar2(72) := g_package||'post_delete';
281 --
282 Begin
283 hr_utility.set_location('Entering:'||l_proc, 5);
284 --
285 --
286 -- Start of API User Hook for post_delete.
287 begin
288 per_ptu_rkd.after_delete
289 (
290 p_person_type_usage_id => p_rec.person_type_usage_id,
291 p_person_id_o => per_ptu_shd.g_old_rec.person_id,
292 p_person_type_id_o => per_ptu_shd.g_old_rec.person_type_id,
293 p_effective_start_date_o
294 => per_ptu_shd.g_old_rec.effective_start_date,
295 p_effective_end_date_o => per_ptu_shd.g_old_rec.effective_end_date,
296 p_object_version_number_o
297 => per_ptu_shd.g_old_rec.object_version_number,
298 p_request_id_o => per_ptu_shd.g_old_rec.request_id,
299 p_program_application_id_o
300 => per_ptu_shd.g_old_rec.program_application_id,
301 p_program_id_o => per_ptu_shd.g_old_rec.program_id,
302 p_program_update_date_o => per_ptu_shd.g_old_rec.program_update_date
303 ,p_attribute_category_o => per_ptu_shd.g_old_rec.attribute_category
304 ,p_attribute1_o => per_ptu_shd.g_old_rec.attribute1
305 ,p_attribute2_o => per_ptu_shd.g_old_rec.attribute2
306 ,p_attribute3_o => per_ptu_shd.g_old_rec.attribute3
307 ,p_attribute4_o => per_ptu_shd.g_old_rec.attribute4
308 ,p_attribute5_o => per_ptu_shd.g_old_rec.attribute5
309 ,p_attribute6_o => per_ptu_shd.g_old_rec.attribute6
310 ,p_attribute7_o => per_ptu_shd.g_old_rec.attribute7
311 ,p_attribute8_o => per_ptu_shd.g_old_rec.attribute8
312 ,p_attribute9_o => per_ptu_shd.g_old_rec.attribute9
313 ,p_attribute10_o => per_ptu_shd.g_old_rec.attribute10
314 ,p_attribute11_o => per_ptu_shd.g_old_rec.attribute11
315 ,p_attribute12_o => per_ptu_shd.g_old_rec.attribute12
316 ,p_attribute13_o => per_ptu_shd.g_old_rec.attribute13
317 ,p_attribute14_o => per_ptu_shd.g_old_rec.attribute14
318 ,p_attribute15_o => per_ptu_shd.g_old_rec.attribute15
319 ,p_attribute16_o => per_ptu_shd.g_old_rec.attribute16
320 ,p_attribute17_o => per_ptu_shd.g_old_rec.attribute17
321 ,p_attribute18_o => per_ptu_shd.g_old_rec.attribute18
322 ,p_attribute19_o => per_ptu_shd.g_old_rec.attribute19
323 ,p_attribute20_o => per_ptu_shd.g_old_rec.attribute20
324 ,p_attribute21_o => per_ptu_shd.g_old_rec.attribute21
325 ,p_attribute22_o => per_ptu_shd.g_old_rec.attribute22
326 ,p_attribute23_o => per_ptu_shd.g_old_rec.attribute23
327 ,p_attribute24_o => per_ptu_shd.g_old_rec.attribute24
328 ,p_attribute25_o => per_ptu_shd.g_old_rec.attribute25
329 ,p_attribute26_o => per_ptu_shd.g_old_rec.attribute26
330 ,p_attribute27_o => per_ptu_shd.g_old_rec.attribute27
331 ,p_attribute28_o => per_ptu_shd.g_old_rec.attribute28
332 ,p_attribute29_o => per_ptu_shd.g_old_rec.attribute29
333 ,p_attribute30_o => per_ptu_shd.g_old_rec.attribute30,
334 p_effective_date => p_effective_date,
335 p_datetrack_mode => p_datetrack_mode,
336 p_validation_start_date => p_validation_start_date,
337 p_validation_end_date => p_validation_end_date,
338 p_effective_start_date => p_rec.effective_start_date,
339 p_effective_end_date => p_rec.effective_end_date,
340 p_object_version_number => p_rec.object_version_number
341 );
342 exception
343 when hr_api.cannot_find_prog_unit then
344 hr_api.cannot_find_prog_unit_error
345 (p_module_name => 'PER_PERSON_TYPE_USAGES_F'
346 ,p_hook_type => 'AD'
347 );
348 end;
349 -- End of API User Hook for post_delete.
350 --
351 hr_utility.set_location(' Leaving:'||l_proc, 10);
352 End post_delete;
353 --
354 -- ----------------------------------------------------------------------------
355 -- |---------------------------------< del >----------------------------------|
356 -- ----------------------------------------------------------------------------
357 Procedure del
358 (
359 p_rec in out nocopy per_ptu_shd.g_rec_type,
360 p_effective_date in date,
361 p_datetrack_mode in varchar2
362 ) is
363 --
364 l_proc varchar2(72) := g_package||'del';
365 l_validation_start_date date;
366 l_validation_end_date date;
367 --
368 Begin
369 hr_utility.set_location('Entering:'||l_proc, 5);
370 --
371 -- Ensure that the DateTrack delete mode is valid
372 --
373 dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
374 --
375 -- We must lock the row which we need to delete.
376 --
377 per_ptu_shd.lck
378 (p_effective_date => p_effective_date,
379 p_datetrack_mode => p_datetrack_mode,
380 p_person_type_usage_id => p_rec.person_type_usage_id,
381 p_object_version_number => p_rec.object_version_number,
382 p_validation_start_date => l_validation_start_date,
383 p_validation_end_date => l_validation_end_date);
384 --
385 -- Call the supporting delete validate operation
386 --
387 per_ptu_bus.delete_validate
388 (p_rec => p_rec,
389 p_effective_date => p_effective_date,
390 p_datetrack_mode => p_datetrack_mode,
391 p_validation_start_date => l_validation_start_date,
392 p_validation_end_date => l_validation_end_date);
393 --
394 -- Call the supporting pre-delete operation
395 --
396 pre_delete
397 (p_rec => p_rec,
398 p_effective_date => p_effective_date,
399 p_datetrack_mode => p_datetrack_mode,
400 p_validation_start_date => l_validation_start_date,
401 p_validation_end_date => l_validation_end_date);
402 --
403 -- Delete the row.
404 --
405 delete_dml
406 (p_rec => p_rec,
407 p_effective_date => p_effective_date,
408 p_datetrack_mode => p_datetrack_mode,
409 p_validation_start_date => l_validation_start_date,
410 p_validation_end_date => l_validation_end_date);
411 --
412 -- Call the supporting post-delete operation
413 --
414 post_delete
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 End del;
421 --
422 -- ----------------------------------------------------------------------------
423 -- |---------------------------------< del >----------------------------------|
424 -- ----------------------------------------------------------------------------
425 Procedure del
426 (
427 p_person_type_usage_id in number,
428 p_effective_start_date out nocopy date,
429 p_effective_end_date out nocopy date,
430 p_object_version_number in out nocopy number,
431 p_effective_date in date,
432 p_datetrack_mode in varchar2
433 ) is
434 --
435 l_rec per_ptu_shd.g_rec_type;
436 l_proc varchar2(72) := g_package||'del';
437 --
438 Begin
439 hr_utility.set_location('Entering:'||l_proc, 5);
440 --
441 -- As the delete procedure accepts a plsql record structure we do need to
442 -- convert the arguments into the record structure.
443 -- We don't need to call the supplied conversion argument routine as we
444 -- only need a few attributes.
445 --
446 l_rec.person_type_usage_id := p_person_type_usage_id;
447 l_rec.object_version_number := p_object_version_number;
448 --
449 -- Having converted the arguments into the per_ptu_rec
450 -- plsql record structure we must call the corresponding entity
451 -- business process
452 --
453 del(l_rec, p_effective_date, p_datetrack_mode);
454 --
455 -- Set the out arguments
456 --
457 p_object_version_number := l_rec.object_version_number;
458 p_effective_start_date := l_rec.effective_start_date;
459 p_effective_end_date := l_rec.effective_end_date;
460 --
461 hr_utility.set_location(' Leaving:'||l_proc, 10);
462 End del;
463 --
464 end per_ptu_del;