DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SSB_UPD

Source


1 Package Body per_ssb_upd as
2 /* $Header: pessbrhi.pkb 115.1 2003/08/06 01:25:57 kavenkat noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ssb_upd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------------< update_dml >------------------------------|
12 -- ----------------------------------------------------------------------------
13 -- {Start Of Comments}
14 --
15 -- Description:
16 --   This procedure controls the actual dml update logic. The processing of
17 --   this procedure is:
18 --   1) Increment the object_version_number by 1 if the object_version_number
19 --      is defined as an attribute for this entity.
20 --   2) To set and unset the g_api_dml status as required (as we are about to
21 --      perform dml).
22 --   3) To update the specified row in the schema using the primary key in
23 --      the predicates.
24 --   4) To trap any constraint violations that may have occurred.
25 --   5) To raise any other errors.
26 --
27 -- Prerequisites:
28 --   This is an internal private procedure which must be called from the upd
29 --   procedure.
30 --
31 -- In Parameters:
32 --   A Pl/Sql record structre.
33 --
34 -- Post Success:
35 --   The specified row will be updated in the schema.
36 --
37 -- Post Failure:
38 --   On the update dml failure it is important to note that we always reset the
39 --   g_api_dml status to false.
40 --   If a check, unique or parent integrity constraint violation is raised the
41 --   constraint_error procedure will be called.
42 --   If any other error is reported, the error will be raised after the
43 --   g_api_dml status is reset.
44 --
45 -- Developer Implementation Notes:
46 --   The update 'set' attribute list should be modified if any of your
47 --   attributes are not updateable.
48 --
49 -- Access Status:
50 --   Internal Row Handler Use Only.
51 --
52 -- {End Of Comments}
53 -- ----------------------------------------------------------------------------
54 Procedure update_dml
55   (p_rec in out nocopy per_ssb_shd.g_rec_type
56   ) is
57 --
58   l_proc  varchar2(72) := g_package||'update_dml';
59 --
60 Begin
61   hr_utility.set_location('Entering:'||l_proc, 5);
62   --
63   -- Increment the object version
64   p_rec.object_version_number := p_rec.object_version_number + 1;
65   --
66   --
67   --
68   -- Update the per_ri_setup_sub_tasks Row
69   --
70   update per_ri_setup_sub_tasks
71     set
72      setup_sub_task_code             = p_rec.setup_sub_task_code
73     ,setup_task_code                 = p_rec.setup_task_code
74     ,setup_sub_task_sequence         = p_rec.setup_sub_task_sequence
75     ,setup_sub_task_status           = p_rec.setup_sub_task_status
76     ,setup_sub_task_type             = p_rec.setup_sub_task_type
77     ,setup_sub_task_data_pump_link   = p_rec.setup_sub_task_data_pump_link
78     ,setup_sub_task_action           = p_rec.setup_sub_task_action
79     ,setup_sub_task_creation_date    = p_rec.setup_sub_task_creation_date
80     ,setup_sub_task_last_mod_date    = p_rec.setup_sub_task_last_mod_date
81     ,legislation_code                = p_rec.legislation_code
82     ,object_version_number           = p_rec.object_version_number
83     where setup_sub_task_code = p_rec.setup_sub_task_code;
84   --
85   --
86   --
87   hr_utility.set_location(' Leaving:'||l_proc, 10);
88 --
89 Exception
90   When hr_api.check_integrity_violated Then
91     -- A check constraint has been violated
92     --
93     per_ssb_shd.constraint_error
94       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
95   When hr_api.parent_integrity_violated Then
96     -- Parent integrity has been violated
97     --
98     per_ssb_shd.constraint_error
99       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
100   When hr_api.unique_integrity_violated Then
101     -- Unique integrity has been violated
102     --
103     per_ssb_shd.constraint_error
104       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
105   When Others Then
106     --
107     Raise;
108 End update_dml;
109 --
110 -- ----------------------------------------------------------------------------
111 -- |------------------------------< pre_update >------------------------------|
112 -- ----------------------------------------------------------------------------
113 -- {Start Of Comments}
114 --
115 -- Description:
116 --   This private procedure contains any processing which is required before
117 --   the update dml.
118 --
119 -- Prerequisites:
120 --   This is an internal procedure which is called from the upd procedure.
121 --
122 -- In Parameters:
123 --   A Pl/Sql record structure.
124 --
125 -- Post Success:
126 --   Processing continues.
127 --
128 -- Post Failure:
129 --   If an error has occurred, an error message and exception wil be raised
130 --   but not handled.
131 --
132 -- Developer Implementation Notes:
133 --   Any pre-processing required before the update dml is issued should be
134 --   coded within this procedure. It is important to note that any 3rd party
135 --   maintenance should be reviewed before placing in this procedure.
136 --
137 -- Access Status:
138 --   Internal Row Handler Use Only.
139 --
140 -- {End Of Comments}
141 -- ----------------------------------------------------------------------------
142 Procedure pre_update
143   (p_rec in per_ssb_shd.g_rec_type
144   ) is
145 --
146   l_proc  varchar2(72) := g_package||'pre_update';
147 --
148 Begin
149   hr_utility.set_location('Entering:'||l_proc, 5);
150   --
151   hr_utility.set_location(' Leaving:'||l_proc, 10);
152 End pre_update;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |-----------------------------< post_update >------------------------------|
156 -- ----------------------------------------------------------------------------
157 -- {Start Of Comments}
158 --
159 -- Description:
160 --   This private procedure contains any processing which is required after
161 --   the update dml.
162 --
163 -- Prerequisites:
164 --   This is an internal procedure which is called from the upd procedure.
165 --
166 -- In Parameters:
167 --   A Pl/Sql record structure.
168 --
169 -- Post Success:
170 --   Processing continues.
171 --
172 -- Post Failure:
173 --   If an error has occurred, an error message and exception will be raised
174 --   but not handled.
175 --
176 -- Developer Implementation Notes:
177 --   Any post-processing required after the update dml is issued should be
178 --   coded within this procedure. It is important to note that any 3rd party
179 --   maintenance should be reviewed before placing in this procedure.
180 --
181 -- Access Status:
182 --   Internal Row Handler Use Only.
183 --
184 -- {End Of Comments}
185 -- ----------------------------------------------------------------------------
186 Procedure post_update
187   (p_effective_date               in date
188   ,p_rec                          in per_ssb_shd.g_rec_type
189   ) is
190 --
191   l_proc  varchar2(72) := g_package||'post_update';
192 --
193 Begin
194   hr_utility.set_location('Entering:'||l_proc, 5);
195   begin
196     --
197     per_ssb_rku.after_update
198       (p_effective_date                 => p_effective_date
199       ,p_setup_sub_task_code            => p_rec.setup_sub_task_code
200       ,p_setup_task_code                => p_rec.setup_task_code
201       ,p_setup_sub_task_sequence        => p_rec.setup_sub_task_sequence
202       ,p_setup_sub_task_status          => p_rec.setup_sub_task_status
203       ,p_setup_sub_task_type            => p_rec.setup_sub_task_type
204       ,p_setup_sub_task_data_pump_lin   => p_rec.setup_sub_task_data_pump_link
205       ,p_setup_sub_task_action          => p_rec.setup_sub_task_action
206       ,p_setup_sub_task_creation_date   => p_rec.setup_sub_task_creation_date
207       ,p_setup_sub_task_last_mod_date   => p_rec.setup_sub_task_last_mod_date
208       ,p_legislation_code               => p_rec.legislation_code
209       ,p_object_version_number          => p_rec.object_version_number
210       ,p_setup_task_code_o              => per_ssb_shd.g_old_rec.setup_task_code
211       ,p_setup_sub_task_sequence_o      => per_ssb_shd.g_old_rec.setup_sub_task_sequence
212       ,p_setup_sub_task_status_o        => per_ssb_shd.g_old_rec.setup_sub_task_status
213       ,p_setup_sub_task_type_o          => per_ssb_shd.g_old_rec.setup_sub_task_type
214       ,p_setup_sub_task_data_pump_l_o   => per_ssb_shd.g_old_rec.setup_sub_task_data_pump_link
215       ,p_setup_sub_task_action_o        => per_ssb_shd.g_old_rec.setup_sub_task_action
216       ,p_setup_sub_task_creation_da_o   => per_ssb_shd.g_old_rec.setup_sub_task_creation_date
217       ,p_setup_sub_task_last_mod_da_o   => per_ssb_shd.g_old_rec.setup_sub_task_last_mod_date
218       ,p_legislation_code_o             => per_ssb_shd.g_old_rec.legislation_code
219       ,p_object_version_number_o        => per_ssb_shd.g_old_rec.object_version_number
220       );
221     --
222   exception
223     --
224     when hr_api.cannot_find_prog_unit then
225       --
226       hr_api.cannot_find_prog_unit_error
227         (p_module_name => 'PER_RI_SETUP_SUB_TASKS'
228         ,p_hook_type   => 'AU');
229       --
230   end;
231   --
232   hr_utility.set_location(' Leaving:'||l_proc, 10);
233 End post_update;
234 --
235 -- ----------------------------------------------------------------------------
236 -- |-----------------------------< convert_defs >-----------------------------|
237 -- ----------------------------------------------------------------------------
238 -- {Start Of Comments}
239 --
240 -- Description:
241 --   The Convert_Defs procedure has one very important function:
242 --   It must return the record structure for the row with all system defaulted
243 --   values converted into its corresponding parameter value for update. When
244 --   we attempt to update a row through the Upd process , certain
245 --   parameters can be defaulted which enables flexibility in the calling of
246 --   the upd process (e.g. only attributes which need to be updated need to be
247 --   specified). For the upd process to determine which attributes
248 --   have NOT been specified we need to check if the parameter has a reserved
249 --   system default value. Therefore, for all parameters which have a
250 --   corresponding reserved system default mechanism specified we need to
251 --   check if a system default is being used. If a system default is being
252 --   used then we convert the defaulted value into its corresponding attribute
253 --   value held in the g_old_rec data structure.
254 --
255 -- Prerequisites:
256 --   This private function can only be called from the upd process.
257 --
258 -- In Parameters:
259 --   A Pl/Sql record structure.
260 --
261 -- Post Success:
262 --   The record structure will be returned with all system defaulted parameter
263 --   values converted into its current row attribute value.
264 --
265 -- Post Failure:
266 --   No direct error handling is required within this function. Any possible
267 --   errors within this procedure will be a PL/SQL value error due to
268 --   conversion of datatypes or data lengths.
269 --
270 -- Developer Implementation Notes:
271 --   None.
272 --
273 -- Access Status:
274 --   Internal Row Handler Use Only.
275 --
276 -- {End Of Comments}
277 -- ----------------------------------------------------------------------------
278 Procedure convert_defs
279   (p_rec in out nocopy per_ssb_shd.g_rec_type
280   ) is
281 --
282 Begin
283   --
284   -- We must now examine each argument value in the
285   -- p_rec plsql record structure
286   -- to see if a system default is being used. If a system default
287   -- is being used then we must set to the 'current' argument value.
288   --
289   If (p_rec.setup_task_code = hr_api.g_varchar2) then
290     p_rec.setup_task_code :=
291     per_ssb_shd.g_old_rec.setup_task_code;
292   End If;
293   If (p_rec.setup_sub_task_sequence = hr_api.g_number) then
294     p_rec.setup_sub_task_sequence :=
295     per_ssb_shd.g_old_rec.setup_sub_task_sequence;
296   End If;
297   If (p_rec.setup_sub_task_status = hr_api.g_varchar2) then
298     p_rec.setup_sub_task_status :=
299     per_ssb_shd.g_old_rec.setup_sub_task_status;
300   End If;
301   If (p_rec.setup_sub_task_type = hr_api.g_varchar2) then
302     p_rec.setup_sub_task_type :=
303     per_ssb_shd.g_old_rec.setup_sub_task_type;
304   End If;
305   If (p_rec.setup_sub_task_data_pump_link = hr_api.g_varchar2) then
306     p_rec.setup_sub_task_data_pump_link :=
307     per_ssb_shd.g_old_rec.setup_sub_task_data_pump_link;
308   End If;
309   If (p_rec.setup_sub_task_action = hr_api.g_varchar2) then
310     p_rec.setup_sub_task_action :=
311     per_ssb_shd.g_old_rec.setup_sub_task_action;
312   End If;
313   If (p_rec.setup_sub_task_creation_date = hr_api.g_date) then
314     p_rec.setup_sub_task_creation_date :=
315     per_ssb_shd.g_old_rec.setup_sub_task_creation_date;
316   End If;
317   If (p_rec.setup_sub_task_last_mod_date = hr_api.g_date) then
318     p_rec.setup_sub_task_last_mod_date :=
319     per_ssb_shd.g_old_rec.setup_sub_task_last_mod_date;
320   End If;
321   If (p_rec.legislation_code = hr_api.g_varchar2) then
322     p_rec.legislation_code := per_ssb_shd.g_old_rec.legislation_code;
323   End If;
324 
325   --
326 End convert_defs;
327 --
328 -- ----------------------------------------------------------------------------
329 -- |---------------------------------< upd >----------------------------------|
330 -- ----------------------------------------------------------------------------
331 Procedure upd
332   (p_effective_date               in date
333   ,p_rec                          in out nocopy per_ssb_shd.g_rec_type
334   ) is
335 --
336   l_proc  varchar2(72) := g_package||'upd';
337 --
338 Begin
339   hr_utility.set_location('Entering:'||l_proc, 5);
340   --
341   -- We must lock the row which we need to update.
342   --
343   per_ssb_shd.lck
344     (p_rec.setup_sub_task_code
345     ,p_rec.object_version_number
346     );
347   --
348   -- 1. During an update system defaults are used to determine if
349   --    arguments have been defaulted or not. We must therefore
350   --    derive the full record structure values to be updated.
351   --
352   -- 2. Call the supporting update validate operations.
353   --
354   convert_defs(p_rec);
355   per_ssb_bus.update_validate
356      (p_effective_date
357      ,p_rec
358      );
359   --
360   -- Call to raise any errors on multi-message list
361   hr_multi_message.end_validation_set;
362   --
363   -- Call the supporting pre-update operation
364   --
365   per_ssb_upd.pre_update(p_rec);
366   --
367   -- Update the row.
368   --
369   per_ssb_upd.update_dml(p_rec);
370   --
371   -- Call the supporting post-update operation
372   --
373   per_ssb_upd.post_update
374      (p_effective_date
375      ,p_rec
376      );
377   --
378   -- Call to raise any errors on multi-message list
379   hr_multi_message.end_validation_set;
380 End upd;
381 --
382 -- ----------------------------------------------------------------------------
383 -- |---------------------------------< upd >----------------------------------|
384 -- ----------------------------------------------------------------------------
385 Procedure upd
386   (p_effective_date               in     date
387   ,p_setup_sub_task_code          in     varchar2
388   ,p_object_version_number        in out nocopy number
389   ,p_setup_task_code              in     varchar2  default hr_api.g_varchar2
390   ,p_setup_sub_task_sequence      in     number    default hr_api.g_number
391   ,p_setup_sub_task_data_pump_lin in     varchar2  default hr_api.g_varchar2
392   ,p_setup_sub_task_status        in     varchar2  default hr_api.g_varchar2
393   ,p_setup_sub_task_type          in     varchar2  default hr_api.g_varchar2
394   ,p_setup_sub_task_action        in     varchar2  default hr_api.g_varchar2
395   ,p_setup_sub_task_creation_date in     date      default hr_api.g_date
396   ,p_setup_sub_task_last_mod_date in     date      default hr_api.g_date
397   ,p_legislation_code             in     varchar2  default hr_api.g_varchar2
398   ) is
399 --
400   l_rec   per_ssb_shd.g_rec_type;
401   l_proc  varchar2(72) := g_package||'upd';
402 --
403 Begin
404   hr_utility.set_location('Entering:'||l_proc, 5);
405   --
406   -- Call conversion function to turn arguments into the
407   -- l_rec structure.
408   --
409   l_rec :=
410   per_ssb_shd.convert_args
411   (p_setup_sub_task_code
412   ,p_setup_task_code
413   ,p_setup_sub_task_sequence
414   ,p_setup_sub_task_status
415   ,p_setup_sub_task_type
416   ,p_setup_sub_task_data_pump_lin
417   ,p_setup_sub_task_action
418   ,p_setup_sub_task_creation_date
419   ,p_setup_sub_task_last_mod_date
420   ,p_legislation_code
421   ,p_object_version_number
422   );
423   --
424   -- Having converted the arguments into the
425   -- plsql record structure we call the corresponding record
426   -- business process.
427   --
428   per_ssb_upd.upd
429      (p_effective_date
430      ,l_rec
431      );
432   p_object_version_number := l_rec.object_version_number;
433   --
434   hr_utility.set_location(' Leaving:'||l_proc, 10);
435 End upd;
436 --
437 end per_ssb_upd;