DBA Data[Home] [Help]

PACKAGE BODY: APPS.FF_GLOBALS_API

Source


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