1 Package Body ben_xfi_del as
2 /* $Header: bexfirhi.pkb 120.0 2005/05/28 12:33:36 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xfi_del.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- ----------------------< delete_app_ownerships >----------------------------|
12 -- ----------------------------------------------------------------------------
13 --
14 -- Description:
15 -- Deletes row(s) from hr_application_ownerships depending on the mode that
16 -- the row handler has been called in.
17 --
18 -- ----------------------------------------------------------------------------
19 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
20 ,p_pk_value IN varchar2) IS
21 --
22 BEGIN
23 --
24 IF (hr_startup_data_api_support.return_startup_mode
25 IN ('STARTUP','GENERIC')) THEN
26 --
27 DELETE FROM hr_application_ownerships
28 WHERE key_name = p_pk_column
29 AND key_value = p_pk_value;
30 --
31 END IF;
32 END delete_app_ownerships;
33 --
34 -- ----------------------------------------------------------------------------
35 -- ----------------------< delete_app_ownerships >----------------------------|
36 -- ----------------------------------------------------------------------------
37 PROCEDURE delete_app_ownerships(p_pk_column IN varchar2
38 ,p_pk_value IN number) IS
39 --
40 BEGIN
41 delete_app_ownerships(p_pk_column, to_char(p_pk_value));
42 END delete_app_ownerships;
43 --
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_xfi_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_xfi_shd.g_api_dml := true; -- Set the api dml status
94 --
95 -- Delete the ben_ext_file row.
96 --
97 delete from ben_ext_file
98 where ext_file_id = p_rec.ext_file_id;
99 --
100 ben_xfi_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_xfi_shd.g_api_dml := false; -- Unset the api dml status
108 ben_xfi_shd.constraint_error
109 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
110 When Others Then
111 ben_xfi_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_xfi_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(p_rec in ben_xfi_shd.g_rec_type) is
190 --
191 l_proc varchar2(72) := g_package||'post_delete';
192 --
193 Begin
194 hr_utility.set_location('Entering:'||l_proc, 5);
195 --
196 --
197 -- Start of API User Hook for post_delete.
198 --
199 begin
200 --
201 --
202 -- Delete ownerships if applicable
203 --
204 delete_app_ownerships('EXT_FILE_ID', p_rec.ext_file_id);
205 --
206 ben_xfi_rkd.after_delete
207 (
208 p_ext_file_id =>p_rec.ext_file_id
209 ,p_name_o =>ben_xfi_shd.g_old_rec.name
210 ,p_xml_tag_name_o =>ben_xfi_shd.g_old_rec.xml_tag_name
211 ,p_business_group_id_o =>ben_xfi_shd.g_old_rec.business_group_id
212 ,p_legislation_code_o =>ben_xfi_shd.g_old_rec.legislation_code
213 ,p_xfi_attribute_category_o =>ben_xfi_shd.g_old_rec.xfi_attribute_category
214 ,p_xfi_attribute1_o =>ben_xfi_shd.g_old_rec.xfi_attribute1
215 ,p_xfi_attribute2_o =>ben_xfi_shd.g_old_rec.xfi_attribute2
216 ,p_xfi_attribute3_o =>ben_xfi_shd.g_old_rec.xfi_attribute3
217 ,p_xfi_attribute4_o =>ben_xfi_shd.g_old_rec.xfi_attribute4
218 ,p_xfi_attribute5_o =>ben_xfi_shd.g_old_rec.xfi_attribute5
219 ,p_xfi_attribute6_o =>ben_xfi_shd.g_old_rec.xfi_attribute6
220 ,p_xfi_attribute7_o =>ben_xfi_shd.g_old_rec.xfi_attribute7
221 ,p_xfi_attribute8_o =>ben_xfi_shd.g_old_rec.xfi_attribute8
222 ,p_xfi_attribute9_o =>ben_xfi_shd.g_old_rec.xfi_attribute9
223 ,p_xfi_attribute10_o =>ben_xfi_shd.g_old_rec.xfi_attribute10
224 ,p_xfi_attribute11_o =>ben_xfi_shd.g_old_rec.xfi_attribute11
225 ,p_xfi_attribute12_o =>ben_xfi_shd.g_old_rec.xfi_attribute12
226 ,p_xfi_attribute13_o =>ben_xfi_shd.g_old_rec.xfi_attribute13
227 ,p_xfi_attribute14_o =>ben_xfi_shd.g_old_rec.xfi_attribute14
228 ,p_xfi_attribute15_o =>ben_xfi_shd.g_old_rec.xfi_attribute15
229 ,p_xfi_attribute16_o =>ben_xfi_shd.g_old_rec.xfi_attribute16
230 ,p_xfi_attribute17_o =>ben_xfi_shd.g_old_rec.xfi_attribute17
231 ,p_xfi_attribute18_o =>ben_xfi_shd.g_old_rec.xfi_attribute18
232 ,p_xfi_attribute19_o =>ben_xfi_shd.g_old_rec.xfi_attribute19
233 ,p_xfi_attribute20_o =>ben_xfi_shd.g_old_rec.xfi_attribute20
234 ,p_xfi_attribute21_o =>ben_xfi_shd.g_old_rec.xfi_attribute21
235 ,p_xfi_attribute22_o =>ben_xfi_shd.g_old_rec.xfi_attribute22
236 ,p_xfi_attribute23_o =>ben_xfi_shd.g_old_rec.xfi_attribute23
237 ,p_xfi_attribute24_o =>ben_xfi_shd.g_old_rec.xfi_attribute24
238 ,p_xfi_attribute25_o =>ben_xfi_shd.g_old_rec.xfi_attribute25
239 ,p_xfi_attribute26_o =>ben_xfi_shd.g_old_rec.xfi_attribute26
240 ,p_xfi_attribute27_o =>ben_xfi_shd.g_old_rec.xfi_attribute27
241 ,p_xfi_attribute28_o =>ben_xfi_shd.g_old_rec.xfi_attribute28
242 ,p_xfi_attribute29_o =>ben_xfi_shd.g_old_rec.xfi_attribute29
243 ,p_xfi_attribute30_o =>ben_xfi_shd.g_old_rec.xfi_attribute30
244 ,p_ext_rcd_in_file_id_o => ben_xfi_shd.g_old_rec.ext_rcd_in_file_id
245 ,p_ext_data_elmt_in_rcd_id1_o => ben_xfi_shd.g_old_rec.ext_data_elmt_in_rcd_id1
246 ,p_ext_data_elmt_in_rcd_id2_o => ben_xfi_shd.g_old_rec.ext_data_elmt_in_rcd_id2
247 ,p_object_version_number_o =>ben_xfi_shd.g_old_rec.object_version_number
248 );
249 --
250 exception
251 --
252 when hr_api.cannot_find_prog_unit then
253 --
254 hr_api.cannot_find_prog_unit_error
255 (p_module_name => 'ben_ext_file'
256 ,p_hook_type => 'AD');
257 --
258 end;
259 --
260 -- End of API User Hook for post_delete.
261 --
262 --
263 hr_utility.set_location(' Leaving:'||l_proc, 10);
264 End post_delete;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |---------------------------------< del >----------------------------------|
268 -- ----------------------------------------------------------------------------
269 Procedure del
270 (
271 p_rec in ben_xfi_shd.g_rec_type
272 ) is
273 --
274 l_proc varchar2(72) := g_package||'del';
275 --
276 Begin
277 hr_utility.set_location('Entering:'||l_proc, 5);
278 --
279 -- We must lock the row which we need to delete.
280 --
281 ben_xfi_shd.lck
282 (
283 p_rec.ext_file_id,
284 p_rec.object_version_number
285 );
286 --
287 -- Call the supporting delete validate operation
288 --
289 ben_xfi_bus.delete_validate(p_rec);
290 --
291 -- Call the supporting pre-delete operation
292 --
293 pre_delete(p_rec);
294 --
295 -- Delete the row.
296 --
297 delete_dml(p_rec);
298 --
299 -- Call the supporting post-delete operation
300 --
301 post_delete(p_rec);
302 End del;
303 --
304 -- ----------------------------------------------------------------------------
305 -- |---------------------------------< del >----------------------------------|
306 -- ----------------------------------------------------------------------------
307 Procedure del
308 (
309 p_ext_file_id in number,
310 p_legislation_code in varchar2 default null,
311 p_object_version_number in number
312 ) is
313 --
314 l_rec ben_xfi_shd.g_rec_type;
315 l_proc varchar2(72) := g_package||'del';
316 --
317 Begin
318 hr_utility.set_location('Entering:'||l_proc, 5);
319 --
320 -- As the delete procedure accepts a plsql record structure we do need to
321 -- convert the arguments into the record structure.
322 -- We don't need to call the supplied conversion argument routine as we
323 -- only need a few attributes.
324 --
325 l_rec.ext_file_id:= p_ext_file_id;
326 l_rec.legislation_code := p_legislation_code;
327 l_rec.object_version_number := p_object_version_number;
328 --
329 -- Having converted the arguments into the ben_xfi_rec
330 -- plsql record structure we must call the corresponding entity
331 -- business process
332 --
333 del(l_rec);
334 --
335 hr_utility.set_location(' Leaving:'||l_proc, 10);
336 End del;
337 --
338 end ben_xfi_del;