1 Package Body hr_tis_upd as
2 /* $Header: hrtisrhi.pkb 120.3 2008/02/25 13:24:06 avarri ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hr_tis_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 -- 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 hr_tis_shd.g_rec_type
56 ) is
57 --
58 l_proc varchar2(72) := g_package||'update_dml';
59 --
60 Begin
61 hr_utility.set_location('Entering:'||l_proc, 5);
62 --
63 -- Increment the object version
64 p_rec.object_version_number := p_rec.object_version_number + 1;
65 --
66 --
67 --
68 -- Update the hr_ki_topic_integrations Row
69 --
70 update hr_ki_topic_integrations
71 set
72 topic_integrations_id = p_rec.topic_integrations_id
73 ,topic_id = p_rec.topic_id
74 ,integration_id = p_rec.integration_id
75 ,param_name1 = p_rec.param_name1
76 ,param_value1 = p_rec.param_value1
77 ,param_name2 = p_rec.param_name2
78 ,param_value2 = p_rec.param_value2
79 ,param_name3 = p_rec.param_name3
80 ,param_value3 = p_rec.param_value3
81 ,param_name4 = p_rec.param_name4
82 ,param_value4 = p_rec.param_value4
83 ,param_name5 = p_rec.param_name5
84 ,param_value5 = p_rec.param_value5
85 ,param_name6 = p_rec.param_name6
86 ,param_value6 = p_rec.param_value6
87 ,param_name7 = p_rec.param_name7
88 ,param_value7 = p_rec.param_value7
89 ,param_name8 = p_rec.param_name8
90 ,param_value8 = p_rec.param_value8
91 ,param_name9 = p_rec.param_name9
92 ,param_value9 = p_rec.param_value9
93 ,param_name10 = p_rec.param_name10
94 ,param_value10 = p_rec.param_value10
95 ,object_version_number = p_rec.object_version_number
96 where topic_integrations_id = p_rec.topic_integrations_id;
97 --
98 --
99 --
100 hr_utility.set_location(' Leaving:'||l_proc, 10);
101 --
102 Exception
103 When hr_api.check_integrity_violated Then
104 -- A check constraint has been violated
105 --
106 hr_tis_shd.constraint_error
107 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
108 When hr_api.parent_integrity_violated Then
109 -- Parent integrity has been violated
110 --
111 hr_tis_shd.constraint_error
112 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
113 When hr_api.unique_integrity_violated Then
114 -- Unique integrity has been violated
115 --
116 hr_tis_shd.constraint_error
117 (p_constraint_name => hr_api.strip_constraint_name(SQLERRM));
118 When Others Then
119 --
120 Raise;
121 End update_dml;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |------------------------------< pre_update >------------------------------|
125 -- ----------------------------------------------------------------------------
126 -- {Start Of Comments}
127 --
128 -- Description:
129 -- This private procedure contains any processing which is required before
130 -- the update dml.
131 --
132 -- Prerequisites:
133 -- This is an internal procedure which is called from the upd procedure.
134 --
135 -- In Parameters:
136 -- A Pl/Sql record structure.
137 --
138 -- Post Success:
139 -- Processing continues.
140 --
141 -- Post Failure:
142 -- If an error has occurred, an error message and exception wil be raised
143 -- but not handled.
144 --
145 -- Developer Implementation Notes:
146 -- Any pre-processing required before the update dml is issued should be
147 -- coded within this procedure. It is important to note that any 3rd party
148 -- maintenance should be reviewed before placing in this procedure.
149 --
150 -- Access Status:
151 -- Internal Row Handler Use Only.
152 --
153 -- {End Of Comments}
154 -- ----------------------------------------------------------------------------
155 Procedure pre_update
156 (p_rec in hr_tis_shd.g_rec_type
157 ) is
158 --
159 l_proc varchar2(72) := g_package||'pre_update';
160 --
161 Begin
162 hr_utility.set_location('Entering:'||l_proc, 5);
163 --
164 hr_utility.set_location(' Leaving:'||l_proc, 10);
165 End pre_update;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |-----------------------------< post_update >------------------------------|
169 -- ----------------------------------------------------------------------------
170 -- {Start Of Comments}
171 --
172 -- Description:
173 -- This private procedure contains any processing which is required after
174 -- the update dml.
175 --
176 -- Prerequisites:
177 -- This is an internal procedure which is called from the upd procedure.
178 --
179 -- In Parameters:
180 -- A Pl/Sql record structure.
181 --
182 -- Post Success:
183 -- Processing continues.
184 --
185 -- Post Failure:
186 -- If an error has occurred, an error message and exception will be raised
187 -- but not handled.
188 --
189 -- Developer Implementation Notes:
190 -- Any post-processing required after the update dml is issued should be
191 -- coded within this procedure. It is important to note that any 3rd party
192 -- maintenance should be reviewed before placing in this procedure.
193 --
194 -- Access Status:
195 -- Internal Row Handler Use Only.
196 --
197 -- {End Of Comments}
198 -- ----------------------------------------------------------------------------
199 Procedure post_update
200 (p_rec in hr_tis_shd.g_rec_type
201 ) is
202 --
203 l_proc varchar2(72) := g_package||'post_update';
204 --
205 Begin
206 hr_utility.set_location('Entering:'||l_proc, 5);
207 begin
208 --
209 hr_tis_rku.after_update
210 (p_topic_integrations_id => p_rec.topic_integrations_id
211 ,p_topic_id => p_rec.topic_id
212 ,p_integration_id => p_rec.integration_id
213 ,p_param_name1 => p_rec.param_name1
214 ,p_param_value1 => p_rec.param_value1
215 ,p_param_name2 => p_rec.param_name2
216 ,p_param_value2 => p_rec.param_value2
217 ,p_param_name3 => p_rec.param_name3
218 ,p_param_value3 => p_rec.param_value3
219 ,p_param_name4 => p_rec.param_name4
220 ,p_param_value4 => p_rec.param_value4
221 ,p_param_name5 => p_rec.param_name5
222 ,p_param_value5 => p_rec.param_value5
223 ,p_param_name6 => p_rec.param_name6
224 ,p_param_value6 => p_rec.param_value6
225 ,p_param_name7 => p_rec.param_name7
226 ,p_param_value7 => p_rec.param_value7
227 ,p_param_name8 => p_rec.param_name8
228 ,p_param_value8 => p_rec.param_value8
229 ,p_param_name9 => p_rec.param_name9
230 ,p_param_value9 => p_rec.param_value9
231 ,p_param_name10 => p_rec.param_name10
232 ,p_param_value10 => p_rec.param_value10
233 ,p_object_version_number => p_rec.object_version_number
234 ,p_topic_id_o => hr_tis_shd.g_old_rec.topic_id
235 ,p_integration_id_o => hr_tis_shd.g_old_rec.integration_id
236 ,p_param_name1_o => hr_tis_shd.g_old_rec.param_name1
237 ,p_param_value1_o => hr_tis_shd.g_old_rec.param_value1
238 ,p_param_name2_o => hr_tis_shd.g_old_rec.param_name2
239 ,p_param_value2_o => hr_tis_shd.g_old_rec.param_value2
240 ,p_param_name3_o => hr_tis_shd.g_old_rec.param_name3
241 ,p_param_value3_o => hr_tis_shd.g_old_rec.param_value3
242 ,p_param_name4_o => hr_tis_shd.g_old_rec.param_name4
243 ,p_param_value4_o => hr_tis_shd.g_old_rec.param_value4
244 ,p_param_name5_o => hr_tis_shd.g_old_rec.param_name5
245 ,p_param_value5_o => hr_tis_shd.g_old_rec.param_value5
246 ,p_param_name6_o => hr_tis_shd.g_old_rec.param_name6
247 ,p_param_value6_o => hr_tis_shd.g_old_rec.param_value6
248 ,p_param_name7_o => hr_tis_shd.g_old_rec.param_name7
249 ,p_param_value7_o => hr_tis_shd.g_old_rec.param_value7
250 ,p_param_name8_o => hr_tis_shd.g_old_rec.param_name8
251 ,p_param_value8_o => hr_tis_shd.g_old_rec.param_value8
252 ,p_param_name9_o => hr_tis_shd.g_old_rec.param_name9
253 ,p_param_value9_o => hr_tis_shd.g_old_rec.param_value9
254 ,p_param_name10_o => hr_tis_shd.g_old_rec.param_name10
255 ,p_param_value10_o => hr_tis_shd.g_old_rec.param_value10
256 ,p_object_version_number_o => hr_tis_shd.g_old_rec.object_version_number
257 );
258 --
259 exception
260 --
261 when hr_api.cannot_find_prog_unit then
262 --
263 hr_api.cannot_find_prog_unit_error
264 (p_module_name => 'HR_KI_TOPIC_INTEGRATIONS'
265 ,p_hook_type => 'AU');
266 --
267 end;
268 --
269 hr_utility.set_location(' Leaving:'||l_proc, 10);
270 End post_update;
271 --
272 -- ----------------------------------------------------------------------------
273 -- |-----------------------------< convert_defs >-----------------------------|
274 -- ----------------------------------------------------------------------------
275 -- {Start Of Comments}
276 --
277 -- Description:
278 -- The Convert_Defs procedure has one very important function:
279 -- It must return the record structure for the row with all system defaulted
280 -- values converted into its corresponding parameter value for update. When
281 -- we attempt to update a row through the Upd process , certain
282 -- parameters can be defaulted which enables flexibility in the calling of
283 -- the upd process (e.g. only attributes which need to be updated need to be
284 -- specified). For the upd process to determine which attributes
285 -- have NOT been specified we need to check if the parameter has a reserved
286 -- system default value. Therefore, for all parameters which have a
287 -- corresponding reserved system default mechanism specified we need to
288 -- check if a system default is being used. If a system default is being
289 -- used then we convert the defaulted value into its corresponding attribute
290 -- value held in the g_old_rec data structure.
291 --
292 -- Prerequisites:
293 -- This private function can only be called from the upd process.
294 --
295 -- In Parameters:
296 -- A Pl/Sql record structure.
297 --
298 -- Post Success:
299 -- The record structure will be returned with all system defaulted parameter
300 -- values converted into its current row attribute value.
301 --
302 -- Post Failure:
303 -- No direct error handling is required within this function. Any possible
304 -- errors within this procedure will be a PL/SQL value error due to
305 -- conversion of datatypes or data lengths.
306 --
307 -- Developer Implementation Notes:
308 -- None.
309 --
310 -- Access Status:
311 -- Internal Row Handler Use Only.
312 --
313 -- {End Of Comments}
314 -- ----------------------------------------------------------------------------
315 Procedure convert_defs
316 (p_rec in out nocopy hr_tis_shd.g_rec_type
317 ) is
318 --
319 Begin
320 --
321 -- We must now examine each argument value in the
322 -- p_rec plsql record structure
323 -- to see if a system default is being used. If a system default
324 -- is being used then we must set to the 'current' argument value.
325 --
326 If (p_rec.topic_id = hr_api.g_number) then
327 p_rec.topic_id :=
328 hr_tis_shd.g_old_rec.topic_id;
329 End If;
330 If (p_rec.integration_id = hr_api.g_number) then
331 p_rec.integration_id :=
332 hr_tis_shd.g_old_rec.integration_id;
333 End If;
334 If (p_rec.param_name1 = hr_api.g_varchar2) then
335 p_rec.param_name1 := hr_tis_shd.g_old_rec.param_name1;
336 End If;
337 If (p_rec.param_value1 = hr_api.g_varchar2) then
338 p_rec.param_value1 := hr_tis_shd.g_old_rec.param_value1;
339 End If;
340 If (p_rec.param_name2 = hr_api.g_varchar2) then
341 p_rec.param_name2 := hr_tis_shd.g_old_rec.param_name2;
342 End If;
343 If (p_rec.param_value2 = hr_api.g_varchar2) then
344 p_rec.param_value2 := hr_tis_shd.g_old_rec.param_value2;
345 End If;
346 If (p_rec.param_name3 = hr_api.g_varchar2) then
347 p_rec.param_name3 := hr_tis_shd.g_old_rec.param_name3;
348 End If;
349 If (p_rec.param_value3 = hr_api.g_varchar2) then
350 p_rec.param_value3 := hr_tis_shd.g_old_rec.param_value3;
351 End If;
352 If (p_rec.param_name4 = hr_api.g_varchar2) then
353 p_rec.param_name4 := hr_tis_shd.g_old_rec.param_name4;
354 End If;
355 If (p_rec.param_value4 = hr_api.g_varchar2) then
356 p_rec.param_value4 := hr_tis_shd.g_old_rec.param_value4;
357 End If;
358 If (p_rec.param_name5 = hr_api.g_varchar2) then
359 p_rec.param_name5 := hr_tis_shd.g_old_rec.param_name5;
360 End If;
361 If (p_rec.param_value5 = hr_api.g_varchar2) then
362 p_rec.param_value5 := hr_tis_shd.g_old_rec.param_value5;
363 End If;
364 If (p_rec.param_name6 = hr_api.g_varchar2) then
365 p_rec.param_name6 := hr_tis_shd.g_old_rec.param_name6;
366 End If;
367 If (p_rec.param_value6 = hr_api.g_varchar2) then
368 p_rec.param_value6 := hr_tis_shd.g_old_rec.param_value6;
369 End If;
370 If (p_rec.param_name7 = hr_api.g_varchar2) then
371 p_rec.param_name7 := hr_tis_shd.g_old_rec.param_name7;
372 End If;
373 If (p_rec.param_value7 = hr_api.g_varchar2) then
374 p_rec.param_value7 := hr_tis_shd.g_old_rec.param_value7;
375 End If;
376 If (p_rec.param_name8 = hr_api.g_varchar2) then
377 p_rec.param_name8 := hr_tis_shd.g_old_rec.param_name8;
378 End If;
379 If (p_rec.param_value8 = hr_api.g_varchar2) then
380 p_rec.param_value8 := hr_tis_shd.g_old_rec.param_value8;
381 End If;
382 If (p_rec.param_name9 = hr_api.g_varchar2) then
383 p_rec.param_name9 := hr_tis_shd.g_old_rec.param_name9;
384 End If;
385 If (p_rec.param_value9 = hr_api.g_varchar2) then
386 p_rec.param_value9 := hr_tis_shd.g_old_rec.param_value9;
387 End If;
388 If (p_rec.param_name10 = hr_api.g_varchar2) then
389 p_rec.param_name10 := hr_tis_shd.g_old_rec.param_name10;
390 End If;
391 If (p_rec.param_value10 = hr_api.g_varchar2) then
392 p_rec.param_value10 := hr_tis_shd.g_old_rec.param_value10;
393 End If;
394 --
395 End convert_defs;
396 --
397 -- ----------------------------------------------------------------------------
398 -- |---------------------------------< upd >----------------------------------|
399 -- ----------------------------------------------------------------------------
400 Procedure upd
401 (p_rec in out nocopy hr_tis_shd.g_rec_type
402 ) is
403 --
404 l_proc varchar2(72) := g_package||'upd';
405 --
406 Begin
407 hr_utility.set_location('Entering:'||l_proc, 5);
408 --
409 -- We must lock the row which we need to update.
410 --
411 hr_tis_shd.lck
412 (p_rec.topic_integrations_id
413 ,p_rec.object_version_number
414 );
415 --
416 -- 1. During an update system defaults are used to determine if
417 -- arguments have been defaulted or not. We must therefore
418 -- derive the full record structure values to be updated.
419 --
420 -- 2. Call the supporting update validate operations.
421 --
422 convert_defs(p_rec);
423 hr_tis_bus.update_validate
424 (p_rec
425 );
426 --
427 -- Call to raise any errors on multi-message list
428 hr_multi_message.end_validation_set;
429 --
430 -- Call the supporting pre-update operation
431 --
432 hr_tis_upd.pre_update(p_rec);
433 --
434 -- Update the row.
435 --
436 hr_tis_upd.update_dml(p_rec);
437 --
438 -- Call the supporting post-update operation
439 --
440 hr_tis_upd.post_update
441 (p_rec
442 );
443 --
444 -- Call to raise any errors on multi-message list
445 hr_multi_message.end_validation_set;
446 End upd;
447 --
448 -- ----------------------------------------------------------------------------
449 -- |---------------------------------< upd >----------------------------------|
450 -- ----------------------------------------------------------------------------
451 Procedure upd
452 (p_topic_integrations_id in number
453 ,p_topic_id in number default hr_api.g_number
454 ,p_integration_id in number default hr_api.g_number
455 ,p_param_name1 in varchar2 default hr_api.g_varchar2
456 ,p_param_value1 in varchar2 default hr_api.g_varchar2
457 ,p_param_name2 in varchar2 default hr_api.g_varchar2
458 ,p_param_value2 in varchar2 default hr_api.g_varchar2
459 ,p_param_name3 in varchar2 default hr_api.g_varchar2
460 ,p_param_value3 in varchar2 default hr_api.g_varchar2
461 ,p_param_name4 in varchar2 default hr_api.g_varchar2
462 ,p_param_value4 in varchar2 default hr_api.g_varchar2
463 ,p_param_name5 in varchar2 default hr_api.g_varchar2
464 ,p_param_value5 in varchar2 default hr_api.g_varchar2
465 ,p_param_name6 in varchar2 default hr_api.g_varchar2
466 ,p_param_value6 in varchar2 default hr_api.g_varchar2
467 ,p_param_name7 in varchar2 default hr_api.g_varchar2
468 ,p_param_value7 in varchar2 default hr_api.g_varchar2
469 ,p_param_name8 in varchar2 default hr_api.g_varchar2
470 ,p_param_value8 in varchar2 default hr_api.g_varchar2
471 ,p_param_name9 in varchar2 default hr_api.g_varchar2
472 ,p_param_value9 in varchar2 default hr_api.g_varchar2
473 ,p_param_name10 in varchar2 default hr_api.g_varchar2
474 ,p_param_value10 in varchar2 default hr_api.g_varchar2
475 ,p_object_version_number in out nocopy number
476 ) is
477 --
478 l_rec hr_tis_shd.g_rec_type;
479 l_proc varchar2(72) := g_package||'upd';
480 --
481 Begin
482 hr_utility.set_location('Entering:'||l_proc, 5);
483 --
484 -- Call conversion function to turn arguments into the
485 -- l_rec structure.
486 --
487 l_rec :=
488 hr_tis_shd.convert_args
489 (p_topic_integrations_id
490 ,p_topic_id
491 ,p_integration_id
492 ,p_param_name1
493 ,p_param_value1
494 ,p_param_name2
495 ,p_param_value2
496 ,p_param_name3
497 ,p_param_value3
498 ,p_param_name4
499 ,p_param_value4
500 ,p_param_name5
501 ,p_param_value5
502 ,p_param_name6
503 ,p_param_value6
504 ,p_param_name7
505 ,p_param_value7
506 ,p_param_name8
507 ,p_param_value8
508 ,p_param_name9
509 ,p_param_value9
510 ,p_param_name10
511 ,p_param_value10
512 ,p_object_version_number
513 );
514 --
515 -- Having converted the arguments into the
516 -- plsql record structure we call the corresponding record
517 -- business process.
518 --
519 hr_tis_upd.upd
520 (l_rec
521 );
522 p_object_version_number := l_rec.object_version_number;
523 --
524 hr_utility.set_location(' Leaving:'||l_proc, 10);
525 End upd;
526 --
527 end hr_tis_upd;