DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_APPROVAL_STYLES_API

Source


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