DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_EAP_UPD

Source


1 Package Body hr_eap_upd 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_upd.';  -- Global package name
9 
10 
11 -- ----------------------------------------------------------------------------
12 -- |----------------------------< update_sso_details >------------------------|
13 -- ----------------------------------------------------------------------------
14 
15 PROCEDURE update_sso_details (
16             p_ext_application_id   IN number,
17             p_app_code             IN VARCHAR2,
18             p_apptype              IN VARCHAR2,
19             p_appurl               IN VARCHAR2,
20             p_logout_url           IN VARCHAR2,
21             p_userfld              IN VARCHAR2,
22             p_pwdfld               IN VARCHAR2,
23             p_authused             IN VARCHAR2,
24             p_fname1               IN VARCHAR2 DEFAULT NULL,
25             p_fval1                IN VARCHAR2 DEFAULT NULL,
26             p_fname2               IN VARCHAR2 DEFAULT NULL,
27             p_fval2                IN VARCHAR2 DEFAULT NULL,
28             p_fname3               IN VARCHAR2 DEFAULT NULL,
29             p_fval3                IN VARCHAR2 DEFAULT NULL,
30             p_fname4               IN VARCHAR2 DEFAULT NULL,
31             p_fval4                IN VARCHAR2 DEFAULT NULL,
32             p_fname5               IN VARCHAR2 DEFAULT NULL,
33             p_fval5                IN VARCHAR2 DEFAULT NULL,
34             p_fname6               IN VARCHAR2 DEFAULT NULL,
35             p_fval6                IN VARCHAR2 DEFAULT NULL,
36             p_fname7               IN VARCHAR2 DEFAULT NULL,
37             p_fval7                IN VARCHAR2 DEFAULT NULL,
38             p_fname8               IN VARCHAR2 DEFAULT NULL,
39             p_fval8                IN VARCHAR2 DEFAULT NULL,
40             p_fname9               IN VARCHAR2 DEFAULT NULL,
41             p_fval9                IN VARCHAR2 DEFAULT NULL) IS
42 
43 l_app_id  NUMBER(15) := NULL;
44 
45 l_proc     varchar2(72) := g_package || 'update_sso_details';
46 
47 CURSOR csr_app_id IS
48 select external_application_id
49 from hr_ki_ext_applications
50 where ext_application_id=p_ext_application_id;
51 
52 
53 BEGIN
54 
55 --
56 --Make sure that ext_application_id is not null
57 --
58 
59 hr_utility.set_location('Entering:'||l_proc, 5);
60 
61   hr_api.mandatory_arg_error
62   (p_api_name           => l_proc
63   ,p_argument           => 'EXT_APPLICATION_ID'
64   ,p_argument_value     => p_ext_application_id
65   );
66 
67 hr_utility.set_location('Validating:'||l_proc, 10);
68 
69 OPEN csr_app_id;
70 FETCH csr_app_id INTO l_app_id;
71 IF csr_app_id%NOTFOUND THEN
72 
73        close csr_app_id;
74        fnd_message.set_name('PER','PER_449986_EAP_EAPP_ID_INVAL');
75        fnd_message.raise_error;
76 
77 END IF;
78 CLOSE csr_app_id;
79 
80 
81 hr_utility.set_location('Calling update SSO:'||l_proc, 20);
82 
83   -- update the application
84 
85   hr_sso_utl.PSTORE_MODIFY_APP_INFO (
86         p_appid          => l_app_id,
87         p_app_name       => p_app_code,
88         p_apptype        => p_apptype,
89         p_appurl         => p_appurl,
90         p_logout_url     => p_logout_url,
91         p_userfield      => p_userfld,
92         p_pwdfield       => p_pwdfld,
93         p_authneeded     => p_authused,
94         p_fname1         => p_fname1,
95         p_fval1          => p_fval1,
96         p_fname2         => p_fname2,
97         p_fval2          => p_fval2,
98         p_fname3         => p_fname3,
99         p_fval3          => p_fval3,
100         p_fname4         => p_fname4,
101         p_fval4          => p_fval4,
102         p_fname5         => p_fname5,
103         p_fval5          => p_fval5,
104         p_fname6         => p_fname6,
105         p_fval6          => p_fval6,
106         p_fname7         => p_fname7,
107         p_fval7          => p_fval7,
108         p_fname8         => p_fname8,
109         p_fval8          => p_fval8,
110         p_fname9         => p_fname9,
111         p_fval9          => p_fval9);
112 
113 
114 -- update record into hr_ki_ext_applications
115 
116   hr_eap_upd.upd
117     (
118      p_ext_application_id           => p_ext_application_id
119     ,p_external_application_name    => p_app_code
120 
121     );
122 
123 
124 END update_sso_details;
125 
126 
127 --
128 -- ----------------------------------------------------------------------------
129 -- |------------------------------< update_dml >------------------------------|
130 -- ----------------------------------------------------------------------------
131 -- {Start Of Comments}
132 --
133 -- Description:
134 --   This procedure controls the actual dml update logic. The processing of
135 --   this procedure is:
136 --   1) Increment the object_version_number by 1 if the object_version_number
137 --      is defined as an attribute for this entity.
138 --   2) To set and unset the g_api_dml status as required (as we are about to
139 --      perform dml).
140 --   3) To update the specified row in the schema using the primary key in
141 --      the predicates.
142 --   4) To trap any constraint violations that may have occurred.
143 --   5) To raise any other errors.
144 --
145 -- Prerequisites:
146 --   This is an internal private procedure which must be called from the upd
147 --   procedure.
148 --
149 -- In Parameters:
150 --   A Pl/Sql record structre.
151 --
152 -- Post Success:
153 --   The specified row will be updated in the schema.
154 --
155 -- Post Failure:
156 --   On the update dml failure it is important to note that we always reset the
157 --   g_api_dml status to false.
158 --   If a check, unique or parent integrity constraint violation is raised the
159 --   constraint_error procedure will be called.
160 --   If any other error is reported, the error will be raised after the
161 --   g_api_dml status is reset.
162 --
163 -- Developer Implementation Notes:
164 --   The update 'set' attribute list should be modified if any of your
165 --   attributes are not updateable.
166 --
167 -- Access Status:
168 --   Internal Row Handler Use Only.
169 --
170 -- {End Of Comments}
171 -- ----------------------------------------------------------------------------
172 Procedure update_dml
173   (p_rec in out nocopy hr_eap_shd.g_rec_type
174   ) is
175 --
176   l_proc  varchar2(72) := g_package||'update_dml';
177 --
178 Begin
179   hr_utility.set_location('Entering:'||l_proc, 5);
180   --
181   --
182   --
183   --
184   -- Update the hr_ki_ext_applications Row
185   --
186   update hr_ki_ext_applications
187     set
188      ext_application_id              = p_rec.ext_application_id
189     ,external_application_name       = p_rec.external_application_name
190 
191     where ext_application_id = p_rec.ext_application_id;
192   --
193   --
194   --
195   hr_utility.set_location(' Leaving:'||l_proc, 10);
196 --
197 Exception
198   When hr_api.check_integrity_violated Then
199     -- A check constraint has been violated
200     --
201     hr_eap_shd.constraint_error
202       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
203   When hr_api.parent_integrity_violated Then
204     -- Parent integrity has been violated
205     --
206     hr_eap_shd.constraint_error
207       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
208   When hr_api.unique_integrity_violated Then
209     -- Unique integrity has been violated
210     --
211     hr_eap_shd.constraint_error
212       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
213   When Others Then
214     --
215     Raise;
216 End update_dml;
217 --
218 -- ----------------------------------------------------------------------------
219 -- |------------------------------< pre_update >------------------------------|
220 -- ----------------------------------------------------------------------------
221 -- {Start Of Comments}
222 --
223 -- Description:
224 --   This private procedure contains any processing which is required before
225 --   the update dml.
226 --
227 -- Prerequisites:
228 --   This is an internal procedure which is called from the upd procedure.
229 --
230 -- In Parameters:
231 --   A Pl/Sql record structure.
232 --
233 -- Post Success:
234 --   Processing continues.
235 --
236 -- Post Failure:
237 --   If an error has occurred, an error message and exception wil be raised
238 --   but not handled.
239 --
240 -- Developer Implementation Notes:
241 --   Any pre-processing required before the update dml is issued should be
242 --   coded within this procedure. It is important to note that any 3rd party
243 --   maintenance should be reviewed before placing in this procedure.
244 --
245 -- Access Status:
246 --   Internal Row Handler Use Only.
247 --
248 -- {End Of Comments}
249 -- ----------------------------------------------------------------------------
250 Procedure pre_update
251   (p_rec in hr_eap_shd.g_rec_type
252   ) is
253 --
254   l_proc  varchar2(72) := g_package||'pre_update';
255 --
256 Begin
257   hr_utility.set_location('Entering:'||l_proc, 5);
258   --
259   hr_utility.set_location(' Leaving:'||l_proc, 10);
260 End pre_update;
261 --
262 -- ----------------------------------------------------------------------------
263 -- |-----------------------------< post_update >------------------------------|
264 -- ----------------------------------------------------------------------------
265 -- {Start Of Comments}
266 --
267 -- Description:
268 --   This private procedure contains any processing which is required after
269 --   the update dml.
270 --
271 -- Prerequisites:
272 --   This is an internal procedure which is called from the upd procedure.
273 --
274 -- In Parameters:
275 --   A Pl/Sql record structure.
276 --
277 -- Post Success:
278 --   Processing continues.
279 --
280 -- Post Failure:
281 --   If an error has occurred, an error message and exception will be raised
282 --   but not handled.
283 --
284 -- Developer Implementation Notes:
285 --   Any post-processing required after the update dml is issued should be
286 --   coded within this procedure. It is important to note that any 3rd party
287 --   maintenance should be reviewed before placing in this procedure.
288 --
289 -- Access Status:
290 --   Internal Row Handler Use Only.
291 --
292 -- {End Of Comments}
293 -- ----------------------------------------------------------------------------
294 Procedure post_update
295   (p_rec                          in hr_eap_shd.g_rec_type
296   ) is
297 --
298   l_proc  varchar2(72) := g_package||'post_update';
299 --
300 Begin
301   hr_utility.set_location('Entering:'||l_proc, 5);
302   begin
303     --
304     hr_eap_rku.after_update
305       (p_ext_application_id
306       => p_rec.ext_application_id
307       ,p_external_application_name
308       => p_rec.external_application_name
309       ,p_external_application_name_o
310       => hr_eap_shd.g_old_rec.external_application_name
311       ,p_external_application_id_o
312       => hr_eap_shd.g_old_rec.external_application_id
313       );
314     --
315   exception
316     --
317     when hr_api.cannot_find_prog_unit then
318       --
319       hr_api.cannot_find_prog_unit_error
320         (p_module_name => 'HR_KI_EXT_APPLICATIONS'
321         ,p_hook_type   => 'AU');
322       --
323   end;
324   --
325   hr_utility.set_location(' Leaving:'||l_proc, 10);
326 End post_update;
327 --
328 -- ----------------------------------------------------------------------------
329 -- |-----------------------------< convert_defs >-----------------------------|
330 -- ----------------------------------------------------------------------------
331 -- {Start Of Comments}
332 --
333 -- Description:
334 --   The Convert_Defs procedure has one very important function:
335 --   It must return the record structure for the row with all system defaulted
336 --   values converted into its corresponding parameter value for update. When
337 --   we attempt to update a row through the Upd process , certain
338 --   parameters can be defaulted which enables flexibility in the calling of
339 --   the upd process (e.g. only attributes which need to be updated need to be
340 --   specified). For the upd process to determine which attributes
341 --   have NOT been specified we need to check if the parameter has a reserved
342 --   system default value. Therefore, for all parameters which have a
343 --   corresponding reserved system default mechanism specified we need to
344 --   check if a system default is being used. If a system default is being
345 --   used then we convert the defaulted value into its corresponding attribute
346 --   value held in the g_old_rec data structure.
347 --
348 -- Prerequisites:
349 --   This private function can only be called from the upd process.
350 --
351 -- In Parameters:
352 --   A Pl/Sql record structure.
353 --
354 -- Post Success:
355 --   The record structure will be returned with all system defaulted parameter
356 --   values converted into its current row attribute value.
357 --
358 -- Post Failure:
359 --   No direct error handling is required within this function. Any possible
360 --   errors within this procedure will be a PL/SQL value error due to
361 --   conversion of datatypes or data lengths.
362 --
363 -- Developer Implementation Notes:
364 --   None.
365 --
366 -- Access Status:
367 --   Internal Row Handler Use Only.
368 --
369 -- {End Of Comments}
370 -- ----------------------------------------------------------------------------
371 Procedure convert_defs
372   (p_rec in out nocopy hr_eap_shd.g_rec_type
373   ) is
374 --
375 Begin
376   --
377   -- We must now examine each argument value in the
378   -- p_rec plsql record structure
379   -- to see if a system default is being used. If a system default
380   -- is being used then we must set to the 'current' argument value.
381   --
382   If (p_rec.external_application_name = hr_api.g_varchar2) then
383     p_rec.external_application_name :=
384     hr_eap_shd.g_old_rec.external_application_name;
385   End If;
386   If (p_rec.external_application_id = hr_api.g_varchar2) then
387     p_rec.external_application_id :=
388     hr_eap_shd.g_old_rec.external_application_id;
389   End If;
390   --
391 End convert_defs;
392 --
393 -- ----------------------------------------------------------------------------
394 -- |---------------------------------< upd >----------------------------------|
395 -- ----------------------------------------------------------------------------
396 Procedure upd
397   (p_rec                          in out nocopy hr_eap_shd.g_rec_type
398   ) is
399 --
400   l_proc  varchar2(72) := g_package||'upd';
401 --
402 Begin
403   hr_utility.set_location('Entering:'||l_proc, 5);
404   --
405   -- We must lock the row which we need to update.
406   --
407   hr_eap_shd.lck
408     (p_rec.ext_application_id
409     );
410   --
411   -- 1. During an update system defaults are used to determine if
412   --    arguments have been defaulted or not. We must therefore
413   --    derive the full record structure values to be updated.
414   --
415   -- 2. Call the supporting update validate operations.
416   --
417   convert_defs(p_rec);
418   hr_eap_bus.update_validate
419      (p_rec
420      );
421   --
422   -- Call to raise any errors on multi-message list
423   hr_multi_message.end_validation_set;
424   --
425   -- Call the supporting pre-update operation
426   --
427   hr_eap_upd.pre_update(p_rec);
428   --
429   -- Update the row.
430   --
431   hr_eap_upd.update_dml(p_rec);
432   --
433   -- Call the supporting post-update operation
434   --
435   hr_eap_upd.post_update
436      (p_rec
437      );
438   --
439   -- Call to raise any errors on multi-message list
440   hr_multi_message.end_validation_set;
441 End upd;
442 --
443 -- ----------------------------------------------------------------------------
444 -- |---------------------------------< upd >----------------------------------|
445 -- ----------------------------------------------------------------------------
446 Procedure upd
447   (p_ext_application_id           in     number
448   ,p_external_application_name    in     varchar2  default hr_api.g_varchar2
449 
450   ) is
451 --
452 
453   l_rec   hr_eap_shd.g_rec_type;
454   l_proc  varchar2(72) := g_package||'upd';
455 --
456 Begin
457   hr_utility.set_location('Entering:'||l_proc, 5);
458   --
459   -- Call conversion function to turn arguments into the
460   -- l_rec structure.
461   --
462   l_rec :=
463   hr_eap_shd.convert_args
464   (p_ext_application_id
465   ,p_external_application_name
466   ,hr_api.g_varchar2
467   );
468   --
469   -- Having converted the arguments into the
470   -- plsql record structure we call the corresponding record
471   -- business process.
472   --
473   hr_eap_upd.upd
474      (l_rec
475      );
476   --
477   --
478   hr_utility.set_location(' Leaving:'||l_proc, 10);
479 End upd;
480 --
481 end hr_eap_upd;