[Home] [Help]
PACKAGE BODY: APPS.HR_ASSESSMENTS_API
Source
1 Package Body hr_assessments_api as
2 /* $Header: peasnapi.pkb 115.8 2003/02/11 10:05:34 raranjan ship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' hr_assessments_api.';
7 --
8 -- ---------------------------------------------------------------------------
9 -- |---------------------< <create_assessment> >-----------------------|
10 -- ---------------------------------------------------------------------------
11 --
12 procedure create_assessment
13 (
14 p_assessment_id out nocopy number,
15 p_assessment_type_id in number,
16 p_business_group_id in number,
17 p_person_id in number,
18 p_assessment_group_id in number default null,
19 p_assessment_period_start_date in date default null,
20 p_assessment_period_end_date in date default null,
21 p_assessment_date in date,
22 p_assessor_person_id in number,
23 p_appraisal_id in number default null,
24 p_group_date in date default null,
25 p_group_initiator_id in number default null,
26 p_comments in varchar2 default null,
27 p_total_score in number default null,
28 p_status in varchar2 default null,
29 p_attribute_category in varchar2 default null,
30 p_attribute1 in varchar2 default null,
31 p_attribute2 in varchar2 default null,
32 p_attribute3 in varchar2 default null,
33 p_attribute4 in varchar2 default null,
34 p_attribute5 in varchar2 default null,
35 p_attribute6 in varchar2 default null,
36 p_attribute7 in varchar2 default null,
37 p_attribute8 in varchar2 default null,
38 p_attribute9 in varchar2 default null,
39 p_attribute10 in varchar2 default null,
40 p_attribute11 in varchar2 default null,
41 p_attribute12 in varchar2 default null,
42 p_attribute13 in varchar2 default null,
43 p_attribute14 in varchar2 default null,
44 p_attribute15 in varchar2 default null,
45 p_attribute16 in varchar2 default null,
46 p_attribute17 in varchar2 default null,
47 p_attribute18 in varchar2 default null,
48 p_attribute19 in varchar2 default null,
49 p_attribute20 in varchar2 default null,
50 p_object_version_number out nocopy number,
51 p_validate in boolean default false,
52 p_effective_date in date
53 ) is
54 --
55 -- Declare cursors and local variables
56 --
57 --
58 l_proc varchar2(72) := g_package||'create_assessment';
59 l_assessment_id per_assessments.assessment_id%TYPE;
60 l_object_version_number per_assessments.object_version_number%TYPE;
61 --
62 begin
63 hr_utility.set_location('Entering:'|| l_proc, 5);
64 --
65 -- Issue a savepoint.
66 --
67 savepoint create_assess;
68 hr_utility.set_location(l_proc, 6);
69 --
70 -- Call Before Process User Hook
71 --
72 begin
73 hr_assessments_bk1.create_assessment_b (
74 p_assessment_type_id => p_assessment_type_id
75 ,p_business_group_id => p_business_group_id
76 ,p_person_id => p_person_id
77 ,p_assessment_group_id => p_assessment_group_id
78 ,p_assessment_period_start_date => p_assessment_period_start_date
79 ,p_assessment_period_end_date => p_assessment_period_end_date
80 ,p_assessment_date => p_assessment_date
81 ,p_assessor_person_id => p_assessor_person_id
82 ,p_appraisal_id => p_appraisal_id
83 ,p_group_date => p_group_date
84 ,p_group_initiator_id => p_group_initiator_id
85 ,p_comments => p_comments
86 ,p_total_score => p_total_score
87 ,p_status => p_status
88 ,p_attribute_category => p_attribute_category
89 ,p_attribute1 => p_attribute1
90 ,p_attribute2 => p_attribute2
91 ,p_attribute3 => p_attribute3
92 ,p_attribute4 => p_attribute4
93 ,p_attribute5 => p_attribute5
94 ,p_attribute6 => p_attribute6
95 ,p_attribute7 => p_attribute7
96 ,p_attribute8 => p_attribute8
97 ,p_attribute9 => p_attribute9
98 ,p_attribute10 => p_attribute10
99 ,p_attribute11 => p_attribute11
100 ,p_attribute12 => p_attribute12
101 ,p_attribute13 => p_attribute13
102 ,p_attribute14 => p_attribute14
103 ,p_attribute15 => p_attribute14
104 ,p_attribute16 => p_attribute16
105 ,p_attribute17 => p_attribute17
106 ,p_attribute18 => p_attribute18
107 ,p_attribute19 => p_attribute19
108 ,p_attribute20 => p_attribute20
109 ,p_effective_date => p_effective_date );
110 exception
111 when hr_api.cannot_find_prog_unit then
112 hr_api.cannot_find_prog_unit_error
113 (p_module_name => 'create_assessment',
114 p_hook_type => 'BP'
115 );
116 end;
117 --
118 -- End of Before Process User Hook call
119 --
120 -- Validation in addition to Table Handlers
121 --
122 hr_utility.set_location(l_proc, 7);
123 --
124 -- Process Logic
125 --
126 per_asn_ins.ins (
127 p_assessment_id => l_assessment_id
128 ,p_assessment_type_id => p_assessment_type_id
129 ,p_business_group_id => p_business_group_id
130 ,p_person_id => p_person_id
131 ,p_assessment_group_id => p_assessment_group_id
132 ,p_assessment_period_start_date => p_assessment_period_start_date
133 ,p_assessment_period_end_date => p_assessment_period_end_date
134 ,p_assessment_date => p_assessment_date
135 ,p_assessor_person_id => p_assessor_person_id
136 ,p_appraisal_id => p_appraisal_id
137 ,p_group_date => p_group_date
138 ,p_group_initiator_id => p_group_initiator_id
139 ,p_comments => p_comments
140 ,p_total_score => p_total_score
141 ,p_status => p_status
142 ,p_attribute_category => p_attribute_category
143 ,p_attribute1 => p_attribute1
144 ,p_attribute2 => p_attribute2
145 ,p_attribute3 => p_attribute3
146 ,p_attribute4 => p_attribute4
147 ,p_attribute5 => p_attribute5
148 ,p_attribute6 => p_attribute6
149 ,p_attribute7 => p_attribute7
150 ,p_attribute8 => p_attribute8
151 ,p_attribute9 => p_attribute9
152 ,p_attribute10 => p_attribute10
153 ,p_attribute11 => p_attribute11
154 ,p_attribute12 => p_attribute12
155 ,p_attribute13 => p_attribute13
156 ,p_attribute14 => p_attribute14
157 ,p_attribute15 => p_attribute14
158 ,p_attribute16 => p_attribute16
159 ,p_attribute17 => p_attribute17
160 ,p_attribute18 => p_attribute18
161 ,p_attribute19 => p_attribute19
162 ,p_attribute20 => p_attribute20
163 ,p_object_version_number => l_object_version_number
164 ,p_validate => p_validate
165 ,p_effective_date => p_effective_date
166 );
167 --
168 hr_utility.set_location(l_proc, 8);
169 --
170 -- Call After Process User Hook
171 --
172 begin
173 hr_assessments_bk1.create_assessment_a (
174 p_assessment_id => l_assessment_id
175 ,p_object_version_number => l_object_version_number
176 ,p_assessment_type_id => p_assessment_type_id
177 ,p_business_group_id => p_business_group_id
178 ,p_person_id => p_person_id
179 ,p_assessment_group_id => p_assessment_group_id
180 ,p_assessment_period_start_date => p_assessment_period_start_date
181 ,p_assessment_period_end_date => p_assessment_period_end_date
182 ,p_assessment_date => p_assessment_date
183 ,p_assessor_person_id => p_assessor_person_id
184 ,p_appraisal_id => p_appraisal_id
185 ,p_group_date => p_group_date
186 ,p_group_initiator_id => p_group_initiator_id
187 ,p_comments => p_comments
188 ,p_total_score => p_total_score
189 ,p_status => p_status
190 ,p_attribute_category => p_attribute_category
191 ,p_attribute1 => p_attribute1
192 ,p_attribute2 => p_attribute2
193 ,p_attribute3 => p_attribute3
194 ,p_attribute4 => p_attribute4
195 ,p_attribute5 => p_attribute5
196 ,p_attribute6 => p_attribute6
197 ,p_attribute7 => p_attribute7
198 ,p_attribute8 => p_attribute8
199 ,p_attribute9 => p_attribute9
200 ,p_attribute10 => p_attribute10
201 ,p_attribute11 => p_attribute11
202 ,p_attribute12 => p_attribute12
203 ,p_attribute13 => p_attribute13
204 ,p_attribute14 => p_attribute14
205 ,p_attribute15 => p_attribute14
206 ,p_attribute16 => p_attribute16
207 ,p_attribute17 => p_attribute17
208 ,p_attribute18 => p_attribute18
209 ,p_attribute19 => p_attribute19
210 ,p_attribute20 => p_attribute20
211 ,p_effective_date => p_effective_date );
212 exception
213 when hr_api.cannot_find_prog_unit then
214 hr_api.cannot_find_prog_unit_error
215 (p_module_name => 'create_assessment',
216 p_hook_type => 'AP'
217 );
218 end;
219 --
220 -- End of After process user hook
221 --
222 -- When in validation only mode raise the Validate_Enabled exception
223 --
224 if p_validate then
225 raise hr_api.validate_enabled;
226 end if;
227 --
228 -- Set all output arguments
229 --
230 p_assessment_id := l_assessment_id;
231 p_object_version_number := l_object_version_number;
232 --
233 hr_utility.set_location(' Leaving:'||l_proc, 11);
234 exception
235 when hr_api.validate_enabled then
236 --
237 -- As the Validate_Enabled exception has been raised
238 -- we must rollback to the savepoint
239 --
240 ROLLBACK TO create_assess;
241 --
242 -- Only set output warning arguments
243 -- (Any key or derived arguments must be set to null
244 -- when validation only mode is being used.)
245 --
246 p_assessment_id := null;
247 p_object_version_number := null;
248 --
249 when others then
250 --
251 -- A validation or unexpected error has occurred
252 --
253 -- Added as part of fix to bug 632482
254 --
255 ROLLBACK TO create_assess;
256 raise;
257 --
258 -- End of fix.
259 --
260 hr_utility.set_location(' Leaving:'||l_proc, 12);
261 end create_assessment;
262 --
263 --
264 -- ---------------------------------------------------------------------------
265 -- |---------------------< <update_assessment> >------------------------|
266 -- ---------------------------------------------------------------------------
267 --
268 procedure update_assessment
269 (
270 p_assessment_id in number,
271 p_assessment_type_id in number default hr_api.g_number,
272 p_assessment_group_id in number default hr_api.g_number,
273 p_assessment_period_start_date in date default hr_api.g_date,
274 p_assessment_period_end_date in date default hr_api.g_date,
275 p_assessment_date in date default hr_api.g_date,
276 p_comments in varchar2 default hr_api.g_varchar2,
277 p_total_score in number default hr_api.g_number,
278 p_status in varchar2 default hr_api.g_varchar2,
279 --
280 p_attribute_category in varchar2 default hr_api.g_varchar2,
281 p_attribute1 in varchar2 default hr_api.g_varchar2,
282 p_attribute2 in varchar2 default hr_api.g_varchar2,
283 p_attribute3 in varchar2 default hr_api.g_varchar2,
284 p_attribute4 in varchar2 default hr_api.g_varchar2,
285 p_attribute5 in varchar2 default hr_api.g_varchar2,
286 p_attribute6 in varchar2 default hr_api.g_varchar2,
287 p_attribute7 in varchar2 default hr_api.g_varchar2,
288 p_attribute8 in varchar2 default hr_api.g_varchar2,
289 p_attribute9 in varchar2 default hr_api.g_varchar2,
290 p_attribute10 in varchar2 default hr_api.g_varchar2,
291 p_attribute11 in varchar2 default hr_api.g_varchar2,
292 p_attribute12 in varchar2 default hr_api.g_varchar2,
293 p_attribute13 in varchar2 default hr_api.g_varchar2,
294 p_attribute14 in varchar2 default hr_api.g_varchar2,
295 p_attribute15 in varchar2 default hr_api.g_varchar2,
296 p_attribute16 in varchar2 default hr_api.g_varchar2,
297 p_attribute17 in varchar2 default hr_api.g_varchar2,
298 p_attribute18 in varchar2 default hr_api.g_varchar2,
299 p_attribute19 in varchar2 default hr_api.g_varchar2,
300 p_attribute20 in varchar2 default hr_api.g_varchar2,
301 p_object_version_number in out nocopy number,
302 p_validate in boolean default false,
303 p_effective_date in date
304 ) is
305 --
306 -- Declare cursors and local variables
307 --
308 l_proc varchar2(72) := g_package||'update_assessment';
309 l_object_version_number per_assessments.object_version_number%TYPE;
310 --
311 lv_object_version_number per_assessments.object_version_number%TYPE := p_object_version_number ;
312 --
313 begin
314 hr_utility.set_location('Entering:'|| l_proc, 5);
315 --
316 -- Issue a savepoint.
317 --
318 savepoint update_assess;
319 hr_utility.set_location(l_proc, 6);
320 --
321 -- Call Before Process User Hook
322 --
323 begin
324 hr_assessments_bk2.update_assessment_b (
325 p_assessment_id => p_assessment_id,
326 p_assessment_type_id => p_assessment_type_id,
327 p_assessment_group_id => p_assessment_group_id,
328 p_assessment_period_start_date => p_assessment_period_start_date,
329 p_assessment_period_end_date => p_assessment_period_end_date,
330 p_assessment_date => p_assessment_date,
331 p_comments => p_comments,
332 p_total_score => p_total_score,
333 p_status => p_status,
334 p_attribute_category => p_attribute_category,
335 p_attribute1 => p_attribute1,
336 p_attribute2 => p_attribute2,
337 p_attribute3 => p_attribute3,
338 p_attribute4 => p_attribute4,
339 p_attribute5 => p_attribute5,
340 p_attribute6 => p_attribute6,
341 p_attribute7 => p_attribute7,
342 p_attribute8 => p_attribute8,
343 p_attribute9 => p_attribute9,
344 p_attribute10 => p_attribute10,
345 p_attribute11 => p_attribute11,
346 p_attribute12 => p_attribute12,
347 p_attribute13 => p_attribute13,
348 p_attribute14 => p_attribute14,
349 p_attribute15 => p_attribute15,
350 p_attribute16 => p_attribute16,
351 p_attribute17 => p_attribute17,
352 p_attribute18 => p_attribute18,
353 p_attribute19 => p_attribute19,
354 p_attribute20 => p_attribute20,
355 p_object_version_number => p_object_version_number,
356 p_effective_date => p_effective_date
357 );
358 exception
359 when hr_api.cannot_find_prog_unit then
360 hr_api.cannot_find_prog_unit_error
361 (p_module_name => 'update_assessment',
362 p_hook_type => 'BP'
363 );
364 end;
365 --
366 -- End of Before Process User Hook call
367 --
368 -- Validation in addition to Table Handlers
369 --
370 hr_utility.set_location(l_proc, 7);
371 --
372 -- Process Logic
373 --
374 l_object_version_number := p_object_version_number;
375 --
376 per_asn_upd.upd
377 (
378 p_assessment_id => p_assessment_id,
379 p_assessment_type_id => p_assessment_type_id,
380 p_assessment_group_id => p_assessment_group_id,
381 p_assessment_period_start_date => p_assessment_period_start_date,
382 p_assessment_period_end_date => p_assessment_period_end_date,
383 p_assessment_date => p_assessment_date,
384 p_comments => p_comments,
385 p_total_score => p_total_score,
386 p_status => p_status,
387 p_attribute_category => p_attribute_category,
388 p_attribute1 => p_attribute1,
389 p_attribute2 => p_attribute2,
390 p_attribute3 => p_attribute3,
391 p_attribute4 => p_attribute4,
392 p_attribute5 => p_attribute5,
393 p_attribute6 => p_attribute6,
394 p_attribute7 => p_attribute7,
395 p_attribute8 => p_attribute8,
396 p_attribute9 => p_attribute9,
397 p_attribute10 => p_attribute10,
398 p_attribute11 => p_attribute11,
399 p_attribute12 => p_attribute12,
400 p_attribute13 => p_attribute13,
401 p_attribute14 => p_attribute14,
402 p_attribute15 => p_attribute15,
403 p_attribute16 => p_attribute16,
404 p_attribute17 => p_attribute17,
405 p_attribute18 => p_attribute18,
406 p_attribute19 => p_attribute19,
407 p_attribute20 => p_attribute20,
408 p_object_version_number => l_object_version_number,
409 p_validate => p_validate,
410 p_effective_date => p_effective_date
411 );
412 --
413 --
414 hr_utility.set_location(l_proc, 8);
415 --
416 -- Call After Process User Hook
417 --
418 begin
419 hr_assessments_bk2.update_assessment_a (
420 p_assessment_id => p_assessment_id,
421 p_assessment_type_id => p_assessment_type_id,
422 p_assessment_group_id => p_assessment_group_id,
423 p_assessment_period_start_date => p_assessment_period_start_date,
424 p_assessment_period_end_date => p_assessment_period_end_date,
425 p_assessment_date => p_assessment_date,
426 p_comments => p_comments,
427 p_total_score => p_total_score,
428 p_status => p_status,
429 p_attribute_category => p_attribute_category,
430 p_attribute1 => p_attribute1,
431 p_attribute2 => p_attribute2,
432 p_attribute3 => p_attribute3,
433 p_attribute4 => p_attribute4,
434 p_attribute5 => p_attribute5,
435 p_attribute6 => p_attribute6,
436 p_attribute7 => p_attribute7,
437 p_attribute8 => p_attribute8,
438 p_attribute9 => p_attribute9,
439 p_attribute10 => p_attribute10,
440 p_attribute11 => p_attribute11,
441 p_attribute12 => p_attribute12,
442 p_attribute13 => p_attribute13,
443 p_attribute14 => p_attribute14,
444 p_attribute15 => p_attribute15,
445 p_attribute16 => p_attribute16,
446 p_attribute17 => p_attribute17,
447 p_attribute18 => p_attribute18,
448 p_attribute19 => p_attribute19,
449 p_attribute20 => p_attribute20,
450 p_object_version_number => l_object_version_number,
451 p_effective_date => p_effective_date
452 );
453 exception
454 when hr_api.cannot_find_prog_unit then
455 hr_api.cannot_find_prog_unit_error
456 (p_module_name => 'update_assessment',
457 p_hook_type => 'AP'
458 );
459 end;
460 --
461 -- End After Process User Hook
462 --
463 -- When in validation only mode raise the Validate_Enabled exception
464 --
465 if p_validate then
466 raise hr_api.validate_enabled;
467 end if;
468 --
469 -- Set all output arguments. l_object_version_number now has the new
470 -- object version number as the update was successful
471 --
472 p_object_version_number := l_object_version_number;
473 --
474 hr_utility.set_location(' Leaving:'||l_proc, 11);
475 exception
476 when hr_api.validate_enabled then
477 --
478 -- As the Validate_Enabled exception has been raised
479 -- we must rollback to the savepoint
480 --
481 ROLLBACK TO update_assess;
482 --
483 -- Only set output warning arguments and in out arguments back
484 -- to their IN value
485 -- (Any key or derived arguments must be set to null
486 -- when validation only mode is being used.)
487 --
488 p_object_version_number := l_object_version_number;
489 --
490 when others then
491 --
492 -- A validation or unexpected error has occurred
493 --
494 -- Added as part of fix to bug 632482
495 --
496 p_object_version_number := lv_object_version_number;
497
498 ROLLBACK TO update_assess;
499 raise;
500 --
501 -- End of fix.
502 --
503 hr_utility.set_location(' Leaving:'||l_proc, 12);
504 --
505 end update_assessment;
506 --
507 --
508 -- ---------------------------------------------------------------------------
509 -- |-----------------------< delete_assessment >-----------------------|
510 -- ---------------------------------------------------------------------------
511 --
512 procedure delete_assessment
513 (p_validate in boolean default false,
514 p_assessment_id in number,
515 p_object_version_number in number
516 ) is
517 --
518 -- Declare cursors and local variables
519 --
520 l_proc varchar2(72) := g_package||'delete_assessment';
521 begin
522 hr_utility.set_location('Entering:'|| l_proc, 5);
523 --
524 -- Issue a savepoint.
525 --
526 savepoint delete_assess;
527 hr_utility.set_location(l_proc, 6);
528 --
529 -- Call Before Process User Hook
530 --
531 begin
532 hr_assessments_bk3.delete_assessment_b
533 (
534 p_assessment_id => p_assessment_id
535 ,p_object_version_number => p_object_version_number
536 );
537 exception
538 when hr_api.cannot_find_prog_unit then
539 hr_api.cannot_find_prog_unit_error
540 (p_module_name => 'delete_assessment',
541 p_hook_type => 'BP'
542 );
543 end;
544 --
545 -- End of Before Process User hook
546 --
547 -- Validation in addition to Table Handlers
548 --
549 hr_utility.set_location(l_proc, 7);
550 --
551 -- Process Logic
552 --
553 -- The check to see whether the assessment_type is being used by an
554 -- assessment is done in the row handler
555 --
556 per_asn_del.del
557 (p_validate => FALSE
558 ,p_assessment_id => p_assessment_id
559 ,p_object_version_number => p_object_version_number
560 );
561 --
562 hr_utility.set_location(l_proc, 8);
563 --
564 -- Call After Process User Hook
565 --
566 begin
567 hr_assessments_bk3.delete_assessment_a (
568 p_assessment_id => p_assessment_id
569 ,p_object_version_number => p_object_version_number
570 );
571 exception
572 when hr_api.cannot_find_prog_unit then
573 hr_api.cannot_find_prog_unit_error
574 (p_module_name => 'delete_assessment',
575 p_hook_type => 'AP'
576 );
577 end;
578 --
579 -- End of After Process User hook
580 --
581 -- When in validation only mode raise the Validate_Enabled exception
582 --
583 if p_validate then
584 raise hr_api.validate_enabled;
585 end if;
586 --
587 hr_utility.set_location(' Leaving:'||l_proc, 11);
588 exception
589 when hr_api.validate_enabled then
590 --
591 -- As the Validate_Enabled exception has been raised
592 -- we must rollback to the savepoint
593 --
594 ROLLBACK TO delete_assess;
595 --
596 --
597 when others then
598 --
599 -- A validation or unexpected error has occurred
600 --
601 -- Added as part of fix to bug 632482
602 --
603 ROLLBACK TO delete_assess;
604 raise;
605 --
606 -- End of fix.
607 --
608 hr_utility.set_location(' Leaving:'||l_proc, 12);
609 end delete_assessment;
610 --
611 end hr_assessments_api;