DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_RANK_PROCESS_APPROVAL_API

Source


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