DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CWB_MATRIX_API

Source


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