DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_SUCCESSION_PLAN_API

Source


1 Package Body PER_SUCCESSION_PLAN_API as
2 /* $Header: pesucapi.pkb 120.1 2008/02/05 12:26:18 schowdhu noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  PER_SUCCESSION_PLAN_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< <create_succession_plan> >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_succession_plan
13  (p_validate                      in boolean        default false,
14   p_person_id                    in number,
15   p_position_id                  in number           default null,
16   p_business_group_id            in number,
17   p_start_date                   in date,
18   p_time_scale                   in varchar2,
19   p_end_date                     in date             default null,
20   p_available_for_promotion      in varchar2         default null,
21   p_manager_comments             in varchar2         default null,
22   p_attribute_category           in varchar2         default null,
23   p_attribute1                   in varchar2         default null,
24   p_attribute2                   in varchar2         default null,
25   p_attribute3                   in varchar2         default null,
26   p_attribute4                   in varchar2         default null,
27   p_attribute5                   in varchar2         default null,
28   p_attribute6                   in varchar2         default null,
29   p_attribute7                   in varchar2         default null,
30   p_attribute8                   in varchar2         default null,
31   p_attribute9                   in varchar2         default null,
32   p_attribute10                  in varchar2         default null,
33   p_attribute11                  in varchar2         default null,
34   p_attribute12                  in varchar2         default null,
35   p_attribute13                  in varchar2         default null,
36   p_attribute14                  in varchar2         default null,
37   p_attribute15                  in varchar2         default null,
38   p_attribute16                  in varchar2         default null,
39   p_attribute17                  in varchar2         default null,
40   p_attribute18                  in varchar2         default null,
41   p_attribute19                  in varchar2         default null,
42   p_attribute20                  in varchar2         default null,
43   p_effective_date               in date,
44   p_job_id                       in number           default null,
45   p_successee_person_id          in number           default null,
46   p_succession_plan_id           out nocopy number,
47   p_object_version_number        out nocopy number
48   ) is
49   --
50   -- Declare cursors and local variables
51   --
52 
53   l_succession_plan_id		per_succession_planning.succession_plan_id%TYPE;
54   l_object_version_number	per_succession_planning.object_version_number%TYPE;
55   l_effective_date              date;
56   l_start_date                  date;
57   l_end_date                    date;
58   l_proc                varchar2(72) := g_package||'create_succession_plan';
59 begin
60   hr_utility.set_location('Entering:'|| l_proc, 10);
61   --
62   -- Issue a savepoint
63   --
64   savepoint create_succession_plan;
65 
66   --
67   -- Truncate the time portion from all IN date parameters
68   --
69   l_effective_date := trunc(p_effective_date);
70   l_start_date     := trunc(p_start_date);
71   l_end_date       := trunc(p_end_date);
72 
73   --
74   -- Call Before Process User Hook
75   --
76   begin
77     PER_SUCCESSION_PLAN_BK1.create_succession_plan_b
78       (
79    p_person_id                    => p_person_id
80  , p_position_id                  => p_position_id
81  , p_business_group_id            => p_business_group_id
82  , p_start_date                   => l_start_date
83  , p_time_scale                   => p_time_scale
84  , p_end_date                     => l_end_date
85  , p_available_for_promotion      => p_available_for_promotion
86  , p_manager_comments             => p_manager_comments
87  , p_attribute_category           => p_attribute_category
88  , p_attribute1                   => p_attribute1
89  , p_attribute2                   => p_attribute2
90  , p_attribute3                   => p_attribute3
91  , p_attribute4                   => p_attribute4
92  , p_attribute5                   => p_attribute5
93  , p_attribute6                   => p_attribute6
94  , p_attribute7                   => p_attribute7
95  , p_attribute8                   => p_attribute8
96  , p_attribute9                   => p_attribute9
97  , p_attribute10                  => p_attribute10
98  , p_attribute11                  => p_attribute11
99  , p_attribute12                  => p_attribute12
100  , p_attribute13                  => p_attribute13
101  , p_attribute14                  => p_attribute14
102  , p_attribute15                  => p_attribute15
103  , p_attribute16                  => p_attribute16
104  , p_attribute17                  => p_attribute17
105  , p_attribute18                  => p_attribute18
106  , p_attribute19                  => p_attribute19
107  , p_attribute20                  => p_attribute20
108  , p_effective_date               => l_effective_date
109  , p_job_id                       => p_job_id
110  , p_successee_person_id          => p_successee_person_id
111       );
112   exception
113     when hr_api.cannot_find_prog_unit then
114       hr_api.cannot_find_prog_unit_error
115         (p_module_name => 'create_succession_plan'
116         ,p_hook_type   => 'BP'
117         );
118   end;
119   --
120   -- Validation in addition to Row Handlers
121   --
122 
123 
124 
125   --
126   -- Process Logic
127   --
128 
129 	hr_utility.set_location('Entering:'|| 'per_suc_ins.ins', 50);
130 
131 per_suc_ins.ins
132   (
133   p_succession_plan_id           => l_succession_plan_id
134  ,p_person_id                    => p_person_id
135  ,p_position_id                  => p_position_id
136  ,p_business_group_id            => p_business_group_id
137  ,p_start_date                   => l_start_date
138  ,p_time_scale                   => p_time_scale
139  ,p_end_date                     => l_end_date
140  ,p_available_for_promotion      => p_available_for_promotion
141  ,p_manager_comments             => p_manager_comments
142  ,p_object_version_number        => l_object_version_number
143  ,p_attribute_category           => p_attribute_category
144  ,p_attribute1                   => p_attribute1
145  ,p_attribute2                   => p_attribute2
146  ,p_attribute3                   => p_attribute3
147  ,p_attribute4                   => p_attribute4
148  ,p_attribute5                   => p_attribute5
149  ,p_attribute6                   => p_attribute6
150  ,p_attribute7                   => p_attribute7
151  ,p_attribute8                   => p_attribute8
152  ,p_attribute9                   => p_attribute9
153  ,p_attribute10                  => p_attribute10
154  ,p_attribute11                  => p_attribute11
155  ,p_attribute12                  => p_attribute12
156  ,p_attribute13                  => p_attribute13
157  ,p_attribute14                  => p_attribute14
158  ,p_attribute15                  => p_attribute15
159  ,p_attribute16                  => p_attribute16
160  ,p_attribute17                  => p_attribute17
161  ,p_attribute18                  => p_attribute18
162  ,p_attribute19                  => p_attribute19
163  ,p_attribute20                  => p_attribute20
164  ,p_effective_date               => l_effective_date
165  ,p_job_id                       => p_job_id
166  ,p_successee_person_id          => p_successee_person_id
167   );
168 
169 hr_utility.set_location('Entering:'|| 'PER_SUCCESSION_PLAN_BK1.create_succession_plan_a', 60);
170   --
171   -- Call After Process User Hook
172   --
173   begin
174     PER_SUCCESSION_PLAN_BK1.create_succession_plan_a
175      (
176    p_person_id                    => p_person_id
177  , p_position_id                  => p_position_id
178  , p_business_group_id            => p_business_group_id
179  , p_start_date                   => l_start_date
180  , p_time_scale                   => p_time_scale
181  , p_end_date                     => l_end_date
182  , p_available_for_promotion      => p_available_for_promotion
183  , p_manager_comments             => p_manager_comments
184  , p_attribute_category           => p_attribute_category
185  , p_attribute1                   => p_attribute1
186  , p_attribute2                   => p_attribute2
187  , p_attribute3                   => p_attribute3
188  , p_attribute4                   => p_attribute4
189  , p_attribute5                   => p_attribute5
190  , p_attribute6                   => p_attribute6
191  , p_attribute7                   => p_attribute7
192  , p_attribute8                   => p_attribute8
193  , p_attribute9                   => p_attribute9
194  , p_attribute10                  => p_attribute10
195  , p_attribute11                  => p_attribute11
196  , p_attribute12                  => p_attribute12
197  , p_attribute13                  => p_attribute13
198  , p_attribute14                  => p_attribute14
199  , p_attribute15                  => p_attribute15
200  , p_attribute16                  => p_attribute16
201  , p_attribute17                  => p_attribute17
202  , p_attribute18                  => p_attribute18
203  , p_attribute19                  => p_attribute19
204  , p_attribute20                  => p_attribute20
205  , p_effective_date               => l_effective_date
206  , p_job_id                       => p_job_id
207  , p_successee_person_id          => p_successee_person_id
208  , p_succession_plan_id           => l_succession_plan_id
209  , p_object_version_number        => l_object_version_number
210       );
211   exception
212     when hr_api.cannot_find_prog_unit then
213       hr_api.cannot_find_prog_unit_error
214         (p_module_name => 'create_succession_plan'
215         ,p_hook_type   => 'AP'
216         );
217   end;
218   --
219   -- When in validation only mode raise the Validate_Enabled exception
220   --
221   if p_validate then
222     raise hr_api.validate_enabled;
223   end if;
224   --
225   -- Set all IN OUT and OUT parameters with out values
226   --
227   p_succession_plan_id     := l_succession_plan_id;
228   p_object_version_number  := l_object_version_number;
229 
230   --
231   hr_utility.set_location(' Leaving:'||l_proc, 70);
232 exception
233   when hr_api.validate_enabled then
234     --
235     -- As the Validate_Enabled exception has been raised
236     -- we must rollback to the savepoint
237     --
238     rollback to create_succession_plan;
239     --
240     -- Reset IN OUT parameters and set OUT parameters
241     -- (Any key or derived arguments must be set to null
242     -- when validation only mode is being used.)
243     --
244 
245     p_succession_plan_id     := null;
246     p_object_version_number  := null;
247 
248     hr_utility.set_location(' Leaving:'||l_proc, 80);
249   when others then
250     --
251     -- A validation or unexpected error has occured
252     --
253     rollback to create_succession_plan;
254     --
255     -- Reset IN OUT parameters and set all
256     -- OUT parameters, including warnings, to null
257     --
258 
259     p_succession_plan_id     := null;
260     p_object_version_number  := null;
261 
262     hr_utility.set_location(' Leaving:'||l_proc, 90);
263     raise;
264 end create_succession_plan;
265 --
266 -- ----------------------------------------------------------------------------
267 -- |--------------------------< <update_succession_plan> >--------------------------|
268 -- ----------------------------------------------------------------------------
269 --
270 procedure update_succession_plan
271  (p_validate                     in boolean         default false,
272   p_succession_plan_id           in number,
273   p_person_id                    in number           default hr_api.g_number,
274   p_position_id                  in number           default hr_api.g_number,
275   p_business_group_id            in number           default hr_api.g_number,
276   p_start_date                   in date             default hr_api.g_date,
277   p_time_scale                   in varchar2         default hr_api.g_varchar2,
278   p_end_date                     in date             default hr_api.g_date,
279   p_available_for_promotion      in varchar2         default hr_api.g_varchar2,
280   p_manager_comments             in varchar2         default hr_api.g_varchar2,
281   p_attribute_category           in varchar2         default hr_api.g_varchar2,
282   p_attribute1                   in varchar2         default hr_api.g_varchar2,
283   p_attribute2                   in varchar2         default hr_api.g_varchar2,
284   p_attribute3                   in varchar2         default hr_api.g_varchar2,
285   p_attribute4                   in varchar2         default hr_api.g_varchar2,
286   p_attribute5                   in varchar2         default hr_api.g_varchar2,
287   p_attribute6                   in varchar2         default hr_api.g_varchar2,
288   p_attribute7                   in varchar2         default hr_api.g_varchar2,
289   p_attribute8                   in varchar2         default hr_api.g_varchar2,
290   p_attribute9                   in varchar2         default hr_api.g_varchar2,
291   p_attribute10                  in varchar2         default hr_api.g_varchar2,
292   p_attribute11                  in varchar2         default hr_api.g_varchar2,
293   p_attribute12                  in varchar2         default hr_api.g_varchar2,
294   p_attribute13                  in varchar2         default hr_api.g_varchar2,
295   p_attribute14                  in varchar2         default hr_api.g_varchar2,
296   p_attribute15                  in varchar2         default hr_api.g_varchar2,
297   p_attribute16                  in varchar2         default hr_api.g_varchar2,
298   p_attribute17                  in varchar2         default hr_api.g_varchar2,
299   p_attribute18                  in varchar2         default hr_api.g_varchar2,
300   p_attribute19                  in varchar2         default hr_api.g_varchar2,
301   p_attribute20                  in varchar2         default hr_api.g_varchar2,
302   p_effective_date               in date,
303   p_job_id                       in number           default hr_api.g_number,
304   p_successee_person_id          in number           default hr_api.g_number,
305   p_object_version_number        in out nocopy number
306   ) is
307   --
308   -- Declare cursors and local variables
309   --
310 
311   l_succession_plan_id		per_succession_planning.succession_plan_id%TYPE;
312   l_object_version_number	per_succession_planning.object_version_number%TYPE;
313   l_ovn per_objectives.object_version_number%TYPE := p_object_version_number;
314   l_effective_date              date;
315   l_start_date                  date;
316   l_end_date                    date;
317   l_proc                varchar2(72) := g_package||'update_succession_plan';
318 begin
319   hr_utility.set_location('Entering:'|| l_proc, 10);
320   --
321   -- Issue a savepoint
322   --
323   savepoint update_succession_plan;
324   --
325   -- Initialise local variables as appropriate
326   --
327   l_object_version_number := p_object_version_number;
328 
329   --
330   -- Truncate the time portion from all IN date parameters
331   --
332   l_effective_date := trunc(p_effective_date);
333   l_start_date     := trunc(p_start_date);
334   l_end_date       := trunc(p_end_date);
335 
336   --
337   -- Call Before Process User Hook
338   --
339   begin
340     PER_SUCCESSION_PLAN_BK2.update_succession_plan_b
341       (
342    p_person_id                    => p_person_id
343  , p_position_id                  => p_position_id
344  , p_business_group_id            => p_business_group_id
345  , p_start_date                   => l_start_date
346  , p_time_scale                   => p_time_scale
347  , p_end_date                     => l_end_date
348  , p_available_for_promotion      => p_available_for_promotion
349  , p_manager_comments             => p_manager_comments
353  , p_attribute3                   => p_attribute3
350  , p_attribute_category           => p_attribute_category
351  , p_attribute1                   => p_attribute1
352  , p_attribute2                   => p_attribute2
354  , p_attribute4                   => p_attribute4
355  , p_attribute5                   => p_attribute5
356  , p_attribute6                   => p_attribute6
357  , p_attribute7                   => p_attribute7
358  , p_attribute8                   => p_attribute8
359  , p_attribute9                   => p_attribute9
360  , p_attribute10                  => p_attribute10
361  , p_attribute11                  => p_attribute11
362  , p_attribute12                  => p_attribute12
363  , p_attribute13                  => p_attribute13
364  , p_attribute14                  => p_attribute14
365  , p_attribute15                  => p_attribute15
366  , p_attribute16                  => p_attribute16
367  , p_attribute17                  => p_attribute17
368  , p_attribute18                  => p_attribute18
369  , p_attribute19                  => p_attribute19
370  , p_attribute20                  => p_attribute20
371  , p_effective_date               => l_effective_date
372  , p_job_id                       => p_job_id
373  , p_successee_person_id          => p_successee_person_id
374  , p_succession_plan_id           => p_succession_plan_id
375  , p_object_version_number        => p_object_version_number
376       );
377   exception
378     when hr_api.cannot_find_prog_unit then
379       hr_api.cannot_find_prog_unit_error
380         (p_module_name => 'update_succession_plan'
381         ,p_hook_type   => 'BP'
382         );
383   end;
384   --
385   -- Validation in addition to Row Handlers
386   --
387 
388 
389 
390   --
391   -- Process Logic
392   --
393 
394 	hr_utility.set_location('Entering:'|| 'per_suc_upd.upd', 50);
395 
396 per_suc_upd.upd
397   (
398   p_succession_plan_id           => p_succession_plan_id
399  ,p_person_id                    => p_person_id
400  ,p_position_id                  => p_position_id
401  ,p_business_group_id            => p_business_group_id
402  ,p_start_date                   => l_start_date
403  ,p_time_scale                   => p_time_scale
404  ,p_end_date                     => l_end_date
405  ,p_available_for_promotion      => p_available_for_promotion
406  ,p_manager_comments             => p_manager_comments
407  ,p_object_version_number        => l_object_version_number
408  ,p_attribute_category           => p_attribute_category
409  ,p_attribute1                   => p_attribute1
410  ,p_attribute2                   => p_attribute2
411  ,p_attribute3                   => p_attribute3
412  ,p_attribute4                   => p_attribute4
413  ,p_attribute5                   => p_attribute5
414  ,p_attribute6                   => p_attribute6
415  ,p_attribute7                   => p_attribute7
416  ,p_attribute8                   => p_attribute8
417  ,p_attribute9                   => p_attribute9
418  ,p_attribute10                  => p_attribute10
419  ,p_attribute11                  => p_attribute11
420  ,p_attribute12                  => p_attribute12
421  ,p_attribute13                  => p_attribute13
422  ,p_attribute14                  => p_attribute14
423  ,p_attribute15                  => p_attribute15
424  ,p_attribute16                  => p_attribute16
425  ,p_attribute17                  => p_attribute17
426  ,p_attribute18                  => p_attribute18
427  ,p_attribute19                  => p_attribute19
428  ,p_attribute20                  => p_attribute20
429  ,p_effective_date               => l_effective_date
430  ,p_job_id                       => p_job_id
431  ,p_successee_person_id          => p_successee_person_id
432   );
433 
434 hr_utility.set_location('Entering:'|| 'PER_SUCCESSION_PLAN_BK1.update_succession_plan_a', 60);
435   --
436   -- Call After Process User Hook
437   --
438   begin
439     PER_SUCCESSION_PLAN_BK2.update_succession_plan_a
440      (
441    p_person_id                    => p_person_id
442  , p_position_id                  => p_position_id
443  , p_business_group_id            => p_business_group_id
444  , p_start_date                   => l_start_date
445  , p_time_scale                   => p_time_scale
446  , p_end_date                     => l_end_date
447  , p_available_for_promotion      => p_available_for_promotion
448  , p_manager_comments             => p_manager_comments
449  , p_attribute_category           => p_attribute_category
450  , p_attribute1                   => p_attribute1
451  , p_attribute2                   => p_attribute2
452  , p_attribute3                   => p_attribute3
453  , p_attribute4                   => p_attribute4
454  , p_attribute5                   => p_attribute5
455  , p_attribute6                   => p_attribute6
456  , p_attribute7                   => p_attribute7
457  , p_attribute8                   => p_attribute8
458  , p_attribute9                   => p_attribute9
459  , p_attribute10                  => p_attribute10
460  , p_attribute11                  => p_attribute11
461  , p_attribute12                  => p_attribute12
462  , p_attribute13                  => p_attribute13
463  , p_attribute14                  => p_attribute14
464  , p_attribute15                  => p_attribute15
465  , p_attribute16                  => p_attribute16
466  , p_attribute17                  => p_attribute17
467  , p_attribute18                  => p_attribute18
468  , p_attribute19                  => p_attribute19
469  , p_attribute20                  => p_attribute20
470  , p_effective_date               => l_effective_date
471  , p_job_id                       => p_job_id
472  , p_successee_person_id          => p_successee_person_id
473  , p_succession_plan_id           => l_succession_plan_id
477     when hr_api.cannot_find_prog_unit then
474  , p_object_version_number        => l_object_version_number
475       );
476   exception
478       hr_api.cannot_find_prog_unit_error
479         (p_module_name => 'update_succession_plan'
480         ,p_hook_type   => 'AP'
481         );
482   end;
483   --
484   -- When in validation only mode raise the Validate_Enabled exception
485   --
486   if p_validate then
487     raise hr_api.validate_enabled;
488   end if;
489   --
490   -- Set all IN OUT and OUT parameters with out values
491   --
492 
493   p_object_version_number  := l_object_version_number;
494 
495   --
496   hr_utility.set_location(' Leaving:'||l_proc, 70);
497 exception
498   when hr_api.validate_enabled then
499     --
500     -- As the Validate_Enabled exception has been raised
501     -- we must rollback to the savepoint
502     --
503     rollback to update_succession_plan;
504     --
505     -- Reset IN OUT parameters and set OUT parameters
506     -- (Any key or derived arguments must be set to null
507     -- when validation only mode is being used.)
508     --
509 
510     p_object_version_number  := l_ovn;
511 
512     hr_utility.set_location(' Leaving:'||l_proc, 80);
513   when others then
514     --
515     -- A validation or unexpected error has occured
516     --
517     rollback to update_succession_plan;
518     --
519     -- Reset IN OUT parameters and set all
520     -- OUT parameters, including warnings, to null
521     --
522 
523     p_object_version_number  := l_ovn;
524 
525     hr_utility.set_location(' Leaving:'||l_proc, 90);
526     raise;
527 end update_succession_plan;
528 --
529 -- ---------------------------------------------------------------------------
530 -- |-------------------------< delete_succession_plan> ----------------------------|
531 -- ---------------------------------------------------------------------------
532 --
533 procedure delete_succession_plan
534 (p_validate                           in boolean default false,
535  p_succession_plan_id                 in number,
536  p_object_version_number              in number
537 ) is
538   --
539   -- Declare cursors and local variables
540   --
541 
542   --
543   --
544   l_proc        varchar2(72) := g_package||'delete_succession_plan';
545 begin
546   hr_utility.set_location('Entering:'|| l_proc, 5);
547   --
548   -- Issue a savepoint
549   --
550   savepoint delete_succession_plan;
551   --
552   begin
553     --
554     -- Start of API User Hook for the before hook delete_objective
555     --
556     PER_SUCCESSION_PLAN_BK3.delete_succession_plan_b
557       (p_succession_plan_id                       => p_succession_plan_id,
558        p_object_version_number              => p_object_version_number
559       );
560 
561   exception
562     when hr_api.cannot_find_prog_unit then
563       hr_api.cannot_find_prog_unit_error
564 	(p_module_name	=> 'delete_succession_plan',
565 	 p_hook_type	=> 'BP'
566 	);
567   end;
568     --
569     -- End of API User Hook for the before hook of delete_objective
570     --
571   hr_utility.set_location(l_proc, 6);
572   --
573   -- Validation in addition to Table Handlers
574   --
575   hr_utility.set_location(l_proc, 7);
576   --
577   -- Process Logic
578   --
579   -- flemonni added cascade delete of obj performance rating
580   --
581   -- get an associated pr for the given obj id
582   -- supply this to the pr api (p_validate = TRUE)
583   -- delete it so that obj delete succeeds
584   -- allow this rollback to undo the delete if necessary
585   --
586 
587   --
588   --  delete the succession plan
589   --
590      per_suc_del.del
591      (p_succession_plan_id			=> p_succession_plan_id
592      ,p_object_version_number 		=> p_object_version_number
593      );
594   --
595   hr_utility.set_location(l_proc, 8);
596   --
597   begin
598     --
599     -- Start of API User Hook for the after hook delete_objective
600     --
601     PER_SUCCESSION_PLAN_BK3.delete_succession_plan_a
602       (p_succession_plan_id                 => p_succession_plan_id,
603        p_object_version_number              => p_object_version_number
604       );
605   exception
606     when hr_api.cannot_find_prog_unit then
607       hr_api.cannot_find_prog_unit_error
608 	(p_module_name	=> 'delete_succession_plan',
609 	 p_hook_type	=> 'AP'
610 	);
611   end;
612     --
613     -- End of API User Hook for the after hook delete_objective
614     --
615   -- When in validation only mode raise the Validate_Enabled exception
616   --
617   if p_validate then
618     raise hr_api.validate_enabled;
619   end if;
620   --
621   hr_utility.set_location(' Leaving:'||l_proc, 11);
622 exception
623   when hr_api.validate_enabled then
624     --
625     -- As the Validate_Enabled exception has been raised
626     -- we must rollback to the savepoint
627     --
628     ROLLBACK TO delete_succession_plan;
629     --
630     -- Only set output warning arguments
631     -- (Any key or derived arguments must be set to null
632     -- when validation only mode is being used.)
633     --
634     hr_utility.set_location(' Leaving:'||l_proc, 12);
635     --
636   when others then
637     --
638     -- A validation or unexpected error has occured
639     --
640   ROLLBACK TO delete_succession_plan;
641     --
642   raise;
643     --
644 end delete_succession_plan;
645 
646 --
647 end PER_SUCCESSION_PLAN_API;