DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TER_DEL

Source


1 Package Body hxc_ter_del as
2 /* $Header: hxcterrhi.pkb 120.2 2005/09/23 09:19:47 nissharm noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_ter_del.';  -- Global package name
9 
10 g_debug boolean := hr_utility.debug_enabled;
11 --
12 -- ----------------------------------------------------------------------------
13 -- |------------------------------< delete_dml >------------------------------|
14 -- ----------------------------------------------------------------------------
15 -- {Start Of Comments}
16 --
17 -- Description:
18 --   This procedure controls the actual dml delete logic. The functions of
19 --   this procedure are as follows:
20 --   1) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   2) To delete the specified row from the schema using the primary key in
23 --      the predicates.
24 --   3) To trap any constraint violations that may have occurred.
25 --   4) To raise any other errors.
26 --
27 -- Prerequisites:
28 --   This is an internal private procedure which must be called from the del
29 --   procedure.
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be delete from the schema.
36 --
37 -- Post Failure:
38 --   On the delete dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a child integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   None.
47 --
48 -- Access Status:
49 --   Internal Row Handler Use Only.
50 --
51 -- {End Of Comments}
52 -- ----------------------------------------------------------------------------
53 Procedure delete_dml
54   (p_rec in hxc_ter_shd.g_rec_type
55   ) is
56 --
57   l_proc  varchar2(72);
58 --
59 Begin
60 
61 
62   if g_debug then
63   	l_proc := g_package||'delete_dml';
64   	hr_utility.set_location('Entering:'||l_proc, 5);
65   end if;
66   --
67   hxc_ter_shd.g_api_dml := true;  -- Set the api dml status
68   --
69   -- Delete the hxc_time_entry_rules row.
70   --
71   delete from hxc_time_entry_rules
72   where time_entry_rule_id = p_rec.time_entry_rule_id;
73   --
74   hxc_ter_shd.g_api_dml := false;   -- Unset the api dml status
75   --
76   if g_debug then
77   	hr_utility.set_location(' Leaving:'||l_proc, 10);
78   end if;
79 --
80 Exception
81   When hr_api.child_integrity_violated then
82     -- Child integrity has been violated
83     hxc_ter_shd.g_api_dml := false;   -- Unset the api dml status
84     hxc_ter_shd.constraint_error
85       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
86   When Others Then
87     hxc_ter_shd.g_api_dml := false;   -- Unset the api dml status
88     Raise;
89 End delete_dml;
90 --
91 -- ----------------------------------------------------------------------------
92 -- |------------------------------< pre_delete >------------------------------|
93 -- ----------------------------------------------------------------------------
94 -- {Start Of Comments}
95 --
96 -- Description:
97 --   This private procedure contains any processing which is required before
98 --   the delete dml.
99 --
100 -- Prerequisites:
101 --   This is an internal procedure which is called from the del procedure.
102 --
103 -- In Parameters:
104 --   A Pl/Sql record structre.
105 --
106 -- Post Success:
107 --   Processing continues.
108 --
109 -- Post Failure:
110 --   If an error has occurred, an error message and exception will be raised
111 --   but not handled.
112 --
113 -- Developer Implementation Notes:
114 --   Any pre-processing required before the delete dml is issued should be
115 --   coded within this procedure. It is important to note that any 3rd party
116 --   maintenance should be reviewed before placing in this procedure.
117 --
118 -- Access Status:
119 --   Internal Row Handler Use Only.
120 --
121 -- {End Of Comments}
122 -- ----------------------------------------------------------------------------
123 Procedure pre_delete(p_rec in hxc_ter_shd.g_rec_type) is
124 --
125   l_proc  varchar2(72);
126 --
127 Begin
128 
129 
130   if g_debug then
131   	l_proc := g_package||'pre_delete';
132   	hr_utility.set_location('Entering:'||l_proc, 5);
133   	--
134   	hr_utility.set_location(' Leaving:'||l_proc, 10);
135   end if;
136 End pre_delete;
137 --
138 -- ----------------------------------------------------------------------------
139 -- |-----------------------------< post_delete >------------------------------|
140 -- ----------------------------------------------------------------------------
141 -- {Start Of Comments}
142 --
143 -- Description:
144 --   This private procedure contains any processing which is required after the
145 --   delete dml.
146 --
147 -- Prerequistes:
148 --   This is an internal procedure which is called from the del procedure.
149 --
150 -- In Parameters:
151 --   A Pl/Sql record structure.
152 --
153 -- Post Success:
154 --   Processing continues.
155 --
156 -- Post Failure:
157 --   If an error has occurred, an error message and exception will be raised
158 --   but not handled.
159 --
160 -- Developer Implementation Notes:
161 --   Any post-processing required after the delete dml is issued should be
162 --   coded within this procedure. It is important to note that any 3rd party
163 --   maintenance should be reviewed before placing in this procedure.
164 --
165 -- Access Status:
166 --   Internal Row Handler Use Only.
167 --
168 -- {End Of Comments}
169 -- -----------------------------------------------------------------------------
170 Procedure post_delete(p_rec in hxc_ter_shd.g_rec_type) is
171 --
172   l_proc  varchar2(72);
173 --
174 Begin
175 
176 
177   if g_debug then
178   	l_proc := g_package||'post_delete';
179   	hr_utility.set_location('Entering:'||l_proc, 5);
180   end if;
181     begin
182     --
183    hxc_ter_rkd.after_delete
184       (p_time_entry_rule_id
185       => p_rec.time_entry_rule_id
186       ,p_name_o
187       => hxc_ter_shd.g_old_rec.name
188       ,p_business_group_id_o	     => hxc_ter_shd.g_old_rec.business_group_id
189       ,p_legislation_code_o	     => hxc_ter_shd.g_old_rec.legislation_code
190       ,p_mapping_id_o => hxc_ter_shd.g_old_rec.mapping_id
191       ,p_rule_usage_o
192       => hxc_ter_shd.g_old_rec.rule_usage
193       ,p_formula_id_o
194       => hxc_ter_shd.g_old_rec.formula_id
195       ,p_description_o
196       => hxc_ter_shd.g_old_rec.description
197       ,p_start_date_o
198       => hxc_ter_shd.g_old_rec.start_date
199       ,p_end_date_o
200       => hxc_ter_shd.g_old_rec.end_date
201       ,p_object_version_number_o
202       => hxc_ter_shd.g_old_rec.object_version_number
203       ,p_attribute_category_o
204       => hxc_hph_shd.g_old_rec.attribute_category
205       ,p_attribute1_o
206       => hxc_hph_shd.g_old_rec.attribute1
207       ,p_attribute2_o
208       => hxc_hph_shd.g_old_rec.attribute2
209       ,p_attribute3_o
210       => hxc_hph_shd.g_old_rec.attribute3
211       ,p_attribute4_o
212       => hxc_hph_shd.g_old_rec.attribute4
213       ,p_attribute5_o
214       => hxc_hph_shd.g_old_rec.attribute5
215       ,p_attribute6_o
216       => hxc_hph_shd.g_old_rec.attribute6
217       ,p_attribute7_o
218       => hxc_hph_shd.g_old_rec.attribute7
219       ,p_attribute8_o
220       => hxc_hph_shd.g_old_rec.attribute8
221       ,p_attribute9_o
222       => hxc_hph_shd.g_old_rec.attribute9
223       ,p_attribute10_o
224       => hxc_hph_shd.g_old_rec.attribute10
225       ,p_attribute11_o
226       => hxc_hph_shd.g_old_rec.attribute11
227       ,p_attribute12_o
228       => hxc_hph_shd.g_old_rec.attribute12
229       ,p_attribute13_o
230       => hxc_hph_shd.g_old_rec.attribute13
231       ,p_attribute14_o
232       => hxc_hph_shd.g_old_rec.attribute14
233       ,p_attribute15_o
234       => hxc_hph_shd.g_old_rec.attribute15
235       ,p_attribute16_o
236       => hxc_hph_shd.g_old_rec.attribute16
237       ,p_attribute17_o
238       => hxc_hph_shd.g_old_rec.attribute17
239       ,p_attribute18_o
240       => hxc_hph_shd.g_old_rec.attribute18
241       ,p_attribute19_o
242       => hxc_hph_shd.g_old_rec.attribute19
243       ,p_attribute20_o
244       => hxc_hph_shd.g_old_rec.attribute20
245       ,p_attribute21_o
246       => hxc_hph_shd.g_old_rec.attribute21
247       ,p_attribute22_o
248       => hxc_hph_shd.g_old_rec.attribute22
249       ,p_attribute23_o
250       => hxc_hph_shd.g_old_rec.attribute23
251       ,p_attribute24_o
252       => hxc_hph_shd.g_old_rec.attribute24
253       ,p_attribute25_o
254       => hxc_hph_shd.g_old_rec.attribute25
255       ,p_attribute26_o
256       => hxc_hph_shd.g_old_rec.attribute26
257       ,p_attribute27_o
258       => hxc_hph_shd.g_old_rec.attribute27
259       ,p_attribute28_o
260       => hxc_hph_shd.g_old_rec.attribute28
261       ,p_attribute29_o
262       => hxc_hph_shd.g_old_rec.attribute29
263       ,p_attribute30_o
264       => hxc_hph_shd.g_old_rec.attribute30
265       );
266     --
267   exception
268     --
269     when hr_api.cannot_find_prog_unit then
270       --
271       hr_api.cannot_find_prog_unit_error
272         (p_module_name => 'HXC_TIME_ENTRY_RULES'
273         ,p_hook_type   => 'AD');
274       --
275   end;
276   --
277   if g_debug then
278   	hr_utility.set_location(' Leaving:'||l_proc, 10);
279   end if;
280 End post_delete;
281 --
282 -- ----------------------------------------------------------------------------
283 -- |---------------------------------< del >----------------------------------|
284 -- ----------------------------------------------------------------------------
285 Procedure del
286   (p_rec	      in hxc_ter_shd.g_rec_type
287   ) is
288 --
289   l_proc  varchar2(72);
290 --
291 Begin
292   g_debug := hr_utility.debug_enabled;
293 
294   if g_debug then
295   	l_proc := g_package||'del';
296   	hr_utility.set_location('Entering:'||l_proc, 5);
297   end if;
298   --
299   -- We must lock the row which we need to delete.
300   --
301   hxc_ter_shd.lck
302     (p_rec.time_entry_rule_id
303     ,p_rec.object_version_number
304     );
305   --
306   -- Call the supporting delete validate operation
307   --
308   hxc_ter_bus.delete_validate(p_rec);
309   --
310   -- Call the supporting pre-delete operation
311   --
312   hxc_ter_del.pre_delete(p_rec);
313   --
314   -- Delete the row.
315   --
316   hxc_ter_del.delete_dml(p_rec);
317   --
318   -- Call the supporting post-delete operation
319   --
320   hxc_ter_del.post_delete(p_rec);
321   --
322 End del;
323 --
324 -- ----------------------------------------------------------------------------
325 -- |---------------------------------< del >----------------------------------|
326 -- ----------------------------------------------------------------------------
327 Procedure del
328   (p_time_entry_rule_id                in     number
329   ,p_object_version_number                in     number
330   ) is
331 --
332   l_rec	  hxc_ter_shd.g_rec_type;
333   l_proc  varchar2(72);
334 --
335 Begin
336   g_debug := hr_utility.debug_enabled;
337 
338   if g_debug then
339   	l_proc := g_package||'del';
340   	hr_utility.set_location('Entering:'||l_proc, 5);
341   end if;
342   --
343   -- As the delete procedure accepts a plsql record structure we do need to
344   -- convert the  arguments into the record structure.
345   -- We don't need to call the supplied conversion argument routine as we
346   -- only need a few attributes.
347   --
348   l_rec.time_entry_rule_id := p_time_entry_rule_id;
349   l_rec.object_version_number := p_object_version_number;
350   --
351   -- Having converted the arguments into the hxc_ter_rec
352   -- plsql record structure we must call the corresponding entity
353   -- business process
354   --
355   hxc_ter_del.del(l_rec);
356   --
357   if g_debug then
358   	hr_utility.set_location(' Leaving:'||l_proc, 10);
359   end if;
360 End del;
361 --
362 end hxc_ter_del;