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