DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XID_DEL

Source


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