DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HEG_DEL

Source


1 Package Body hxc_heg_del as
2 /* $Header: hxchegrhi.pkb 120.2 2005/09/23 10:42:21 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_heg_del.';  -- Global package name
9 g_debug	boolean		:=hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< delete_dml >------------------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Description:
16 --   This procedure controls the actual dml delete logic. The functions of
17 --   this procedure are as follows:
18 --   1) To set and unset the g_api_dml status as required (as we are about to
19 --      perform dml).
20 --   2) To delete the specified row from the schema using the primary key in
21 --      the predicates.
22 --   3) To trap any constraint violations that may have occurred.
23 --   4) To raise any other errors.
24 --
25 -- Prerequisites:
26 --   This is an internal private procedure which must be called from the del
27 --   procedure.
28 --
29 -- In Parameters:
30 --   A Pl/Sql record structre.
31 --
32 -- Post Success:
33 --   The specified row will be delete from the schema.
34 --
35 -- Post Failure:
36 --   On the delete dml failure it is important to note that we always reset the
37 --   g_api_dml status to false.
38 --   If a child integrity constraint violation is raised the
39 --   constraint_error procedure will be called.
40 --   If any other error is reported, the error will be raised after the
41 --   g_api_dml status is reset.
42 --
43 -- Developer Implementation Notes:
44 --   None.
45 --
46 -- Access Status:
47 --   Internal Row Handler Use Only.
48 --
49 -- ----------------------------------------------------------------------------
50 Procedure delete_dml
51   (p_rec in hxc_heg_shd.g_rec_type
52   ) is
53 --
54   l_proc  varchar2(72);
55 --
56 Begin
57   if g_debug then
58 	l_proc := g_package||'delete_dml';
59 	hr_utility.set_location('Entering:'||l_proc, 5);
60   end if;
61   --
62   hxc_heg_shd.g_api_dml := true;  -- Set the api dml status
63 
64   -- first of all delete any child rows
65 
66   delete from hxc_entity_group_comps egc
67   where  egc.entity_group_id = p_rec.entity_group_id;
68 
69   -- Delete the hxc_entity_groups row.
70   --
71   delete from hxc_entity_groups heg
72   where  heg.entity_group_id = p_rec.entity_group_id;
73   --
74   hxc_heg_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_heg_shd.g_api_dml := false;   -- Unset the api dml status
84     hxc_heg_shd.constraint_error
85       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
86   When Others Then
87     hxc_heg_shd.g_api_dml := false;   -- Unset the api dml status
88     Raise;
89 End delete_dml;
90 --
91 -- ----------------------------------------------------------------------------
92 -- |------------------------------< pre_delete >------------------------------|
93 -- ----------------------------------------------------------------------------
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 -- ----------------------------------------------------------------------------
121 Procedure pre_delete(p_rec in hxc_heg_shd.g_rec_type) is
122 --
123   l_proc  varchar2(72);
124 --
125 Begin
126   if g_debug then
127 	  l_proc := g_package||'pre_delete';
128 	  hr_utility.set_location('Entering:'||l_proc, 5);
129 	  --
130 	  hr_utility.set_location(' Leaving:'||l_proc, 10);
131   end if;
132 End pre_delete;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |-----------------------------< post_delete >------------------------------|
136 -- ----------------------------------------------------------------------------
137 --
138 -- Description:
139 --   This private procedure contains any processing which is required after the
140 --   delete dml.
141 --
142 -- Prerequistes:
143 --   This is an internal procedure which is called from the del procedure.
144 --
145 -- In Parameters:
146 --   A Pl/Sql record structure.
147 --
148 -- Post Success:
149 --   Processing continues.
150 --
151 -- Post Failure:
152 --   If an error has occurred, an error message and exception will be raised
153 --   but not handled.
154 --
155 -- Developer Implementation Notes:
156 --   Any post-processing required after the delete dml is issued should be
157 --   coded within this procedure. It is important to note that any 3rd party
158 --   maintenance should be reviewed before placing in this procedure.
159 --
160 -- Access Status:
161 --   Internal Row Handler Use Only.
162 --
163 -- -----------------------------------------------------------------------------
164 Procedure post_delete(p_rec in hxc_heg_shd.g_rec_type) is
165 --
166   l_proc  varchar2(72);
167 --
168 Begin
169   if g_debug then
170 	l_proc := g_package||'post_delete';
171 	hr_utility.set_location('Entering:'||l_proc, 5);
172   end if;
173     begin
174     --
175     hxc_heg_rkd.after_delete
176       (p_entity_group_id
177       => p_rec.entity_group_id
178       ,p_name_o
179       => hxc_heg_shd.g_old_rec.name
180       ,p_entity_type_o
181       => hxc_heg_shd.g_old_rec.entity_type
182       ,p_object_version_number_o
183       => hxc_heg_shd.g_old_rec.object_version_number
184       ,p_description_o
185       => hxc_heg_shd.g_old_rec.description
186       ,p_business_group_id_o
187       => hxc_heg_shd.g_old_rec.business_group_id
188       ,p_legislation_code_o
189       => hxc_heg_shd.g_old_rec.legislation_code
190       );
191     --
192   exception
193     --
194     when hr_api.cannot_find_prog_unit then
195       --
196       hr_api.cannot_find_prog_unit_error
197         (p_module_name => 'HXC_ENTITY_GROUPS'
198         ,p_hook_type   => 'AD');
199       --
200   end;
201   --
202   if g_debug then
203 	hr_utility.set_location(' Leaving:'||l_proc, 10);
204   end if;
205 End post_delete;
206 --
207 -- ----------------------------------------------------------------------------
208 -- |---------------------------------< del >----------------------------------|
209 -- ----------------------------------------------------------------------------
210 Procedure del
211   (p_rec	      in hxc_heg_shd.g_rec_type
212   ) is
213 --
214   l_proc  varchar2(72);
215 --
216 Begin
217   g_debug:=hr_utility.debug_enabled;
218   if g_debug then
219 	l_proc := g_package||'del';
220 	hr_utility.set_location('Entering:'||l_proc, 5);
221   end if;
222   --
223   -- We must lock the row which we need to delete.
224   --
225   hxc_heg_shd.lck
226     (p_rec.entity_group_id
227     ,p_rec.object_version_number
228     );
229   --
230   -- Call the supporting delete validate operation
231   --
232   hxc_heg_bus.delete_validate(p_rec);
233   --
234   -- Call the supporting pre-delete operation
235   --
236   hxc_heg_del.pre_delete(p_rec);
237   --
238   -- Delete the row.
239   --
240   hxc_heg_del.delete_dml(p_rec);
241   --
242   -- Call the supporting post-delete operation
243   --
244   hxc_heg_del.post_delete(p_rec);
245   --
246 End del;
247 --
248 -- ----------------------------------------------------------------------------
249 -- |---------------------------------< del >----------------------------------|
250 -- ----------------------------------------------------------------------------
251 Procedure del
252   (p_entity_group_id                      in     number
253   ,p_object_version_number                in     number
254   ) is
255 --
256   l_rec	  hxc_heg_shd.g_rec_type;
257   l_proc  varchar2(72);
258 --
259 Begin
260   g_debug:=hr_utility.debug_enabled;
261   if g_debug then
262 	l_proc := g_package||'del';
263 	hr_utility.set_location('Entering:'||l_proc, 5);
264   end if;
265   --
266   -- As the delete procedure accepts a plsql record structure we do need to
267   -- convert the  arguments into the record structure.
268   -- We don't need to call the supplied conversion argument routine as we
269   -- only need a few attributes.
270   --
271   l_rec.entity_group_id := p_entity_group_id;
272   l_rec.object_version_number := p_object_version_number;
273   --
274   -- Having converted the arguments into the hxc_heg_rec
275   -- plsql record structure we must call the corresponding entity
276   -- business process
277   --
278   hxc_heg_del.del(l_rec);
279   --
280   if g_debug then
281 	hr_utility.set_location(' Leaving:'||l_proc, 10);
282   end if;
283 End del;
284 --
285 end hxc_heg_del;