DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XRC_DEL

Source


1 Package Body ben_xrc_del as
2 /* $Header: bexrcrhi.pkb 120.0 2005/05/28 12:37:58 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_xrc_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 --
47 -- ----------------------------------------------------------------------------
48 -- |------------------------------< delete_dml >------------------------------|
49 -- ----------------------------------------------------------------------------
50 -- {Start Of Comments}
51 --
52 -- Description:
53 --   This procedure controls the actual dml delete logic. The functions of
54 --   this procedure are as follows:
55 --   1) To set and unset the g_api_dml status as required (as we are about to
56 --      perform dml).
57 --   2) To delete the specified row from the schema using the primary key in
58 --      the predicates.
59 --   3) To trap any constraint violations that may have occurred.
60 --   4) To raise any other errors.
61 --
62 -- Prerequisites:
63 --   This is an internal private procedure which must be called from the del
64 --   procedure.
65 --
66 -- In Parameters:
67 --   A Pl/Sql record structre.
68 --
69 -- Post Success:
70 --   The specified row will be delete from the schema.
71 --
72 -- Post Failure:
73 --   On the delete dml failure it is important to note that we always reset the
74 --   g_api_dml status to false.
75 --   If a child integrity constraint violation is raised the
76 --   constraint_error procedure will be called.
77 --   If any other error is reported, the error will be raised after the
78 --   g_api_dml status is reset.
79 --
80 -- Developer Implementation Notes:
81 --   None.
82 --
83 -- Access Status:
84 --   Internal Row Handler Use Only.
85 --
86 -- {End Of Comments}
87 -- ----------------------------------------------------------------------------
88 Procedure delete_dml(p_rec in ben_xrc_shd.g_rec_type) is
89 --
90   l_proc  varchar2(72) := g_package||'delete_dml';
91 --
92 Begin
93   hr_utility.set_location('Entering:'||l_proc, 5);
94   --
95   ben_xrc_shd.g_api_dml := true;  -- Set the api dml status
96   --
97   -- Delete the ben_ext_rcd row.
98   --
99   delete from ben_ext_rcd
100   where ext_rcd_id = p_rec.ext_rcd_id;
101   --
102   ben_xrc_shd.g_api_dml := false;   -- Unset the api dml status
103   --
104   hr_utility.set_location(' Leaving:'||l_proc, 10);
105 --
106 Exception
107   When hr_api.child_integrity_violated then
108     -- Child integrity has been violated
109     ben_xrc_shd.g_api_dml := false;   -- Unset the api dml status
110     ben_xrc_shd.constraint_error
111       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
112   When Others Then
113     ben_xrc_shd.g_api_dml := false;   -- Unset the api dml status
114     Raise;
115 End delete_dml;
116 --
117 -- ----------------------------------------------------------------------------
118 -- |------------------------------< pre_delete >------------------------------|
119 -- ----------------------------------------------------------------------------
120 -- {Start Of Comments}
121 --
122 -- Description:
123 --   This private procedure contains any processing which is required before
124 --   the delete dml.
125 --
126 -- Prerequisites:
127 --   This is an internal procedure which is called from the del procedure.
128 --
129 -- In Parameters:
130 --   A Pl/Sql record structre.
131 --
132 -- Post Success:
133 --   Processing continues.
134 --
135 -- Post Failure:
136 --   If an error has occurred, an error message and exception will be raised
137 --   but not handled.
138 --
139 -- Developer Implementation Notes:
140 --   Any pre-processing required before the delete dml is issued should be
141 --   coded within this procedure. It is important to note that any 3rd party
142 --   maintenance should be reviewed before placing in this procedure.
143 --
144 -- Access Status:
145 --   Internal Row Handler Use Only.
146 --
147 -- {End Of Comments}
148 -- ----------------------------------------------------------------------------
149 Procedure pre_delete(p_rec in ben_xrc_shd.g_rec_type) is
150 --
151   l_proc  varchar2(72) := g_package||'pre_delete';
152 --
153 Begin
154   hr_utility.set_location('Entering:'||l_proc, 5);
155   --
156   hr_utility.set_location(' Leaving:'||l_proc, 10);
157 End pre_delete;
158 --
159 -- ----------------------------------------------------------------------------
160 -- |-----------------------------< post_delete >------------------------------|
161 -- ----------------------------------------------------------------------------
162 -- {Start Of Comments}
163 --
164 -- Description:
165 --   This private procedure contains any processing which is required after the
166 --   delete dml.
167 --
168 -- Prerequisites:
169 --   This is an internal procedure which is called from the del procedure.
170 --
171 -- In Parameters:
172 --   A Pl/Sql record structre.
173 --
174 -- Post Success:
175 --   Processing continues.
176 --
177 -- Post Failure:
178 --   If an error has occurred, an error message and exception will be raised
179 --   but not handled.
180 --
181 -- Developer Implementation Notes:
182 --   Any post-processing required after the delete dml is issued should be
183 --   coded within this procedure. It is important to note that any 3rd party
184 --   maintenance should be reviewed before placing in this procedure.
185 --
186 -- Access Status:
187 --   Internal table Handler Use Only.
188 --
189 -- {End Of Comments}
190 -- ----------------------------------------------------------------------------
191 Procedure post_delete(
192 p_effective_date in date,p_rec in ben_xrc_shd.g_rec_type) is
193 --
194   l_proc  varchar2(72) := g_package||'post_delete';
195 --
196 Begin
197   hr_utility.set_location('Entering:'||l_proc, 5);
198 --
199   --
200   -- Delete ownerships if applicable
201   --
202   delete_app_ownerships('EXT_RCD_ID', p_rec.ext_rcd_id);
203 
204   --
205   -- Start of API User Hook for post_delete.
206   --
207   begin
208     --
209     ben_xrc_rkd.after_delete
210       (
211   p_ext_rcd_id                    =>p_rec.ext_rcd_id
212  ,p_name_o                        =>ben_xrc_shd.g_old_rec.name
213  ,p_xml_tag_name_o                  =>ben_xrc_shd.g_old_rec.xml_tag_name
214  ,p_rcd_type_cd_o                 =>ben_xrc_shd.g_old_rec.rcd_type_cd
215  ,p_low_lvl_cd_o                  =>ben_xrc_shd.g_old_rec.low_lvl_cd
216  ,p_business_group_id_o           =>ben_xrc_shd.g_old_rec.business_group_id
217  ,p_legislation_code_o            =>ben_xrc_shd.g_old_rec.legislation_code
218  ,p_xrc_attribute_category_o      =>ben_xrc_shd.g_old_rec.xrc_attribute_category
219  ,p_xrc_attribute1_o              =>ben_xrc_shd.g_old_rec.xrc_attribute1
220  ,p_xrc_attribute2_o              =>ben_xrc_shd.g_old_rec.xrc_attribute2
221  ,p_xrc_attribute3_o              =>ben_xrc_shd.g_old_rec.xrc_attribute3
222  ,p_xrc_attribute4_o              =>ben_xrc_shd.g_old_rec.xrc_attribute4
223  ,p_xrc_attribute5_o              =>ben_xrc_shd.g_old_rec.xrc_attribute5
224  ,p_xrc_attribute6_o              =>ben_xrc_shd.g_old_rec.xrc_attribute6
225  ,p_xrc_attribute7_o              =>ben_xrc_shd.g_old_rec.xrc_attribute7
226  ,p_xrc_attribute8_o              =>ben_xrc_shd.g_old_rec.xrc_attribute8
227  ,p_xrc_attribute9_o              =>ben_xrc_shd.g_old_rec.xrc_attribute9
228  ,p_xrc_attribute10_o             =>ben_xrc_shd.g_old_rec.xrc_attribute10
229  ,p_xrc_attribute11_o             =>ben_xrc_shd.g_old_rec.xrc_attribute11
230  ,p_xrc_attribute12_o             =>ben_xrc_shd.g_old_rec.xrc_attribute12
231  ,p_xrc_attribute13_o             =>ben_xrc_shd.g_old_rec.xrc_attribute13
232  ,p_xrc_attribute14_o             =>ben_xrc_shd.g_old_rec.xrc_attribute14
233  ,p_xrc_attribute15_o             =>ben_xrc_shd.g_old_rec.xrc_attribute15
234  ,p_xrc_attribute16_o             =>ben_xrc_shd.g_old_rec.xrc_attribute16
235  ,p_xrc_attribute17_o             =>ben_xrc_shd.g_old_rec.xrc_attribute17
236  ,p_xrc_attribute18_o             =>ben_xrc_shd.g_old_rec.xrc_attribute18
237  ,p_xrc_attribute19_o             =>ben_xrc_shd.g_old_rec.xrc_attribute19
238  ,p_xrc_attribute20_o             =>ben_xrc_shd.g_old_rec.xrc_attribute20
239  ,p_xrc_attribute21_o             =>ben_xrc_shd.g_old_rec.xrc_attribute21
240  ,p_xrc_attribute22_o             =>ben_xrc_shd.g_old_rec.xrc_attribute22
241  ,p_xrc_attribute23_o             =>ben_xrc_shd.g_old_rec.xrc_attribute23
242  ,p_xrc_attribute24_o             =>ben_xrc_shd.g_old_rec.xrc_attribute24
243  ,p_xrc_attribute25_o             =>ben_xrc_shd.g_old_rec.xrc_attribute25
244  ,p_xrc_attribute26_o             =>ben_xrc_shd.g_old_rec.xrc_attribute26
245  ,p_xrc_attribute27_o             =>ben_xrc_shd.g_old_rec.xrc_attribute27
246  ,p_xrc_attribute28_o             =>ben_xrc_shd.g_old_rec.xrc_attribute28
247  ,p_xrc_attribute29_o             =>ben_xrc_shd.g_old_rec.xrc_attribute29
248  ,p_xrc_attribute30_o             =>ben_xrc_shd.g_old_rec.xrc_attribute30
249  ,p_object_version_number_o       =>ben_xrc_shd.g_old_rec.object_version_number
250       );
251     --
252   exception
253     --
254     when hr_api.cannot_find_prog_unit then
255       --
256       hr_api.cannot_find_prog_unit_error
257         (p_module_name => 'ben_ext_rcd'
258         ,p_hook_type   => 'AD');
259       --
260   end;
261   --
262   -- End of API User Hook for post_delete.
263   --
264   --
265   hr_utility.set_location(' Leaving:'||l_proc, 10);
266 End post_delete;
267 --
268 -- ----------------------------------------------------------------------------
269 -- |---------------------------------< del >----------------------------------|
270 -- ----------------------------------------------------------------------------
271 Procedure del
272   (
273   p_effective_date in date,
274   p_rec	      in ben_xrc_shd.g_rec_type
275   ) is
276 --
277   l_proc  varchar2(72) := g_package||'del';
278 --
279 Begin
280   hr_utility.set_location('Entering:'||l_proc, 5);
281   --
282   -- We must lock the row which we need to delete.
283   --
284   ben_xrc_shd.lck
285 	(
286 	p_rec.ext_rcd_id,
287 	p_rec.object_version_number
288 	);
289   --
290   -- Call the supporting delete validate operation
291   --
292   ben_xrc_bus.delete_validate(p_rec
293   ,p_effective_date);
294   --
295   -- Call the supporting pre-delete operation
296   --
297   pre_delete(p_rec);
298   --
299   -- Delete the row.
300   --
301   delete_dml(p_rec);
302   --
303   -- Call the supporting post-delete operation
304   --
305   post_delete(
306 p_effective_date,p_rec);
307 End del;
308 --
309 -- ----------------------------------------------------------------------------
310 -- |---------------------------------< del >----------------------------------|
311 -- ----------------------------------------------------------------------------
312 Procedure del
313   (
314   p_effective_date in date,
315   p_ext_rcd_id                   in number,
316   p_legislation_code             in varchar2         default null,
317   p_object_version_number        in number
318   ) is
319 --
320   l_rec	  ben_xrc_shd.g_rec_type;
321   l_proc  varchar2(72) := g_package||'del';
322 --
323 Begin
324   hr_utility.set_location('Entering:'||l_proc, 5);
325   --
326   -- As the delete procedure accepts a plsql record structure we do need to
327   -- convert the  arguments into the record structure.
328   -- We don't need to call the supplied conversion argument routine as we
329   -- only need a few attributes.
330   --
331   l_rec.ext_rcd_id:= p_ext_rcd_id;
332   l_rec.legislation_code := p_legislation_code;
333   l_rec.object_version_number := p_object_version_number;
334   --
335   -- Having converted the arguments into the ben_xrc_rec
336   -- plsql record structure we must call the corresponding entity
337   -- business process
338   --
339   del(
340     p_effective_date,l_rec);
341   --
342   hr_utility.set_location(' Leaving:'||l_proc, 10);
343 End del;
344 --
345 end ben_xrc_del;