1 Package Body hxc_dtl_del as
2 /* $Header: hxcdtlrhi.pkb 120.2 2005/09/23 08:07:34 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_dtl_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_dtl_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_definitions_tl row.
67 --
68 delete from hxc_alias_definitions_tl
69 where alias_definition_id = p_rec.alias_definition_id
70 and language = p_rec.language;
71 --
72 --
73 --
74 if g_debug then
75 hr_utility.set_location(' Leaving:'||l_proc, 10);
76 end if;
77 --
78 Exception
79 When hr_api.child_integrity_violated then
80 -- Child integrity has been violated
81 --
82 hxc_dtl_shd.constraint_error
83 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
84 When Others Then
85 --
86 Raise;
87 End delete_dml;
88 --
89 -- ----------------------------------------------------------------------------
90 -- |------------------------------< pre_delete >------------------------------|
91 -- ----------------------------------------------------------------------------
92 -- {Start Of Comments}
93 --
94 -- Description:
95 -- This private procedure contains any processing which is required before
96 -- the delete dml.
97 --
98 -- Prerequisites:
99 -- This is an internal procedure which is called from the del procedure.
100 --
101 -- In Parameters:
102 -- A Pl/Sql record structre.
103 --
104 -- Post Success:
105 -- Processing continues.
106 --
107 -- Post Failure:
108 -- If an error has occurred, an error message and exception will be raised
109 -- but not handled.
110 --
111 -- Developer Implementation Notes:
112 -- Any pre-processing required before the delete dml is issued should be
113 -- coded within this procedure. It is important to note that any 3rd party
114 -- maintenance should be reviewed before placing in this procedure.
115 --
116 -- Access Status:
117 -- Internal Row Handler Use Only.
118 --
119 -- {End Of Comments}
120 -- ----------------------------------------------------------------------------
121 Procedure pre_delete(p_rec in hxc_dtl_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 -- {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_dtl_shd.g_rec_type) is
167 --
168 l_proc varchar2(72);
169 --
170 Begin
171 if g_debug then
172 l_proc := g_package||'post_delete';
173 hr_utility.set_location('Entering:'||l_proc, 5);
174 end if;
175 begin
176 --
177 hxc_dtl_rkd.after_delete
178 (p_alias_definition_id
179 => p_rec.alias_definition_id
180 ,p_language
181 => p_rec.language
182 ,p_alias_definition_name_o
183 => hxc_dtl_shd.g_old_rec.alias_definition_name
184 ,p_description_o
185 => hxc_dtl_shd.g_old_rec.description
186 ,p_source_lang_o
187 => hxc_dtl_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_DEFINITIONS_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_dtl_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_dtl_shd.lck
224 (p_rec.alias_definition_id
225 ,p_rec.language
226 );
227 --
228 -- Call the supporting delete validate operation
229 --
230 hxc_dtl_bus.delete_validate(p_rec);
231 --
232 -- Call the supporting pre-delete operation
233 --
234 hxc_dtl_del.pre_delete(p_rec);
235 --
236 -- Delete the row.
237 --
238 hxc_dtl_del.delete_dml(p_rec);
239 --
240 -- Call the supporting post-delete operation
241 --
242 hxc_dtl_del.post_delete(p_rec);
243 --
244 End del;
245 --
246 -- ----------------------------------------------------------------------------
247 -- |---------------------------------< del >----------------------------------|
248 -- ----------------------------------------------------------------------------
249 Procedure del
250 (p_alias_definition_id in number
251 ,p_language in varchar2
252 ) is
253 --
254 l_rec hxc_dtl_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_definition_id := p_alias_definition_id;
270 l_rec.language := p_language;
271 --
272 --
273 -- Having converted the arguments into the hxc_dtl_rec
274 -- plsql record structure we must call the corresponding entity
275 -- business process
276 --
277 hxc_dtl_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_definition_id in number
289 ) is
290 --
291 -- Cursor to obtain all the translation rows.
292 --
293 cursor csr_del_langs is
294 select dtl.language
295 from hxc_alias_definitions_tl dtl
296 where dtl.alias_definition_id = p_alias_definition_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_dtl_del.del
311 (p_alias_definition_id => p_alias_definition_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_dtl_del;