DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SIV_UPD

Source


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