DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HAT_DEL

Source


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