DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_HAN_UPD

Source


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