4 -- ----------------------------------------------------------------------------
1 Package Body ben_xic_del as
2 /* $Header: bexicrhi.pkb 120.2 2006/03/20 13:02:22 tjesumic noship $ */
3 --
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xic_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_xic_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_xic_shd.g_api_dml := true; -- Set the api dml status
94 --
95 -- Delete the ben_ext_incl_chg row.
96 --
97 delete from ben_ext_incl_chg
98 where ext_incl_chg_id = p_rec.ext_incl_chg_id;
99 --
100 ben_xic_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_xic_shd.g_api_dml := false; -- Unset the api dml status
108 ben_xic_shd.constraint_error
109 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
110 When Others Then
111 ben_xic_shd.g_api_dml := false; -- Unset the api dml status
112 Raise;
113 End delete_dml;
117 -- ----------------------------------------------------------------------------
114 --
115 -- ----------------------------------------------------------------------------
116 -- |------------------------------< pre_delete >------------------------------|
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_xic_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_xic_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 --
198 -- Start of API User Hook for post_delete.
199 --
200 begin
201 --
202 --
203 -- Delete ownerships if applicable
204 --
205 delete_app_ownerships('EXT_INCL_CHG_ID', p_rec.ext_incl_chg_id);
206 --
207 ben_xic_rkd.after_delete
208 (
209 p_ext_incl_chg_id =>p_rec.ext_incl_chg_id
210 ,p_chg_evt_cd_o =>ben_xic_shd.g_old_rec.chg_evt_cd
211 ,p_chg_evt_source_o =>ben_xic_shd.g_old_rec.chg_evt_source
212 ,p_ext_rcd_in_file_id_o =>ben_xic_shd.g_old_rec.ext_rcd_in_file_id
213 ,p_ext_data_elmt_in_rcd_id_o =>ben_xic_shd.g_old_rec.ext_data_elmt_in_rcd_id
214 ,p_business_group_id_o =>ben_xic_shd.g_old_rec.business_group_id
215 ,p_legislation_code_o =>ben_xic_shd.g_old_rec.legislation_code
216 ,p_object_version_number_o =>ben_xic_shd.g_old_rec.object_version_number
217 );
218 --
219 exception
220 --
221 when hr_api.cannot_find_prog_unit then
222 --
223 hr_api.cannot_find_prog_unit_error
224 (p_module_name => 'ben_ext_incl_chg'
225 ,p_hook_type => 'AD');
226 --
227 end;
228 --
229 -- End of API User Hook for post_delete.
230 --
231 --
232 hr_utility.set_location(' Leaving:'||l_proc, 10);
233 End post_delete;
234 --
235 -- ----------------------------------------------------------------------------
236 -- |---------------------------------< del >----------------------------------|
237 -- ----------------------------------------------------------------------------
238 Procedure del
239 (
240 p_effective_date in date,
241 p_rec in ben_xic_shd.g_rec_type
242 ) is
243 --
244 l_proc varchar2(72) := g_package||'del';
245 --
246 Begin
247 hr_utility.set_location('Entering:'||l_proc, 5);
248 --
249 -- We must lock the row which we need to delete.
250 --
251 ben_xic_shd.lck
252 (
253 p_rec.ext_incl_chg_id,
254 p_rec.object_version_number
255 );
256 --
257 -- Call the supporting delete validate operation
258 --
259 ben_xic_bus.delete_validate(p_rec
260 ,p_effective_date);
261 --
262 -- Call the supporting pre-delete operation
263 --
264 pre_delete(p_rec);
265 --
266 -- Delete the row.
267 --
268 delete_dml(p_rec);
269 --
270 -- Call the supporting post-delete operation
271 --
272 post_delete(
273 p_effective_date,p_rec);
274 End del;
275 --
279 Procedure del
276 -- ----------------------------------------------------------------------------
277 -- |---------------------------------< del >----------------------------------|
278 -- ----------------------------------------------------------------------------
280 (
281 p_effective_date in date,
282 p_ext_incl_chg_id in number,
283 p_legislation_code in varchar2 default null,
284 p_object_version_number in number
285 ) is
286 --
287 l_rec ben_xic_shd.g_rec_type;
288 l_proc varchar2(72) := g_package||'del';
289 --
290 Begin
291 hr_utility.set_location('Entering:'||l_proc, 5);
292 --
293 -- As the delete procedure accepts a plsql record structure we do need to
294 -- convert the arguments into the record structure.
295 -- We don't need to call the supplied conversion argument routine as we
296 -- only need a few attributes.
297 --
298 l_rec.ext_incl_chg_id:= p_ext_incl_chg_id;
299 l_rec.legislation_code := p_legislation_code;
300 l_rec.object_version_number := p_object_version_number;
301 --
302 -- Having converted the arguments into the ben_xic_rec
303 -- plsql record structure we must call the corresponding entity
304 -- business process
305 --
306 del(
307 p_effective_date,l_rec);
308 --
309 hr_utility.set_location(' Leaving:'||l_proc, 10);
310 End del;
311 --
312 end ben_xic_del;