DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_EAP_DEL

Source


1 Package Body hr_eap_del as
2 /* $Header: hreaprhi.pkb 115.0 2004/01/09 00:17 vkarandi noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  hr_eap_del.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |----------------------------< delete_sso_details >------------------------|
12 -- ----------------------------------------------------------------------------
13 
14 PROCEDURE delete_sso_details (
15             p_sso_id   IN number
16 ) IS
17 
18 l_ext_application_id  NUMBER(15) := NULL;
19 l_error number(15) := null;
20 
21 l_proc     varchar2(72) := g_package || 'delete_sso_details';
22 
23 CURSOR csr_app_id IS
24 select EXT_APPLICATION_ID
25 from hr_ki_ext_applications
26 where external_application_id=p_sso_id;
27 
28 
29 BEGIN
30 
31 --
32 --Make sure that ext_application_id is not null
33 --
34 
35 hr_utility.set_location('Entering:'||l_proc, 5);
36 
37   hr_api.mandatory_arg_error
38   (p_api_name           => l_proc
39   ,p_argument           => 'EXTERNAL_APPLICATION_ID'
40   ,p_argument_value     => p_sso_id
41   );
42 
43 hr_utility.set_location('Validating:'||l_proc, 10);
44 
45 OPEN csr_app_id;
46 FETCH csr_app_id INTO l_ext_application_id;
47 IF csr_app_id%NOTFOUND THEN
48 
49        close csr_app_id;
50        fnd_message.set_name('PER','PER_449986_EAP_EAPP_ID_INVAL');
51        fnd_message.raise_error;
52 
53 END IF;
54 CLOSE csr_app_id;
55 
56 
57 hr_utility.set_location('Calling update SSO:'||l_proc, 20);
58 
59   -- delete the application
60    hr_sso_utl.delete_application
61    (
62    p_appid => p_sso_id
63    ,p_error => l_error
64    );
65 
66    --if l_error =0 means application deleted from SSO
67 
68     if (l_error=0) then
69         hr_eap_del.del
70          (
71          p_ext_application_id     => l_ext_application_id
72          );
73    else
74      fnd_message.set_name('PER','PER_449987_EAP_SSODEL_ERR');
75      fnd_message.raise_error;
76    end if;
77 
78 END delete_sso_details;
79 -- ----------------------------------------------------------------------------
80 -- |------------------------------< delete_dml >------------------------------|
81 -- ----------------------------------------------------------------------------
82 -- {Start Of Comments}
83 --
84 -- Description:
85 --   This procedure controls the actual dml delete logic. The functions of
86 --   this procedure are as follows:
87 --   1) To set and unset the g_api_dml status as required (as we are about to
88 --      perform dml).
89 --   2) To delete the specified row from the schema using the primary key in
90 --      the predicates.
91 --   3) To trap any constraint violations that may have occurred.
92 --   4) To raise any other errors.
93 --
94 -- Prerequisites:
95 --   This is an internal private procedure which must be called from the del
96 --   procedure.
97 --
98 -- In Parameters:
99 --   A Pl/Sql record structre.
100 --
101 -- Post Success:
102 --   The specified row will be delete from the schema.
103 --
104 -- Post Failure:
105 --   On the delete dml failure it is important to note that we always reset the
106 --   g_api_dml status to false.
107 --   If a child integrity constraint violation is raised the
108 --   constraint_error procedure will be called.
109 --   If any other error is reported, the error will be raised after the
110 --   g_api_dml status is reset.
111 --
112 -- Developer Implementation Notes:
113 --   None.
114 --
115 -- Access Status:
116 --   Internal Row Handler Use Only.
117 --
118 -- {End Of Comments}
119 -- ----------------------------------------------------------------------------
120 Procedure delete_dml
121   (p_rec in hr_eap_shd.g_rec_type
122   ) is
123 --
124   l_proc  varchar2(72) := g_package||'delete_dml';
125 --
126 Begin
127   hr_utility.set_location('Entering:'||l_proc, 5);
128   --
129   --
130   --
131   -- Delete the hr_ki_ext_applications row.
132   --
133   delete from hr_ki_ext_applications
134   where ext_application_id = p_rec.ext_application_id;
135   --
136   --
137   --
138   hr_utility.set_location(' Leaving:'||l_proc, 10);
139 --
140 Exception
141   When hr_api.child_integrity_violated then
142     -- Child integrity has been violated
143     --
144     hr_eap_shd.constraint_error
145       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
146   When Others Then
147     --
148     Raise;
149 End delete_dml;
150 --
151 -- ----------------------------------------------------------------------------
152 -- |------------------------------< pre_delete >------------------------------|
153 -- ----------------------------------------------------------------------------
154 -- {Start Of Comments}
155 --
156 -- Description:
157 --   This private procedure contains any processing which is required before
158 --   the delete dml.
159 --
160 -- Prerequisites:
161 --   This is an internal procedure which is called from the del procedure.
162 --
163 -- In Parameters:
164 --   A Pl/Sql record structre.
165 --
166 -- Post Success:
167 --   Processing continues.
168 --
169 -- Post Failure:
170 --   If an error has occurred, an error message and exception will be raised
171 --   but not handled.
172 --
173 -- Developer Implementation Notes:
174 --   Any pre-processing required before the delete dml is issued should be
175 --   coded within this procedure. It is important to note that any 3rd party
176 --   maintenance should be reviewed before placing in this procedure.
177 --
178 -- Access Status:
179 --   Internal Row Handler Use Only.
180 --
181 -- {End Of Comments}
182 -- ----------------------------------------------------------------------------
183 Procedure pre_delete(p_rec in hr_eap_shd.g_rec_type) is
184 --
185   l_proc  varchar2(72) := g_package||'pre_delete';
186 --
187 Begin
188   hr_utility.set_location('Entering:'||l_proc, 5);
189   --
190   hr_utility.set_location(' Leaving:'||l_proc, 10);
191 End pre_delete;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |-----------------------------< post_delete >------------------------------|
195 -- ----------------------------------------------------------------------------
196 -- {Start Of Comments}
197 --
198 -- Description:
199 --   This private procedure contains any processing which is required after
200 --   the delete dml.
201 --
202 -- Prerequistes:
203 --   This is an internal procedure which is called from the del procedure.
204 --
205 -- In Parameters:
206 --   A Pl/Sql record structure.
207 --
208 -- Post Success:
209 --   Processing continues.
210 --
211 -- Post Failure:
212 --   If an error has occurred, an error message and exception will be raised
213 --   but not handled.
214 --
215 -- Developer Implementation Notes:
216 --   Any post-processing required after the delete dml is issued should be
217 --   coded within this procedure. It is important to note that any 3rd party
218 --   maintenance should be reviewed before placing in this procedure.
219 --
220 -- Access Status:
221 --   Internal Row Handler Use Only.
222 --
223 -- {End Of Comments}
224 -- -----------------------------------------------------------------------------
225 Procedure post_delete(p_rec in hr_eap_shd.g_rec_type) is
226 --
227   l_proc  varchar2(72) := g_package||'post_delete';
228 --
229 Begin
230   hr_utility.set_location('Entering:'||l_proc, 5);
231   begin
232     --
233     hr_eap_rkd.after_delete
234       (p_ext_application_id
235       => p_rec.ext_application_id
236       ,p_external_application_name_o
237       => hr_eap_shd.g_old_rec.external_application_name
238       ,p_external_application_id_o
239       => hr_eap_shd.g_old_rec.external_application_id
240       );
241     --
242   exception
243     --
244     when hr_api.cannot_find_prog_unit then
245       --
246       hr_api.cannot_find_prog_unit_error
247         (p_module_name => 'HR_KI_EXT_APPLICATIONS'
248         ,p_hook_type   => 'AD');
249       --
250   end;
251   --
252   hr_utility.set_location(' Leaving:'||l_proc, 10);
253 End post_delete;
254 --
255 -- ----------------------------------------------------------------------------
256 -- |---------------------------------< del >----------------------------------|
257 -- ----------------------------------------------------------------------------
258 Procedure del
259   (p_rec              in hr_eap_shd.g_rec_type
260   ) is
261 --
262   l_proc  varchar2(72) := g_package||'del';
263 --
264 Begin
265   hr_utility.set_location('Entering:'||l_proc, 5);
266   --
267   -- We must lock the row which we need to delete.
268   --
269   hr_eap_shd.lck
270     (p_rec.ext_application_id
271     );
272   --
273   -- Call the supporting delete validate operation
274   --
275   hr_eap_bus.delete_validate(p_rec);
276   --
277   -- Call to raise any errors on multi-message list
278   hr_multi_message.end_validation_set;
279   --
280   -- Call the supporting pre-delete operation
281   --
282   hr_eap_del.pre_delete(p_rec);
283   --
284   -- Delete the row.
285   --
286   hr_eap_del.delete_dml(p_rec);
287   --
288   -- Call the supporting post-delete operation
289   --
290   hr_eap_del.post_delete(p_rec);
291   --
292   -- Call to raise any errors on multi-message list
293   hr_multi_message.end_validation_set;
294   --
295 End del;
296 --
297 -- ----------------------------------------------------------------------------
298 -- |---------------------------------< del >----------------------------------|
299 -- ----------------------------------------------------------------------------
300 Procedure del
301   (p_ext_application_id                   in     number
302   ) is
303 --
304   l_rec   hr_eap_shd.g_rec_type;
305   l_proc  varchar2(72) := g_package||'del';
306 --
307 Begin
308   hr_utility.set_location('Entering:'||l_proc, 5);
309   --
310   -- As the delete procedure accepts a plsql record structure we do need to
311   -- convert the  arguments into the record structure.
312   -- We don't need to call the supplied conversion argument routine as we
313   -- only need a few attributes.
314   --
315   l_rec.ext_application_id := p_ext_application_id;
316   --
317   --
318   -- Having converted the arguments into the hr_eap_rec
319   -- plsql record structure we must call the corresponding entity
320   -- business process
321   --
322   hr_eap_del.del(l_rec);
323   --
324   hr_utility.set_location(' Leaving:'||l_proc, 10);
325 End del;
326 --
327 end hr_eap_del;