DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_DIS_DEL

Source


1 Package Body per_dis_del as
2 /* $Header: pedisrhi.pkb 115.8 2002/12/04 18:57:24 pkakar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_dis_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_dis_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 per_disabilities_f
72     where       disability_id = p_rec.disability_id
73     and	  effective_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 per_disabilities_f
83     where        disability_id = p_rec.disability_id
84     and	  effective_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 per_dis_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   per_dis_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 per_dis_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.effective_start_date
169       := per_dis_shd.g_old_rec.effective_start_date;
170     --
171     If (p_datetrack_mode = hr_api.g_delete) then
172       p_rec.effective_end_date := p_validation_start_date - 1;
173     Else
174       p_rec.effective_end_date := p_validation_end_date;
175     End If;
176     --
177     -- Update the current effective end date record
178     --
179     per_dis_shd.upd_effective_end_date
180       (p_effective_date	        => p_effective_date
181       ,p_base_key_value	        => p_rec.disability_id
182       ,p_new_effective_end_date => p_rec.effective_end_date
183       ,p_validation_start_date  => p_validation_start_date
184       ,p_validation_end_date	=> p_validation_end_date
185       ,p_object_version_number            => p_rec.object_version_number
186       );
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 structure.
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 per_dis_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
233   ) is
234 --
235   l_proc	varchar2(72) := g_package||'pre_delete';
236 --
237   --
238 --
239 Begin
240   hr_utility.set_location('Entering:'||l_proc, 5);
241   --
242 --
243   --
244   per_dis_del.dt_pre_delete
245     (p_rec                   => p_rec
246     ,p_effective_date        => p_effective_date
247     ,p_datetrack_mode        => p_datetrack_mode
248     ,p_validation_start_date => p_validation_start_date
249     ,p_validation_end_date   => p_validation_end_date
250     );
251   --
252   hr_utility.set_location(' Leaving:'||l_proc, 10);
253 End pre_delete;
254 --
255 -- ----------------------------------------------------------------------------
256 -- |----------------------------< post_delete >-------------------------------|
257 -- ----------------------------------------------------------------------------
258 -- {Start Of Comments}
259 --
260 -- Description:
261 --   This private procedure contains any processing which is required after the
262 --   delete dml.
263 --
264 -- Prerequisites:
265 --   This is an internal procedure which is called from the del procedure.
266 --
267 -- In Parameters:
268 --   A Pl/Sql record structure.
269 --
270 -- Post Success:
271 --   Processing continues.
272 --
273 -- Post Failure:
274 --   If an error has occurred, an error message and exception will be raised
275 --   but not handled.
276 --
277 -- Developer Implementation Notes:
278 --   Any post-processing required after the delete dml is issued should be
279 --   coded within this procedure. It is important to note that any 3rd party
280 --   maintenance should be reviewed before placing in this procedure.
281 --
282 -- Access Status:
283 --   Internal Row Handler Use Only.
284 --
285 -- {End Of Comments}
286 -- ----------------------------------------------------------------------------
287 Procedure post_delete
288   (p_rec                   in per_dis_shd.g_rec_type
289   ,p_effective_date        in date
290   ,p_datetrack_mode        in varchar2
291   ,p_validation_start_date in date
292   ,p_validation_end_date   in date
293   ) is
294 --
295   l_proc	varchar2(72) := g_package||'post_delete';
296 --
297 Begin
298   hr_utility.set_location('Entering:'||l_proc, 5);
299    begin
300     --
301     per_dis_rkd.after_delete
302       (p_effective_date
303       => p_effective_date
304       ,p_datetrack_mode
305       => p_datetrack_mode
306       ,p_validation_start_date
307       => p_validation_start_date
308       ,p_validation_end_date
309       => p_validation_end_date
310       ,p_disability_id
311       => p_rec.disability_id
312       ,p_effective_start_date
313       => p_rec.effective_start_date
314       ,p_effective_end_date
315       => p_rec.effective_end_date
316       ,p_effective_start_date_o
317       => per_dis_shd.g_old_rec.effective_start_date
318       ,p_effective_end_date_o
319       => per_dis_shd.g_old_rec.effective_end_date
320       ,p_person_id_o
321       => per_dis_shd.g_old_rec.person_id
322       ,p_incident_id_o
323       => per_dis_shd.g_old_rec.incident_id
324       ,p_organization_id_o
325       => per_dis_shd.g_old_rec.organization_id
326       ,p_registration_id_o
327       => per_dis_shd.g_old_rec.registration_id
328       ,p_registration_date_o
329       => per_dis_shd.g_old_rec.registration_date
330       ,p_registration_exp_date_o
331       => per_dis_shd.g_old_rec.registration_exp_date
332       ,p_category_o
333       => per_dis_shd.g_old_rec.category
334       ,p_status_o
335       => per_dis_shd.g_old_rec.status
336       ,p_description_o
337       => per_dis_shd.g_old_rec.description
338       ,p_degree_o
339       => per_dis_shd.g_old_rec.degree
340       ,p_quota_fte_o
341       => per_dis_shd.g_old_rec.quota_fte
342       ,p_reason_o
343       => per_dis_shd.g_old_rec.reason
344       ,p_pre_registration_job_o
345       => per_dis_shd.g_old_rec.pre_registration_job
346       ,p_work_restriction_o
347       => per_dis_shd.g_old_rec.work_restriction
348       ,p_attribute_category_o
349       => per_dis_shd.g_old_rec.attribute_category
350       ,p_attribute1_o
351       => per_dis_shd.g_old_rec.attribute1
352       ,p_attribute2_o
353       => per_dis_shd.g_old_rec.attribute2
354       ,p_attribute3_o
355       => per_dis_shd.g_old_rec.attribute3
356       ,p_attribute4_o
357       => per_dis_shd.g_old_rec.attribute4
358       ,p_attribute5_o
359       => per_dis_shd.g_old_rec.attribute5
360       ,p_attribute6_o
361       => per_dis_shd.g_old_rec.attribute6
362       ,p_attribute7_o
363       => per_dis_shd.g_old_rec.attribute7
364       ,p_attribute8_o
365       => per_dis_shd.g_old_rec.attribute8
366       ,p_attribute9_o
367       => per_dis_shd.g_old_rec.attribute9
368       ,p_attribute10_o
369       => per_dis_shd.g_old_rec.attribute10
370       ,p_attribute11_o
371       => per_dis_shd.g_old_rec.attribute11
372       ,p_attribute12_o
373       => per_dis_shd.g_old_rec.attribute12
374       ,p_attribute13_o
375       => per_dis_shd.g_old_rec.attribute13
376       ,p_attribute14_o
377       => per_dis_shd.g_old_rec.attribute14
378       ,p_attribute15_o
379       => per_dis_shd.g_old_rec.attribute15
380       ,p_attribute16_o
381       => per_dis_shd.g_old_rec.attribute16
382       ,p_attribute17_o
383       => per_dis_shd.g_old_rec.attribute17
384       ,p_attribute18_o
385       => per_dis_shd.g_old_rec.attribute18
386       ,p_attribute19_o
387       => per_dis_shd.g_old_rec.attribute19
388       ,p_attribute20_o
389       => per_dis_shd.g_old_rec.attribute20
390       ,p_attribute21_o
391       => per_dis_shd.g_old_rec.attribute21
392       ,p_attribute22_o
393       => per_dis_shd.g_old_rec.attribute22
394       ,p_attribute23_o
395       => per_dis_shd.g_old_rec.attribute23
396       ,p_attribute24_o
397       => per_dis_shd.g_old_rec.attribute24
398       ,p_attribute25_o
399       => per_dis_shd.g_old_rec.attribute25
400       ,p_attribute26_o
401       => per_dis_shd.g_old_rec.attribute26
402       ,p_attribute27_o
403       => per_dis_shd.g_old_rec.attribute27
404       ,p_attribute28_o
405       => per_dis_shd.g_old_rec.attribute28
406       ,p_attribute29_o
407       => per_dis_shd.g_old_rec.attribute29
408       ,p_attribute30_o
409       => per_dis_shd.g_old_rec.attribute30
410       ,p_dis_information_category_o
411       => per_dis_shd.g_old_rec.dis_information_category
412       ,p_dis_information1_o
413       => per_dis_shd.g_old_rec.dis_information1
414       ,p_dis_information2_o
415       => per_dis_shd.g_old_rec.dis_information2
416       ,p_dis_information3_o
417       => per_dis_shd.g_old_rec.dis_information3
418       ,p_dis_information4_o
419       => per_dis_shd.g_old_rec.dis_information4
420       ,p_dis_information5_o
421       => per_dis_shd.g_old_rec.dis_information5
422       ,p_dis_information6_o
423       => per_dis_shd.g_old_rec.dis_information6
424       ,p_dis_information7_o
425       => per_dis_shd.g_old_rec.dis_information7
426       ,p_dis_information8_o
427       => per_dis_shd.g_old_rec.dis_information8
428       ,p_dis_information9_o
429       => per_dis_shd.g_old_rec.dis_information9
430       ,p_dis_information10_o
431       => per_dis_shd.g_old_rec.dis_information10
432       ,p_dis_information11_o
433       => per_dis_shd.g_old_rec.dis_information11
434       ,p_dis_information12_o
435       => per_dis_shd.g_old_rec.dis_information12
436       ,p_dis_information13_o
437       => per_dis_shd.g_old_rec.dis_information13
438       ,p_dis_information14_o
439       => per_dis_shd.g_old_rec.dis_information14
440       ,p_dis_information15_o
441       => per_dis_shd.g_old_rec.dis_information15
442       ,p_dis_information16_o
443       => per_dis_shd.g_old_rec.dis_information16
444       ,p_dis_information17_o
445       => per_dis_shd.g_old_rec.dis_information17
446       ,p_dis_information18_o
447       => per_dis_shd.g_old_rec.dis_information18
448       ,p_dis_information19_o
449       => per_dis_shd.g_old_rec.dis_information19
450       ,p_dis_information20_o
451       => per_dis_shd.g_old_rec.dis_information20
452       ,p_dis_information21_o
453       => per_dis_shd.g_old_rec.dis_information21
454       ,p_dis_information22_o
455       => per_dis_shd.g_old_rec.dis_information22
456       ,p_dis_information23_o
457       => per_dis_shd.g_old_rec.dis_information23
458       ,p_dis_information24_o
459       => per_dis_shd.g_old_rec.dis_information24
460       ,p_dis_information25_o
461       => per_dis_shd.g_old_rec.dis_information25
462       ,p_dis_information26_o
463       => per_dis_shd.g_old_rec.dis_information26
464       ,p_dis_information27_o
465       => per_dis_shd.g_old_rec.dis_information27
466       ,p_dis_information28_o
467       => per_dis_shd.g_old_rec.dis_information28
468       ,p_dis_information29_o
469       => per_dis_shd.g_old_rec.dis_information29
470       ,p_dis_information30_o
471       => per_dis_shd.g_old_rec.dis_information30
472       ,p_object_version_number_o
473       => per_dis_shd.g_old_rec.object_version_number
474       );
475     --
476   exception
477     --
478     when hr_api.cannot_find_prog_unit then
479       --
480       hr_api.cannot_find_prog_unit_error
481         (p_module_name => 'PER_DISABILITIES_F'
482         ,p_hook_type   => 'AD');
483       --
484   end;
485   --
486   hr_utility.set_location(' Leaving:'||l_proc, 10);
487 End post_delete;
488 --
489 -- ----------------------------------------------------------------------------
490 -- |---------------------------------< del >----------------------------------|
491 -- ----------------------------------------------------------------------------
492 Procedure del
493   (p_effective_date in     date
494   ,p_datetrack_mode in     varchar2
495   ,p_rec            in out nocopy per_dis_shd.g_rec_type
496   ) is
497 --
498   l_proc			varchar2(72) := g_package||'del';
499   l_validation_start_date	date;
500   l_validation_end_date		date;
501 --
502 Begin
503   hr_utility.set_location('Entering:'||l_proc, 5);
504   --
505   -- Ensure that the DateTrack delete mode is valid
506   --
507   dt_api.validate_dt_del_mode(p_datetrack_mode => p_datetrack_mode);
508   --
509   -- We must lock the row which we need to delete.
510   --
511   per_dis_shd.lck
512     (p_effective_date                   => p_effective_date
513     ,p_datetrack_mode                   => p_datetrack_mode
514     ,p_disability_id                    => p_rec.disability_id
515     ,p_object_version_number            => p_rec.object_version_number
516     ,p_validation_start_date            => l_validation_start_date
517     ,p_validation_end_date              => l_validation_end_date
518     );
519   --
520   -- Call the supporting delete validate operation
521   --
522   per_dis_bus.delete_validate
523     (p_rec                              => p_rec
524     ,p_effective_date                   => p_effective_date
525     ,p_datetrack_mode                   => p_datetrack_mode
526     ,p_validation_start_date            => l_validation_start_date
527     ,p_validation_end_date              => l_validation_end_date
528     );
529   --
530   -- Call the supporting pre-delete operation
531   --
532   per_dis_del.pre_delete
533     (p_rec                              => p_rec
534     ,p_effective_date                   => p_effective_date
535     ,p_datetrack_mode                   => p_datetrack_mode
536     ,p_validation_start_date            => l_validation_start_date
537     ,p_validation_end_date              => l_validation_end_date
538     );
539   --
540   -- Delete the row.
541   --
542   per_dis_del.delete_dml
543     (p_rec                              => p_rec
544     ,p_effective_date                   => p_effective_date
545     ,p_datetrack_mode                   => p_datetrack_mode
546     ,p_validation_start_date            => l_validation_start_date
547     ,p_validation_end_date              => l_validation_end_date
548     );
549   -- Call the supporting post-delete operation
550   --
551   per_dis_del.post_delete
552     (p_rec                              => p_rec
553     ,p_effective_date                   => p_effective_date
554     ,p_datetrack_mode                   => p_datetrack_mode
555     ,p_validation_start_date            => l_validation_start_date
556     ,p_validation_end_date              => l_validation_end_date
557     );
558   --
559   hr_utility.set_location(' Leaving:'||l_proc, 5);
560 End del;
561 --
562 -- ----------------------------------------------------------------------------
563 -- |--------------------------------< del >-----------------------------------|
564 -- ----------------------------------------------------------------------------
565 Procedure del
566   (p_effective_date                   in     date
567   ,p_datetrack_mode                   in     varchar2
568   ,p_disability_id                    in     number
569   ,p_object_version_number            in out nocopy number
570   ,p_effective_start_date                out nocopy date
571   ,p_effective_end_date	                 out nocopy date
572   ) is
573 --
574   l_rec		per_dis_shd.g_rec_type;
575   l_proc	varchar2(72) := g_package||'del';
576 --
577 Begin
578   hr_utility.set_location('Entering:'||l_proc, 5);
579   --
580   -- As the delete procedure accepts a plsql record structure we do need to
581   -- convert the  arguments into the record structure.
582   -- We don't need to call the supplied conversion argument routine as we
583   -- only need a few attributes.
584   --
585   l_rec.disability_id		:= p_disability_id;
586   l_rec.object_version_number 	:= p_object_version_number;
587   --
588   -- Having converted the arguments into the per_dis_rec
589   -- plsql record structure we must call the corresponding entity
590   -- business process
591   --
592   per_dis_del.del
593      (p_effective_date
594      ,p_datetrack_mode
595      ,l_rec
596      );
597   --
598   -- Set the out arguments
599   --
600   p_object_version_number            := l_rec.object_version_number;
601   p_effective_start_date             := l_rec.effective_start_date;
602   p_effective_end_date               := l_rec.effective_end_date;
603   --
604   hr_utility.set_location(' Leaving:'||l_proc, 10);
605 End del;
606 --
607 end per_dis_del;