1 Package body hxc_tkgq_del as
2 /* $Header: hxctkgqrhi.pkb 120.2 2005/09/23 09:33:26 rchennur noship $ */
3 --
4 g_package varchar2(33) := ' hxc_tkgq_del.'; -- Global package name
5 g_debug boolean := hr_utility.debug_enabled;
6 -- ----------------------------------------------------------------------------
7 -- |------------------------------< delete_dml >------------------------------|
8 -- ----------------------------------------------------------------------------
9 --
10 -- Description:
11 -- This procedure controls the actual dml delete logic. The functions of
12 -- this procedure are as follows:
13 -- 1) To set and unset the g_api_dml status as required (as we are about to
14 -- perform dml).
15 -- 2) To delete the specified row from the schema using the primary key in
16 -- the predicates.
17 -- 3) To trap any constraint violations that may have occurred.
18 -- 4) To raise any other errors.
19 --
20 -- Prerequisites:
21 -- This is an internal private procedure which must be called from the del
22 -- procedure.
23 --
24 -- In Parameters:
25 -- A Pl/Sql record structre.
26 --
27 -- Post Success:
28 -- The specified row will be delete from the schema.
29 --
30 -- Post Failure:
31 -- On the delete dml failure it is important to note that we always reset the
32 -- g_api_dml status to false.
33 -- If a child integrity constraint violation is raised the
34 -- constraint_error procedure will be called.
35 -- If any other error is reported, the error will be raised after the
36 -- g_api_dml status is reset.
37 --
38 -- Developer Implementation Notes:
39 -- None.
40 --
41 -- Access Status:
42 -- Internal Row Handler Use Only.
43 --
44 -- ----------------------------------------------------------------------------
45 Procedure delete_dml
46 (p_rec in hxc_tkgq_shd.g_rec_type
47 ) is
48 --
49 l_proc varchar2(72) ;
50 --
51 Begin
52
53 if g_debug then
54 l_proc := g_package||'delete_dml';
55 hr_utility.set_location('Entering:'||l_proc, 5);
56 end if;
57 --
58 hxc_tkgq_shd.g_api_dml := true; -- Set the api dml status
59
60 -- first of all delete any child rows
61
62 delete from hxc_tk_group_query_criteria tkgqc
63 where tkgqc.tk_group_query_id in
64 ( select tkgq.tk_group_query_id
65 from hxc_tk_group_queries tkgq
66 where tkgq.tk_group_id = p_rec.tk_group_id );
67
68 -- Delete the hxc_tk_group_queries row.
69
70 delete from hxc_tk_group_queries tkgq
71 where tkgq.tk_group_query_id = p_rec.tk_group_query_id;
72
73 --
74 hxc_tkgq_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_tkgq_shd.g_api_dml := false; -- Unset the api dml status
84 hxc_tkgq_shd.constraint_error
85 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
86 When Others Then
87 hxc_tkgq_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_tkgq_shd.g_rec_type) is
122 --
123 l_proc varchar2(72) ;
124 --
125 Begin
126
127 if g_debug then
128 l_proc := g_package||'pre_delete';
129 hr_utility.set_location('Entering:'||l_proc, 5);
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_tkgq_shd.g_rec_type) is
165 --
166 l_proc varchar2(72) ;
167 --
168 Begin
169
170 if g_debug then
171 l_proc := g_package||'post_delete';
172 hr_utility.set_location('Entering:'||l_proc, 5);
173 end if;
174 begin
175 --
176 hxc_tkgq_rkd.after_delete
177 (p_tk_group_query_id
178 => p_rec.tk_group_query_id
179 ,p_group_query_name_o
180 => hxc_tkgq_shd.g_old_rec.group_query_name
181 ,p_tk_group_id_o
182 => hxc_tkgq_shd.g_old_rec.tk_group_id
183 ,p_include_exclude_o
184 => hxc_tkgq_shd.g_old_rec.include_exclude
185 ,p_system_user_o
186 => hxc_tkgq_shd.g_old_rec.system_user
187 ,p_object_version_number_o
188 => hxc_tkgq_shd.g_old_rec.object_version_number
189 );
190 --
191 exception
192 --
193 when hr_api.cannot_find_prog_unit then
194 --
195 hr_api.cannot_find_prog_unit_error
196 (p_module_name => 'HXC_TK_GROUP_QUERY'
197 ,p_hook_type => 'AD');
198 --
199 end;
200 --
201 if g_debug then
202 hr_utility.set_location(' Leaving:'||l_proc, 10);
203 end if;
204 End post_delete;
205 -- ----------------------------------------------------------------------------
206 -- |---------------------------------< del >----------------------------------|
207 -- ----------------------------------------------------------------------------
208 --
209 -- Description:
210 -- This procedure is the record interface for the delete process
211 -- for the specified entity. The role of this process is to delete the
212 -- row from the HR schema. This process is the main backbone of the del
213 -- business process. The processing of this procedure is as follows:
214 -- 1) The controlling validation process delete_validate is then executed
215 -- which will execute all private and public validation business rule
216 -- processes.
217 -- 2) The pre_delete process is then executed which enables any
218 -- logic to be processed before the delete dml process is executed.
219 -- 3) The delete_dml process will physical perform the delete dml for the
220 -- specified row.
221 -- 4) The post_delete process is then executed which enables any
222 -- logic to be processed after the delete dml process.
223 --
224 -- Prerequisites:
225 -- The main parameters to the business process have to be in the record
226 -- format.
227 --
228 -- In Parameters:
229 --
230 -- Post Success:
231 -- The specified row will be fully validated and deleted for the specified
232 -- entity without being committed.
233 --
234 -- Post Failure:
235 -- If an error has occurred, an error message will be raised.
236 --
237 -- Developer Implementation Notes:
238 -- None.
239 --
240 -- Access Status:
241 -- Internal Development Use Only.
242 --
243 -- ----------------------------------------------------------------------------
244 Procedure del
245 (p_rec in hxc_tkgq_shd.g_rec_type
246 ) is
247 --
248 l_proc varchar2(72) ;
249 --
250 Begin
251 g_debug :=hr_utility.debug_enabled;
252 if g_debug then
253 l_proc := g_package||'del';
254 hr_utility.set_location('Entering:'||l_proc, 5);
255 end if;
256 --
257 -- We must lock the row which we need to delete.
258 --
259 hxc_tkgq_shd.lck
260 (p_rec.tk_group_query_id
261 ,p_rec.object_version_number
262 );
263 --
264 -- Call the supporting delete validate operation
265 --
266 hxc_tkgq_bus.delete_validate(p_rec);
267 --
268 -- Call the supporting pre-delete operation
269 --
270 hxc_tkgq_del.pre_delete(p_rec);
271 --
272 -- Delete the row.
273 --
274 hxc_tkgq_del.delete_dml(p_rec);
275 --
276 -- Call the supporting post-delete operation
277 --
278 hxc_tkgq_del.post_delete(p_rec);
279 --
280 End del;
281 --
282 -- ----------------------------------------------------------------------------
283 -- |---------------------------------< del >----------------------------------|
284 -- ----------------------------------------------------------------------------
285 --
286 -- Description:
287 -- This procedure is the attribute interface for the delete
288 -- process for the specified entity and is the outermost layer. The role
289 -- of this process is to validate and delete the specified row from the
290 -- HR schema. The processing of this procedure is as follows:
291 -- 1) The attributes are converted into a local record structure by
292 -- explicitly coding the attribute parameters into the g_rec_type
293 -- datatype.
294 -- 2) After the conversion has taken place, the corresponding record del
295 -- interface process is executed.
296 --
297 -- Prerequisites:
298 --
299 -- In Parameters:
300 --
301 -- Post Success:
302 -- The specified row will be fully validated and deleted for the specified
303 -- entity without being committed.
304 --
305 -- Post Failure:
306 -- If an error has occurred, an error message will be raised.
307 --
308 -- Developer Implementation Notes:
309 -- The attrbute in parameters should be modified as to the business process
310 -- requirements.
311 --
312 -- Access Status:
313 -- Internal Development Use Only.
314 --
315 -- ----------------------------------------------------------------------------
316 Procedure del
317 (p_tk_group_query_id in number
318 ,p_object_version_number in number
319 ) is
320 --
321 l_rec hxc_tkgq_shd.g_rec_type;
322 l_proc varchar2(72) ;
323 --
324 Begin
325 g_debug :=hr_utility.debug_enabled;
326 if g_debug then
327 l_proc := g_package||'del';
328 hr_utility.set_location('Entering:'||l_proc, 5);
329 end if;
330 --
331 -- As the delete procedure accepts a plsql record structure we do need to
332 -- convert the arguments into the record structure.
333 -- We don't need to call the supplied conversion argument routine as we
334 -- only need a few attributes.
335 --
336 l_rec.tk_group_query_id := p_tk_group_query_id;
337 l_rec.object_version_number := p_object_version_number;
338 --
339 -- Having converted the arguments into the hxc_tkgq_rec
340 -- plsql record structure we must call the corresponding entity
341 -- business process
342 --
343 hxc_tkgq_del.del(l_rec);
344 --
345 if g_debug then
346 hr_utility.set_location(' Leaving:'||l_proc, 10);
347 end if;
348 End del;
349 --
350 end hxc_tkgq_del;