DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_APL_DEL

Source


1 Package Body per_apl_del as
2 /* $Header: peaplrhi.pkb 120.1 2005/10/25 00:31:11 risgupta noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_apl_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_apl_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_apl_shd.g_api_dml := true;  -- Set the api dml status
59   --
60   -- Delete the per_applications row.
61   --
62   delete from per_applications
63   where application_id = p_rec.application_id;
64   --
65   per_apl_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_apl_shd.g_api_dml := false;   -- Unset the api dml status
73     per_apl_shd.constraint_error
74       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
75   When Others Then
76     per_apl_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_apl_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_apl_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_apl_rkd.after_delete
164       (p_application_id               => p_rec.application_id
165       ,p_business_group_id_o
166           => per_apl_shd.g_old_rec.business_group_id
167       ,p_person_id_o
168           => per_apl_shd.g_old_rec.person_id
169       ,p_date_received_o
170           => per_apl_shd.g_old_rec.date_received
171       ,p_comments_o
172           => per_apl_shd.g_old_rec.comments
173       ,p_current_employer_o
174           => per_apl_shd.g_old_rec.current_employer
175       ,p_date_end_o
176           => per_apl_shd.g_old_rec.date_end
177       ,p_projected_hire_date_o
178           => per_apl_shd.g_old_rec.projected_hire_date
179       ,p_successful_flag_o
180           => per_apl_shd.g_old_rec.successful_flag
181       ,p_termination_reason_o
182           => per_apl_shd.g_old_rec.termination_reason
183       ,p_request_id_o
184           => per_apl_shd.g_old_rec.request_id
185       ,p_program_application_id_o
186           => per_apl_shd.g_old_rec.program_application_id
187       ,p_program_id_o
188           => per_apl_shd.g_old_rec.program_id
189       ,p_program_update_date_o
190           => per_apl_shd.g_old_rec.program_update_date
191       ,p_appl_attribute_category_o
192           => per_apl_shd.g_old_rec.appl_attribute_category
193       ,p_appl_attribute1_o
194           => per_apl_shd.g_old_rec.appl_attribute1
195       ,p_appl_attribute2_o
196           => per_apl_shd.g_old_rec.appl_attribute2
197       ,p_appl_attribute3_o
198           => per_apl_shd.g_old_rec.appl_attribute3
199       ,p_appl_attribute4_o
200           => per_apl_shd.g_old_rec.appl_attribute4
201       ,p_appl_attribute5_o
202           => per_apl_shd.g_old_rec.appl_attribute5
203       ,p_appl_attribute6_o
204           => per_apl_shd.g_old_rec.appl_attribute6
205       ,p_appl_attribute7_o
206           => per_apl_shd.g_old_rec.appl_attribute7
207       ,p_appl_attribute8_o
208           => per_apl_shd.g_old_rec.appl_attribute8
209       ,p_appl_attribute9_o
210           => per_apl_shd.g_old_rec.appl_attribute9
211       ,p_appl_attribute10_o
212           => per_apl_shd.g_old_rec.appl_attribute10
213       ,p_appl_attribute11_o
214           => per_apl_shd.g_old_rec.appl_attribute11
215       ,p_appl_attribute12_o
216           => per_apl_shd.g_old_rec.appl_attribute12
217       ,p_appl_attribute13_o
218           => per_apl_shd.g_old_rec.appl_attribute13
219       ,p_appl_attribute14_o
220           => per_apl_shd.g_old_rec.appl_attribute14
221       ,p_appl_attribute15_o
222           => per_apl_shd.g_old_rec.appl_attribute15
223       ,p_appl_attribute16_o
224           => per_apl_shd.g_old_rec.appl_attribute16
225       ,p_appl_attribute17_o
226           => per_apl_shd.g_old_rec.appl_attribute17
227       ,p_appl_attribute18_o
228           => per_apl_shd.g_old_rec.appl_attribute18
229       ,p_appl_attribute19_o
230           => per_apl_shd.g_old_rec.appl_attribute19
231       ,p_appl_attribute20_o
232           => per_apl_shd.g_old_rec.appl_attribute20
233       ,p_object_version_number_o
234           => per_apl_shd.g_old_rec.object_version_number
235       );
236   exception
237     when hr_api.cannot_find_prog_unit then
238       hr_api.cannot_find_prog_unit_error
239         (p_module_name => 'PER_APPLICATIONS'
240         ,p_hook_type   => 'AD'
241         );
242   end;
243   -- End of API User Hook for post_delete.
244   --
245   hr_utility.set_location(' Leaving:'||l_proc, 10);
246 End post_delete;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |---------------------------------< del >----------------------------------|
250 -- ----------------------------------------------------------------------------
251 Procedure del
252   (
253   p_rec	      in per_apl_shd.g_rec_type,
254   p_validate  in boolean default false
255   ) is
256 --
257   l_proc  varchar2(72) := g_package||'del';
258 --
259 Begin
260   hr_utility.set_location('Entering:'||l_proc, 5);
261   --
262   -- Determine if the business process is to be validated.
263   --
264   If p_validate then
265     --
266     -- Issue the savepoint.
267     --
268     SAVEPOINT del_per_apl;
269   End If;
270   --
271   -- We must lock the row which we need to delete.
272   --
273   per_apl_shd.lck
274 	(
275 	p_rec.application_id,
276 	p_rec.object_version_number
277 	);
278   --
279   -- Call the supporting delete validate operation
280   --
281   per_apl_bus.delete_validate(p_rec);
282   --
283   -- Call to raise any errors on multi-message list
284   --
285   hr_multi_message.end_validation_set;
286   --
287   -- Call the supporting pre-delete operation
288   --
289   pre_delete(p_rec);
290   --
291   -- Delete the row.
292   --
293   delete_dml(p_rec);
294   --
295   -- Call the supporting post-delete operation
296   --
297   post_delete(p_rec);
298   --
299   -- Call to raise any errors on multi-message list
300   --
301   hr_multi_message.end_validation_set;
302   --
303   -- If we are validating then raise the Validate_Enabled exception
304   --
305   If p_validate then
306     Raise HR_Api.Validate_Enabled;
307   End If;
308   --
309   hr_utility.set_location(' Leaving:'||l_proc, 10);
310 Exception
311   When HR_Api.Validate_Enabled Then
312     --
313     -- As the Validate_Enabled exception has been raised
314     -- we must rollback to the savepoint
315     --
316     ROLLBACK TO del_per_apl;
317 End del;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |---------------------------------< del >----------------------------------|
321 -- ----------------------------------------------------------------------------
322 Procedure del
323   (
324   p_application_id                     in number,
325   p_object_version_number              in number,
326   p_validate                           in boolean default false
327   ) is
328 --
329   l_rec	  per_apl_shd.g_rec_type;
330   l_proc  varchar2(72) := g_package||'del';
331 --
332 Begin
333   hr_utility.set_location('Entering:'||l_proc, 5);
334   --
335   -- As the delete procedure accepts a plsql record structure we do need to
336   -- convert the  arguments into the record structure.
337   -- We don't need to call the supplied conversion argument routine as we
338   -- only need a few attributes.
339   --
340   l_rec.application_id:= p_application_id;
341   l_rec.object_version_number := p_object_version_number;
342   --
343   -- Having converted the arguments into the per_apl_rec
344   -- plsql record structure we must call the corresponding entity
345   -- business process
346   --
347   del(l_rec, p_validate);
348   --
349   hr_utility.set_location(' Leaving:'||l_proc, 10);
350 End del;
351 --
352 end per_apl_del;