DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_STS_DEL

Source


1 Package Body pqh_sts_del as
2 /* $Header: pqstsrhi.pkb 120.0 2005/05/29 02:43 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_sts_del.';  -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< delete_dml >------------------------------|
13 -- ----------------------------------------------------------------------------
14 -- {Start Of Comments}
15 --
16 -- Description:
17 --   This procedure controls the actual dml delete logic. The functions of
18 --   this procedure are 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) To delete the specified row from the schema using the primary key in
22 --      the predicates.
23 --   3) To trap any constraint violations that may have occurred.
24 --   4) To raise any other errors.
25 --
26 -- Prerequisites:
27 --   This is an internal private procedure which must be called from the del
28 --   procedure.
29 --
30 -- In Parameters:
31 --   A Pl/Sql record structre.
32 --
33 -- Post Success:
34 --   The specified row will be delete from the schema.
35 --
36 -- Post Failure:
37 --   On the delete dml failure it is important to note that we always reset the
38 --   g_api_dml status to false.
39 --   If a child integrity constraint violation is raised the
40 --   constraint_error procedure will be called.
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 --   None.
46 --
47 -- Access Status:
48 --   Internal Row Handler Use Only.
49 --
50 -- {End Of Comments}
51 -- ----------------------------------------------------------------------------
52 Procedure delete_dml
53   (p_rec in pqh_sts_shd.g_rec_type
54   ) is
55 --
56   l_proc  varchar2(72) := g_package||'delete_dml';
57 --
58 Begin
59 if g_debug then
60    --
61   hr_utility.set_location('Entering:'||l_proc, 5);
62   --
63   End if;
64 
65   --
66   --
67   --
68   -- Delete the pqh_fr_stat_situations row.
69   --
70   delete from pqh_fr_stat_situations
71   where statutory_situation_id = p_rec.statutory_situation_id;
72   --
73   --
74   --
75   if g_debug then
76    --
77   hr_utility.set_location(' Leaving:'||l_proc, 10);
78   --
79   End if;
80 --
81 Exception
82   When hr_api.child_integrity_violated then
83     -- Child integrity has been violated
84     --
85     pqh_sts_shd.constraint_error
86       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
87   When Others Then
88     --
89     Raise;
90 End delete_dml;
91 --
92 -- ----------------------------------------------------------------------------
93 -- |------------------------------< pre_delete >------------------------------|
94 -- ----------------------------------------------------------------------------
95 -- {Start Of Comments}
96 --
97 -- Description:
98 --   This private procedure contains any processing which is required before
99 --   the delete dml.
100 --
101 -- Prerequisites:
102 --   This is an internal procedure which is called from the del procedure.
103 --
104 -- In Parameters:
105 --   A Pl/Sql record structre.
106 --
107 -- Post Success:
108 --   Processing continues.
109 --
110 -- Post Failure:
111 --   If an error has occurred, an error message and exception will be raised
112 --   but not handled.
113 --
114 -- Developer Implementation Notes:
115 --   Any pre-processing required before the delete dml is issued should be
116 --   coded within this procedure. It is important to note that any 3rd party
117 --   maintenance should be reviewed before placing in this procedure.
118 --
119 -- Access Status:
120 --   Internal Row Handler Use Only.
121 --
122 -- {End Of Comments}
123 -- ----------------------------------------------------------------------------
124 Procedure pre_delete(p_rec in pqh_sts_shd.g_rec_type) is
125 --
126   l_proc  varchar2(72) := g_package||'pre_delete';
127 --
128 Begin
129  if g_debug then
130    --
131   hr_utility.set_location('Entering:'||l_proc, 5);
132   --
133   hr_utility.set_location(' Leaving:'||l_proc, 10);
134   --
135   End if;
136 
137 End pre_delete;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |-----------------------------< post_delete >------------------------------|
141 -- ----------------------------------------------------------------------------
142 -- {Start Of Comments}
143 --
144 -- Description:
145 --   This private procedure contains any processing which is required after
146 --   the delete dml.
147 --
148 -- Prerequistes:
149 --   This is an internal procedure which is called from the del procedure.
150 --
151 -- In Parameters:
152 --   A Pl/Sql record structure.
153 --
154 -- Post Success:
155 --   Processing continues.
156 --
157 -- Post Failure:
158 --   If an error has occurred, an error message and exception will be raised
159 --   but not handled.
160 --
161 -- Developer Implementation Notes:
162 --   Any post-processing required after the delete dml is issued should be
163 --   coded within this procedure. It is important to note that any 3rd party
164 --   maintenance should be reviewed before placing in this procedure.
165 --
166 -- Access Status:
167 --   Internal Row Handler Use Only.
168 --
169 -- {End Of Comments}
170 -- -----------------------------------------------------------------------------
171 Procedure post_delete(p_rec in pqh_sts_shd.g_rec_type) is
172 --
173   l_proc  varchar2(72) := g_package||'post_delete';
174 --
175 Begin
176 
177   g_debug := hr_utility.debug_enabled;
178 
179   if g_debug then
180    --
181   hr_utility.set_location('Entering:'||l_proc, 5);
182   --
183   End if;
184   begin
185     --
186     pqh_sts_rkd.after_delete
187       (p_statutory_situation_id
188       => p_rec.statutory_situation_id
189       ,p_business_group_id_o
190       => pqh_sts_shd.g_old_rec.business_group_id
191       ,p_situation_name_o
192       => pqh_sts_shd.g_old_rec.situation_name
193       ,p_type_of_ps_o
194       => pqh_sts_shd.g_old_rec.type_of_ps
195       ,p_situation_type_o
196       => pqh_sts_shd.g_old_rec.situation_type
197       ,p_sub_type_o
198       => pqh_sts_shd.g_old_rec.sub_type
199       ,p_source_o
200       => pqh_sts_shd.g_old_rec.source
201       ,p_location_o
202       => pqh_sts_shd.g_old_rec.location
203       ,p_reason_o
204       => pqh_sts_shd.g_old_rec.reason
205       ,p_is_default_o
206       => pqh_sts_shd.g_old_rec.is_default
207       ,p_date_from_o
208       => pqh_sts_shd.g_old_rec.date_from
209       ,p_date_to_o
210       => pqh_sts_shd.g_old_rec.date_to
211       ,p_request_type_o
212       => pqh_sts_shd.g_old_rec.request_type
213       ,p_employee_agreement_needed_o
214       => pqh_sts_shd.g_old_rec.employee_agreement_needed
215       ,p_manager_agreement_needed_o
216       => pqh_sts_shd.g_old_rec.manager_agreement_needed
217       ,p_print_arrette_o
218       => pqh_sts_shd.g_old_rec.print_arrette
219       ,p_reserve_position_o
220       => pqh_sts_shd.g_old_rec.reserve_position
221       ,p_allow_progressions_o
222       => pqh_sts_shd.g_old_rec.allow_progressions
223       ,p_extend_probation_period_o
224       => pqh_sts_shd.g_old_rec.extend_probation_period
225       ,p_remuneration_paid_o
226       => pqh_sts_shd.g_old_rec.remuneration_paid
227       ,p_pay_share_o
228       => pqh_sts_shd.g_old_rec.pay_share
229       ,p_pay_periods_o
230       => pqh_sts_shd.g_old_rec.pay_periods
231       ,p_frequency_o
232       => pqh_sts_shd.g_old_rec.frequency
233       ,p_first_period_max_duration_o
234       => pqh_sts_shd.g_old_rec.first_period_max_duration
235       ,p_min_duration_per_request_o
236       => pqh_sts_shd.g_old_rec.min_duration_per_request
237       ,p_max_duration_per_request_o
238       => pqh_sts_shd.g_old_rec.max_duration_per_request
239       ,p_max_duration_whole_career_o
240       => pqh_sts_shd.g_old_rec.max_duration_whole_career
241       ,p_renewable_allowed_o
242       => pqh_sts_shd.g_old_rec.renewable_allowed
243       ,p_max_no_of_renewals_o
244       => pqh_sts_shd.g_old_rec.max_no_of_renewals
245       ,p_max_duration_per_renewal_o
246       => pqh_sts_shd.g_old_rec.max_duration_per_renewal
247       ,p_max_tot_continuous_duratio_o
248       => pqh_sts_shd.g_old_rec.max_tot_continuous_duration
249       ,p_object_version_number_o
250       => pqh_sts_shd.g_old_rec.object_version_number
251       ,p_remunerate_assign_stat_id_o
252       => pqh_sts_shd.g_old_rec.remunerate_assign_status_id
253       );
254     --
255   exception
256     --
257     when hr_api.cannot_find_prog_unit then
258       --
259       hr_api.cannot_find_prog_unit_error
260         (p_module_name => 'PQH_FR_STAT_SITUATIONS'
261         ,p_hook_type   => 'AD');
262       --
263   end;
264   --
265   if g_debug then
266    --
267   hr_utility.set_location(' Leaving:'||l_proc, 10);
268   --
269   End if;
270 End post_delete;
271 --
272 -- ----------------------------------------------------------------------------
273 -- |---------------------------------< del >----------------------------------|
274 -- ----------------------------------------------------------------------------
275 Procedure del
276   (p_rec              in pqh_sts_shd.g_rec_type
277   ) is
278 --
279   l_proc  varchar2(72) := g_package||'del';
280 --
281 Begin
282  if g_debug then
283    --
284   hr_utility.set_location('Entering:'||l_proc, 5);
285   --
286   End if;
287   --
288   -- We must lock the row which we need to delete.
289   --
290   pqh_sts_shd.lck
291     (p_rec.statutory_situation_id
292     ,p_rec.object_version_number
293     );
294   --
295   -- Call the supporting delete validate operation
296   --
297   pqh_sts_bus.delete_validate(p_rec);
298   --
299   -- Call to raise any errors on multi-message list
300   hr_multi_message.end_validation_set;
301   --
302   -- Call the supporting pre-delete operation
303   --
304   pqh_sts_del.pre_delete(p_rec);
305   --
306   -- Delete the row.
307   --
308   pqh_sts_del.delete_dml(p_rec);
309   --
310   -- Call the supporting post-delete operation
311   --
312   pqh_sts_del.post_delete(p_rec);
313   --
314   -- Call to raise any errors on multi-message list
315   hr_multi_message.end_validation_set;
316   --
317 End del;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |---------------------------------< del >----------------------------------|
321 -- ----------------------------------------------------------------------------
322 Procedure del
323   (p_statutory_situation_id               in     number
324   ,p_object_version_number                in     number
325   ) is
326 --
327   l_rec   pqh_sts_shd.g_rec_type;
328   l_proc  varchar2(72) := g_package||'del';
329 --
330 Begin
331 
332  g_debug := hr_utility.debug_enabled;
333 
334  if g_debug then
335    --
336   hr_utility.set_location('Entering:'||l_proc, 5);
337   --
338   End if;
339   --
340   -- As the delete procedure accepts a plsql record structure we do need to
341   -- convert the  arguments into the record structure.
342   -- We don't need to call the supplied conversion argument routine as we
343   -- only need a few attributes.
344   --
345   l_rec.statutory_situation_id := p_statutory_situation_id;
346   l_rec.object_version_number := p_object_version_number;
347   --
348   -- Having converted the arguments into the pqh_sts_rec
349   -- plsql record structure we must call the corresponding entity
350   -- business process
351   --
352   pqh_sts_del.del(l_rec);
353   --
354   if g_debug then
355    --
356   hr_utility.set_location(' Leaving:'||l_proc, 10);
357   --
358   End if;
359 
360 End del;
361 --
362 end pqh_sts_del;