DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ULC_UPD

Source


1 Package Body hxc_ulc_upd as
2 /* $Header: hxculcrhi.pkb 120.2 2005/09/23 06:07:43 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_ulc_upd.';  -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |------------------------------< update_dml >------------------------------|
13 -- ----------------------------------------------------------------------------
14 -- {Start Of Comments}
15 --
16 -- Description:
17 --   This procedure controls the actual dml update logic. The processing of
18 --   this procedure is:
19 --   1) Increment the object_version_number by 1 if the object_version_number
20 --      is defined as an attribute for this entity.
21 --   2) To set and unset the g_api_dml status as required (as we are about to
22 --      perform dml).
23 --   3) To update the specified row in the schema using the primary key in
24 --      the predicates.
25 --   4) To trap any constraint violations that may have occurred.
26 --   5) To raise any other errors.
27 --
28 -- Prerequisites:
29 --   This is an internal private procedure which must be called from the upd
30 --   procedure.
31 --
32 -- In Parameters:
33 --   A Pl/Sql record structre.
34 --
35 -- Post Success:
36 --   The specified row will be updated in the schema.
37 --
38 -- Post Failure:
39 --   On the update dml failure it is important to note that we always reset the
40 --   g_api_dml status to false.
41 --   If a check, unique or parent integrity constraint violation is raised the
42 --   constraint_error procedure will be called.
43 --   If any other error is reported, the error will be raised after the
44 --   g_api_dml status is reset.
45 --
46 -- Developer Implementation Notes:
47 --   The update 'set' attribute list should be modified if any of your
48 --   attributes are not updateable.
49 --
50 -- Access Status:
51 --   Internal Row Handler Use Only.
52 --
53 -- {End Of Comments}
54 -- ----------------------------------------------------------------------------
55 Procedure update_dml
56   (p_rec in out nocopy hxc_ulc_shd.g_rec_type
57   ) is
58 --
59   l_proc  varchar2(72) ;
60 --
61 Begin
62 
63   if g_debug then
64   	l_proc := g_package||'update_dml';
65   	hr_utility.set_location('Entering:'||l_proc, 5);
66   end if;
67   --
68   -- Increment the object version
69   p_rec.object_version_number := p_rec.object_version_number + 1;
70   --
71   --
72   --
73   -- Update the hxc_layout_components Row
74   --
75   update hxc_layout_components
76     set
77      layout_component_id             = p_rec.layout_component_id
78     ,layout_id                       = p_rec.layout_id
79     ,parent_component_id             = p_rec.parent_component_id
80     ,component_name                  = p_rec.component_name
81     ,component_value                 = p_rec.component_value
82     ,sequence                        = p_rec.sequence
83     ,name_value_string               = p_rec.name_value_string
84     ,region_code                     = p_rec.region_code
85     ,region_code_app_id              = p_rec.region_code_app_id
86     ,attribute_code                  = p_rec.attribute_code
87     ,attribute_code_app_id           = p_rec.attribute_code_app_id
88     ,object_version_number           = p_rec.object_version_number
89     ,layout_comp_definition_id       = p_rec.layout_comp_definition_id
90     ,component_alias                 = p_rec.component_alias
91     ,parent_bean                     = p_rec.parent_bean
92     ,attribute1                      = p_rec.attribute1
93     ,attribute2                      = p_rec.attribute2
94     ,attribute3                      = p_rec.attribute3
95     ,attribute4                      = p_rec.attribute4
96     ,attribute5                      = p_rec.attribute5
97         ,last_updated_by		     = fnd_global.user_id
98     ,last_update_date		     = sysdate
99     ,last_update_login	             = fnd_global.login_id
100 
101     where layout_component_id = p_rec.layout_component_id;
102   --
103   --
104   --
105   if g_debug then
106   	hr_utility.set_location(' Leaving:'||l_proc, 10);
107   end if;
108 --
109 Exception
110   When hr_api.check_integrity_violated Then
111     -- A check constraint has been violated
112     --
113     hxc_ulc_shd.constraint_error
114       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
115   When hr_api.parent_integrity_violated Then
116     -- Parent integrity has been violated
117     --
118     hxc_ulc_shd.constraint_error
119       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
120   When hr_api.unique_integrity_violated Then
121     -- Unique integrity has been violated
122     --
123     hxc_ulc_shd.constraint_error
124       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
125   When Others Then
126     --
127     Raise;
128 End update_dml;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |------------------------------< pre_update >------------------------------|
132 -- ----------------------------------------------------------------------------
133 -- {Start Of Comments}
134 --
135 -- Description:
136 --   This private procedure contains any processing which is required before
137 --   the update dml.
138 --
139 -- Prerequisites:
140 --   This is an internal procedure which is called from the upd procedure.
141 --
142 -- In Parameters:
143 --   A Pl/Sql record structure.
144 --
145 -- Post Success:
146 --   Processing continues.
147 --
148 -- Post Failure:
149 --   If an error has occurred, an error message and exception wil be raised
150 --   but not handled.
151 --
152 -- Developer Implementation Notes:
153 --   Any pre-processing required before the update dml is issued should be
154 --   coded within this procedure. It is important to note that any 3rd party
155 --   maintenance should be reviewed before placing in this procedure.
156 --
157 -- Access Status:
158 --   Internal Row Handler Use Only.
159 --
160 -- {End Of Comments}
161 -- ----------------------------------------------------------------------------
162 Procedure pre_update
163   (p_rec in hxc_ulc_shd.g_rec_type
164   ) is
165 --
166   l_proc  varchar2(72) ;
167 --
168 Begin
169 
170   if g_debug then
171   	l_proc := g_package||'pre_update';
172   	hr_utility.set_location('Entering:'||l_proc, 5);
173   	hr_utility.set_location(' Leaving:'||l_proc, 10);
174   end if;
175 End pre_update;
176 --
177 -- ----------------------------------------------------------------------------
178 -- |-----------------------------< post_update >------------------------------|
179 -- ----------------------------------------------------------------------------
180 -- {Start Of Comments}
181 --
182 -- Description:
183 --   This private procedure contains any processing which is required after the
184 --   update dml.
185 --
186 -- Prerequisites:
187 --   This is an internal procedure which is called from the upd procedure.
188 --
189 -- In Parameters:
190 --   A Pl/Sql record structure.
191 --
192 -- Post Success:
193 --   Processing continues.
194 --
195 -- Post Failure:
196 --   If an error has occurred, an error message and exception will be raised
197 --   but not handled.
198 --
199 -- Developer Implementation Notes:
200 --   Any post-processing required after the update dml is issued should be
201 --   coded within this procedure. It is important to note that any 3rd party
202 --   maintenance should be reviewed before placing in this procedure.
203 --
204 -- Access Status:
205 --   Internal Row Handler Use Only.
206 --
207 -- {End Of Comments}
208 -- ----------------------------------------------------------------------------
209 Procedure post_update
210   (p_rec                          in hxc_ulc_shd.g_rec_type
211   ) is
212 --
213   l_proc  varchar2(72) ;
214 --
215 Begin
216 
217   if g_debug then
218   	l_proc := g_package||'post_update';
219   	hr_utility.set_location('Entering:'||l_proc, 5);
220   end if;
221   begin
222     --
223     hxc_ulc_rku.after_update
224       (p_layout_component_id
225       => p_rec.layout_component_id
226       ,p_layout_id
227       => p_rec.layout_id
228       ,p_parent_component_id
229       => p_rec.parent_component_id
230       ,p_component_name
231       => p_rec.component_name
232       ,p_component_value
233       => p_rec.component_value
234       ,p_sequence
235       => p_rec.sequence
236       ,p_name_value_string
237       => p_rec.name_value_string
238       ,p_region_code
239       => p_rec.region_code
240       ,p_region_code_app_id
241       => p_rec.region_code_app_id
242       ,p_attribute_code
243       => p_rec.attribute_code
244       ,p_attribute_code_app_id
245       => p_rec.attribute_code_app_id
246       ,p_object_version_number
247       => p_rec.object_version_number
248       ,p_layout_comp_definition_id
249       => p_rec.layout_comp_definition_id
250       ,p_component_alias
251       => p_rec.component_alias
252       ,p_parent_bean
253       => p_rec.parent_bean
254       ,p_attribute1
255       => p_rec.attribute1
256       ,p_attribute2
257       => p_rec.attribute2
258       ,p_attribute3
259       => p_rec.attribute3
260       ,p_attribute4
261       => p_rec.attribute4
262       ,p_attribute5
263       => p_rec.attribute5
264       ,p_layout_id_o
265       => hxc_ulc_shd.g_old_rec.layout_id
266       ,p_parent_component_id_o
267       => hxc_ulc_shd.g_old_rec.parent_component_id
268       ,p_component_name_o
269       => hxc_ulc_shd.g_old_rec.component_name
270       ,p_component_value_o
271       => hxc_ulc_shd.g_old_rec.component_value
272       ,p_sequence_o
273       => hxc_ulc_shd.g_old_rec.sequence
274       ,p_name_value_string_o
275       => hxc_ulc_shd.g_old_rec.name_value_string
276       ,p_region_code_o
277       => hxc_ulc_shd.g_old_rec.region_code
278       ,p_region_code_app_id_o
279       => hxc_ulc_shd.g_old_rec.region_code_app_id
280       ,p_attribute_code_o
281       => hxc_ulc_shd.g_old_rec.attribute_code
282       ,p_attribute_code_app_id_o
283       => hxc_ulc_shd.g_old_rec.attribute_code_app_id
284       ,p_object_version_number_o
285       => hxc_ulc_shd.g_old_rec.object_version_number
286       ,p_layout_comp_definition_id_o
287       => hxc_ulc_shd.g_old_rec.layout_comp_definition_id
288       ,p_component_alias_o
289       => hxc_ulc_shd.g_old_rec.component_alias
290       ,p_parent_bean_o
291       => hxc_ulc_shd.g_old_rec.parent_bean
292       ,p_attribute1_o
293       => hxc_ulc_shd.g_old_rec.attribute1
294       ,p_attribute2_o
295       => hxc_ulc_shd.g_old_rec.attribute2
296       ,p_attribute3_o
297       => hxc_ulc_shd.g_old_rec.attribute3
298       ,p_attribute4_o
299       => hxc_ulc_shd.g_old_rec.attribute4
300       ,p_attribute5_o
301       => hxc_ulc_shd.g_old_rec.attribute5
302       );
303     --
304   exception
305     --
306     when hr_api.cannot_find_prog_unit then
307       --
308       hr_api.cannot_find_prog_unit_error
309         (p_module_name => 'HXC_LAYOUT_COMPONENTS'
310         ,p_hook_type   => 'AU');
311       --
312   end;
313   --
314   if g_debug then
315   	hr_utility.set_location(' Leaving:'||l_proc, 10);
316   end if;
317 End post_update;
318 --
319 -- ----------------------------------------------------------------------------
320 -- |-----------------------------< convert_defs >-----------------------------|
321 -- ----------------------------------------------------------------------------
322 -- {Start Of Comments}
323 --
324 -- Description:
325 --   The Convert_Defs procedure has one very important function:
326 --   It must return the record structure for the row with all system defaulted
327 --   values converted into its corresponding parameter value for update. When
328 --   we attempt to update a row through the Upd process , certain
329 --   parameters can be defaulted which enables flexibility in the calling of
330 --   the upd process (e.g. only attributes which need to be updated need to be
331 --   specified). For the upd process to determine which attributes
332 --   have NOT been specified we need to check if the parameter has a reserved
333 --   system default value. Therefore, for all parameters which have a
334 --   corresponding reserved system default mechanism specified we need to
335 --   check if a system default is being used. If a system default is being
336 --   used then we convert the defaulted value into its corresponding attribute
337 --   value held in the g_old_rec data structure.
338 --
339 -- Prerequisites:
340 --   This private function can only be called from the upd process.
341 --
342 -- In Parameters:
343 --   A Pl/Sql record structure.
344 --
345 -- Post Success:
346 --   The record structure will be returned with all system defaulted parameter
347 --   values converted into its current row attribute value.
348 --
349 -- Post Failure:
350 --   No direct error handling is required within this function. Any possible
351 --   errors within this procedure will be a PL/SQL value error due to
352 --   conversion of datatypes or data lengths.
353 --
354 -- Developer Implementation Notes:
355 --   None.
356 --
357 -- Access Status:
358 --   Internal Row Handler Use Only.
359 --
360 -- {End Of Comments}
361 -- ----------------------------------------------------------------------------
362 Procedure convert_defs
363   (p_rec in out nocopy hxc_ulc_shd.g_rec_type
364   ) is
365 --
366 Begin
367   --
368   -- We must now examine each argument value in the
369   -- p_rec plsql record structure
370   -- to see if a system default is being used. If a system default
371   -- is being used then we must set to the 'current' argument value.
372   --
373   If (p_rec.layout_id = hr_api.g_number) then
374     p_rec.layout_id :=
375     hxc_ulc_shd.g_old_rec.layout_id;
376   End If;
377   If (p_rec.layout_comp_definition_id = hr_api.g_number) then
378     p_rec.layout_comp_definition_id :=
379     hxc_ulc_shd.g_old_rec.layout_comp_definition_id;
380   End If;
381   If (p_rec.parent_component_id = hr_api.g_number) then
382     p_rec.parent_component_id :=
383     hxc_ulc_shd.g_old_rec.parent_component_id;
384   End If;
385   If (p_rec.component_name = hr_api.g_varchar2) then
386     p_rec.component_name :=
387     hxc_ulc_shd.g_old_rec.component_name;
388   End If;
389   If (p_rec.component_value = hr_api.g_varchar2) then
390     p_rec.component_value :=
391     hxc_ulc_shd.g_old_rec.component_value;
392   End If;
393   If (p_rec.sequence = hr_api.g_number) then
394     p_rec.sequence :=
395     hxc_ulc_shd.g_old_rec.sequence;
396   End If;
397   If (p_rec.name_value_string = hr_api.g_varchar2) then
398     p_rec.name_value_string :=
399     hxc_ulc_shd.g_old_rec.name_value_string;
400   End If;
401   If (p_rec.region_code = hr_api.g_varchar2) then
402     p_rec.region_code :=
403     hxc_ulc_shd.g_old_rec.region_code;
404   End If;
405   If (p_rec.region_code_app_id = hr_api.g_number) then
406     p_rec.region_code_app_id :=
407     hxc_ulc_shd.g_old_rec.region_code_app_id;
408   End If;
409   If (p_rec.attribute_code = hr_api.g_varchar2) then
410     p_rec.attribute_code :=
411     hxc_ulc_shd.g_old_rec.attribute_code;
412   End If;
413   If (p_rec.attribute_code_app_id = hr_api.g_number) then
414     p_rec.attribute_code_app_id :=
415     hxc_ulc_shd.g_old_rec.attribute_code_app_id;
416   End If;
417   If (p_rec.component_alias = hr_api.g_varchar2) then
418     p_rec.component_alias :=
419     hxc_ulc_shd.g_old_rec.component_alias;
420   End If;
421   If (p_rec.parent_bean = hr_api.g_varchar2) then
422     p_rec.parent_bean :=
423     hxc_ulc_shd.g_old_rec.parent_bean;
424   End If;
425   If (p_rec.attribute1 = hr_api.g_varchar2) then
426     p_rec.attribute1 :=
427     hxc_ulc_shd.g_old_rec.attribute1;
428   End If;
429   If (p_rec.attribute2 = hr_api.g_varchar2) then
430     p_rec.attribute2 :=
431     hxc_ulc_shd.g_old_rec.attribute2;
432   End If;
433   If (p_rec.attribute3 = hr_api.g_varchar2) then
434     p_rec.attribute3 :=
435     hxc_ulc_shd.g_old_rec.attribute3;
436   End If;
437   If (p_rec.attribute4 = hr_api.g_varchar2) then
438     p_rec.attribute4 :=
439     hxc_ulc_shd.g_old_rec.attribute4;
440   End If;
441   If (p_rec.attribute5 = hr_api.g_varchar2) then
442     p_rec.attribute5 :=
443     hxc_ulc_shd.g_old_rec.attribute5;
444   End If;
445   --
446 End convert_defs;
447 --
448 -- ----------------------------------------------------------------------------
449 -- |---------------------------------< upd >----------------------------------|
450 -- ----------------------------------------------------------------------------
451 Procedure upd
452   (p_rec                          in out nocopy hxc_ulc_shd.g_rec_type
453   ) is
454 --
455   l_proc  varchar2(72) ;
456 --
457 Begin
458   g_debug :=hr_utility.debug_enabled;
459   if g_debug then
460   	l_proc := g_package||'upd';
461   	hr_utility.set_location('Entering:'||l_proc, 5);
462   end if;
463   --
464   -- We must lock the row which we need to update.
465   --
466   hxc_ulc_shd.lck
467     (p_rec.layout_component_id
468     ,p_rec.object_version_number
469     );
470   --
471   -- 1. During an update system defaults are used to determine if
472   --    arguments have been defaulted or not. We must therefore
473   --    derive the full record structure values to be updated.
474   --
475   -- 2. Call the supporting update validate operations.
476   --
477   convert_defs(p_rec);
478   hxc_ulc_bus.update_validate
479      (p_rec
480      );
481   --
482   -- Call the supporting pre-update operation
483   --
484   hxc_ulc_upd.pre_update(p_rec);
485   --
486   -- Update the row.
487   --
488   hxc_ulc_upd.update_dml(p_rec);
489   --
490   -- Call the supporting post-update operation
491   --
492   hxc_ulc_upd.post_update
493      (p_rec
494      );
495 End upd;
496 --
497 -- ----------------------------------------------------------------------------
498 -- |---------------------------------< upd >----------------------------------|
499 -- ----------------------------------------------------------------------------
500 Procedure upd
501   (p_layout_component_id          in     number
502   ,p_object_version_number        in out nocopy number
503   ,p_layout_id                    in     number    default hr_api.g_number
504   ,p_parent_component_id          in     number    default hr_api.g_number
505   ,p_sequence                     in     number    default hr_api.g_number
506   ,p_component_name               in     varchar2  default hr_api.g_varchar2
507   ,p_component_value              in     varchar2  default hr_api.g_varchar2
508   ,p_name_value_string            in     varchar2  default hr_api.g_varchar2
509   ,p_region_code                  in     varchar2  default hr_api.g_varchar2
510   ,p_region_code_app_id           in     number    default hr_api.g_number
511   ,p_attribute_code               in     varchar2  default hr_api.g_varchar2
512   ,p_attribute_code_app_id        in     number    default hr_api.g_number
513   ,p_layout_comp_definition_id    in     number    default hr_api.g_number
514   ,p_component_alias              in     varchar2  default hr_api.g_varchar2
515   ,p_parent_bean                  in     varchar2  default hr_api.g_varchar2
516   ,p_attribute1                   in     varchar2  default hr_api.g_varchar2
517   ,p_attribute2                   in     varchar2  default hr_api.g_varchar2
518   ,p_attribute3                   in     varchar2  default hr_api.g_varchar2
519   ,p_attribute4                   in     varchar2  default hr_api.g_varchar2
520   ,p_attribute5                   in     varchar2  default hr_api.g_varchar2
521   ) is
522 --
523   l_rec	  hxc_ulc_shd.g_rec_type;
524   l_proc  varchar2(72) ;
525 --
526 Begin
527   g_debug :=hr_utility.debug_enabled;
528   if g_debug then
529   	l_proc := g_package||'upd';
530   	hr_utility.set_location('Entering:'||l_proc, 5);
531   end if;
532   --
533   -- Call conversion function to turn arguments into the
534   -- l_rec structure.
535   --
536   l_rec :=
537   hxc_ulc_shd.convert_args
538   (p_layout_component_id
539   ,p_layout_id
540   ,p_parent_component_id
541   ,p_component_name
542   ,p_component_value
543   ,p_sequence
544   ,p_name_value_string
545   ,p_region_code
546   ,p_region_code_app_id
547   ,p_attribute_code
548   ,p_attribute_code_app_id
549   ,p_object_version_number
550   ,p_layout_comp_definition_id
551   ,p_component_alias
552   ,p_parent_bean
553   ,p_attribute1
554   ,p_attribute2
555   ,p_attribute3
556   ,p_attribute4
557   ,p_attribute5
558   );
559   --
560   -- Having converted the arguments into the
561   -- plsql record structure we call the corresponding record
562   -- business process.
563   --
564   hxc_ulc_upd.upd
565      (l_rec
566      );
567   p_object_version_number := l_rec.object_version_number;
568   --
569   if g_debug then
570   	hr_utility.set_location(' Leaving:'||l_proc, 10);
571   end if;
572 End upd;
573 --
574 end hxc_ulc_upd;