DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_SBF_UPD

Source


1 Package Body pay_sbf_upd as
2 /* $Header: pysbfrhi.pkb 115.9 2003/02/05 17:28:10 arashid ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_sbf_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_sbf_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_balance_feeds Row
64   --
65   update pay_shadow_balance_feeds
66   set
67   scale                             = p_rec.scale,
68   exclusion_rule_id                 = p_rec.exclusion_rule_id,
69   object_version_number             = p_rec.object_version_number
70   where balance_feed_id = p_rec.balance_feed_id;
71   --
72   --
73   hr_utility.set_location(' Leaving:'||l_proc, 10);
74 --
75 Exception
76   When hr_api.check_integrity_violated Then
77     -- A check constraint has been violated
78     pay_sbf_shd.constraint_error
79       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
80   When hr_api.parent_integrity_violated Then
81     -- Parent integrity has been violated
82     pay_sbf_shd.constraint_error
83       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
84   When hr_api.unique_integrity_violated Then
85     -- Unique integrity has been violated
86     pay_sbf_shd.constraint_error
87       (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
88   When Others Then
89     Raise;
90 End update_dml;
91 --
92 -- ----------------------------------------------------------------------------
93 -- |------------------------------< pre_update >------------------------------|
94 -- ----------------------------------------------------------------------------
95 -- {Start Of Comments}
96 --
97 -- Description:
98 --   This private procedure contains any processing which is required before
99 --   the update dml.
100 --
101 -- Prerequisites:
102 --   This is an internal procedure which is called from the upd procedure.
103 --
104 -- In Parameters:
105 --   A Pl/Sql record structre.
106 --
107 -- Post Success:
108 --   Processing continues.
109 --
110 -- Post Failure:
111 --   If an error has occurred, an error message and exception will be raised
112 --   but not handled.
113 --
114 -- Developer Implementation Notes:
115 --   Any pre-processing required before the update dml is issued should be
116 --   coded within this procedure. It is important to note that any 3rd party
117 --   maintenance should be reviewed before placing in this procedure.
118 --
119 -- Access Status:
120 --   Internal Row Handler Use Only.
121 --
122 -- {End Of Comments}
123 -- ----------------------------------------------------------------------------
124 Procedure pre_update(p_rec in pay_sbf_shd.g_rec_type) is
125 --
126   l_proc  varchar2(72) := g_package||'pre_update';
127 --
128 Begin
129   hr_utility.set_location('Entering:'||l_proc, 5);
130   --
131   hr_utility.set_location(' Leaving:'||l_proc, 10);
132 End pre_update;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |-----------------------------< post_update >------------------------------|
136 -- ----------------------------------------------------------------------------
137 -- {Start Of Comments}
138 --
139 -- Description:
140 --   This private procedure contains any processing which is required after the
141 --   update dml.
142 --
143 -- Prerequisites:
144 --   This is an internal procedure which is called from the upd procedure.
145 --
146 -- In Parameters:
147 --   A Pl/Sql record structre.
148 --
149 -- Post Success:
150 --   Processing continues.
151 --
152 -- Post Failure:
153 --   If an error has occurred, an error message and exception will be raised
154 --   but not handled.
155 --
156 -- Developer Implementation Notes:
157 --   Any post-processing required after the update dml is issued should be
158 --   coded within this procedure. It is important to note that any 3rd party
159 --   maintenance should be reviewed before placing in this procedure.
160 --
161 -- Access Status:
162 --   Internal Row Handler Use Only.
163 --
164 -- {End Of Comments}
165 -- ----------------------------------------------------------------------------
166 Procedure post_update(p_rec in pay_sbf_shd.g_rec_type) is
167 --
168   l_proc  varchar2(72) := g_package||'post_update';
169 --
170 Begin
171   hr_utility.set_location('Entering:'||l_proc, 5);
172   --
173   hr_utility.set_location(' Leaving:'||l_proc, 10);
174 End post_update;
175 --
176 -- ----------------------------------------------------------------------------
177 -- |-----------------------------< convert_defs >-----------------------------|
178 -- ----------------------------------------------------------------------------
179 -- {Start Of Comments}
180 --
181 -- Description:
182 --   The Convert_Defs procedure has one very important function:
183 --   It must return the record structure for the row with all system defaulted
184 --   values converted into its corresponding parameter value for update. When
185 --   we attempt to update a row through the Upd process , certain
186 --   parameters can be defaulted which enables flexibility in the calling of
187 --   the upd process (e.g. only attributes which need to be updated need to be
188 --   specified). For the upd process to determine which attributes
189 --   have NOT been specified we need to check if the parameter has a reserved
190 --   system default value. Therefore, for all parameters which have a
191 --   corresponding reserved system default mechanism specified we need to
192 --   check if a system default is being used. If a system default is being
193 --   used then we convert the defaulted value into its corresponding attribute
194 --   value held in the g_old_rec data structure.
195 --
196 -- Prerequisites:
197 --   This private function can only be called from the upd process.
198 --
199 -- In Parameters:
200 --   A Pl/Sql record structre.
201 --
202 -- Post Success:
203 --   The record structure will be returned with all system defaulted parameter
204 --   values converted into its current row attribute value.
205 --
206 -- Post Failure:
207 --   No direct error handling is required within this function. Any possible
208 --   errors within this procedure will be a PL/SQL value error due to conversion
209 
210 --   of datatypes or data lengths.
211 --
212 -- Developer Implementation Notes:
213 --   None.
214 --
215 -- Access Status:
216 --   Internal Row Handler Use Only.
217 --
218 -- {End Of Comments}
219 -- ----------------------------------------------------------------------------
220 Procedure convert_defs(p_rec in out nocopy pay_sbf_shd.g_rec_type) is
221 --
222   l_proc  varchar2(72) := g_package||'convert_defs';
223 --
224 Begin
225   --
226   hr_utility.set_location('Entering:'||l_proc, 5);
227   --
228   -- We must now examine each argument value in the
229   -- p_rec plsql record structure
230   -- to see if a system default is being used. If a system default
231   -- is being used then we must set to the 'current' argument value.
232   --
233   If (p_rec.balance_type_id = hr_api.g_number) then
234     p_rec.balance_type_id :=
235     pay_sbf_shd.g_old_rec.balance_type_id;
236   End If;
237   If (p_rec.input_value_id = hr_api.g_number) then
238     p_rec.input_value_id :=
239     pay_sbf_shd.g_old_rec.input_value_id;
240   End If;
241   If (p_rec.scale = hr_api.g_number) then
242     p_rec.scale :=
243     pay_sbf_shd.g_old_rec.scale;
244   End If;
245   If (p_rec.exclusion_rule_id = hr_api.g_number) then
246     p_rec.exclusion_rule_id :=
247     pay_sbf_shd.g_old_rec.exclusion_rule_id;
248   End If;
249   If (p_rec.balance_name = hr_api.g_varchar2) then
250     p_rec.balance_name :=
251     pay_sbf_shd.g_old_rec.balance_name;
252   End If;
253 
254   --
255   hr_utility.set_location(' Leaving:'||l_proc, 10);
256 --
257 End convert_defs;
258 --
259 -- ----------------------------------------------------------------------------
260 -- |---------------------------------< upd >----------------------------------|
261 -- ----------------------------------------------------------------------------
262 Procedure upd
263   (
264   p_effective_date in date,
265   p_rec        in out nocopy pay_sbf_shd.g_rec_type
266   ) is
267 --
268   l_proc  varchar2(72) := g_package||'upd';
269 --
270 Begin
271   hr_utility.set_location('Entering:'||l_proc, 5);
272   --
273   -- We must lock the row which we need to update.
274   --
275   pay_sbf_shd.lck
276 	(
277 	p_rec.balance_feed_id,
278 	p_rec.object_version_number
279 	);
280   --
281   -- 1. During an update system defaults are used to determine if
282   --    arguments have been defaulted or not. We must therefore
283   --    derive the full record structure values to be updated.
284   --
285   -- 2. Call the supporting update validate operations.
286   --
287   convert_defs(p_rec);
288   pay_sbf_bus.update_validate(p_rec);
289   --
290   -- Call the supporting pre-update operation
291   --
292   pre_update(p_rec);
293   --
294   -- Update the row.
295   --
296   update_dml(p_rec);
297   --
298   -- Call the supporting post-update operation
299   --
300   post_update(p_rec);
301 End upd;
302 --
303 -- ----------------------------------------------------------------------------
304 -- |---------------------------------< upd >----------------------------------|
305 -- ----------------------------------------------------------------------------
306 Procedure upd
307   (
308   p_effective_date in date,
309   p_balance_feed_id              in number,
310   p_scale                        in number           default hr_api.g_number,
311   p_exclusion_rule_id            in number           default hr_api.g_number,
312   p_object_version_number        in out nocopy number
313   ) is
314 --
315   l_rec	  pay_sbf_shd.g_rec_type;
316   l_proc  varchar2(72) := g_package||'upd';
317 --
318 Begin
319   hr_utility.set_location('Entering:'||l_proc, 5);
320   --
321   -- Call conversion function to turn arguments into the
322   -- l_rec structure.
323   --
324   l_rec :=
325   pay_sbf_shd.convert_args
326   (
327   p_balance_feed_id,
328   hr_api.g_number,
329   hr_api.g_number,
330   p_scale,
331   hr_api.g_varchar2,
332   p_exclusion_rule_id,
333   p_object_version_number
334   );
335   --
336   -- Having converted the arguments into the
337   -- plsql record structure we call the corresponding record
338   -- business process.
339   --
340   upd(p_effective_date, l_rec);
341   p_object_version_number := l_rec.object_version_number;
342   --
343   hr_utility.set_location(' Leaving:'||l_proc, 10);
344 End upd;
345 --
346 end pay_sbf_upd;