1 Package Body ben_ctk_del as
2 /* $Header: bectkrhi.pkb 120.0 2005/05/28 01:25 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_ctk_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_ctk_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_ctk_shd.g_api_dml := true; -- Set the api dml status
64 --
65 -- Delete the ben_cwb_person_tasks row.
66 --
67 delete from ben_cwb_person_tasks
68 where group_per_in_ler_id = p_rec.group_per_in_ler_id
69 and task_id = p_rec.task_id;
70 --
71 ben_ctk_shd.g_api_dml := false; -- Unset the api dml status
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 ben_ctk_shd.g_api_dml := false; -- Unset the api dml status
81 ben_ctk_shd.constraint_error
82 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
83 When Others Then
84 ben_ctk_shd.g_api_dml := false; -- Unset the api dml status
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 ben_ctk_shd.g_rec_type) is
121 --
122 l_proc varchar2(72) := g_package||'pre_delete';
123 --
124 Begin
125 if g_debug then
126 hr_utility.set_location('Entering:'||l_proc, 5);
127 end if;
128 --
129 if g_debug then
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
141 -- the 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 ben_ctk_shd.g_rec_type) is
167 --
168 l_proc varchar2(72) := g_package||'post_delete';
169 --
170 Begin
171 if g_debug then
172 hr_utility.set_location('Entering:'||l_proc, 5);
173 end if;
174 begin
175 --
176 ben_ctk_rkd.after_delete
177 (p_group_per_in_ler_id
178 => p_rec.group_per_in_ler_id
179 ,p_task_id
180 => p_rec.task_id
181 ,p_group_pl_id_o
182 => ben_ctk_shd.g_old_rec.group_pl_id
183 ,p_lf_evt_ocrd_dt_o
184 => ben_ctk_shd.g_old_rec.lf_evt_ocrd_dt
185 ,p_status_cd_o
186 => ben_ctk_shd.g_old_rec.status_cd
187 ,p_access_cd_o
188 => ben_ctk_shd.g_old_rec.access_cd
189 ,p_task_last_update_date_o
190 => ben_ctk_shd.g_old_rec.task_last_update_date
191 ,p_task_last_update_by_o
192 => ben_ctk_shd.g_old_rec.task_last_update_by
193 ,p_object_version_number_o
194 => ben_ctk_shd.g_old_rec.object_version_number
195 );
196 --
197 exception
198 --
199 when hr_api.cannot_find_prog_unit then
200 --
201 hr_api.cannot_find_prog_unit_error
202 (p_module_name => 'BEN_CWB_PERSON_TASKS'
203 ,p_hook_type => 'AD');
204 --
205 end;
206 --
207 if g_debug then
208 hr_utility.set_location(' Leaving:'||l_proc, 10);
209 end if;
210 End post_delete;
211 --
212 -- ----------------------------------------------------------------------------
213 -- |---------------------------------< del >----------------------------------|
214 -- ----------------------------------------------------------------------------
215 Procedure del
216 (p_rec in ben_ctk_shd.g_rec_type
217 ) is
218 --
219 l_proc varchar2(72) := g_package||'del';
220 --
221 Begin
222 if g_debug then
223 hr_utility.set_location('Entering:'||l_proc, 5);
224 end if;
225 --
226 -- We must lock the row which we need to delete.
227 --
228 ben_ctk_shd.lck
229 (p_rec.group_per_in_ler_id
230 ,p_rec.task_id
231 ,p_rec.object_version_number
232 );
233 --
234 -- Call the supporting delete validate operation
235 --
236 ben_ctk_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 ben_ctk_del.pre_delete(p_rec);
244 --
245 -- Delete the row.
246 --
247 ben_ctk_del.delete_dml(p_rec);
248 --
249 -- Call the supporting post-delete operation
250 --
251 ben_ctk_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_group_per_in_ler_id in number
263 ,p_task_id in number
264 ,p_object_version_number in number
265 ) is
266 --
267 l_rec ben_ctk_shd.g_rec_type;
268 l_proc varchar2(72) := g_package||'del';
269 --
270 Begin
271 if g_debug then
272 hr_utility.set_location('Entering:'||l_proc, 5);
273 end if;
274 --
275 -- As the delete procedure accepts a plsql record structure we do need to
276 -- convert the arguments into the record structure.
277 -- We don't need to call the supplied conversion argument routine as we
278 -- only need a few attributes.
279 --
280 l_rec.group_per_in_ler_id := p_group_per_in_ler_id;
281 l_rec.task_id := p_task_id;
282 l_rec.object_version_number := p_object_version_number;
283 --
284 -- Having converted the arguments into the ben_ctk_rec
285 -- plsql record structure we must call the corresponding entity
286 -- business process
287 --
288 ben_ctk_del.del(l_rec);
289 --
290 if g_debug then
291 hr_utility.set_location(' Leaving:'||l_proc, 10);
292 end if;
293 End del;
294 --
295 end ben_ctk_del;