DBA Data[Home] [Help]
Skip to content

PACKAGE BODY: APPS.PAY_AMP_UPD

Source


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