1 Package Body ben_xdd_del as
2 /* $Header: bexddrhi.pkb 120.1 2005/06/08 13:09:46 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_xdd_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_xdd_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_xdd_shd.g_api_dml := true; -- Set the api dml status
94 --
95 -- Delete the ben_ext_data_elmt_decd row.
96 --
97 delete from ben_ext_data_elmt_decd
101 --
98 where ext_data_elmt_decd_id = p_rec.ext_data_elmt_decd_id;
99 --
100 ben_xdd_shd.g_api_dml := false; -- Unset the api dml status
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_xdd_shd.g_api_dml := false; -- Unset the api dml status
108 ben_xdd_shd.constraint_error
109 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
110 When Others Then
111 ben_xdd_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_xdd_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_xdd_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_DATA_ELMT_DECD_ID', p_rec.ext_data_elmt_decd_id);
205 --
206 ben_xdd_rkd.after_delete
207 (
208 p_ext_data_elmt_decd_id =>p_rec.ext_data_elmt_decd_id
209 ,p_val_o =>ben_xdd_shd.g_old_rec.val
210 ,p_dcd_val_o =>ben_xdd_shd.g_old_rec.dcd_val
211 ,p_chg_evt_source_o =>ben_xdd_shd.g_old_rec.chg_evt_source
212 ,p_ext_data_elmt_id_o =>ben_xdd_shd.g_old_rec.ext_data_elmt_id
213 ,p_business_group_id_o =>ben_xdd_shd.g_old_rec.business_group_id
214 ,p_legislation_code_o =>ben_xdd_shd.g_old_rec.legislation_code
215 ,p_object_version_number_o =>ben_xdd_shd.g_old_rec.object_version_number
216 );
217 --
218 exception
219 --
220 when hr_api.cannot_find_prog_unit then
221 --
222 hr_api.cannot_find_prog_unit_error
223 (p_module_name => 'ben_ext_data_elmt_decd'
224 ,p_hook_type => 'AD');
225 --
226 end;
227 --
228 -- End of API User Hook for post_delete.
229 --
230 --
231 hr_utility.set_location(' Leaving:'||l_proc, 10);
232 End post_delete;
233 --
234 -- ----------------------------------------------------------------------------
235 -- |---------------------------------< del >----------------------------------|
236 -- ----------------------------------------------------------------------------
237 Procedure del
238 (
239 p_rec in ben_xdd_shd.g_rec_type
240 ) is
241 --
242 l_proc varchar2(72) := g_package||'del';
243 --
244 Begin
245 hr_utility.set_location('Entering:'||l_proc, 5);
246 --
247 -- We must lock the row which we need to delete.
248 --
249 ben_xdd_shd.lck
250 (
251 p_rec.ext_data_elmt_decd_id,
252 p_rec.object_version_number
253 );
254 --
255 -- Call the supporting delete validate operation
256 --
257 ben_xdd_bus.delete_validate(p_rec);
258 --
259 -- Call the supporting pre-delete operation
260 --
261 pre_delete(p_rec);
262 --
263 -- Delete the row.
264 --
265 delete_dml(p_rec);
266 --
267 -- Call the supporting post-delete operation
268 --
269 post_delete(p_rec);
270 End del;
271 --
272 -- ----------------------------------------------------------------------------
273 -- |---------------------------------< del >----------------------------------|
274 -- ----------------------------------------------------------------------------
275 Procedure del
276 (
277 p_ext_data_elmt_decd_id in number,
278 p_legislation_code in varchar2 default null,
279 p_object_version_number in number
280 ) is
281 --
282 l_rec ben_xdd_shd.g_rec_type;
283 l_proc varchar2(72) := g_package||'del';
284 --
285 Begin
286 hr_utility.set_location('Entering:'||l_proc, 5);
287 --
288 -- As the delete procedure accepts a plsql record structure we do need to
289 -- convert the arguments into the record structure.
290 -- We don't need to call the supplied conversion argument routine as we
291 -- only need a few attributes.
292 --
293 l_rec.ext_data_elmt_decd_id:= p_ext_data_elmt_decd_id;
294 l_rec.legislation_code := p_legislation_code;
295 l_rec.object_version_number := p_object_version_number;
296 --
297 -- Having converted the arguments into the ben_xdd_rec
298 -- plsql record structure we must call the corresponding entity
299 -- business process
300 --
301 del(l_rec);
302 --
303 hr_utility.set_location(' Leaving:'||l_proc, 10);
304 End del;
305 --
306 end ben_xdd_del;