1 Package Body hxc_hav_del as
2 /* $Header: hxchavrhi.pkb 120.2 2005/09/23 10:41:41 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_hav_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_hav_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_values row.
67 --
68 delete from hxc_alias_values
69 where alias_value_id = p_rec.alias_value_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_hav_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_hav_shd.g_rec_type) is
121 --
122 l_proc varchar2(72);
123 --
124 Begin
125 if g_debug then
126 l_proc := g_package||'pre_delete';
127 hr_utility.set_location('Entering:'||l_proc, 5);
128 end if;
129
130 hxc_time_category_utils_pkg.alias_value_ref_int_chk ( p_rec.alias_value_id, 'DELETE' );
131
132 if g_debug then
133 hr_utility.set_location(' Leaving:'||l_proc, 10);
134 end if;
135 End pre_delete;
136 --
137 -- ----------------------------------------------------------------------------
138 -- |-----------------------------< post_delete >------------------------------|
139 -- ----------------------------------------------------------------------------
140 -- {Start Of Comments}
141 --
142 -- Description:
143 -- This private procedure contains any processing which is required after the
144 -- delete dml.
145 --
146 -- Prerequistes:
147 -- This is an internal procedure which is called from the del procedure.
148 --
149 -- In Parameters:
150 -- A Pl/Sql record structure.
151 --
152 -- Post Success:
153 -- Processing continues.
154 --
155 -- Post Failure:
156 -- If an error has occurred, an error message and exception will be raised
157 -- but not handled.
158 --
159 -- Developer Implementation Notes:
160 -- Any post-processing required after the delete dml is issued should be
161 -- coded within this procedure. It is important to note that any 3rd party
162 -- maintenance should be reviewed before placing in this procedure.
163 --
164 -- Access Status:
165 -- Internal Row Handler Use Only.
166 --
167 -- {End Of Comments}
168 -- -----------------------------------------------------------------------------
169 Procedure post_delete(p_rec in hxc_hav_shd.g_rec_type) is
170 --
171 l_proc varchar2(72);
172 --
173 Begin
174 if g_debug then
175 l_proc := g_package||'post_delete';
176 hr_utility.set_location('Entering:'||l_proc, 5);
177 end if;
178 begin
179 --
180 hxc_hav_rkd.after_delete
181 (p_alias_value_id
182 => p_rec.alias_value_id
183 ,p_alias_value_name_o
184 => hxc_hav_shd.g_old_rec.alias_value_name
185 ,p_date_from_o
186 => hxc_hav_shd.g_old_rec.date_from
187 ,p_date_to_o
188 => hxc_hav_shd.g_old_rec.date_to
189 ,p_alias_definition_id_o
190 => hxc_hav_shd.g_old_rec.alias_definition_id
191 ,p_enabled_flag_o
192 => hxc_hav_shd.g_old_rec.enabled_flag
193 ,p_attribute_category_o
194 => hxc_hav_shd.g_old_rec.attribute_category
195 ,p_attribute1_o
196 => hxc_hav_shd.g_old_rec.attribute1
197 ,p_attribute2_o
198 => hxc_hav_shd.g_old_rec.attribute2
199 ,p_attribute3_o
200 => hxc_hav_shd.g_old_rec.attribute3
201 ,p_attribute4_o
202 => hxc_hav_shd.g_old_rec.attribute4
203 ,p_attribute5_o
204 => hxc_hav_shd.g_old_rec.attribute5
205 ,p_attribute6_o
206 => hxc_hav_shd.g_old_rec.attribute6
207 ,p_attribute7_o
208 => hxc_hav_shd.g_old_rec.attribute7
209 ,p_attribute8_o
210 => hxc_hav_shd.g_old_rec.attribute8
211 ,p_attribute9_o
212 => hxc_hav_shd.g_old_rec.attribute9
213 ,p_attribute10_o
214 => hxc_hav_shd.g_old_rec.attribute10
215 ,p_attribute11_o
216 => hxc_hav_shd.g_old_rec.attribute11
217 ,p_attribute12_o
218 => hxc_hav_shd.g_old_rec.attribute12
219 ,p_attribute13_o
220 => hxc_hav_shd.g_old_rec.attribute13
221 ,p_attribute14_o
222 => hxc_hav_shd.g_old_rec.attribute14
223 ,p_attribute15_o
224 => hxc_hav_shd.g_old_rec.attribute15
225 ,p_attribute16_o
226 => hxc_hav_shd.g_old_rec.attribute16
227 ,p_attribute17_o
228 => hxc_hav_shd.g_old_rec.attribute17
229 ,p_attribute18_o
230 => hxc_hav_shd.g_old_rec.attribute18
231 ,p_attribute19_o
232 => hxc_hav_shd.g_old_rec.attribute19
233 ,p_attribute20_o
234 => hxc_hav_shd.g_old_rec.attribute20
235 ,p_attribute21_o
236 => hxc_hav_shd.g_old_rec.attribute21
237 ,p_attribute22_o
238 => hxc_hav_shd.g_old_rec.attribute22
239 ,p_attribute23_o
240 => hxc_hav_shd.g_old_rec.attribute23
241 ,p_attribute24_o
242 => hxc_hav_shd.g_old_rec.attribute24
243 ,p_attribute25_o
244 => hxc_hav_shd.g_old_rec.attribute25
245 ,p_attribute26_o
246 => hxc_hav_shd.g_old_rec.attribute26
247 ,p_attribute27_o
248 => hxc_hav_shd.g_old_rec.attribute27
249 ,p_attribute28_o
250 => hxc_hav_shd.g_old_rec.attribute28
251 ,p_attribute29_o
252 => hxc_hav_shd.g_old_rec.attribute29
253 ,p_attribute30_o
254 => hxc_hav_shd.g_old_rec.attribute30
255 ,p_object_version_number_o
256 => hxc_hav_shd.g_old_rec.object_version_number
257 );
258 --
259 exception
260 --
261 when hr_api.cannot_find_prog_unit then
262 --
263 hr_api.cannot_find_prog_unit_error
264 (p_module_name => 'HXC_ALIAS_VALUES'
265 ,p_hook_type => 'AD');
266 --
267 end;
268 --
269 if g_debug then
270 hr_utility.set_location(' Leaving:'||l_proc, 10);
271 end if;
272 End post_delete;
273 --
274 -- ----------------------------------------------------------------------------
275 -- |---------------------------------< del >----------------------------------|
276 -- ----------------------------------------------------------------------------
277 Procedure del
278 (p_rec in hxc_hav_shd.g_rec_type
279 ) is
280 --
281 l_proc varchar2(72);
282 --
283 Begin
284 g_debug:=hr_utility.debug_enabled;
285 if g_debug then
286 l_proc := g_package||'del';
287 hr_utility.set_location('Entering:'||l_proc, 5);
288 end if;
289 --
290 -- We must lock the row which we need to delete.
291 --
292 hxc_hav_shd.lck
293 (p_rec.alias_value_id
294 ,p_rec.object_version_number
295 );
296 --
297 -- Call the supporting delete validate operation
298 --
299 hxc_hav_bus.delete_validate(p_rec);
300 --
301 -- Call the supporting pre-delete operation
302 --
303 hxc_hav_del.pre_delete(p_rec);
304 --
305 -- Delete the row.
306 --
307 hxc_hav_del.delete_dml(p_rec);
308 --
309 -- Call the supporting post-delete operation
310 --
311 hxc_hav_del.post_delete(p_rec);
312 --
313 End del;
314 --
315 -- ----------------------------------------------------------------------------
316 -- |---------------------------------< del >----------------------------------|
317 -- ----------------------------------------------------------------------------
318 Procedure del
319 (p_alias_value_id in number
320 ,p_object_version_number in number
321 ) is
322 --
323 l_rec hxc_hav_shd.g_rec_type;
324 l_proc varchar2(72);
325 --
326 Begin
327 g_debug:=hr_utility.debug_enabled;
328 if g_debug then
332 --
329 l_proc := g_package||'del';
330 hr_utility.set_location('Entering:'||l_proc, 5);
331 end if;
333 -- As the delete procedure accepts a plsql record structure we do need to
334 -- convert the arguments into the record structure.
335 -- We don't need to call the supplied conversion argument routine as we
336 -- only need a few attributes.
337 --
338 l_rec.alias_value_id := p_alias_value_id;
339 l_rec.object_version_number := p_object_version_number;
340 --
341 -- Having converted the arguments into the hxc_hav_rec
342 -- plsql record structure we must call the corresponding entity
343 -- business process
344 --
345 hxc_hav_del.del(l_rec);
346 --
347 --
348 -- Remove all matching translation rows
349 hxc_vtl_del.del_tl
350 (p_alias_value_id => p_alias_value_id
351 );
352
353 if g_debug then
354 hr_utility.set_location(' Leaving:'||l_proc, 10);
355 end if;
356 End del;
357 --
358 end hxc_hav_del;