DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RANK_PROCESS_API

Source


1 Package Body PQH_RANK_PROCESS_API as
2 /* $Header: pqrnkapi.pkb 120.1 2005/06/03 11:58:40 nsanghal noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  constant varchar2(33) := '  PQH_RANK_PROCESS_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< create_rank_process >-------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_rank_process
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_rank_process_id                  out nocopy number
16   ,p_pgm_id                        in     number default null
17   ,p_pl_id                         in     number default null
18   ,p_oipl_id                       in     number default null
19   ,p_process_cd                    in     varchar2
20   ,p_process_date                  in     date
21   ,p_benefit_action_id             in     number default null
22   ,p_person_id                     in     number
23   ,p_assignment_id                 in     number
24   ,p_total_score                   in     number default null
25   ,p_request_id                    in     number default null
26   ,p_business_group_id             in     number default null
27   ,p_object_version_number            out nocopy number
28   ,p_per_in_ler_id                 in     number default null
29   ) is
30   --
31   -- Declare cursors and local variables
32   --
33   l_object_version_number    number;
34   l_effective_date      date;
35   l_rank_process_id     pqh_rank_processes.rank_process_id%Type;
36   l_proc constant varchar2(72):= g_package||'create_rank_process';
37 begin
38 
39   hr_utility.set_location('Entering:'|| l_proc, 10);
40   --
41   -- Issue a savepoint
42   --
43   savepoint CREATE_RANK_PROCESS;
44   --
45   -- Truncate the time portion from all IN date parameters
46   --
47   l_effective_date        := trunc(p_effective_date);
48 
49   --
50   -- Call Before Process User Hook
51   --
52   begin
53     pqh_rank_process_bk1.create_rank_process_b
54       (p_effective_date                => l_effective_date
55       ,p_rank_process_id               => l_rank_process_id
56       ,p_pgm_id                        => p_pgm_id
57       ,p_pl_id                         => p_pl_id
58       ,p_oipl_id                       => p_oipl_id
59       ,p_process_cd                    => p_process_cd
60       ,p_process_date                  => p_process_date
61       ,p_benefit_action_id             => p_benefit_action_id
62       ,p_person_id                     => p_person_id
63       ,p_assignment_id                 => p_assignment_id
64       ,p_total_score                   => p_total_score
65       ,p_request_id                    => p_request_id
66       ,p_business_group_id             => p_business_group_id
67       ,p_per_in_ler_id                 => p_per_in_ler_id
68       );
69 
70   exception
71     when hr_api.cannot_find_prog_unit then
72       hr_api.cannot_find_prog_unit_error
73         (p_module_name => 'PQH_RANK_PROCESS_API'
74         ,p_hook_type   => 'BP'
75         );
76   end;
77   --
78   -- Process Logic
79   --
80   pqh_rnk_ins.ins
81       (p_effective_date                => l_effective_date
82       ,p_pgm_id                        => p_pgm_id
83       ,p_pl_id                         => p_pl_id
84       ,p_oipl_id                       => p_oipl_id
85       ,p_process_cd                    => p_process_cd
86       ,p_process_date                  => p_process_date
87       ,p_benefit_action_id             => p_benefit_action_id
88       ,p_person_id                     => p_person_id
89       ,p_assignment_id                 => p_assignment_id
90       ,p_total_score                   => p_total_score
91       ,p_request_id                    => p_request_id
92       ,p_rank_process_id               => l_rank_process_id
93       ,p_business_group_id             => p_business_group_id
94       ,p_object_version_number         => l_object_version_number
95       ,p_per_in_ler_id                 => p_per_in_ler_id
96       );
97 
98   --
99   -- Call After Process User Hook
100   --
101   begin
102     pqh_rank_process_bk1.create_rank_process_a
103       (p_effective_date                => l_effective_date
104       ,p_rank_process_id               => l_rank_process_id
105       ,p_pgm_id                        => p_pgm_id
106       ,p_pl_id                         => p_pl_id
107       ,p_oipl_id                       => p_oipl_id
108       ,p_process_cd                    => p_process_cd
109       ,p_process_date                  => p_process_date
110       ,p_benefit_action_id             => p_benefit_action_id
111       ,p_person_id                     => p_person_id
112       ,p_assignment_id                 => p_assignment_id
113       ,p_total_score                   => p_total_score
114       ,p_request_id                    => p_request_id
115       ,p_business_group_id             => p_business_group_id
116       ,p_object_version_number         => l_object_version_number
117       ,p_per_in_ler_id                 => p_per_in_ler_id
118       );
119   exception
120     when hr_api.cannot_find_prog_unit then
121       hr_api.cannot_find_prog_unit_error
122         (p_module_name => 'PQH_RANK_PROCESS_API'
123         ,p_hook_type   => 'AP'
124         );
125   end;
126   --
127   -- When in validation only mode raise the Validate_Enabled exception
128   --
129   if p_validate then
130     raise hr_api.validate_enabled;
131   end if;
132   --
133   -- Set all IN OUT and OUT parameters with out values
134   --
135   p_object_version_number  := l_object_version_number;
136   p_rank_process_id        := l_rank_process_id;
137   --
138   hr_utility.set_location(' Leaving:'||l_proc, 70);
139 exception
140   when hr_api.validate_enabled then
141     --
142     -- As the Validate_Enabled exception has been raised
143     -- we must rollback to the savepoint
144     --
145     rollback to CREATE_RANK_PROCESS;
146     --
147     -- Reset IN OUT parameters and set OUT parameters
148     -- (Any key or derived arguments must be set to null
149     -- when validation only mode is being used.)
150     --
151     p_rank_process_id        := null;
152     p_object_version_number  := null;
153     hr_utility.set_location(' Leaving:'||l_proc, 80);
154   when others then
155     --
156     -- A validation or unexpected error has occured
157     --
158     rollback to CREATE_RANK_PROCESS;
159     --
160     -- Reset IN OUT parameters and set all
161     -- OUT parameters, including warnings, to null
162     --
163     p_rank_process_id        := null;
164     p_object_version_number  := null;
165     hr_utility.set_location(' Leaving:'||l_proc, 90);
166     raise;
167 end create_rank_process;
168 --
169 -- ----------------------------------------------------------------------------
170 -- |--------------------------< update_rank_process >-------------------------|
171 -- ----------------------------------------------------------------------------
172 --
173 procedure update_rank_process
174   (p_validate                      in     boolean  default false
175   ,p_effective_date                in     date
176   ,p_rank_process_id               in     number
177   ,p_pgm_id                        in     number default hr_api.g_number
178   ,p_pl_id                         in     number default hr_api.g_number
179   ,p_oipl_id                       in     number default hr_api.g_number
180   ,p_process_cd                    in     varchar2
181   ,p_process_date                  in     date
182   ,p_benefit_action_id             in     number default hr_api.g_number
183   ,p_person_id                     in     number
184   ,p_assignment_id                 in     number
185   ,p_total_score                   in     number default hr_api.g_number
186   ,p_request_id                    in     number default hr_api.g_number
187   ,p_business_group_id             in     number default hr_api.g_number
188   ,p_object_version_number         in out nocopy number
189   ,p_per_in_ler_id                 in     number default hr_api.g_number
190   ) is
191   --
192   -- Declare cursors and local variables
193   --
194   l_object_version_number    number;
195   l_effective_date      date;
196   --l_rank_process_id     pqh_rank_processes.rank_process_id%Type;
197   l_proc constant varchar2(72):= g_package||'update_rank_process';
198 begin
199 
200   hr_utility.set_location('Entering:'|| l_proc, 10);
201   --
202   -- Issue a savepoint
203   savepoint UPDATE_RANK_PROCESS;
204   --
205   --Remember IN OUT parameter IN values
206   --
207   l_object_version_number := p_object_version_number;
208 
209   --
210   -- Truncate the time portion from all IN date parameters
211   --
212   l_effective_date := trunc(p_effective_date);
213 
214   --
215   -- Call Before Process User Hook
216   --
217   begin
218     pqh_rank_process_bk2.update_rank_process_b
219       (p_effective_date                => l_effective_date
220       ,p_rank_process_id               => p_rank_process_id
221       ,p_pgm_id                        => p_pgm_id
222       ,p_pl_id                         => p_pl_id
223       ,p_oipl_id                       => p_oipl_id
224       ,p_process_cd                    => p_process_cd
225       ,p_process_date                  => p_process_date
226       ,p_benefit_action_id             => p_benefit_action_id
227       ,p_person_id                     => p_person_id
228       ,p_assignment_id                 => p_assignment_id
229       ,p_total_score                   => p_total_score
230       ,p_request_id                    => p_request_id
231       ,p_business_group_id             => p_business_group_id
232       ,p_object_version_number         => l_object_version_number
233       ,p_per_in_ler_id                 => p_per_in_ler_id
234       );
235   exception
236     when hr_api.cannot_find_prog_unit then
237       hr_api.cannot_find_prog_unit_error
238         (p_module_name => 'PQH_RANK_PROCESS_API'
239         ,p_hook_type   => 'BP'
240         );
241   end;
242 
243  --
244   -- Process Logic
245   --
246   pqh_rnk_upd.upd
247       (p_effective_date                => l_effective_date
248       ,p_rank_process_id               => p_rank_process_id
249       ,p_pgm_id                        => p_pgm_id
250       ,p_pl_id                         => p_pl_id
251       ,p_oipl_id                       => p_oipl_id
252       ,p_process_cd                    => p_process_cd
253       ,p_process_date                  => p_process_date
254       ,p_benefit_action_id             => p_benefit_action_id
255       ,p_person_id                     => p_person_id
256       ,p_assignment_id                 => p_assignment_id
257       ,p_total_score                   => p_total_score
258       ,p_request_id                    => p_request_id
259       ,p_business_group_id             => p_business_group_id
260       ,p_object_version_number         => l_object_version_number
261       ,p_per_in_ler_id                 => p_per_in_ler_id
262       );
263 
264   --
265   -- Call After Process User Hook
266   --
267   begin
268     pqh_rank_process_bk2.update_rank_process_a
269       (p_effective_date                => l_effective_date
270       ,p_rank_process_id               => p_rank_process_id
271       ,p_pgm_id                        => p_pgm_id
272       ,p_pl_id                         => p_pl_id
273       ,p_oipl_id                       => p_oipl_id
274       ,p_process_cd                    => p_process_cd
275       ,p_process_date                  => p_process_date
276       ,p_benefit_action_id             => p_benefit_action_id
277       ,p_person_id                     => p_person_id
278       ,p_assignment_id                 => p_assignment_id
279       ,p_total_score                   => p_total_score
280       ,p_request_id                    => p_request_id
281       ,p_business_group_id             => p_business_group_id
282       ,p_object_version_number         => l_object_version_number
283       ,p_per_in_ler_id                 => p_per_in_ler_id
284       );
285   exception
286     when hr_api.cannot_find_prog_unit then
287       hr_api.cannot_find_prog_unit_error
288         (p_module_name => 'PQH_RANK_PROCESS_API'
289         ,p_hook_type   => 'AP'
290         );
291   end;
292   --
293   -- When in validation only mode raise the Validate_Enabled exception
294   --
295   if p_validate then
296     raise hr_api.validate_enabled;
297   end if;
298   --
299   -- Set all IN OUT and OUT parameters with out values
300   --
301   p_object_version_number  := l_object_version_number;
302   --
303   hr_utility.set_location(' Leaving:'||l_proc, 70);
304 
305 exception
306   when hr_api.validate_enabled then
307     --
308     -- As the Validate_Enabled exception has been raised
309     -- we must rollback to the savepoint
310     --
311     rollback to UPDATE_RANK_PROCESS;
312     --
313     -- Reset IN OUT parameters and set OUT parameters
314     -- (Any key or derived arguments must be set to null
315     -- when validation only mode is being used.)
316     --
317     p_object_version_number  := l_object_version_number;
318     hr_utility.set_location(' Leaving:'||l_proc, 80);
319   when others then
320     --
324     --
321     -- A validation or unexpected error has occured
322     --
323     rollback to UPDATE_RANK_PROCESS;
325     -- Reset IN OUT parameters and set all
326     -- OUT parameters, including warnings, to null
327     --
328     p_object_version_number  := l_object_version_number;
329     hr_utility.set_location(' Leaving:'||l_proc, 90);
330     raise;
331 end update_rank_process;
332 --
333 -- ----------------------------------------------------------------------------
334 -- |--------------------------< delete_rank_process >-------------------------|
335 -- ----------------------------------------------------------------------------
336 --
337 procedure delete_rank_process
338   (p_validate                      in     boolean  default false
339   ,p_effective_date                in     date
340   ,p_rank_process_id               in     number
341   ,p_object_version_number         in     number
342   ) is
343   --
344   -- Declare cursors and local variables
345   --
346   l_object_version_number    number;
347   l_effective_date      date;
348   l_proc constant varchar2(72):= g_package||'delete_rank_process';
349 begin
350 
351   hr_utility.set_location('Entering:'|| l_proc, 10);
352   --
353   -- Issue a savepoint
354   savepoint DELETE_RANK_PROCESS;
355   --
356   --
357   -- Truncate the time portion from all IN date parameters
358   --
359   l_effective_date := trunc(p_effective_date);
360 
361   --
362   -- Call Before Process User Hook
363   --
364   begin
365     pqh_rank_process_bk3.delete_rank_process_b
366       (p_effective_date                => l_effective_date
367       ,p_rank_process_id               => p_rank_process_id
368       ,p_object_version_number         => p_object_version_number
369       );
370   exception
371     when hr_api.cannot_find_prog_unit then
372       hr_api.cannot_find_prog_unit_error
373         (p_module_name => 'PQH_RANK_PROCESS_API'
374         ,p_hook_type   => 'BP'
375         );
376   end;
377 
378  --
379   -- Process Logic
380   --
381   pqh_rnk_del.del
382       (p_rank_process_id               => p_rank_process_id
383       ,p_object_version_number         => p_object_version_number
384       );
385 
386   --
387   -- Call After Process User Hook
388   --
389   begin
390     pqh_rank_process_bk3.delete_rank_process_a
391       (p_effective_date                => l_effective_date
392       ,p_rank_process_id               => p_rank_process_id
393       ,p_object_version_number         => p_object_version_number
394       );
395   exception
399         ,p_hook_type   => 'AP'
396     when hr_api.cannot_find_prog_unit then
397       hr_api.cannot_find_prog_unit_error
398         (p_module_name => 'PQH_RANK_PROCESS_API'
400         );
401   end;
402   --
403   -- When in validation only mode raise the Validate_Enabled exception
404   --
405   if p_validate then
406     raise hr_api.validate_enabled;
407   end if;
408   --
409   --
410   hr_utility.set_location(' Leaving:'||l_proc, 70);
411 
412 exception
413   when hr_api.validate_enabled then
414     --
415     -- As the Validate_Enabled exception has been raised
416     -- we must rollback to the savepoint
417     --
418     rollback to DELETE_RANK_PROCESS;
419     --
420     hr_utility.set_location(' Leaving:'||l_proc, 80);
421   when others then
422     --
423     -- A validation or unexpected error has occured
424     --
425     rollback to DELETE_RANK_PROCESS;
426     --
427     hr_utility.set_location(' Leaving:'||l_proc, 90);
428     raise;
429 end delete_rank_process;
430 --
431 end pqh_rank_process_api;