DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TBB_DEL

Source


1 package body hxc_tbb_del as
2 /* $Header: hxctbbrhi.pkb 120.6.12010000.1 2008/07/28 11:19:46 appldev ship $ */
3 
4 -- --------------------------------------------------------------------------
5 -- |                     Private Global Definitions                         |
6 -- --------------------------------------------------------------------------
7 
8 g_package  varchar2(33)	:= '  hxc_tbb_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_tbb_shd.g_rec_type
55   ) is
56 
57   l_proc  varchar2(72);
58 
59 begin
60 
61 
62 
63   if g_debug then
64   	l_proc := g_package||'delete_dml';
65   	hr_utility.set_location('Entering:'||l_proc, 5);
66   end if;
67 
68   -- delete the hxc_time_building_blocks row.
69 
70   delete from hxc_time_building_blocks
71   where time_building_block_id = p_rec.time_building_block_id;
72 
73   if g_debug then
74   	hr_utility.set_location(' Leaving:'||l_proc, 10);
75   end if;
76 
77 exception
78   when hr_api.child_integrity_violated then
79     -- child integrity has been violated
80     hxc_tbb_shd.constraint_error
81       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
82   when others Then
83     raise;
84 
85 end delete_dml;
86 
87 -- --------------------------------------------------------------------------
88 -- |------------------------------< pre_delete >----------------------------|
89 -- --------------------------------------------------------------------------
90 -- {Start Of Comments}
91 --
92 -- Description:
93 --   This private procedure contains any processing which is required before
94 --   the delete dml.
95 --
96 -- Prerequisites:
97 --   This is an internal procedure which is called from the del procedure.
98 --
99 -- In Parameters:
100 --   A Pl/Sql record structre.
101 --
102 -- Post Success:
103 --   Processing continues.
104 --
105 -- Post Failure:
106 --   if an error has occurred, an error message and exception will be raised
107 --   but not handled.
108 --
109 -- Developer Implementation Notes:
110 --   Any pre-processing required before the delete dml is issued should be
111 --   coded within this procedure. It is important to note that any 3rd party
112 --   maintenance should be reviewed before placing in this procedure.
113 --
114 -- Access Status:
115 --   Internal Row Handler Use Only.
116 --
117 -- {end Of Comments}
118 -- --------------------------------------------------------------------------
119 procedure pre_delete(p_rec in hxc_tbb_shd.g_rec_type) is
120 
121   l_proc  varchar2(72);
122 
123 begin
124 
125 
126 
127   if g_debug then
128   	l_proc := g_package||'pre_delete';
129   	hr_utility.set_location('Entering:'||l_proc, 5);
130 
131   	hr_utility.set_location(' Leaving:'||l_proc, 10);
132   end if;
133 
134 end pre_delete;
135 
136 -- --------------------------------------------------------------------------
137 -- |-----------------------------< post_delete >----------------------------|
138 -- --------------------------------------------------------------------------
139 -- {Start Of Comments}
140 --
141 -- Description:
142 --   This private procedure contains any processing which is required after the
143 --   delete dml.
144 --
145 -- Prerequistes:
146 --   This is an internal procedure which is called from the del procedure.
147 --
148 -- In Parameters:
149 --   A Pl/Sql record structure.
150 --
151 -- Post Success:
152 --   Processing continues.
153 --
154 -- Post Failure:
155 --   if an error has occurred, an error message and exception will be raised
156 --   but not handled.
157 --
158 -- Developer Implementation Notes:
159 --   Any post-processing required after the delete dml is issued should be
160 --   coded within this procedure. It is important to note that any 3rd party
161 --   maintenance should be reviewed before placing in this procedure.
162 --
163 -- Access Status:
164 --   Internal Row Handler Use Only.
165 --
166 -- {end Of Comments}
167 -- ---------------------------------------------------------------------------
168 procedure post_delete(p_rec in hxc_tbb_shd.g_rec_type) is
169 
170   l_proc  varchar2(72);
171 
172 begin
173 
174 
175 
176   if g_debug then
177   	l_proc := g_package||'post_delete';
178   	hr_utility.set_location('Entering:'||l_proc, 5);
179   end if;
180     begin
181 
182     hxc_tbb_rkd.after_delete
183       (p_time_building_block_id
184       => p_rec.time_building_block_id
185       ,p_type_o
186       => hxc_tbb_shd.g_old_rec.type
187       ,p_measure_o
188       => hxc_tbb_shd.g_old_rec.measure
189       ,p_unit_of_measure_o
190       => hxc_tbb_shd.g_old_rec.unit_of_measure
191       ,p_start_time_o
192       => hxc_tbb_shd.g_old_rec.start_time
193       ,p_stop_time_o
194       => hxc_tbb_shd.g_old_rec.stop_time
195       ,p_parent_building_block_id_o
196       => hxc_tbb_shd.g_old_rec.parent_building_block_id
197       ,p_parent_building_block_ovn_o
198       => hxc_tbb_shd.g_old_rec.parent_building_block_ovn
199       ,p_scope_o
200       => hxc_tbb_shd.g_old_rec.scope
201       ,p_object_version_number_o
202       => hxc_tbb_shd.g_old_rec.object_version_number
203       ,p_approval_status_o
204       => hxc_tbb_shd.g_old_rec.approval_status
205       ,p_resource_id_o
206       => hxc_tbb_shd.g_old_rec.resource_id
207       ,p_resource_type_o
208       => hxc_tbb_shd.g_old_rec.resource_type
209       ,p_approval_style_id_o
210       => hxc_tbb_shd.g_old_rec.approval_style_id
211       ,p_date_from_o
212       => hxc_tbb_shd.g_old_rec.date_from
213       ,p_date_to_o
214       => hxc_tbb_shd.g_old_rec.date_to
215       ,p_comment_text_o
216       => hxc_tbb_shd.g_old_rec.comment_text
217       ,p_application_set_id_o
218       => hxc_tbb_shd.g_old_rec.application_set_id
219       ,p_translation_display_key_o
220       => hxc_tbb_shd.g_old_rec.translation_display_key
221       );
222 
223   exception
224     when hr_api.cannot_find_prog_unit then
225       hr_api.cannot_find_prog_unit_error
226         (p_module_name => 'HXC_TIME_BUILDING_BLOCKS'
227         ,p_hook_type   => 'AD');
228   end;
229 
230   if g_debug then
231   	hr_utility.set_location(' Leaving:'||l_proc, 10);
232   end if;
233 
234 end post_delete;
235 
236 -- --------------------------------------------------------------------------
237 -- |---------------------------------< del >--------------------------------|
238 -- --------------------------------------------------------------------------
239 procedure del
240   (p_rec in hxc_tbb_shd.g_rec_type
241   ) is
242 
243   l_proc  varchar2(72);
244 
245 begin
246 
247   g_debug := hr_utility.debug_enabled;
248 
249   if g_debug then
250   	l_proc := g_package||'del';
251   	hr_utility.set_location('Entering:'||l_proc, 5);
252   end if;
253 
254   -- we must lock the row which we need to delete.
255 
256   hxc_tbb_shd.lck
257     (p_rec.time_building_block_id
258     ,p_rec.object_version_number
259     );
260 
261   -- call the supporting delete validate operation
262 
263   hxc_tbb_bus.delete_validate(p_rec);
264 
265   -- call the supporting pre-delete operation
266 
267   hxc_tbb_del.pre_delete(p_rec);
268 
269   -- delete the row.
270 
271   hxc_tbb_del.delete_dml(p_rec);
272 
273   -- call the supporting post-delete operation
274 
275   hxc_tbb_del.post_delete(p_rec);
276 
277 end del;
278 
279 -- --------------------------------------------------------------------------
280 -- |---------------------------------< del >--------------------------------|
281 -- --------------------------------------------------------------------------
282 procedure del
283   (p_time_building_block_id in number
284   ,p_object_version_number  in number
285   ) is
286 
287   l_rec	 hxc_tbb_shd.g_rec_type;
288   l_proc varchar2(72);
289 
290 begin
291 
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   -- as the delete procedure accepts a plsql record structure we do need to
300   -- convert the arguments into the record structure.
301   -- we don't need to call the supplied conversion argument routine as we
302   -- only need a few attributes.
303 
304   l_rec.time_building_block_id := p_time_building_block_id;
305   l_rec.object_version_number := p_object_version_number;
306 
307   -- having converted the arguments into the hxc_tbb_rec
308   -- plsql record structure we must call the corresponding entity
309   -- business process
310 
311   hxc_tbb_del.del(l_rec);
312 
313   if g_debug then
314   	hr_utility.set_location(' Leaving:'||l_proc, 10);
315   end if;
316 
317 end del;
318 
319 end hxc_tbb_del;