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