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