DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_REI_DEL

Source


1 Package Body per_rei_del as
2 /* $Header: pereirhi.pkb 115.6 2003/10/07 19:01:25 ttagawa noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_rei_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 per_rei_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     per_rei_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 per_contact_extra_info_f
72     where       contact_extra_info_id = p_rec.contact_extra_info_id
73     and   effective_start_date = p_validation_start_date;
74     --
75     per_rei_shd.g_api_dml := false;   -- Unset the api dml status
76   Else
77     per_rei_shd.g_api_dml := true;  -- Set the api dml status
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 per_contact_extra_info_f
83     where        contact_extra_info_id = p_rec.contact_extra_info_id
84     and   effective_start_date >= p_validation_start_date;
85     --
86     per_rei_shd.g_api_dml := false;   -- Unset the api dml status
87   End If;
88   --
89   hr_utility.set_location(' Leaving:'||l_proc, 20);
90 --
91 Exception
92   When Others Then
93     per_rei_shd.g_api_dml := false;   -- Unset the api dml status
94     Raise;
95 --
96 End dt_delete_dml;
97 --
98 -- ----------------------------------------------------------------------------
99 -- |------------------------------< delete_dml >------------------------------|
100 -- ----------------------------------------------------------------------------
101 Procedure delete_dml
102   (p_rec                     in out nocopy per_rei_shd.g_rec_type
103   ,p_effective_date          in date
104   ,p_datetrack_mode          in varchar2
105   ,p_validation_start_date   in date
106   ,p_validation_end_date     in date
107   ) 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   per_rei_del.dt_delete_dml
115     (p_rec                   => p_rec
116     ,p_effective_date        => p_effective_date
117     ,p_datetrack_mode        => p_datetrack_mode
118     ,p_validation_start_date => p_validation_start_date
119     ,p_validation_end_date   => p_validation_end_date
120     );
121   --
122   hr_utility.set_location(' Leaving:'||l_proc, 10);
123 End delete_dml;
124 --
125 -- ----------------------------------------------------------------------------
126 -- |----------------------------< dt_pre_delete >-----------------------------|
127 -- ----------------------------------------------------------------------------
128 -- {Start Of Comments}
129 --
130 -- Description:
131 --   The dt_pre_delete process controls the execution of dml
132 --   for the datetrack modes: DELETE, FUTURE_CHANGE
133 --   and DELETE_NEXT_CHANGE only.
134 --
135 -- Prerequisites:
136 --   This is an internal procedure which is called from the pre_delete
137 --   procedure.
138 --
139 -- In Parameters:
140 --   A Pl/Sql record structure.
141 --
142 -- Post Success:
143 --   Processing continues.
144 --
145 -- Post Failure:
146 --   If an error has occurred, an error message and exception will be raised
147 --   but not handled.
148 --
149 -- Developer Implementation Notes:
150 --   This is an internal procedure which is required by Datetrack. Don't
151 --   remove or modify.
152 --
153 -- Access Status:
154 --   Internal Row Handler Use Only.
155 --
156 -- {End Of Comments}
157 -- ----------------------------------------------------------------------------
158 Procedure dt_pre_delete
159   (p_rec                     in out nocopy per_rei_shd.g_rec_type
160   ,p_effective_date          in date
161   ,p_datetrack_mode          in varchar2
162   ,p_validation_start_date   in date
163   ,p_validation_end_date     in date
164   ) is
165 --
166   l_proc        varchar2(72) := g_package||'dt_pre_delete';
167 --
168 Begin
169   hr_utility.set_location('Entering:'||l_proc, 5);
170   --
171   If (p_datetrack_mode <> hr_api.g_zap) then
172     --
173     p_rec.effective_start_date
174       := per_rei_shd.g_old_rec.effective_start_date;
175     --
176     If (p_datetrack_mode = hr_api.g_delete) then
177       p_rec.effective_end_date := p_validation_start_date - 1;
178     Else
179       p_rec.effective_end_date := p_validation_end_date;
180     End If;
181     --
182     -- Update the current effective end date record
183     --
184     per_rei_shd.upd_effective_end_date
185       (p_effective_date         => p_effective_date
186       ,p_base_key_value         => p_rec.contact_extra_info_id
187       ,p_new_effective_end_date => p_rec.effective_end_date
188       ,p_validation_start_date  => p_validation_start_date
189       ,p_validation_end_date    => p_validation_end_date
190       ,p_object_version_number            => p_rec.object_version_number
191       );
192   Else
193     p_rec.effective_start_date := null;
194     p_rec.effective_end_date   := null;
195   End If;
196   hr_utility.set_location(' Leaving:'||l_proc, 10);
197 End dt_pre_delete;
198 --
199 -- ----------------------------------------------------------------------------
200 -- |------------------------------< pre_delete >------------------------------|
201 -- ----------------------------------------------------------------------------
202 -- {Start Of Comments}
203 --
204 -- Description:
205 --   This private procedure contains any processing which is required before
206 --   the delete dml.
207 --
208 -- Prerequisites:
209 --   This is an internal procedure which is called from the del procedure.
210 --
211 -- In Parameters:
212 --   A Pl/Sql record structure.
213 --
214 -- Post Success:
215 --   Processing continues.
216 --
217 -- Post Failure:
218 --   If an error has occurred, an error message and exception will be raised
219 --   but not handled.
220 --
221 -- Developer Implementation Notes:
222 --   Any pre-processing required before the delete dml is issued should be
223 --   coded within this procedure. It is important to note that any 3rd party
224 --   maintenance should be reviewed before placing in this procedure. The call
225 --   to the dt_delete_dml procedure should NOT be removed.
226 --
227 -- Access Status:
228 --   Internal Row Handler Use Only.
229 --
230 -- {End Of Comments}
231 -- ----------------------------------------------------------------------------
232 Procedure pre_delete
233   (p_rec                   in out nocopy per_rei_shd.g_rec_type
234   ,p_effective_date        in date
235   ,p_datetrack_mode        in varchar2
236   ,p_validation_start_date in date
237   ,p_validation_end_date   in date
238   ) is
239 --
240   l_proc        varchar2(72) := g_package||'pre_delete';
241 --
242   --
243 --
244 Begin
245   hr_utility.set_location('Entering:'||l_proc, 5);
246   --
247 --
248   --
249   per_rei_del.dt_pre_delete
250     (p_rec                   => p_rec
251     ,p_effective_date        => p_effective_date
252     ,p_datetrack_mode        => p_datetrack_mode
253     ,p_validation_start_date => p_validation_start_date
254     ,p_validation_end_date   => p_validation_end_date
255     );
256   --
257   hr_utility.set_location(' Leaving:'||l_proc, 10);
258 End pre_delete;
259 --
260 -- ----------------------------------------------------------------------------
261 -- |----------------------------< post_delete >-------------------------------|
262 -- ----------------------------------------------------------------------------
263 -- {Start Of Comments}
264 --
265 -- Description:
266 --   This private procedure contains any processing which is required after
267 --   the delete dml.
268 --
269 -- Prerequisites:
270 --   This is an internal procedure which is called from the del procedure.
271 --
272 -- In Parameters:
273 --   A Pl/Sql record structure.
274 --
275 -- Post Success:
276 --   Processing continues.
277 --
278 -- Post Failure:
279 --   If an error has occurred, an error message and exception will be raised
280 --   but not handled.
281 --
282 -- Developer Implementation Notes:
283 --   Any post-processing required after the delete dml is issued should be
284 --   coded within this procedure. It is important to note that any 3rd party
285 --   maintenance should be reviewed before placing in this procedure.
286 --
287 -- Access Status:
288 --   Internal Row Handler Use Only.
289 --
290 -- {End Of Comments}
291 -- ----------------------------------------------------------------------------
292 Procedure post_delete
293   (p_rec                   in per_rei_shd.g_rec_type
294   ,p_effective_date        in date
295   ,p_datetrack_mode        in varchar2
296   ,p_validation_start_date in date
297   ,p_validation_end_date   in date
298   ) is
299 --
300   l_proc        varchar2(72) := g_package||'post_delete';
301 --
302 Begin
303   hr_utility.set_location('Entering:'||l_proc, 5);
304    begin
305     --
306     per_rei_rkd.after_delete
307       (p_effective_date
308       => p_effective_date
309       ,p_datetrack_mode
310       => p_datetrack_mode
311       ,p_validation_start_date
312       => p_validation_start_date
313       ,p_validation_end_date
314       => p_validation_end_date
315       ,p_contact_extra_info_id
316       => p_rec.contact_extra_info_id
317       ,p_effective_start_date
318       => p_rec.effective_start_date
319       ,p_effective_end_date
320       => p_rec.effective_end_date
321       ,p_effective_start_date_o
322       => per_rei_shd.g_old_rec.effective_start_date
323       ,p_effective_end_date_o
324       => per_rei_shd.g_old_rec.effective_end_date
325       ,p_contact_relationship_id_o
326       => per_rei_shd.g_old_rec.contact_relationship_id
327       ,p_information_type_o
328       => per_rei_shd.g_old_rec.information_type
329       ,p_cei_information_category_o
330       => per_rei_shd.g_old_rec.cei_information_category
331       ,p_cei_information1_o
332       => per_rei_shd.g_old_rec.cei_information1
333       ,p_cei_information2_o
334       => per_rei_shd.g_old_rec.cei_information2
335       ,p_cei_information3_o
336       => per_rei_shd.g_old_rec.cei_information3
337       ,p_cei_information4_o
338       => per_rei_shd.g_old_rec.cei_information4
339       ,p_cei_information5_o
340       => per_rei_shd.g_old_rec.cei_information5
341       ,p_cei_information6_o
342       => per_rei_shd.g_old_rec.cei_information6
343       ,p_cei_information7_o
344       => per_rei_shd.g_old_rec.cei_information7
345       ,p_cei_information8_o
346       => per_rei_shd.g_old_rec.cei_information8
347       ,p_cei_information9_o
348       => per_rei_shd.g_old_rec.cei_information9
349       ,p_cei_information10_o
350       => per_rei_shd.g_old_rec.cei_information10
351       ,p_cei_information11_o
352       => per_rei_shd.g_old_rec.cei_information11
353       ,p_cei_information12_o
354       => per_rei_shd.g_old_rec.cei_information12
355       ,p_cei_information13_o
356       => per_rei_shd.g_old_rec.cei_information13
357       ,p_cei_information14_o
358       => per_rei_shd.g_old_rec.cei_information14
359       ,p_cei_information15_o
360       => per_rei_shd.g_old_rec.cei_information15
361       ,p_cei_information16_o
362       => per_rei_shd.g_old_rec.cei_information16
363       ,p_cei_information17_o
364       => per_rei_shd.g_old_rec.cei_information17
365       ,p_cei_information18_o
366       => per_rei_shd.g_old_rec.cei_information18
367       ,p_cei_information19_o
368       => per_rei_shd.g_old_rec.cei_information19
369       ,p_cei_information20_o
370       => per_rei_shd.g_old_rec.cei_information20
371       ,p_cei_information21_o
372       => per_rei_shd.g_old_rec.cei_information21
373       ,p_cei_information22_o
374       => per_rei_shd.g_old_rec.cei_information22
378       => per_rei_shd.g_old_rec.cei_information24
375       ,p_cei_information23_o
376       => per_rei_shd.g_old_rec.cei_information23
377       ,p_cei_information24_o
379       ,p_cei_information25_o
380       => per_rei_shd.g_old_rec.cei_information25
381       ,p_cei_information26_o
382       => per_rei_shd.g_old_rec.cei_information26
383       ,p_cei_information27_o
384       => per_rei_shd.g_old_rec.cei_information27
385       ,p_cei_information28_o
386       => per_rei_shd.g_old_rec.cei_information28
387       ,p_cei_information29_o
388       => per_rei_shd.g_old_rec.cei_information29
389       ,p_cei_information30_o
390       => per_rei_shd.g_old_rec.cei_information30
391       ,p_cei_attribute_category_o
392       => per_rei_shd.g_old_rec.cei_attribute_category
393       ,p_cei_attribute1_o
394       => per_rei_shd.g_old_rec.cei_attribute1
395       ,p_cei_attribute2_o
396       => per_rei_shd.g_old_rec.cei_attribute2
397       ,p_cei_attribute3_o
398       => per_rei_shd.g_old_rec.cei_attribute3
399       ,p_cei_attribute4_o
400       => per_rei_shd.g_old_rec.cei_attribute4
401       ,p_cei_attribute5_o
402       => per_rei_shd.g_old_rec.cei_attribute5
403       ,p_cei_attribute6_o
404       => per_rei_shd.g_old_rec.cei_attribute6
405       ,p_cei_attribute7_o
406       => per_rei_shd.g_old_rec.cei_attribute7
407       ,p_cei_attribute8_o
408       => per_rei_shd.g_old_rec.cei_attribute8
409       ,p_cei_attribute9_o
410       => per_rei_shd.g_old_rec.cei_attribute9
411       ,p_cei_attribute10_o
412       => per_rei_shd.g_old_rec.cei_attribute10
413       ,p_cei_attribute11_o
414       => per_rei_shd.g_old_rec.cei_attribute11
415       ,p_cei_attribute12_o
416       => per_rei_shd.g_old_rec.cei_attribute12
417       ,p_cei_attribute13_o
418       => per_rei_shd.g_old_rec.cei_attribute13
419       ,p_cei_attribute14_o
420       => per_rei_shd.g_old_rec.cei_attribute14
421       ,p_cei_attribute15_o
422       => per_rei_shd.g_old_rec.cei_attribute15
423       ,p_cei_attribute16_o
424       => per_rei_shd.g_old_rec.cei_attribute16
425       ,p_cei_attribute17_o
426       => per_rei_shd.g_old_rec.cei_attribute17
427       ,p_cei_attribute18_o
428       => per_rei_shd.g_old_rec.cei_attribute18
429       ,p_cei_attribute19_o
430       => per_rei_shd.g_old_rec.cei_attribute19
431       ,p_cei_attribute20_o
432       => per_rei_shd.g_old_rec.cei_attribute20
433       ,p_object_version_number_o
434       => per_rei_shd.g_old_rec.object_version_number
435       ,p_request_id_o
436       => per_rei_shd.g_old_rec.request_id
437       ,p_program_application_id_o
438       => per_rei_shd.g_old_rec.program_application_id
439       ,p_program_id_o
440       => per_rei_shd.g_old_rec.program_id
441       ,p_program_update_date_o
442       => per_rei_shd.g_old_rec.program_update_date
443       );
444     --
445   exception
446     --
447     when hr_api.cannot_find_prog_unit then
448       --
449       hr_api.cannot_find_prog_unit_error
450         (p_module_name => 'PER_CONTACT_EXTRA_INFO_F'
451         ,p_hook_type   => 'AD');
452       --
453   end;
454   --
455   hr_utility.set_location(' Leaving:'||l_proc, 10);
456 End post_delete;
457 --
458 -- ----------------------------------------------------------------------------
459 -- |---------------------------------< del >----------------------------------|
460 -- ----------------------------------------------------------------------------
461 Procedure del
462   (p_effective_date in     date
463   ,p_datetrack_mode in     varchar2
464   ,p_rec            in out nocopy per_rei_shd.g_rec_type
465   ) is
466 --
467   l_proc                        varchar2(72) := g_package||'del';
468   l_validation_start_date       date;
469   l_validation_end_date         date;
470 --
471 Begin
472   hr_utility.set_location('Entering:'||l_proc, 5);
473   --
474   -- Ensure that the DateTrack delete mode is valid
475   --
476   dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
477   --
478   -- We must lock the row which we need to delete.
479   --
480   per_rei_shd.lck
481     (p_effective_date                   => p_effective_date
482     ,p_datetrack_mode                   => p_datetrack_mode
483     ,p_contact_extra_info_id            => p_rec.contact_extra_info_id
484     ,p_object_version_number            => p_rec.object_version_number
485     ,p_validation_start_date            => l_validation_start_date
486     ,p_validation_end_date              => l_validation_end_date
487     );
488   --
489   -- Call the supporting delete validate operation
490   --
491   per_rei_bus.delete_validate
492     (p_rec                              => p_rec
493     ,p_effective_date                   => p_effective_date
494     ,p_datetrack_mode                   => p_datetrack_mode
495     ,p_validation_start_date            => l_validation_start_date
496     ,p_validation_end_date              => l_validation_end_date
497     );
498   --
499   -- Call to raise any errors on multi-message list
500   hr_multi_message.end_validation_set;
501   --
502   -- Call the supporting pre-delete operation
503   --
504   per_rei_del.pre_delete
505     (p_rec                              => p_rec
509     ,p_validation_end_date              => l_validation_end_date
506     ,p_effective_date                   => p_effective_date
507     ,p_datetrack_mode                   => p_datetrack_mode
508     ,p_validation_start_date            => l_validation_start_date
510     );
511   --
512   -- Delete the row.
513   --
514   per_rei_del.delete_dml
515     (p_rec                              => p_rec
516     ,p_effective_date                   => p_effective_date
517     ,p_datetrack_mode                   => p_datetrack_mode
518     ,p_validation_start_date            => l_validation_start_date
519     ,p_validation_end_date              => l_validation_end_date
520     );
521   -- Call the supporting post-delete operation
522   --
523   per_rei_del.post_delete
524     (p_rec                              => p_rec
525     ,p_effective_date                   => p_effective_date
526     ,p_datetrack_mode                   => p_datetrack_mode
527     ,p_validation_start_date            => l_validation_start_date
528     ,p_validation_end_date              => l_validation_end_date
529     );
530   --
531   -- Call to raise any errors on multi-message list
532   hr_multi_message.end_validation_set;
533   --
534   hr_utility.set_location(' Leaving:'||l_proc, 5);
535 End del;
536 --
537 -- ----------------------------------------------------------------------------
538 -- |--------------------------------< del >-----------------------------------|
539 -- ----------------------------------------------------------------------------
540 Procedure del
541   (p_effective_date                   in     date
542   ,p_datetrack_mode                   in     varchar2
543   ,p_contact_extra_info_id            in     number
544   ,p_object_version_number            in out nocopy number
545   ,p_effective_start_date                out nocopy date
546   ,p_effective_end_date                  out nocopy date
547   ) is
548 --
549   l_rec         per_rei_shd.g_rec_type;
550   l_proc        varchar2(72) := g_package||'del';
551 --
552 Begin
553   hr_utility.set_location('Entering:'||l_proc, 5);
554   --
555   -- As the delete procedure accepts a plsql record structure we do need to
556   -- convert the  arguments into the record structure.
557   -- We don't need to call the supplied conversion argument routine as we
558   -- only need a few attributes.
559   --
560   l_rec.contact_extra_info_id          := p_contact_extra_info_id;
561   l_rec.object_version_number     := p_object_version_number;
562   --
563   -- Having converted the arguments into the per_rei_rec
564   -- plsql record structure we must call the corresponding entity
565   -- business process
566   --
567   per_rei_del.del
568      (p_effective_date
569      ,p_datetrack_mode
570      ,l_rec
571      );
572   --
573   --
574   -- Set the out arguments
575   --
576   p_object_version_number            := l_rec.object_version_number;
577   p_effective_start_date             := l_rec.effective_start_date;
578   p_effective_end_date               := l_rec.effective_end_date;
579   --
580   hr_utility.set_location(' Leaving:'||l_proc, 10);
581 End del;
582 --
583 end per_rei_del;