DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_CRITERIA_RATE_ELEMENTS_API

Source


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