DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ULA_UPD

Source


1 Package Body hxc_ula_upd as
2 /* $Header: hxcularhi.pkb 120.3 2005/09/23 05:57:47 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_ula_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_ula_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_layouts Row
74   --
75   update hxc_layouts
76     set
77      layout_id                       = p_rec.layout_id
78     ,layout_name                     = p_rec.layout_name
79     ,application_id                  = p_rec.application_id
80     ,layout_type                     = p_rec.layout_type
81     ,modifier_level                  = p_rec.modifier_level
82     ,modifier_value                  = p_rec.modifier_value
83     ,top_level_region_code           = p_rec.top_level_region_code
84     ,object_version_number           = p_rec.object_version_number
85         ,last_updated_by		     = fnd_global.user_id
86     ,last_update_date		     = sysdate
87     ,last_update_login	             = fnd_global.login_id
88 
89     where layout_id = p_rec.layout_id;
90   --
91   --
92   --
93   if g_debug then
94   	hr_utility.set_location(' Leaving:'||l_proc, 10);
95   end if;
96 --
97 Exception
98   When hr_api.check_integrity_violated Then
99     -- A check constraint has been violated
100     --
101     hxc_ula_shd.constraint_error
102       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
103   When hr_api.parent_integrity_violated Then
104     -- Parent integrity has been violated
105     --
106     hxc_ula_shd.constraint_error
107       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
108   When hr_api.unique_integrity_violated Then
109     -- Unique integrity has been violated
110     --
111     hxc_ula_shd.constraint_error
112       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
113   When Others Then
114     --
115     Raise;
116 End update_dml;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |------------------------------< pre_update >------------------------------|
120 -- ----------------------------------------------------------------------------
121 -- {Start Of Comments}
122 --
123 -- Description:
124 --   This private procedure contains any processing which is required before
125 --   the update dml.
126 --
127 -- Prerequisites:
128 --   This is an internal procedure which is called from the upd procedure.
129 --
130 -- In Parameters:
131 --   A Pl/Sql record structure.
132 --
133 -- Post Success:
134 --   Processing continues.
135 --
136 -- Post Failure:
137 --   If an error has occurred, an error message and exception wil be raised
138 --   but not handled.
139 --
140 -- Developer Implementation Notes:
141 --   Any pre-processing required before the update dml is issued should be
142 --   coded within this procedure. It is important to note that any 3rd party
143 --   maintenance should be reviewed before placing in this procedure.
144 --
145 -- Access Status:
146 --   Internal Row Handler Use Only.
147 --
148 -- {End Of Comments}
149 -- ----------------------------------------------------------------------------
150 Procedure pre_update
151   (p_rec in hxc_ula_shd.g_rec_type
152   ) is
153 --
154   l_proc  varchar2(72) ;
155 --
156 Begin
157 
158   if g_debug then
159   	l_proc := g_package||'pre_update';
160   	hr_utility.set_location('Entering:'||l_proc, 5);
161         hr_utility.set_location(' Leaving:'||l_proc, 10);
162   end if;
163 End pre_update;
164 --
165 -- ----------------------------------------------------------------------------
166 -- |-----------------------------< post_update >------------------------------|
167 -- ----------------------------------------------------------------------------
168 -- {Start Of Comments}
169 --
170 -- Description:
171 --   This private procedure contains any processing which is required after the
172 --   update dml.
173 --
174 -- Prerequisites:
175 --   This is an internal procedure which is called from the upd procedure.
176 --
177 -- In Parameters:
178 --   A Pl/Sql record structure.
179 --
180 -- Post Success:
181 --   Processing continues.
182 --
183 -- Post Failure:
184 --   If an error has occurred, an error message and exception will be raised
185 --   but not handled.
186 --
187 -- Developer Implementation Notes:
188 --   Any post-processing required after the update dml is issued should be
189 --   coded within this procedure. It is important to note that any 3rd party
190 --   maintenance should be reviewed before placing in this procedure.
191 --
192 -- Access Status:
193 --   Internal Row Handler Use Only.
194 --
195 -- {End Of Comments}
196 -- ----------------------------------------------------------------------------
197 Procedure post_update
198   (p_rec                          in hxc_ula_shd.g_rec_type
199   ) is
200 --
201   l_proc  varchar2(72) ;
202 --
203 Begin
204 
205   if g_debug then
206   	l_proc := g_package||'post_update';
207   	hr_utility.set_location('Entering:'||l_proc, 5);
208   end if;
209   begin
210     --
211     hxc_ula_rku.after_update
212       (p_layout_id
213       => p_rec.layout_id
214       ,p_layout_name
215       => p_rec.layout_name
216       ,p_application_id
217       => p_rec.application_id
218       ,p_layout_type
219       => p_rec.layout_type
220       ,p_modifier_level
221       => p_rec.modifier_level
222       ,p_modifier_value
223       => p_rec.modifier_value
224       ,p_top_level_region_code
225       => p_rec.top_level_region_code
226       ,p_object_version_number
227       => p_rec.object_version_number
228       ,p_layout_name_o
229       => hxc_ula_shd.g_old_rec.layout_name
230       ,p_application_id_o
231       => hxc_ula_shd.g_old_rec.application_id
232       ,p_layout_type_o
233       => hxc_ula_shd.g_old_rec.layout_type
234       ,p_modifier_level_o
235       => hxc_ula_shd.g_old_rec.modifier_level
236       ,p_modifier_value_o
237       => hxc_ula_shd.g_old_rec.modifier_value
238       ,p_top_level_region_code_o
239       => hxc_ula_shd.g_old_rec.top_level_region_code
240       ,p_object_version_number_o
241       => hxc_ula_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 => 'HXC_LAYOUTS'
250         ,p_hook_type   => 'AU');
251       --
252   end;
253   --
254   if g_debug then
255   	hr_utility.set_location(' Leaving:'||l_proc, 10);
256   end if;
257 End post_update;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |-----------------------------< convert_defs >-----------------------------|
261 -- ----------------------------------------------------------------------------
262 -- {Start Of Comments}
263 --
264 -- Description:
265 --   The Convert_Defs procedure has one very important function:
266 --   It must return the record structure for the row with all system defaulted
267 --   values converted into its corresponding parameter value for update. When
268 --   we attempt to update a row through the Upd process , certain
269 --   parameters can be defaulted which enables flexibility in the calling of
270 --   the upd process (e.g. only attributes which need to be updated need to be
271 --   specified). For the upd process to determine which attributes
272 --   have NOT been specified we need to check if the parameter has a reserved
273 --   system default value. Therefore, for all parameters which have a
274 --   corresponding reserved system default mechanism specified we need to
275 --   check if a system default is being used. If a system default is being
276 --   used then we convert the defaulted value into its corresponding attribute
277 --   value held in the g_old_rec data structure.
278 --
279 -- Prerequisites:
280 --   This private function can only be called from the upd process.
281 --
282 -- In Parameters:
283 --   A Pl/Sql record structure.
284 --
285 -- Post Success:
286 --   The record structure will be returned with all system defaulted parameter
287 --   values converted into its current row attribute value.
288 --
289 -- Post Failure:
290 --   No direct error handling is required within this function. Any possible
291 --   errors within this procedure will be a PL/SQL value error due to
292 --   conversion of datatypes or data lengths.
293 --
294 -- Developer Implementation Notes:
295 --   None.
296 --
297 -- Access Status:
298 --   Internal Row Handler Use Only.
299 --
300 -- {End Of Comments}
301 -- ----------------------------------------------------------------------------
302 Procedure convert_defs
303   (p_rec in out nocopy hxc_ula_shd.g_rec_type
304   ) is
305 --
306 Begin
307   --
308   -- We must now examine each argument value in the
309   -- p_rec plsql record structure
310   -- to see if a system default is being used. If a system default
311   -- is being used then we must set to the 'current' argument value.
312   --
313   If (p_rec.layout_name = hr_api.g_varchar2) then
314     p_rec.layout_name :=
315     hxc_ula_shd.g_old_rec.layout_name;
316   End If;
317   If (p_rec.application_id = hr_api.g_number) then
318     p_rec.application_id :=
319     hxc_ula_shd.g_old_rec.application_id;
320   End If;
321   If (p_rec.layout_type = hr_api.g_varchar2) then
322     p_rec.layout_type :=
323     hxc_ula_shd.g_old_rec.layout_type;
324   End If;
325   If (p_rec.modifier_level = hr_api.g_varchar2) then
326     p_rec.modifier_level :=
327     hxc_ula_shd.g_old_rec.modifier_level;
328   End If;
329   If (p_rec.modifier_value = hr_api.g_varchar2) then
330     p_rec.modifier_value :=
331     hxc_ula_shd.g_old_rec.modifier_value;
332   End If;
333   If (p_rec.top_level_region_code = hr_api.g_varchar2) then
334     p_rec.top_level_region_code :=
335     hxc_ula_shd.g_old_rec.top_level_region_code;
336   End If;
337   --
338 End convert_defs;
339 --
340 -- ----------------------------------------------------------------------------
341 -- |---------------------------------< upd >----------------------------------|
342 -- ----------------------------------------------------------------------------
343 Procedure upd
344   (p_rec                          in out nocopy hxc_ula_shd.g_rec_type
345   ) is
346 --
347   l_proc  varchar2(72) ;
348 --
349 Begin
350   g_debug :=hr_utility.debug_enabled;
351   if g_debug then
352   	l_proc := g_package||'upd';
353   	hr_utility.set_location('Entering:'||l_proc, 5);
354   end if;
355   --
356   -- We must lock the row which we need to update.
357   --
358   hxc_ula_shd.lck
359     (p_rec.layout_id
360     ,p_rec.object_version_number
361     );
362   --
363   -- 1. During an update system defaults are used to determine if
364   --    arguments have been defaulted or not. We must therefore
365   --    derive the full record structure values to be updated.
366   --
367   -- 2. Call the supporting update validate operations.
368   --
369   convert_defs(p_rec);
370   hxc_ula_bus.update_validate
371      (p_rec
372      );
373   --
374   -- Call the supporting pre-update operation
375   --
376   hxc_ula_upd.pre_update(p_rec);
377   --
378   -- Update the row.
379   --
380   hxc_ula_upd.update_dml(p_rec);
381   --
382   -- Call the supporting post-update operation
383   --
384   hxc_ula_upd.post_update
385      (p_rec
386      );
387 End upd;
388 --
389 -- ----------------------------------------------------------------------------
390 -- |---------------------------------< upd >----------------------------------|
391 -- ----------------------------------------------------------------------------
392 Procedure upd
393   (p_layout_id                    in     number
394   ,p_object_version_number        in out nocopy number
395   ,p_layout_name                  in     varchar2  default hr_api.g_varchar2
396   ,p_application_id               in     number    default hr_api.g_number
397   ,p_layout_type                  in     varchar2  default hr_api.g_varchar2
398   ,p_modifier_level               in     varchar2  default hr_api.g_varchar2
399   ,p_modifier_value               in     varchar2  default hr_api.g_varchar2
400   ,p_top_level_region_code        in     varchar2  default hr_api.g_varchar2
401   ) is
402 --
403   l_rec	  hxc_ula_shd.g_rec_type;
404   l_proc  varchar2(72) ;
405 --
406 Begin
407   g_debug :=hr_utility.debug_enabled;
408   if g_debug then
409   	l_proc := g_package||'upd';
410   	hr_utility.set_location('Entering:'||l_proc, 5);
411   end if;
412   --
413   -- Call conversion function to turn arguments into the
414   -- l_rec structure.
415   --
416   l_rec :=
417   hxc_ula_shd.convert_args
418   (p_layout_id
419   ,p_layout_name
420   ,p_application_id
421   ,p_layout_type
422   ,p_modifier_level
423   ,p_modifier_value
424   ,p_top_level_region_code
425   ,p_object_version_number
426   );
427   --
428   -- Having converted the arguments into the
429   -- plsql record structure we call the corresponding record
430   -- business process.
431   --
432   hxc_ula_upd.upd
433      (l_rec
434      );
435   p_object_version_number := l_rec.object_version_number;
436   --
437   if g_debug then
438   	hr_utility.set_location(' Leaving:'||l_proc, 10);
439   end if;
440 End upd;
441 --
442 end hxc_ula_upd;