1 Package Body ben_xdf_del as
2 /* $Header: bexdfrhi.pkb 120.6 2006/07/10 21:53:55 tjesumic ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xdf_del.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- ----------------------< delete_app_ownerships >----------------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 -- Description:
16 -- Deletes row(s) from hr_application_ownerships depending on the mode that
17 -- the row handler has been called in.
18 --
19 -- ----------------------------------------------------------------------------
20 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
21 ,p_pk_value IN varchar2) IS
22 --
23 BEGIN
24 --
25 IF (hr_startup_data_api_support.return_startup_mode
26 IN ('STARTUP','GENERIC')) THEN
27 --
28 DELETE FROM hr_application_ownerships
29 WHERE key_name = p_pk_column
30 AND key_value = p_pk_value;
31 --
32 END IF;
33 END delete_app_ownerships;
34 --
35 -- ----------------------------------------------------------------------------
36 -- ----------------------< delete_app_ownerships >----------------------------|
37 -- ----------------------------------------------------------------------------
38 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
39 ,p_pk_value IN number) IS
40 --
41 BEGIN
42 delete_app_ownerships(p_pk_column, to_char(p_pk_value));
43 END delete_app_ownerships;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |------------------------------< delete_dml >------------------------------|
47 -- ----------------------------------------------------------------------------
48 -- {Start Of Comments}
49 --
50 -- Description:
51 -- This procedure controls the actual dml delete logic. The functions of
52 -- this procedure are as follows:
53 -- 1) To set and unset the g_api_dml status as required (as we are about to
54 -- perform dml).
55 -- 2) To delete the specified row from the schema using the primary key in
56 -- the predicates.
57 -- 3) To trap any constraint violations that may have occurred.
58 -- 4) To raise any other errors.
59 --
60 -- Prerequisites:
61 -- This is an internal private procedure which must be called from the del
62 -- procedure.
63 --
64 -- In Parameters:
65 -- A Pl/Sql record structre.
66 --
67 -- Post Success:
68 -- The specified row will be delete from the schema.
69 --
70 -- Post Failure:
71 -- On the delete dml failure it is important to note that we always reset the
72 -- g_api_dml status to false.
73 -- If a child integrity constraint violation is raised the
74 -- constraint_error procedure will be called.
75 -- If any other error is reported, the error will be raised after the
76 -- g_api_dml status is reset.
77 --
78 -- Developer Implementation Notes:
79 -- None.
80 --
81 -- Access Status:
82 -- Internal Row Handler Use Only.
83 --
84 -- {End Of Comments}
85 -- ----------------------------------------------------------------------------
86 Procedure delete_dml(p_rec in ben_xdf_shd.g_rec_type) is
87 --
88 l_proc varchar2(72) := g_package||'delete_dml';
89 --
90 Begin
91 hr_utility.set_location('Entering:'||l_proc, 5);
92 --
93 ben_xdf_shd.g_api_dml := true; -- Set the api dml status
94 --
95 -- Delete the ben_ext_dfn row.
96 --
97 delete from ben_ext_dfn
98 where ext_dfn_id = p_rec.ext_dfn_id;
99 --
100 ben_xdf_shd.g_api_dml := false; -- Unset the api dml status
101 --
102 hr_utility.set_location(' Leaving:'||l_proc, 10);
103 --
104 Exception
105 When hr_api.child_integrity_violated then
106 -- Child integrity has been violated
107 ben_xdf_shd.g_api_dml := false; -- Unset the api dml status
108 ben_xdf_shd.constraint_error
109 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
110 When Others Then
111 ben_xdf_shd.g_api_dml := false; -- Unset the api dml status
112 Raise;
113 End delete_dml;
114 --
115 -- ----------------------------------------------------------------------------
116 -- |------------------------------< pre_delete >------------------------------|
117 -- ----------------------------------------------------------------------------
118 -- {Start Of Comments}
119 --
120 -- Description:
121 -- This private procedure contains any processing which is required before
122 -- the delete dml.
123 --
124 -- Prerequisites:
125 -- This is an internal procedure which is called from the del procedure.
126 --
127 -- In Parameters:
128 -- A Pl/Sql record structre.
129 --
130 -- Post Success:
131 -- Processing continues.
132 --
133 -- Post Failure:
134 -- If an error has occurred, an error message and exception will be raised
135 -- but not handled.
136 --
137 -- Developer Implementation Notes:
138 -- Any pre-processing required before the delete dml is issued should be
139 -- coded within this procedure. It is important to note that any 3rd party
140 -- maintenance should be reviewed before placing in this procedure.
141 --
142 -- Access Status:
143 -- Internal Row Handler Use Only.
144 --
145 -- {End Of Comments}
146 -- ----------------------------------------------------------------------------
147 Procedure pre_delete(p_rec in ben_xdf_shd.g_rec_type) is
148 --
149 l_proc varchar2(72) := g_package||'pre_delete';
150 --
151 Begin
152 hr_utility.set_location('Entering:'||l_proc, 5);
153 --
154 hr_utility.set_location(' Leaving:'||l_proc, 10);
155 End pre_delete;
156 --
157 -- ----------------------------------------------------------------------------
158 -- |-----------------------------< post_delete >------------------------------|
159 -- ----------------------------------------------------------------------------
160 -- {Start Of Comments}
161 --
162 -- Description:
163 -- This private procedure contains any processing which is required after the
164 -- delete dml.
165 --
166 -- Prerequisites:
167 -- This is an internal procedure which is called from the del procedure.
168 --
169 -- In Parameters:
170 -- A Pl/Sql record structre.
171 --
172 -- Post Success:
173 -- Processing continues.
174 --
175 -- Post Failure:
176 -- If an error has occurred, an error message and exception will be raised
177 -- but not handled.
178 --
179 -- Developer Implementation Notes:
180 -- Any post-processing required after the delete dml is issued should be
181 -- coded within this procedure. It is important to note that any 3rd party
182 -- maintenance should be reviewed before placing in this procedure.
183 --
184 -- Access Status:
185 -- Internal table Handler Use Only.
186 --
187 -- {End Of Comments}
188 -- ----------------------------------------------------------------------------
189 Procedure post_delete(
190 p_effective_date in date,p_rec in ben_xdf_shd.g_rec_type) is
191 --
192 l_proc varchar2(72) := g_package||'post_delete';
193 --
194 Begin
195 hr_utility.set_location('Entering:'||l_proc, 5);
196 --
197 delete_app_ownerships('EXT_DFN_ID', p_rec.ext_dfn_id);
198 --
199 -- Start of API User Hook for post_delete.
200 --
201 begin
202 --
203 ben_xdf_rkd.after_delete
204 (
205 p_ext_dfn_id =>p_rec.ext_dfn_id
206 ,p_name_o =>ben_xdf_shd.g_old_rec.name
207 ,p_xml_tag_name_o =>ben_xdf_shd.g_old_rec.xml_tag_name
208 ,p_xdo_template_id_o =>ben_xdf_shd.g_old_rec.xdo_template_id
209 ,p_data_typ_cd_o =>ben_xdf_shd.g_old_rec.data_typ_cd
210 ,p_ext_typ_cd_o =>ben_xdf_shd.g_old_rec.ext_typ_cd
211 ,p_output_name_o =>ben_xdf_shd.g_old_rec.output_name
212 ,p_output_type_o =>ben_xdf_shd.g_old_rec.output_type
213 ,p_apnd_rqst_id_flag_o =>ben_xdf_shd.g_old_rec.apnd_rqst_id_flag
214 ,p_prmy_sort_cd_o =>ben_xdf_shd.g_old_rec.prmy_sort_cd
215 ,p_scnd_sort_cd_o =>ben_xdf_shd.g_old_rec.scnd_sort_cd
216 ,p_strt_dt_o =>ben_xdf_shd.g_old_rec.strt_dt
217 ,p_end_dt_o =>ben_xdf_shd.g_old_rec.end_dt
218 ,p_ext_crit_prfl_id_o =>ben_xdf_shd.g_old_rec.ext_crit_prfl_id
219 ,p_ext_file_id_o =>ben_xdf_shd.g_old_rec.ext_file_id
220 ,p_business_group_id_o =>ben_xdf_shd.g_old_rec.business_group_id
221 ,p_legislation_code_o =>ben_xdf_shd.g_old_rec.legislation_code
222 ,p_xdf_attribute_category_o =>ben_xdf_shd.g_old_rec.xdf_attribute_category
223 ,p_xdf_attribute1_o =>ben_xdf_shd.g_old_rec.xdf_attribute1
224 ,p_xdf_attribute2_o =>ben_xdf_shd.g_old_rec.xdf_attribute2
225 ,p_xdf_attribute3_o =>ben_xdf_shd.g_old_rec.xdf_attribute3
226 ,p_xdf_attribute4_o =>ben_xdf_shd.g_old_rec.xdf_attribute4
227 ,p_xdf_attribute5_o =>ben_xdf_shd.g_old_rec.xdf_attribute5
228 ,p_xdf_attribute6_o =>ben_xdf_shd.g_old_rec.xdf_attribute6
229 ,p_xdf_attribute7_o =>ben_xdf_shd.g_old_rec.xdf_attribute7
230 ,p_xdf_attribute8_o =>ben_xdf_shd.g_old_rec.xdf_attribute8
231 ,p_xdf_attribute9_o =>ben_xdf_shd.g_old_rec.xdf_attribute9
232 ,p_xdf_attribute10_o =>ben_xdf_shd.g_old_rec.xdf_attribute10
233 ,p_xdf_attribute11_o =>ben_xdf_shd.g_old_rec.xdf_attribute11
234 ,p_xdf_attribute12_o =>ben_xdf_shd.g_old_rec.xdf_attribute12
235 ,p_xdf_attribute13_o =>ben_xdf_shd.g_old_rec.xdf_attribute13
236 ,p_xdf_attribute14_o =>ben_xdf_shd.g_old_rec.xdf_attribute14
237 ,p_xdf_attribute15_o =>ben_xdf_shd.g_old_rec.xdf_attribute15
238 ,p_xdf_attribute16_o =>ben_xdf_shd.g_old_rec.xdf_attribute16
239 ,p_xdf_attribute17_o =>ben_xdf_shd.g_old_rec.xdf_attribute17
240 ,p_xdf_attribute18_o =>ben_xdf_shd.g_old_rec.xdf_attribute18
241 ,p_xdf_attribute19_o =>ben_xdf_shd.g_old_rec.xdf_attribute19
242 ,p_xdf_attribute20_o =>ben_xdf_shd.g_old_rec.xdf_attribute20
243 ,p_xdf_attribute21_o =>ben_xdf_shd.g_old_rec.xdf_attribute21
244 ,p_xdf_attribute22_o =>ben_xdf_shd.g_old_rec.xdf_attribute22
245 ,p_xdf_attribute23_o =>ben_xdf_shd.g_old_rec.xdf_attribute23
246 ,p_xdf_attribute24_o =>ben_xdf_shd.g_old_rec.xdf_attribute24
247 ,p_xdf_attribute25_o =>ben_xdf_shd.g_old_rec.xdf_attribute25
248 ,p_xdf_attribute26_o =>ben_xdf_shd.g_old_rec.xdf_attribute26
249 ,p_xdf_attribute27_o =>ben_xdf_shd.g_old_rec.xdf_attribute27
250 ,p_xdf_attribute28_o =>ben_xdf_shd.g_old_rec.xdf_attribute28
251 ,p_xdf_attribute29_o =>ben_xdf_shd.g_old_rec.xdf_attribute29
252 ,p_xdf_attribute30_o =>ben_xdf_shd.g_old_rec.xdf_attribute30
253 ,p_object_version_number_o =>ben_xdf_shd.g_old_rec.object_version_number
254 ,p_drctry_name_o =>ben_xdf_shd.g_old_rec.drctry_name
255 ,p_kickoff_wrt_prc_flag_o =>ben_xdf_shd.g_old_rec.kickoff_wrt_prc_flag
256 ,p_upd_cm_sent_dt_flag_o =>ben_xdf_shd.g_old_rec.upd_cm_sent_dt_flag
257 ,p_spcl_hndl_flag_o =>ben_xdf_shd.g_old_rec.spcl_hndl_flag
258 ,p_ext_global_flag_o =>ben_xdf_shd.g_old_rec.ext_global_flag
259 ,p_cm_display_flag_o =>ben_xdf_shd.g_old_rec.cm_display_flag
260 ,p_use_eff_dt_for_chgs_flag_o =>ben_xdf_shd.g_old_rec.use_eff_dt_for_chgs_flag
261 ,p_ext_post_prcs_rl_o =>ben_xdf_shd.g_old_rec.ext_post_prcs_rl
262 );
263 --
264 exception
265 --
266 when hr_api.cannot_find_prog_unit then
267 --
268 hr_api.cannot_find_prog_unit_error
269 (p_module_name => 'ben_ext_dfn'
270 ,p_hook_type => 'AD');
271 --
272 end;
273 --
274 -- End of API User Hook for post_delete.
275 --
276 --
277 hr_utility.set_location(' Leaving:'||l_proc, 10);
278 End post_delete;
279 --
280 -- ----------------------------------------------------------------------------
281 -- |---------------------------------< del >----------------------------------|
282 -- ----------------------------------------------------------------------------
283 Procedure del
284 (
285 p_effective_date in date,
286 p_rec in ben_xdf_shd.g_rec_type
287 ) is
288 --
289 l_proc varchar2(72) := g_package||'del';
290 --
291 Begin
292 hr_utility.set_location('Entering:'||l_proc, 5);
293 --
294 -- We must lock the row which we need to delete.
295 --
296 ben_xdf_shd.lck
297 (
298 p_rec.ext_dfn_id,
299 p_rec.object_version_number
300 );
301 --
302 -- Call the supporting delete validate operation
303 --
304 ben_xdf_bus.delete_validate(p_rec
305 ,p_effective_date);
306 --
307 -- Call the supporting pre-delete operation
308 --
309 pre_delete(p_rec);
310 --
311 -- Delete the row.
312 --
313 delete_dml(p_rec);
314 --
315 -- Call the supporting post-delete operation
316 --
317 post_delete(
318 p_effective_date,p_rec);
319 End del;
320 --
321 -- ----------------------------------------------------------------------------
322 -- |---------------------------------< del >----------------------------------|
323 -- ----------------------------------------------------------------------------
324 Procedure del
325 (
326 p_effective_date in date,
327 p_ext_dfn_id in number,
328 p_object_version_number in number
329 ) is
330 --
331 l_rec ben_xdf_shd.g_rec_type;
332 l_proc varchar2(72) := g_package||'del';
333 --
334 Begin
335 hr_utility.set_location('Entering:'||l_proc, 5);
336 --
337 -- As the delete procedure accepts a plsql record structure we do need to
338 -- convert the arguments into the record structure.
339 -- We don't need to call the supplied conversion argument routine as we
340 -- only need a few attributes.
341 --
342 l_rec.ext_dfn_id:= p_ext_dfn_id;
343 l_rec.object_version_number := p_object_version_number;
344 --
345 -- Having converted the arguments into the ben_xdf_rec
346 -- plsql record structure we must call the corresponding entity
347 -- business process
348 --
349 del(
350 p_effective_date,l_rec);
351 --
352 hr_utility.set_location(' Leaving:'||l_proc, 10);
353 End del;
354 --
355 end ben_xdf_del;