DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CTR_DEL

Source


1 Package Body per_ctr_del as
2 /* $Header: pectrrhi.pkb 120.0.12000000.2 2007/02/19 11:59:36 ssutar ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ctr_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 -- Pre Conditions:
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 Table Handler Use Only.
48 --
49 -- {End Of Comments}
50 -- ----------------------------------------------------------------------------
51 Procedure delete_dml(p_rec in per_ctr_shd.g_rec_type) is
52 --
53   l_proc  varchar2(72) := g_package||'delete_dml';
54 --
55 Begin
56   hr_utility.set_location('Entering:'||l_proc, 5);
57   --
58   per_ctr_shd.g_api_dml := true;  -- Set the api dml status
59   --
60   -- Delete the per_contact_relationships row.
61   --
62   delete from per_contact_relationships
63   where contact_relationship_id = p_rec.contact_relationship_id;
64   --
65   per_ctr_shd.g_api_dml := false;   -- Unset the api dml status
66   --
67   hr_utility.set_location(' Leaving:'||l_proc, 10);
68 --
69 Exception
70   When hr_api.child_integrity_violated then
71     -- Child integrity has been violated
72     per_ctr_shd.g_api_dml := false;   -- Unset the api dml status
73     per_ctr_shd.constraint_error
74       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
75   When Others Then
76     per_ctr_shd.g_api_dml := false;   -- Unset the api dml status
77     Raise;
78 End delete_dml;
79 --
80 -- ----------------------------------------------------------------------------
81 -- |------------------------------< pre_delete >------------------------------|
82 -- ----------------------------------------------------------------------------
83 -- {Start Of Comments}
84 --
85 -- Description:
86 --   This private procedure contains any processing which is required before
87 --   the delete dml.
88 --
89 -- Pre Conditions:
90 --   This is an internal procedure which is called from the del procedure.
91 --
92 -- In Parameters:
93 --   A Pl/Sql record structre.
94 --
95 -- Post Success:
96 --   Processing continues.
97 --
98 -- Post Failure:
99 --   If an error has occurred, an error message and exception will be raised
100 --   but not handled.
101 --
102 -- Developer Implementation Notes:
103 --   Any pre-processing required before the delete dml is issued should be
104 --   coded within this procedure. It is important to note that any 3rd party
105 --   maintenance should be reviewed before placing in this procedure.
106 --
107 -- Access Status:
108 --   Internal Table Handler Use Only.
109 --
110 -- {End Of Comments}
111 -- ----------------------------------------------------------------------------
112 Procedure pre_delete(p_rec in per_ctr_shd.g_rec_type) is
113 --
114   l_proc  varchar2(72) := g_package||'pre_delete';
115 --
116 Begin
117   hr_utility.set_location('Entering:'||l_proc, 5);
118   --
119   hr_utility.set_location(' Leaving:'||l_proc, 10);
120 End pre_delete;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |-----------------------------< post_delete >------------------------------|
124 -- ----------------------------------------------------------------------------
125 -- {Start Of Comments}
126 --
127 -- Description:
128 --   This private procedure contains any processing which is required after the
129 --   delete dml.
130 --
131 -- Pre Conditions:
132 --   This is an internal procedure which is called from the del procedure.
133 --
134 -- In Parameters:
135 --   A Pl/Sql record structre.
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 --   Any post-processing required after the delete dml is issued should be
146 --   coded within this procedure. It is important to note that any 3rd party
147 --   maintenance should be reviewed before placing in this procedure.
148 --
149 -- Access Status:
150 --   Internal table Handler Use Only.
151 --
152 -- {End Of Comments}
153 -- ----------------------------------------------------------------------------
154 Procedure post_delete(p_rec in per_ctr_shd.g_rec_type) is
155 --
156   l_proc  varchar2(72) := g_package||'post_delete';
157 --
158 Begin
159   hr_utility.set_location('Entering:'||l_proc, 5);
160   --
161   -- Start of API User Hook for post_delete.
162   begin
163     per_ctr_rkd.after_delete
164       (p_contact_relationship_id        => p_rec.contact_relationship_id
165       ,p_business_group_id_o
166           => per_ctr_shd.g_old_rec.business_group_id
167       ,p_person_id_o
168           => per_ctr_shd.g_old_rec.person_id
169       ,p_contact_person_id_o
170           => per_ctr_shd.g_old_rec.contact_person_id
171       ,p_contact_type_o
172           => per_ctr_shd.g_old_rec.contact_type
173       ,p_comments_o
174           => per_ctr_shd.g_old_rec.comments
175       ,p_primary_contact_flag_o
176           => per_ctr_shd.g_old_rec.primary_contact_flag
177       ,p_request_id_o
178           => per_ctr_shd.g_old_rec.request_id
179       ,p_program_application_id_o
180           => per_ctr_shd.g_old_rec.program_application_id
181       ,p_program_id_o
182           => per_ctr_shd.g_old_rec.program_id
183       ,p_program_update_date_o
184           => per_ctr_shd.g_old_rec.program_update_date
185       ,p_date_start_o
186           => per_ctr_shd.g_old_rec.date_start
187       ,p_start_life_id_o
188           => per_ctr_shd.g_old_rec.start_life_reason_id
189       ,p_date_end_o
190           => per_ctr_shd.g_old_rec.date_end
191       ,p_end_life_id_o
192           => per_ctr_shd.g_old_rec.end_life_reason_id
193       ,p_rltd_per_dsgntr_flag_o
194          => per_ctr_shd.g_old_rec.rltd_per_rsds_w_dsgntr_flag
195       ,p_personal_flag_o
196          => per_ctr_shd.g_old_rec.personal_flag
197       ,p_sequence_number_o
198     => per_ctr_shd.g_old_rec.sequence_number
199       ,p_cont_attribute_category_o
200           => per_ctr_shd.g_old_rec.cont_attribute_category
201       ,p_cont_attribute1_o
202           => per_ctr_shd.g_old_rec.cont_attribute1
203       ,p_cont_attribute2_o
204           => per_ctr_shd.g_old_rec.cont_attribute2
205       ,p_cont_attribute3_o
206           => per_ctr_shd.g_old_rec.cont_attribute3
207       ,p_cont_attribute4_o
208           => per_ctr_shd.g_old_rec.cont_attribute4
209       ,p_cont_attribute5_o
210           => per_ctr_shd.g_old_rec.cont_attribute5
211       ,p_cont_attribute6_o
212           => per_ctr_shd.g_old_rec.cont_attribute6
213       ,p_cont_attribute7_o
214           => per_ctr_shd.g_old_rec.cont_attribute7
215       ,p_cont_attribute8_o
216           => per_ctr_shd.g_old_rec.cont_attribute8
217       ,p_cont_attribute9_o
218           => per_ctr_shd.g_old_rec.cont_attribute9
219       ,p_cont_attribute10_o
220           => per_ctr_shd.g_old_rec.cont_attribute10
221       ,p_cont_attribute11_o
222           => per_ctr_shd.g_old_rec.cont_attribute11
223       ,p_cont_attribute12_o
224           => per_ctr_shd.g_old_rec.cont_attribute12
225       ,p_cont_attribute13_o
226           => per_ctr_shd.g_old_rec.cont_attribute13
227       ,p_cont_attribute14_o
228           => per_ctr_shd.g_old_rec.cont_attribute14
229       ,p_cont_attribute15_o
230           => per_ctr_shd.g_old_rec.cont_attribute15
231       ,p_cont_attribute16_o
232           => per_ctr_shd.g_old_rec.cont_attribute16
233       ,p_cont_attribute17_o
234           => per_ctr_shd.g_old_rec.cont_attribute17
235       ,p_cont_attribute18_o
236           => per_ctr_shd.g_old_rec.cont_attribute18
237       ,p_cont_attribute19_o
238           => per_ctr_shd.g_old_rec.cont_attribute19
239       ,p_cont_attribute20_o
240           => per_ctr_shd.g_old_rec.cont_attribute20
241       ,p_cont_information_category_o
242           => per_ctr_shd.g_old_rec.cont_information_category
243       ,p_cont_information1_o
244           => per_ctr_shd.g_old_rec.cont_information1
245       ,p_cont_information2_o
246           => per_ctr_shd.g_old_rec.cont_information2
247       ,p_cont_information3_o
248           => per_ctr_shd.g_old_rec.cont_information3
249       ,p_cont_information4_o
250           => per_ctr_shd.g_old_rec.cont_information4
251       ,p_cont_information5_o
252           => per_ctr_shd.g_old_rec.cont_information5
253       ,p_cont_information6_o
254           => per_ctr_shd.g_old_rec.cont_information6
255       ,p_cont_information7_o
256           => per_ctr_shd.g_old_rec.cont_information7
257       ,p_cont_information8_o
258           => per_ctr_shd.g_old_rec.cont_information8
259       ,p_cont_information9_o
260           => per_ctr_shd.g_old_rec.cont_information9
261       ,p_cont_information10_o
262           => per_ctr_shd.g_old_rec.cont_information10
263       ,p_cont_information11_o
264           => per_ctr_shd.g_old_rec.cont_information11
265       ,p_cont_information12_o
266           => per_ctr_shd.g_old_rec.cont_information12
267       ,p_cont_information13_o
268           => per_ctr_shd.g_old_rec.cont_information13
269       ,p_cont_information14_o
270           => per_ctr_shd.g_old_rec.cont_information14
271       ,p_cont_information15_o
272           => per_ctr_shd.g_old_rec.cont_information15
273       ,p_cont_information16_o
274           => per_ctr_shd.g_old_rec.cont_information16
275       ,p_cont_information17_o
276           => per_ctr_shd.g_old_rec.cont_information17
277       ,p_cont_information18_o
278           => per_ctr_shd.g_old_rec.cont_information18
279       ,p_cont_information19_o
280           => per_ctr_shd.g_old_rec.cont_information19
281       ,p_cont_information20_o
282           => per_ctr_shd.g_old_rec.cont_information20
283       ,p_third_party_pay_flag_o
284           => per_ctr_shd.g_old_rec.third_party_pay_flag
285       ,p_bondholder_flag_o
286           => per_ctr_shd.g_old_rec.bondholder_flag
287       ,p_dependent_flag_o
288           => per_ctr_shd.g_old_rec.dependent_flag
289       ,p_beneficiary_flag_o
290           => per_ctr_shd.g_old_rec.beneficiary_flag
291       ,p_object_version_number_o
292           => per_ctr_shd.g_old_rec.object_version_number
293       );
294   exception
295     when hr_api.cannot_find_prog_unit then
296       hr_api.cannot_find_prog_unit_error
297         (p_module_name => 'PER_CONTACT_RELATIONSHIPS'
298         ,p_hook_type   => 'AD'
299         );
300   end;
301   -- End of API User Hook for post_delete.
302   --
303   hr_utility.set_location(' Leaving:'||l_proc, 10);
304 End post_delete;
305 --
306 -- ----------------------------------------------------------------------------
307 -- |---------------------------------< del >----------------------------------|
308 -- ----------------------------------------------------------------------------
309 Procedure del
310   (
311   p_rec        in per_ctr_shd.g_rec_type,
312   p_validate  in boolean default false
313   ) is
314 --
315   l_proc  varchar2(72) := g_package||'del';
316 --
317 Begin
318   hr_utility.set_location('Entering:'||l_proc, 5);
319   --
320   -- Determine if the business process is to be validated.
321   --
322   If p_validate then
323     --
324     -- Issue the savepoint.
325     --
326     SAVEPOINT del_per_ctr;
327   End If;
328   --
329   -- We must lock the row which we need to delete.
330   --
331   per_ctr_shd.lck
332    (
333    p_rec.contact_relationship_id,
334    p_rec.object_version_number
335    );
336   --
337   -- Call the supporting delete validate operation
338   --
339   per_ctr_bus.delete_validate(p_rec);
340   --
341   -- Call the supporting pre-delete operation
342   --
343   pre_delete(p_rec);
344   --
345   -- Delete the row.
346   --
347   delete_dml(p_rec);
348   --
349   -- Call the supporting post-delete operation
350   --
351   post_delete(p_rec);
352   --
353   -- If we are validating then raise the Validate_Enabled exception
354   --
355   If p_validate then
356     Raise HR_Api.Validate_Enabled;
357   End If;
358   --
359   hr_utility.set_location(' Leaving:'||l_proc, 10);
360 Exception
361   When HR_Api.Validate_Enabled Then
362     --
363     -- As the Validate_Enabled exception has been raised
364     -- we must rollback to the savepoint
365     --
366     ROLLBACK TO del_per_ctr;
367 End del;
368 --
369 -- ----------------------------------------------------------------------------
370 -- |---------------------------------< del >----------------------------------|
371 -- ----------------------------------------------------------------------------
372 Procedure del
373   (
374   p_contact_relationship_id            in number,
375   p_object_version_number              in number,
376   p_validate                           in boolean default false
377   ) is
378 --
379   l_rec    per_ctr_shd.g_rec_type;
380   l_proc  varchar2(72) := g_package||'del';
381 --
382 Begin
383   hr_utility.set_location('Entering:'||l_proc, 5);
384   --
385   -- As the delete procedure accepts a plsql record structure we do need to
386   -- convert the  arguments into the record structure.
387   -- We don't need to call the supplied conversion argument routine as we
388   -- only need a few attributes.
389   --
390   l_rec.contact_relationship_id:= p_contact_relationship_id;
391   l_rec.object_version_number := p_object_version_number;
392   --
393   -- Having converted the arguments into the per_ctr_rec
394   -- plsql record structure we must call the corresponding entity
395   -- business process
396   --
397   del(l_rec, p_validate);
398   --
399   hr_utility.set_location(' Leaving:'||l_proc, 10);
400 End del;
401 --
402 end per_ctr_del;