DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_VTL_DEL

Source


1 Package Body hxc_vtl_del as
2 /* $Header: hxcvtlrhi.pkb 120.2 2005/09/23 06:39:43 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_vtl_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_vtl_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_alias_values_tl row.
68   --
69   delete from hxc_alias_values_tl
70   where alias_value_id = p_rec.alias_value_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_vtl_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_vtl_shd.g_rec_type) is
123 --
124   l_proc  varchar2(72) ;
125 --
126 Begin
127 
128   if g_debug then
129   	l_proc := g_package||'pre_delete';
130   	hr_utility.set_location('Entering:'||l_proc, 5);
131   	hr_utility.set_location(' Leaving:'||l_proc, 10);
132   end if;
133 End pre_delete;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |-----------------------------< post_delete >------------------------------|
137 -- ----------------------------------------------------------------------------
138 -- {Start Of Comments}
139 --
140 -- Description:
141 --   This private procedure contains any processing which is required after the
142 --   delete dml.
143 --
144 -- Prerequistes:
145 --   This is an internal procedure which is called from the del procedure.
146 --
147 -- In Parameters:
148 --   A Pl/Sql record structure.
149 --
150 -- Post Success:
151 --   Processing continues.
152 --
153 -- Post Failure:
154 --   If an error has occurred, an error message and exception will be raised
155 --   but not handled.
156 --
157 -- Developer Implementation Notes:
158 --   Any post-processing required after the delete dml is issued should be
159 --   coded within this procedure. It is important to note that any 3rd party
160 --   maintenance should be reviewed before placing in this procedure.
161 --
162 -- Access Status:
163 --   Internal Row Handler Use Only.
164 --
165 -- {End Of Comments}
166 -- -----------------------------------------------------------------------------
167 Procedure post_delete(p_rec in hxc_vtl_shd.g_rec_type) is
168 --
169   l_proc  varchar2(72) ;
170 --
171 Begin
172 
173   if g_debug then
174   	l_proc := g_package||'post_delete';
175   	hr_utility.set_location('Entering:'||l_proc, 5);
176   end if;
177     begin
178     --
179     hxc_vtl_rkd.after_delete
180       (p_alias_value_id
181       => p_rec.alias_value_id
182       ,p_language
183       => p_rec.language
184       ,p_alias_value_name_o
185       => hxc_vtl_shd.g_old_rec.alias_value_name
186       ,p_source_lang_o
187       => hxc_vtl_shd.g_old_rec.source_lang
188       );
189     --
190   exception
191     --
192     when hr_api.cannot_find_prog_unit then
193       --
194       hr_api.cannot_find_prog_unit_error
195         (p_module_name => 'HXC_ALIAS_VALUES_TL'
196         ,p_hook_type   => 'AD');
197       --
198   end;
199   --
200   if g_debug then
201   	hr_utility.set_location(' Leaving:'||l_proc, 10);
202   end if;
203 End post_delete;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |---------------------------------< del >----------------------------------|
207 -- ----------------------------------------------------------------------------
208 Procedure del
209   (p_rec	      in hxc_vtl_shd.g_rec_type
210   ) is
211 --
212   l_proc  varchar2(72) ;
213 --
214 Begin
215   g_debug :=hr_utility.debug_enabled;
216   if g_debug then
217  	l_proc := g_package||'del';
218  	hr_utility.set_location('Entering:'||l_proc, 5);
219   end if;
220   --
221   -- We must lock the row which we need to delete.
222   --
223   hxc_vtl_shd.lck
224     (p_rec.alias_value_id
225     ,p_rec.language
226     );
227   --
228   -- Call the supporting delete validate operation
229   --
230   hxc_vtl_bus.delete_validate(p_rec);
231   --
232   -- Call the supporting pre-delete operation
233   --
234   hxc_vtl_del.pre_delete(p_rec);
235   --
236   -- Delete the row.
237   --
238   hxc_vtl_del.delete_dml(p_rec);
239   --
240   -- Call the supporting post-delete operation
241   --
242   hxc_vtl_del.post_delete(p_rec);
243   --
244 End del;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |---------------------------------< del >----------------------------------|
248 -- ----------------------------------------------------------------------------
249 Procedure del
250   (p_alias_value_id                       in     number
251   ,p_language                             in     varchar2
252   ) is
253 --
254   l_rec	  hxc_vtl_shd.g_rec_type;
255   l_proc  varchar2(72) ;
256 --
257 Begin
258   g_debug :=hr_utility.debug_enabled;
259   if g_debug then
260   	l_proc := g_package||'del';
261   	hr_utility.set_location('Entering:'||l_proc, 5);
262   end if;
263   --
264   -- As the delete procedure accepts a plsql record structure we do need to
265   -- convert the  arguments into the record structure.
266   -- We don't need to call the supplied conversion argument routine as we
267   -- only need a few attributes.
268   --
269   l_rec.alias_value_id := p_alias_value_id;
270   l_rec.language := p_language;
271   --
272   --
273   -- Having converted the arguments into the hxc_vtl_rec
274   -- plsql record structure we must call the corresponding entity
275   -- business process
276   --
277   hxc_vtl_del.del(l_rec);
278   --
279   if g_debug then
280   	hr_utility.set_location(' Leaving:'||l_proc, 10);
281   end if;
282 End del;
283 --
284 -- ----------------------------------------------------------------------------
285 -- |------------------------------< del_tl >----------------------------------|
286 -- ----------------------------------------------------------------------------
287 Procedure del_tl
288   (p_alias_value_id                       in number
289   ) is
290   --
291   -- Cursor to obtain all the translation rows.
292   --
293   cursor csr_del_langs is
294     select vtl.language
295       from hxc_alias_values_tl vtl
296      where vtl.alias_value_id = p_alias_value_id;
297   --
298   l_proc  varchar2(72) ;
299   --
300 Begin
301   g_debug :=hr_utility.debug_enabled;
302   if g_debug then
303   	l_proc := g_package||'del_tl';
304   	hr_utility.set_location('Entering:'||l_proc,10);
305   end if;
306   --
307   -- Delete all the translated rows
308   --
309   for l_lang in csr_del_langs loop
310     hxc_vtl_del.del
311       (p_alias_value_id              => p_alias_value_id
312       ,p_language                    => l_lang.language
313       );
314   end loop;
315   --
316   if g_debug then
317   	hr_utility.set_location(' Leaving:'||l_proc,20);
318   end if;
319 End del_tl;
320 --
321 end hxc_vtl_del;