DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XCR_DEL

Source


1 Package Body ben_xcr_del as
2 /* $Header: bexcrrhi.pkb 120.0 2005/05/28 12:25:40 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_xcr_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 -- |------------------------------< delete_dml >------------------------------|
48 -- ----------------------------------------------------------------------------
49 -- {Start Of Comments}
50 --
51 -- Description:
52 --   This procedure controls the actual dml delete logic. The functions of
53 --   this procedure are as follows:
54 --   1) To set and unset the g_api_dml status as required (as we are about to
55 --      perform dml).
56 --   2) To delete the specified row from the schema using the primary key in
57 --      the predicates.
58 --   3) To trap any constraint violations that may have occurred.
59 --   4) To raise any other errors.
60 --
61 -- Prerequisites:
62 --   This is an internal private procedure which must be called from the del
63 --   procedure.
64 --
65 -- In Parameters:
66 --   A Pl/Sql record structre.
67 --
68 -- Post Success:
69 --   The specified row will be delete from the schema.
70 --
71 -- Post Failure:
72 --   On the delete dml failure it is important to note that we always reset the
73 --   g_api_dml status to false.
74 --   If a child integrity constraint violation is raised the
75 --   constraint_error procedure will be called.
76 --   If any other error is reported, the error will be raised after the
77 --   g_api_dml status is reset.
78 --
79 -- Developer Implementation Notes:
80 --   None.
81 --
82 -- Access Status:
83 --   Internal Row Handler Use Only.
84 --
85 -- {End Of Comments}
86 -- ----------------------------------------------------------------------------
87 Procedure delete_dml(p_rec in ben_xcr_shd.g_rec_type) is
88 --
89   l_proc  varchar2(72) := g_package||'delete_dml';
90 --
91 Begin
92   hr_utility.set_location('Entering:'||l_proc, 5);
93   --
94   ben_xcr_shd.g_api_dml := true;  -- Set the api dml status
95   --
96   -- Delete the ben_ext_crit_prfl row.
97   --
98   delete from ben_ext_crit_prfl
99   where ext_crit_prfl_id = p_rec.ext_crit_prfl_id;
100   --
101   ben_xcr_shd.g_api_dml := false;   -- Unset the api dml status
102   --
103   hr_utility.set_location(' Leaving:'||l_proc, 10);
104 --
105 Exception
106   When hr_api.child_integrity_violated then
107     -- Child integrity has been violated
108     ben_xcr_shd.g_api_dml := false;   -- Unset the api dml status
109     ben_xcr_shd.constraint_error
110       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
111   When Others Then
112     ben_xcr_shd.g_api_dml := false;   -- Unset the api dml status
113     Raise;
114 End delete_dml;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |------------------------------< pre_delete >------------------------------|
118 -- ----------------------------------------------------------------------------
119 -- {Start Of Comments}
120 --
121 -- Description:
122 --   This private procedure contains any processing which is required before
123 --   the delete dml.
124 --
125 -- Prerequisites:
126 --   This is an internal procedure which is called from the del procedure.
127 --
128 -- In Parameters:
129 --   A Pl/Sql record structre.
130 --
131 -- Post Success:
132 --   Processing continues.
133 --
134 -- Post Failure:
135 --   If an error has occurred, an error message and exception will be raised
136 --   but not handled.
137 --
138 -- Developer Implementation Notes:
139 --   Any pre-processing required before the delete dml is issued should be
140 --   coded within this procedure. It is important to note that any 3rd party
141 --   maintenance should be reviewed before placing in this procedure.
142 --
143 -- Access Status:
144 --   Internal Row Handler Use Only.
145 --
146 -- {End Of Comments}
147 -- ----------------------------------------------------------------------------
148 Procedure pre_delete(p_rec in ben_xcr_shd.g_rec_type) is
149 --
150   l_proc  varchar2(72) := g_package||'pre_delete';
151 --
152 Begin
153   hr_utility.set_location('Entering:'||l_proc, 5);
154   --
155   hr_utility.set_location(' Leaving:'||l_proc, 10);
156 End pre_delete;
157 --
158 -- ----------------------------------------------------------------------------
159 -- |-----------------------------< post_delete >------------------------------|
160 -- ----------------------------------------------------------------------------
161 -- {Start Of Comments}
162 --
163 -- Description:
164 --   This private procedure contains any processing which is required after the
165 --   delete dml.
166 --
167 -- Prerequisites:
168 --   This is an internal procedure which is called from the del procedure.
169 --
170 -- In Parameters:
171 --   A Pl/Sql record structre.
172 --
173 -- Post Success:
174 --   Processing continues.
175 --
176 -- Post Failure:
177 --   If an error has occurred, an error message and exception will be raised
178 --   but not handled.
179 --
180 -- Developer Implementation Notes:
181 --   Any post-processing required after the delete dml is issued should be
182 --   coded within this procedure. It is important to note that any 3rd party
183 --   maintenance should be reviewed before placing in this procedure.
184 --
185 -- Access Status:
186 --   Internal table Handler Use Only.
187 --
188 -- {End Of Comments}
189 -- ----------------------------------------------------------------------------
190 Procedure post_delete(p_rec in ben_xcr_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   delete_app_ownerships('EXT_CRIT_PRFL_ID', p_rec.ext_crit_prfl_id);
198   --
199   -- Start of API User Hook for post_delete.
200   --
201   begin
202     --
203     ben_xcr_rkd.after_delete
204       (
205   p_ext_crit_prfl_id              =>p_rec.ext_crit_prfl_id
206  ,p_name_o                        =>ben_xcr_shd.g_old_rec.name
207  ,p_business_group_id_o           =>ben_xcr_shd.g_old_rec.business_group_id
208  ,p_legislation_code_o            =>ben_xcr_shd.g_old_rec.legislation_code
209  ,p_xcr_attribute_category_o      =>ben_xcr_shd.g_old_rec.xcr_attribute_category
210  ,p_xcr_attribute1_o              =>ben_xcr_shd.g_old_rec.xcr_attribute1
211  ,p_xcr_attribute2_o              =>ben_xcr_shd.g_old_rec.xcr_attribute2
212  ,p_xcr_attribute3_o              =>ben_xcr_shd.g_old_rec.xcr_attribute3
213  ,p_xcr_attribute4_o              =>ben_xcr_shd.g_old_rec.xcr_attribute4
214  ,p_xcr_attribute5_o              =>ben_xcr_shd.g_old_rec.xcr_attribute5
215  ,p_xcr_attribute6_o              =>ben_xcr_shd.g_old_rec.xcr_attribute6
216  ,p_xcr_attribute7_o              =>ben_xcr_shd.g_old_rec.xcr_attribute7
217  ,p_xcr_attribute8_o              =>ben_xcr_shd.g_old_rec.xcr_attribute8
218  ,p_xcr_attribute9_o              =>ben_xcr_shd.g_old_rec.xcr_attribute9
219  ,p_xcr_attribute10_o             =>ben_xcr_shd.g_old_rec.xcr_attribute10
220  ,p_xcr_attribute11_o             =>ben_xcr_shd.g_old_rec.xcr_attribute11
221  ,p_xcr_attribute12_o             =>ben_xcr_shd.g_old_rec.xcr_attribute12
222  ,p_xcr_attribute13_o             =>ben_xcr_shd.g_old_rec.xcr_attribute13
223  ,p_xcr_attribute14_o             =>ben_xcr_shd.g_old_rec.xcr_attribute14
224  ,p_xcr_attribute15_o             =>ben_xcr_shd.g_old_rec.xcr_attribute15
225  ,p_xcr_attribute16_o             =>ben_xcr_shd.g_old_rec.xcr_attribute16
226  ,p_xcr_attribute17_o             =>ben_xcr_shd.g_old_rec.xcr_attribute17
227  ,p_xcr_attribute18_o             =>ben_xcr_shd.g_old_rec.xcr_attribute18
228  ,p_xcr_attribute19_o             =>ben_xcr_shd.g_old_rec.xcr_attribute19
229  ,p_xcr_attribute20_o             =>ben_xcr_shd.g_old_rec.xcr_attribute20
230  ,p_xcr_attribute21_o             =>ben_xcr_shd.g_old_rec.xcr_attribute21
231  ,p_xcr_attribute22_o             =>ben_xcr_shd.g_old_rec.xcr_attribute22
232  ,p_xcr_attribute23_o             =>ben_xcr_shd.g_old_rec.xcr_attribute23
233  ,p_xcr_attribute24_o             =>ben_xcr_shd.g_old_rec.xcr_attribute24
234  ,p_xcr_attribute25_o             =>ben_xcr_shd.g_old_rec.xcr_attribute25
235  ,p_xcr_attribute26_o             =>ben_xcr_shd.g_old_rec.xcr_attribute26
236  ,p_xcr_attribute27_o             =>ben_xcr_shd.g_old_rec.xcr_attribute27
237  ,p_xcr_attribute28_o             =>ben_xcr_shd.g_old_rec.xcr_attribute28
238  ,p_xcr_attribute29_o             =>ben_xcr_shd.g_old_rec.xcr_attribute29
239  ,p_xcr_attribute30_o             =>ben_xcr_shd.g_old_rec.xcr_attribute30
240  ,p_ext_global_flag_o             =>ben_xcr_shd.g_old_rec.ext_global_flag
241  ,p_object_version_number_o       =>ben_xcr_shd.g_old_rec.object_version_number
242       );
243     --
244   exception
245     --
246     when hr_api.cannot_find_prog_unit then
247       --
248       hr_api.cannot_find_prog_unit_error
249         (p_module_name => 'ben_ext_crit_prfl'
250         ,p_hook_type   => 'AD');
251       --
252   end;
253   --
254   -- End of API User Hook for post_delete.
255   --
256   --
257   hr_utility.set_location(' Leaving:'||l_proc, 10);
258 End post_delete;
259 --
260 -- ----------------------------------------------------------------------------
261 -- |---------------------------------< del >----------------------------------|
262 -- ----------------------------------------------------------------------------
263 Procedure del
264   (
265   p_rec	      in ben_xcr_shd.g_rec_type
266   ) is
267 --
268   l_proc  varchar2(72) := g_package||'del';
269 --
270 Begin
271   hr_utility.set_location('Entering:'||l_proc, 5);
272   --
273   -- We must lock the row which we need to delete.
274   --
275   ben_xcr_shd.lck
276 	(
277 	p_rec.ext_crit_prfl_id,
278 	p_rec.object_version_number
279 	);
280   --
281   -- Call the supporting delete validate operation
282   --
283   ben_xcr_bus.delete_validate(p_rec);
284   --
285   -- Call the supporting pre-delete operation
286   --
287   pre_delete(p_rec);
288   --
289   -- Delete the row.
290   --
291   delete_dml(p_rec);
292   --
293   -- Call the supporting post-delete operation
294   --
295   post_delete(p_rec);
296 End del;
297 --
298 -- ----------------------------------------------------------------------------
299 -- |---------------------------------< del >----------------------------------|
300 -- ----------------------------------------------------------------------------
301 Procedure del
302   (
303   p_ext_crit_prfl_id                   in number,
304   p_legislation_code                   in varchar2         default null,
305   p_object_version_number              in number
306   ) is
307 --
308   l_rec	  ben_xcr_shd.g_rec_type;
309   l_proc  varchar2(72) := g_package||'del';
310 --
311 Begin
312   hr_utility.set_location('Entering:'||l_proc, 5);
313   --
314   -- As the delete procedure accepts a plsql record structure we do need to
315   -- convert the  arguments into the record structure.
316   -- We don't need to call the supplied conversion argument routine as we
317   -- only need a few attributes.
318   --
319   l_rec.ext_crit_prfl_id:= p_ext_crit_prfl_id;
320   l_rec.legislation_code := p_legislation_code;
321   l_rec.object_version_number := p_object_version_number;
322 
323   --
324   -- Having converted the arguments into the ben_xcr_rec
325   -- plsql record structure we must call the corresponding entity
326   -- business process
327   --
328   del(l_rec);
329   --
330   hr_utility.set_location(' Leaving:'||l_proc, 10);
331 End del;
332 --
333 end ben_xcr_del;