1 Package Body ben_cpg_del as
2 /* $Header: becpgrhi.pkb 120.0 2005/05/28 01:13 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_cpg_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 ben_cpg_shd.g_rec_type
54 ) is
55 --
56 l_proc varchar2(72) := g_package||'delete_dml';
57 --
58 Begin
59 if g_debug then
60 hr_utility.set_location('Entering:'||l_proc, 5);
61 end if;
62 --
63 ben_cpg_shd.g_api_dml := true; -- Set the api dml status
64 --
65 -- Delete the ben_cwb_person_groups row.
66 --
67 delete from ben_cwb_person_groups
68 where group_per_in_ler_id = p_rec.group_per_in_ler_id
69 and group_pl_id = p_rec.group_pl_id
70 and group_oipl_id = p_rec.group_oipl_id;
71 --
72 ben_cpg_shd.g_api_dml := false; -- Unset the api dml status
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 ben_cpg_shd.g_api_dml := false; -- Unset the api dml status
82 ben_cpg_shd.constraint_error
83 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
84 When Others Then
85 ben_cpg_shd.g_api_dml := false; -- Unset the api dml status
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 ben_cpg_shd.g_rec_type) is
122 --
123 l_proc varchar2(72) := g_package||'pre_delete';
124 --
125 Begin
126 if g_debug then
127 hr_utility.set_location('Entering:'||l_proc, 5);
128 end if;
129 --
130 if g_debug then
131 hr_utility.set_location(' Leaving:'||l_proc, 10);
132 end if;
133 End pre_delete;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |-----------------------------< post_delete >------------------------------|
137 -- ----------------------------------------------------------------------------
138 -- {Start Of Comments}
139 --
140 -- Description:
141 -- This private procedure contains any processing which is required after
142 -- the delete dml.
143 --
144 -- Prerequistes:
145 -- This is an internal procedure which is called from the del procedure.
146 --
147 -- In Parameters:
148 -- A Pl/Sql record structure.
149 --
150 -- Post Success:
151 -- Processing continues.
152 --
153 -- Post Failure:
154 -- If an error has occurred, an error message and exception will be raised
155 -- but not handled.
156 --
157 -- Developer Implementation Notes:
158 -- Any post-processing required after the delete dml is issued should be
159 -- coded within this procedure. It is important to note that any 3rd party
160 -- maintenance should be reviewed before placing in this procedure.
161 --
162 -- Access Status:
163 -- Internal Row Handler Use Only.
164 --
165 -- {End Of Comments}
166 -- -----------------------------------------------------------------------------
167 Procedure post_delete(p_rec in ben_cpg_shd.g_rec_type) is
168 --
169 l_proc varchar2(72) := g_package||'post_delete';
170 --
171 Begin
172 if g_debug then
173 hr_utility.set_location('Entering:'||l_proc, 5);
174 end if;
175 begin
176 --
177 ben_cpg_rkd.after_delete
178 (p_group_per_in_ler_id
179 => p_rec.group_per_in_ler_id
180 ,p_group_pl_id
181 => p_rec.group_pl_id
182 ,p_group_oipl_id
183 => p_rec.group_oipl_id
184 ,p_lf_evt_ocrd_dt_o
185 => ben_cpg_shd.g_old_rec.lf_evt_ocrd_dt
186 ,p_bdgt_pop_cd_o
187 => ben_cpg_shd.g_old_rec.bdgt_pop_cd
188 ,p_due_dt_o
189 => ben_cpg_shd.g_old_rec.due_dt
190 ,p_access_cd_o
191 => ben_cpg_shd.g_old_rec.access_cd
192 ,p_approval_cd_o
193 => ben_cpg_shd.g_old_rec.approval_cd
194 ,p_approval_date_o
195 => ben_cpg_shd.g_old_rec.approval_date
196 ,p_approval_comments_o
197 => ben_cpg_shd.g_old_rec.approval_comments
198 ,p_submit_cd_o
199 => ben_cpg_shd.g_old_rec.submit_cd
200 ,p_submit_date_o
201 => ben_cpg_shd.g_old_rec.submit_date
202 ,p_submit_comments_o
203 => ben_cpg_shd.g_old_rec.submit_comments
204 ,p_dist_bdgt_val_o
205 => ben_cpg_shd.g_old_rec.dist_bdgt_val
206 ,p_ws_bdgt_val_o
207 => ben_cpg_shd.g_old_rec.ws_bdgt_val
208 ,p_rsrv_val_o
209 => ben_cpg_shd.g_old_rec.rsrv_val
210 ,p_dist_bdgt_mn_val_o
211 => ben_cpg_shd.g_old_rec.dist_bdgt_mn_val
212 ,p_dist_bdgt_mx_val_o
213 => ben_cpg_shd.g_old_rec.dist_bdgt_mx_val
214 ,p_dist_bdgt_incr_val_o
215 => ben_cpg_shd.g_old_rec.dist_bdgt_incr_val
216 ,p_ws_bdgt_mn_val_o
217 => ben_cpg_shd.g_old_rec.ws_bdgt_mn_val
218 ,p_ws_bdgt_mx_val_o
219 => ben_cpg_shd.g_old_rec.ws_bdgt_mx_val
220 ,p_ws_bdgt_incr_val_o
221 => ben_cpg_shd.g_old_rec.ws_bdgt_incr_val
222 ,p_rsrv_mn_val_o
223 => ben_cpg_shd.g_old_rec.rsrv_mn_val
224 ,p_rsrv_mx_val_o
225 => ben_cpg_shd.g_old_rec.rsrv_mx_val
226 ,p_rsrv_incr_val_o
227 => ben_cpg_shd.g_old_rec.rsrv_incr_val
228 ,p_dist_bdgt_iss_val_o
229 => ben_cpg_shd.g_old_rec.dist_bdgt_iss_val
230 ,p_ws_bdgt_iss_val_o
231 => ben_cpg_shd.g_old_rec.ws_bdgt_iss_val
232 ,p_dist_bdgt_iss_date_o
233 => ben_cpg_shd.g_old_rec.dist_bdgt_iss_date
234 ,p_ws_bdgt_iss_date_o
235 => ben_cpg_shd.g_old_rec.ws_bdgt_iss_date
236 ,p_ws_bdgt_val_last_upd_date_o
237 => ben_cpg_shd.g_old_rec.ws_bdgt_val_last_upd_date
238 ,p_dist_bdgt_val_last_upd_dat_o
239 => ben_cpg_shd.g_old_rec.dist_bdgt_val_last_upd_date
240 ,p_rsrv_val_last_upd_date_o
241 => ben_cpg_shd.g_old_rec.rsrv_val_last_upd_date
242 ,p_ws_bdgt_val_last_upd_by_o
243 => ben_cpg_shd.g_old_rec.ws_bdgt_val_last_upd_by
244 ,p_dist_bdgt_val_last_upd_by_o
245 => ben_cpg_shd.g_old_rec.dist_bdgt_val_last_upd_by
246 ,p_rsrv_val_last_upd_by_o
247 => ben_cpg_shd.g_old_rec.rsrv_val_last_upd_by
248 ,p_object_version_number_o
249 => ben_cpg_shd.g_old_rec.object_version_number
250 );
251 --
252 exception
253 --
254 when hr_api.cannot_find_prog_unit then
255 --
256 hr_api.cannot_find_prog_unit_error
257 (p_module_name => 'BEN_CWB_PERSON_GROUPS'
258 ,p_hook_type => 'AD');
259 --
260 end;
261 --
262 if g_debug then
263 hr_utility.set_location(' Leaving:'||l_proc, 10);
264 end if;
265 End post_delete;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |---------------------------------< del >----------------------------------|
269 -- ----------------------------------------------------------------------------
270 Procedure del
271 (p_rec in ben_cpg_shd.g_rec_type
272 ) is
273 --
274 l_proc varchar2(72) := g_package||'del';
275 --
276 Begin
277 if g_debug then
278 hr_utility.set_location('Entering:'||l_proc, 5);
279 end if;
280 --
281 -- We must lock the row which we need to delete.
282 --
283 ben_cpg_shd.lck
284 (p_rec.group_per_in_ler_id
285 ,p_rec.group_pl_id
286 ,p_rec.group_oipl_id
287 ,p_rec.object_version_number
288 );
289 --
290 -- Call the supporting delete validate operation
291 --
292 ben_cpg_bus.delete_validate(p_rec);
293 --
294 -- Call to raise any errors on multi-message list
295 hr_multi_message.end_validation_set;
296 --
297 -- Call the supporting pre-delete operation
298 --
299 ben_cpg_del.pre_delete(p_rec);
300 --
301 -- Delete the row.
302 --
303 ben_cpg_del.delete_dml(p_rec);
304 --
305 -- Call the supporting post-delete operation
306 --
307 ben_cpg_del.post_delete(p_rec);
308 --
309 -- Call to raise any errors on multi-message list
310 hr_multi_message.end_validation_set;
311 --
312 End del;
313 --
314 -- ----------------------------------------------------------------------------
315 -- |---------------------------------< del >----------------------------------|
316 -- ----------------------------------------------------------------------------
317 Procedure del
318 (p_group_per_in_ler_id in number
319 ,p_group_pl_id in number
320 ,p_group_oipl_id in number
321 ,p_object_version_number in number
322 ) is
323 --
324 l_rec ben_cpg_shd.g_rec_type;
325 l_proc varchar2(72) := g_package||'del';
326 --
327 Begin
328 if g_debug then
329 hr_utility.set_location('Entering:'||l_proc, 5);
330 end if;
331 --
332 -- As the delete procedure accepts a plsql record structure we do need to
333 -- convert the arguments into the record structure.
334 -- We don't need to call the supplied conversion argument routine as we
335 -- only need a few attributes.
336 --
337 l_rec.group_per_in_ler_id := p_group_per_in_ler_id;
338 l_rec.group_pl_id := p_group_pl_id;
339 l_rec.group_oipl_id := p_group_oipl_id;
340 l_rec.object_version_number := p_object_version_number;
341 --
342 -- Having converted the arguments into the ben_cpg_rec
343 -- plsql record structure we must call the corresponding entity
344 -- business process
345 --
346 ben_cpg_del.del(l_rec);
347 --
348 if g_debug then
349 hr_utility.set_location(' Leaving:'||l_proc, 10);
350 end if;
351 End del;
352 --
353 end ben_cpg_del;