DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CTK_DEL

Source


1 Package Body per_ctk_del as
2 /* $Header: pectkrhi.pkb 120.7 2006/09/11 20:45:03 sturlapa noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ctk_del.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< delete_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml delete logic. The functions of
17 --   this procedure are as follows:
18 --   1) To set and unset the g_api_dml status as required (as we are about to
19 --      perform dml).
20 --   2) To delete the specified row from the schema using the primary key in
21 --      the predicates.
22 --   3) To trap any constraint violations that may have occurred.
23 --   4) To raise any other errors.
24 --
25 -- Prerequisites:
26 --   This is an internal private procedure which must be called from the del
27 --   procedure.
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be delete from the schema.
34 --
35 -- Post Failure:
36 --   On the delete dml failure it is important to note that we always reset the
37 --   g_api_dml status to false.
38 --   If a child integrity constraint violation is raised the
39 --   constraint_error procedure will be called.
40 --   If any other error is reported, the error will be raised after the
41 --   g_api_dml status is reset.
42 --
43 -- Developer Implementation Notes:
44 --   None.
45 --
46 -- Access Status:
47 --   Internal Row Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml
52   (p_rec in per_ctk_shd.g_rec_type
53   ) is
54 --
55   l_proc  varchar2(72) := g_package||'delete_dml';
56 --
57 Begin
58   hr_utility.set_location('Entering:'||l_proc, 5);
59   --
60   --
61   --
62   -- Delete the per_tasks_in_checklist row.
63   --
64   delete from per_tasks_in_checklist
65   where task_in_checklist_id = p_rec.task_in_checklist_id;
66   --
67   --
68   --
69   hr_utility.set_location(' Leaving:'||l_proc, 10);
70 --
71 Exception
72   When hr_api.child_integrity_violated then
73     -- Child integrity has been violated
74     --
75     per_ctk_shd.constraint_error
76       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
77   When Others Then
78     --
79     Raise;
80 End delete_dml;
81 --
82 -- ----------------------------------------------------------------------------
83 -- |------------------------------< pre_delete >------------------------------|
84 -- ----------------------------------------------------------------------------
85 -- {Start Of Comments}
86 --
87 -- Description:
88 --   This private procedure contains any processing which is required before
89 --   the delete dml.
90 --
91 -- Prerequisites:
92 --   This is an internal procedure which is called from the del procedure.
93 --
94 -- In Parameters:
95 --   A Pl/Sql record structre.
96 --
97 -- Post Success:
98 --   Processing continues.
99 --
100 -- Post Failure:
101 --   If an error has occurred, an error message and exception will be raised
102 --   but not handled.
103 --
104 -- Developer Implementation Notes:
105 --   Any pre-processing required before the delete dml is issued should be
106 --   coded within this procedure. It is important to note that any 3rd party
107 --   maintenance should be reviewed before placing in this procedure.
108 --
109 -- Access Status:
110 --   Internal Row Handler Use Only.
111 --
112 -- {End Of Comments}
113 -- ----------------------------------------------------------------------------
114 Procedure pre_delete(p_rec in per_ctk_shd.g_rec_type) is
115 --
116   l_proc  varchar2(72) := g_package||'pre_delete';
117 --
118  -- for elgiy object
119 
120   cursor c_elig_obj (p_elig_objid number) is
121       select object_version_number,effective_start_date
122   from ben_elig_obj_f
123   where elig_obj_id = p_elig_objid;
124 
125   -- for eligy profile and eligy object
126   cursor c_elig_prfl_elig_obj (c_elig_prfl_id number, c_elig_obj_id number) is
127   select
128     elig_obj_elig_prfl_id,
129     object_version_number,
130     effective_start_date
131   from
132    ben_elig_obj_elig_profl_f
133   where elig_obj_id = c_elig_obj_id and elig_prfl_id=c_elig_prfl_id;
134 
135 
136   l_elig_obj_id           number;
137   l_elig_obj_elig_prfl_id number;
138   l_prf_ovn               number;
139   l_obj_ovn               number;
140   l_prf_obj_ovn           number;
141   l_effective_start_date  date;
142   l_effective_end_date    date;
143   l_effective_date        date;
144 Begin
145    hr_utility.set_location('Entering:'||l_proc, 10);
146    --
147      if ( nvl(per_ctk_shd.g_old_rec.eligibility_profile_id, hr_api.g_number) <> hr_api.g_number  AND
148       nvl(per_ctk_shd.g_old_rec.eligibility_profile_id, hr_api.g_number) <> nvl(p_rec.eligibility_profile_id, hr_api.g_number))   then
149 
150       -- delete old eligy profile eligy object (child)
151         open c_elig_prfl_elig_obj(per_ctk_shd.g_old_rec.eligibility_profile_id, per_ctk_shd.g_old_rec.eligibility_object_id);
152           fetch c_elig_prfl_elig_obj into l_elig_obj_elig_prfl_id,l_prf_obj_ovn,l_effective_date;
153           if(c_elig_prfl_elig_obj%found) then
154            begin
155                 ben_ELIG_OBJ_ELIG_PROFL_api.delete_elig_obj_elig_profl
156                 (
157                     p_validate=> false,
158                     p_elig_obj_elig_prfl_id=>l_elig_obj_elig_prfl_id,
159                     p_effective_start_date=>l_effective_start_date,
160                     p_effective_end_date=>l_effective_end_date,
161                     p_object_version_number=>l_prf_obj_ovn,
162                     p_effective_date=>l_effective_date,
163                     p_datetrack_mode =>'ZAP'
164                  );
165            exception
166 
167             when others then
168                close c_elig_prfl_elig_obj;
169                raise;
170            end;
171           end if;
172         close c_elig_prfl_elig_obj;
173 
174 
175         open c_elig_obj(per_ctk_shd.g_old_rec.eligibility_object_id);
176           fetch c_elig_obj into l_obj_ovn,l_effective_date;
177           if(c_elig_obj%found) then
178             begin
179                     ben_elig_obj_api.delete_elig_obj
180                     (
181                         p_validate=>false,
182                         p_elig_obj_id=>per_ctk_shd.g_old_rec.eligibility_object_id,
183                         p_effective_start_date=>l_effective_start_date,
184                         p_effective_end_date=>l_effective_end_date,
185                         p_object_version_number=>l_obj_ovn,
186                         p_effective_date=>l_effective_date,
187                         p_datetrack_mode=>'ZAP'
188                     );
189             exception
190             when others then
191                 close c_elig_obj;
192                 raise;
193             end;
194           end if;
195         close c_elig_obj;
196    end if;
197   hr_utility.set_location(' Leaving:'||l_proc, 10);
198 End pre_delete;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |-----------------------------< post_delete >------------------------------|
202 -- ----------------------------------------------------------------------------
203 -- {Start Of Comments}
204 --
205 -- Description:
206 --   This private procedure contains any processing which is required after
207 --   the delete dml.
208 --
209 -- Prerequistes:
210 --   This is an internal procedure which is called from the del procedure.
211 --
212 -- In Parameters:
213 --   A Pl/Sql record structure.
214 --
215 -- Post Success:
216 --   Processing continues.
217 --
218 -- Post Failure:
219 --   If an error has occurred, an error message and exception will be raised
220 --   but not handled.
221 --
222 -- Developer Implementation Notes:
223 --   Any post-processing required after the delete dml is issued should be
224 --   coded within this procedure. It is important to note that any 3rd party
225 --   maintenance should be reviewed before placing in this procedure.
226 --
227 -- Access Status:
228 --   Internal Row Handler Use Only.
229 --
230 -- {End Of Comments}
231 -- -----------------------------------------------------------------------------
232 Procedure post_delete(p_rec in per_ctk_shd.g_rec_type) is
233 --
234   l_proc  varchar2(72) := g_package||'post_delete';
235 --
236 Begin
237   hr_utility.set_location('Entering:'||l_proc, 5);
238   begin
239     --
240     per_ctk_rkd.after_delete
241       (p_task_in_checklist_id
242       => p_rec.task_in_checklist_id
243       ,p_checklist_id_o
244       => per_ctk_shd.g_old_rec.checklist_id
245       ,p_checklist_task_name_o
246       => per_ctk_shd.g_old_rec.checklist_task_name
247       ,p_eligibility_object_id_o
248       => per_ctk_shd.g_old_rec.eligibility_object_id
249       ,p_eligibility_profile_id_o
250       => per_ctk_shd.g_old_rec.eligibility_profile_id
251       ,p_ame_attribute_identifier_o
252       => per_ctk_shd.g_old_rec.ame_attribute_identifier
253       ,p_description_o
254       => per_ctk_shd.g_old_rec.description
255       ,p_mandatory_flag_o
256       => per_ctk_shd.g_old_rec.mandatory_flag
257       ,p_target_duration_o
258       => per_ctk_shd.g_old_rec.target_duration
259       ,p_target_duration_uom_o
260       => per_ctk_shd.g_old_rec.target_duration_uom
261       ,p_task_sequence_o
262       => per_ctk_shd.g_old_rec.task_sequence
263       ,p_object_version_number_o
264       => per_ctk_shd.g_old_rec.object_version_number
265       ,p_action_url_o
266       => per_ctk_shd.g_old_rec.action_url
267       ,p_attribute_category_o
268       => per_ctk_shd.g_old_rec.attribute_category
269       ,p_attribute1_o
270       => per_ctk_shd.g_old_rec.attribute1
271       ,p_attribute2_o
272       => per_ctk_shd.g_old_rec.attribute2
273       ,p_attribute3_o
274       => per_ctk_shd.g_old_rec.attribute3
275       ,p_attribute4_o
276       => per_ctk_shd.g_old_rec.attribute4
277       ,p_attribute5_o
278       => per_ctk_shd.g_old_rec.attribute5
279       ,p_attribute6_o
280       => per_ctk_shd.g_old_rec.attribute6
281       ,p_attribute7_o
282       => per_ctk_shd.g_old_rec.attribute7
283       ,p_attribute8_o
284       => per_ctk_shd.g_old_rec.attribute8
285       ,p_attribute9_o
286       => per_ctk_shd.g_old_rec.attribute9
287       ,p_attribute10_o
288       => per_ctk_shd.g_old_rec.attribute10
289       ,p_attribute11_o
290       => per_ctk_shd.g_old_rec.attribute11
291       ,p_attribute12_o
292       => per_ctk_shd.g_old_rec.attribute12
293       ,p_attribute13_o
294       => per_ctk_shd.g_old_rec.attribute13
295       ,p_attribute14_o
296       => per_ctk_shd.g_old_rec.attribute14
297       ,p_attribute15_o
298       => per_ctk_shd.g_old_rec.attribute15
299       ,p_attribute16_o
300       => per_ctk_shd.g_old_rec.attribute16
301       ,p_attribute17_o
302       => per_ctk_shd.g_old_rec.attribute17
303       ,p_attribute18_o
304       => per_ctk_shd.g_old_rec.attribute18
305       ,p_attribute19_o
306       => per_ctk_shd.g_old_rec.attribute19
307       ,p_attribute20_o
308       => per_ctk_shd.g_old_rec.attribute20
309       ,p_information_category_o
310       => per_ctk_shd.g_old_rec.information_category
311       ,p_information1_o
312       => per_ctk_shd.g_old_rec.information1
313       ,p_information2_o
314       => per_ctk_shd.g_old_rec.information2
315       ,p_information3_o
316       => per_ctk_shd.g_old_rec.information3
317       ,p_information4_o
318       => per_ctk_shd.g_old_rec.information4
319       ,p_information5_o
320       => per_ctk_shd.g_old_rec.information5
321       ,p_information6_o
322       => per_ctk_shd.g_old_rec.information6
323       ,p_information7_o
324       => per_ctk_shd.g_old_rec.information7
325       ,p_information8_o
326       => per_ctk_shd.g_old_rec.information8
327       ,p_information9_o
328       => per_ctk_shd.g_old_rec.information9
329       ,p_information10_o
330       => per_ctk_shd.g_old_rec.information10
331       ,p_information11_o
332       => per_ctk_shd.g_old_rec.information11
333       ,p_information12_o
334       => per_ctk_shd.g_old_rec.information12
335       ,p_information13_o
336       => per_ctk_shd.g_old_rec.information13
337       ,p_information14_o
338       => per_ctk_shd.g_old_rec.information14
339       ,p_information15_o
340       => per_ctk_shd.g_old_rec.information15
341       ,p_information16_o
342       => per_ctk_shd.g_old_rec.information16
343       ,p_information17_o
344       => per_ctk_shd.g_old_rec.information17
345       ,p_information18_o
346       => per_ctk_shd.g_old_rec.information18
347       ,p_information19_o
348       => per_ctk_shd.g_old_rec.information19
349       ,p_information20_o
350       => per_ctk_shd.g_old_rec.information20
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 => 'PER_TASKS_IN_CHECKLIST'
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_rec              in per_ctk_shd.g_rec_type
371   ) is
372 --
373   l_proc  varchar2(72) := g_package||'del';
374 --
375 Begin
376   hr_utility.set_location('Entering:'||l_proc, 5);
377   --
378   -- We must lock the row which we need to delete.
379   --
380   per_ctk_shd.lck
381     (p_rec.task_in_checklist_id
382     ,p_rec.object_version_number
383     );
384   --
385   -- Call the supporting delete validate operation
386   --
387   per_ctk_bus.delete_validate(p_rec);
388   --
389   -- Call to raise any errors on multi-message list
390   hr_multi_message.end_validation_set;
391   --
392   -- Call the supporting pre-delete operation
393   --
394   per_ctk_del.pre_delete(p_rec);
395   --
396   -- Delete the row.
397   --
398   per_ctk_del.delete_dml(p_rec);
399   --
400   -- Call the supporting post-delete operation
401   --
402   per_ctk_del.post_delete(p_rec);
403   --
404   -- Call to raise any errors on multi-message list
405   hr_multi_message.end_validation_set;
406   --
407 End del;
408 --
409 -- ----------------------------------------------------------------------------
410 -- |---------------------------------< del >----------------------------------|
411 -- ----------------------------------------------------------------------------
412 Procedure del
413   (p_task_in_checklist_id                 in     number
414   ,p_object_version_number                in     number
415   ) is
416 --
417   l_rec   per_ctk_shd.g_rec_type;
418   l_proc  varchar2(72) := g_package||'del';
419 --
420 Begin
421   hr_utility.set_location('Entering:'||l_proc, 5);
422   --
423   -- As the delete procedure accepts a plsql record structure we do need to
424   -- convert the  arguments into the record structure.
425   -- We don't need to call the supplied conversion argument routine as we
426   -- only need a few attributes.
427   --
428   l_rec.task_in_checklist_id := p_task_in_checklist_id;
429   l_rec.object_version_number := p_object_version_number;
430   --
431   -- Having converted the arguments into the per_ctk_rec
432   -- plsql record structure we must call the corresponding entity
433   -- business process
434   --
435   per_ctk_del.del(l_rec);
436   --
437   hr_utility.set_location(' Leaving:'||l_proc, 10);
438 End del;
439 --
440 end per_ctk_del;