DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ULD_UPD

Source


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