DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_CRITERIA_RATE_FACTORS_API

Source


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