DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ULT_DEL

Source


1 Package Body hxc_ult_del as
2 /* $Header: hxcultrhi.pkb 120.2 2005/09/23 06:33:16 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_ult_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 hxc_ult_shd.g_rec_type
54   ) is
55 --
56   l_proc  varchar2(72) ;
57 --
58 Begin
59 
60   if g_debug then
61   	l_proc := g_package||'delete_dml';
62   	hr_utility.set_location('Entering:'||l_proc, 5);
63   end if;
64   --
65   --
66   --
67   -- Delete the hxc_layouts_tl row.
68   --
69   delete from hxc_layouts_tl
70   where layout_id = p_rec.layout_id
71     AND language = p_rec.language;
72   --
73   --
74   --
75   if g_debug then
76   	hr_utility.set_location(' Leaving:'||l_proc, 10);
77   end if;
78 --
79 Exception
80   When hr_api.child_integrity_violated then
81     -- Child integrity has been violated
82     --
83     hxc_ult_shd.constraint_error
84       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
85   When Others Then
86     --
87     Raise;
88 End delete_dml;
89 --
90 -- ----------------------------------------------------------------------------
91 -- |------------------------------< pre_delete >------------------------------|
92 -- ----------------------------------------------------------------------------
93 -- {Start Of Comments}
94 --
95 -- Description:
96 --   This private procedure contains any processing which is required before
97 --   the delete dml.
98 --
99 -- Prerequisites:
100 --   This is an internal procedure which is called from the del procedure.
101 --
102 -- In Parameters:
103 --   A Pl/Sql record structre.
104 --
105 -- Post Success:
106 --   Processing continues.
107 --
108 -- Post Failure:
109 --   If an error has occurred, an error message and exception will be raised
110 --   but not handled.
111 --
112 -- Developer Implementation Notes:
113 --   Any pre-processing required before the delete dml is issued should be
114 --   coded within this procedure. It is important to note that any 3rd party
115 --   maintenance should be reviewed before placing in this procedure.
116 --
117 -- Access Status:
118 --   Internal Row Handler Use Only.
119 --
120 -- {End Of Comments}
121 -- ----------------------------------------------------------------------------
122 Procedure pre_delete(p_rec in hxc_ult_shd.g_rec_type) is
123 --
124   l_proc  varchar2(72) ;
125 --
126 Begin
127   if g_debug then
128   	l_proc := g_package||'pre_delete';
129   	hr_utility.set_location('Entering:'||l_proc, 5);
130   	hr_utility.set_location(' Leaving:'||l_proc, 10);
131   end if;
132 End pre_delete;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |-----------------------------< post_delete >------------------------------|
136 -- ----------------------------------------------------------------------------
137 -- {Start Of Comments}
138 --
139 -- Description:
140 --   This private procedure contains any processing which is required after the
141 --   delete dml.
142 --
143 -- Prerequistes:
144 --   This is an internal procedure which is called from the del procedure.
145 --
146 -- In Parameters:
147 --   A Pl/Sql record structure.
148 --
149 -- Post Success:
150 --   Processing continues.
151 --
152 -- Post Failure:
153 --   If an error has occurred, an error message and exception will be raised
154 --   but not handled.
155 --
156 -- Developer Implementation Notes:
157 --   Any post-processing required after the delete dml is issued should be
158 --   coded within this procedure. It is important to note that any 3rd party
159 --   maintenance should be reviewed before placing in this procedure.
160 --
161 -- Access Status:
162 --   Internal Row Handler Use Only.
163 --
164 -- {End Of Comments}
165 -- -----------------------------------------------------------------------------
166 Procedure post_delete(p_rec in hxc_ult_shd.g_rec_type) is
167 --
168   l_proc  varchar2(72) ;
169 --
170 Begin
171 
172   if g_debug then
173   	l_proc := g_package||'post_delete';
174   	hr_utility.set_location('Entering:'||l_proc, 5);
175   end if;
176     begin
177     --
178     hxc_ult_rkd.after_delete
179       (p_layout_id
180       => p_rec.layout_id
181       ,p_language
182       => p_rec.language
183       ,p_display_layout_name_o
184       => hxc_ult_shd.g_old_rec.display_layout_name
185       ,p_source_lang_o
186       => hxc_ult_shd.g_old_rec.source_lang
187       );
188     --
189   exception
190     --
191     when hr_api.cannot_find_prog_unit then
192       --
193       hr_api.cannot_find_prog_unit_error
194         (p_module_name => 'HXC_LAYOUTS_TL'
195         ,p_hook_type   => 'AD');
196       --
197   end;
198   --
199   if g_debug then
200   	hr_utility.set_location(' Leaving:'||l_proc, 10);
201   end if;
202 End post_delete;
203 --
204 -- ----------------------------------------------------------------------------
205 -- |---------------------------------< del >----------------------------------|
206 -- ----------------------------------------------------------------------------
207 Procedure del
208   (p_rec	      in hxc_ult_shd.g_rec_type
209   ) is
210 --
211   l_proc  varchar2(72) ;
212 --
213 Begin
214   g_debug :=hr_utility.debug_enabled;
215   if g_debug then
216   	l_proc := g_package||'del';
217   	hr_utility.set_location('Entering:'||l_proc, 5);
218   end if;
219   --
220   -- We must lock the row which we need to delete.
221   --
222   hxc_ult_shd.lck
223     (p_rec.layout_id
224     ,p_rec.language
225     );
226   --
227   -- Call the supporting delete validate operation
228   --
229   hxc_ult_bus.delete_validate(p_rec);
230   --
231   -- Call the supporting pre-delete operation
232   --
233   hxc_ult_del.pre_delete(p_rec);
234   --
235   -- Delete the row.
236   --
237   hxc_ult_del.delete_dml(p_rec);
238   --
239   -- Call the supporting post-delete operation
240   --
241   hxc_ult_del.post_delete(p_rec);
242   --
243 End del;
244 --
245 -- ----------------------------------------------------------------------------
246 -- |---------------------------------< del >----------------------------------|
247 -- ----------------------------------------------------------------------------
248 Procedure del
249   (p_layout_id                            in     number
250   ,p_language                             in     varchar2
251   ) is
252 --
253   l_rec	  hxc_ult_shd.g_rec_type;
254   l_proc  varchar2(72) ;
255 --
256 Begin
257   g_debug :=hr_utility.debug_enabled;
258   if g_debug then
259   	l_proc := g_package||'del';
260   	hr_utility.set_location('Entering:'||l_proc, 5);
261   end if;
262   --
263   -- As the delete procedure accepts a plsql record structure we do need to
264   -- convert the  arguments into the record structure.
265   -- We don't need to call the supplied conversion argument routine as we
266   -- only need a few attributes.
267   --
268   l_rec.layout_id := p_layout_id;
269   l_rec.language := p_language;
270   --
271   --
272   -- Having converted the arguments into the hxc_ult_rec
273   -- plsql record structure we must call the corresponding entity
274   -- business process
275   --
276   hxc_ult_del.del(l_rec);
277   --
278   if g_debug then
279   	hr_utility.set_location(' Leaving:'||l_proc, 10);
280   end if;
281 End del;
282 --
283 -- ----------------------------------------------------------------------------
284 -- |------------------------------< del_tl >----------------------------------|
285 -- ----------------------------------------------------------------------------
286 Procedure del_tl
287   (p_layout_id                            in number
288   ) is
289   --
290   -- Cursor to obtain all the translation rows.
291   --
292   cursor csr_del_langs is
293     select ult.language
294       from hxc_layouts_tl ult
295      where ult.layout_id = p_layout_id;
296   --
297   l_proc  varchar2(72) ;
298   --
299 Begin
300   g_debug :=hr_utility.debug_enabled;
301   if g_debug then
302   	l_proc := g_package||'del_tl';
303   	hr_utility.set_location('Entering:'||l_proc,10);
304   end if;
305   --
306   -- Delete all the translated rows
307   --
308   for l_lang in csr_del_langs loop
309     hxc_ult_del.del
310       (p_layout_id                   => p_layout_id
311       ,p_language                    => l_lang.language
312       );
313   end loop;
314   --
315   if g_debug then
316  	 hr_utility.set_location(' Leaving:'||l_proc,20);
317   end if;
318 End del_tl;
319 --
320 end hxc_ult_del;