DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_ALIAS_DEFINITIONS_API

Source


1 Package Body hxc_alias_definitions_api as
2 /* $Header: hxchadapi.pkb 120.2 2005/09/23 08:09:15 sechandr noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  hxc_alias_definitions_api.';
7 g_debug	boolean	:=hr_utility.debug_enabled;
8 --
9 -- ----------------------------------------------------------------------------
10 -- |------------------------< create_alias_definition >------------------------|
11 -- ----------------------------------------------------------------------------
12 --
13 procedure create_alias_definition
14   (p_validate                      in     boolean  default false
15   ,p_alias_definition_id              out nocopy number
16   ,p_alias_definition_name         in     varchar2
17   ,p_alias_context_code            in     varchar2 default null
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_prompt                        in     varchar2 default null
22   ,p_timecard_field                in     varchar2
23   ,p_object_version_number            out nocopy number
24   ,p_language_code                 in     varchar2  default hr_api.userenv_lang
25   ,p_alias_type_id                 in     number
26   ) is
27   --
28   -- Declare cursors and local variables
29   --
30 
31   l_proc                varchar2(72);
32   l_object_version_number hxc_alias_definitions.object_version_number%TYPE;
33   l_alias_definition_id   hxc_alias_definitions.alias_definition_id%TYPE;
34   l_language_code         hxc_alias_definitions_tl.language%TYPE;
35 
36 begin
37   g_debug:=hr_utility.debug_enabled;
38   if g_debug then
39 	l_proc := g_package||'create_alias_definition';
40 	hr_utility.set_location('Entering:'|| l_proc, 10);
41   end if;
42   --
43   -- Issue a savepoint
44   --
45   savepoint create_alias_definition;
46   --
47   -- Truncate the time portion from all IN date parameters
48   --
49 
50   -- Validate the language parameter.  l_language_code should be passed
51   -- to functions instead of p_language_code from now on, to allow
52   -- an IN OUT parameter to be passed through.
53   --
54   l_language_code := p_language_code;
55   hr_api.validate_language_code(p_language_code => l_language_code);
56   --
57   --
58   -- Call Before Process User Hook
59   --
60   if g_debug then
61 	hr_utility.set_location('Entering:'|| l_proc, 20);
62   end if;
63   --
64   begin
65     hxc_alias_definitions_bk_1.create_alias_definition_b
66       (p_alias_definition_name         => p_alias_definition_name
67       ,p_alias_context_code            => p_alias_context_code
68       ,p_business_group_id             => p_business_group_id
69       ,p_legislation_code              => p_legislation_code
70       ,p_description                   => p_description
71       ,p_prompt                        => p_prompt
72       ,p_timecard_field                => p_timecard_field
73       ,p_language_code                 => l_language_code
74       ,p_alias_type_id 		       => p_alias_type_id
75       );
76   exception
77     when hr_api.cannot_find_prog_unit then
78       hr_api.cannot_find_prog_unit_error
79         (p_module_name => 'create_alias_definition'
80         ,p_hook_type   => 'BP'
81         );
82   end;
83   --
84   if g_debug then
85 	hr_utility.set_location(l_proc, 30);
86   end if;
87   --
88   -- Validation in addition to Row Handlers
89   --
90 
91 
92 
93   --
94   -- Process Logic
95   --
96   if g_debug then
97 	hr_utility.set_location(l_proc, 40);
98   end if;
99   --
100   -- call row handler to insert record.
101   --
102   hxc_had_ins.ins
103   (p_alias_definition_name          => p_alias_definition_name
104   ,p_alias_context_code             => p_alias_context_code
105   ,p_business_group_id              => p_business_group_id
106   ,p_legislation_code               => p_legislation_code
107   ,p_timecard_field                 => p_timecard_field
108   ,p_description                    => p_description
109   ,p_prompt                         => p_prompt
110   ,p_alias_definition_id            => l_alias_definition_id
111   ,p_object_version_number          => l_object_version_number
112   ,p_alias_type_id                 => p_alias_type_id
113   );
114 
115 /*
116   -- Call row handler to insert into translated tables
117   --
118   hxc_dtl_ins.ins_tl
119   (p_language_code                  => l_language_code
120   ,p_alias_definition_id            => l_alias_definition_id
121   ,p_alias_definition_name          => p_alias_definition_name
122   ,p_description                    => p_description
123   );
124 */
125   --
126   -- Call After Process User Hook
127   --
128   if g_debug then
129 	hr_utility.set_location(l_proc, 50);
130   end if;
131   --
132   begin
133     hxc_alias_definitions_bk_1.create_alias_definition_a
134       (p_alias_definition_id           => l_alias_definition_id
135       ,p_alias_definition_name	       => p_alias_definition_name
136       ,p_alias_context_code            => p_alias_context_code
137       ,p_business_group_id             => p_business_group_id
138       ,p_legislation_code              => p_legislation_code
139       ,p_description		       => p_description
140       ,p_prompt                        => p_prompt
141       ,p_timecard_field		       => p_timecard_field
142       ,p_object_version_number         => l_object_version_number
143       ,p_language_code                 => l_language_code
144       ,p_alias_type_id                 => p_alias_type_id
145       );
146   exception
147     when hr_api.cannot_find_prog_unit then
148       hr_api.cannot_find_prog_unit_error
149         (p_module_name => 'create_alias_definition'
150         ,p_hook_type   => 'AP'
151         );
152   end;
153   --
154   -- When in validation only mode raise the Validate_Enabled exception
155   --
156   if p_validate then
157     raise hr_api.validate_enabled;
158   end if;
159   --
160   -- Set all output arguments
161   --
162   p_alias_definition_id    := l_alias_definition_id;
163   p_object_version_number  := l_object_version_number;
164   --
165   if g_debug then
166 	hr_utility.set_location(' Leaving:'||l_proc, 70);
167   end if;
168 exception
169   when hr_api.validate_enabled then
170     --
171     -- As the Validate_Enabled exception has been raised
172     -- we must rollback to the savepoint
173     --
174     rollback to create_alias_definition;
175     --
176     -- Only set output warning arguments
177     -- (Any key or derived arguments must be set to null
178     -- when validation only mode is being used.)
179     --
180     p_alias_definition_id    := null;
181     p_object_version_number  := null;
182     -- p_some_warning           := <local_var_set_in_process_logic>
183     if g_debug then
184 	hr_utility.set_location(' Leaving:'||l_proc, 80);
185     end if;
186   when others then
187     --
188     -- A validation or unexpected error has occured
189     --
190     rollback to create_alias_definition;
191     if g_debug then
192 	hr_utility.set_location(' Leaving:'||l_proc, 90);
193     end if;
194     raise;
195 end create_alias_definition;
196 --
197 -- ----------------------------------------------------------------------------
198 -- |------------------------< update_alias_definition >-----------------------|
199 -- ----------------------------------------------------------------------------
200 --
201 procedure update_alias_definition
202   (p_validate                      in     boolean  default false
203   ,p_alias_definition_id           in     number
204   ,p_alias_definition_name         in     varchar2
205   ,p_alias_context_code            in     varchar2  default null
206   ,p_business_group_id             in     number   default null
207   ,p_legislation_code              in     varchar2 default null
208   ,p_description                   in     varchar2 default null
209   ,p_prompt                        in     varchar2 default null
210   ,p_timecard_field                in     varchar2
211   ,p_object_version_number         in out nocopy number
212   ,p_language_code                 in     varchar2  default hr_api.userenv_lang
213   ,p_alias_type_id 		   in     number
214   ) is
215   --
216   -- Declare cursors and local variables
217   --
218 
219   l_proc                varchar2(72);
220   l_object_version_number hxc_alias_definitions.object_version_number%TYPE := p_object_version_number;
221   l_language_code         hxc_alias_definitions_tl.language%TYPE;
222 
223 begin
224   g_debug:=hr_utility.debug_enabled;
225   if g_debug then
226 	l_proc := g_package||'update_alias_definition';
227 	hr_utility.set_location('Entering:'|| l_proc, 10);
228   end if;
229   --
230   -- Issue a savepoint
231   --
232   savepoint update_alias_definition;
233   --
234   -- Truncate the time portion from all IN date parameters
235   --
236 
237   -- Validate the language parameter.  l_language_code should be passed
238   -- to functions instead of p_language_code from now on, to allow
239   -- an IN OUT parameter to be passed through.
240   --
241   l_language_code := p_language_code;
242   hr_api.validate_language_code(p_language_code => l_language_code);
243   --
244 
245   --
246   -- Call Before Process User Hook
247   --
248   if g_debug then
249 	hr_utility.set_location('Entering:'|| l_proc, 20);
250   end if;
251   --
252   begin
253     hxc_alias_definitions_bk_1.update_alias_definition_b
254       (p_alias_definition_id	       => p_alias_definition_id
255       ,p_alias_definition_name         => p_alias_definition_name
256       ,p_alias_context_code            => p_alias_context_code
257       ,p_business_group_id             => p_business_group_id
258       ,p_legislation_code              => p_legislation_code
259       ,p_description                   => p_description
260       ,p_prompt                        => p_prompt
261       ,p_timecard_field                => p_timecard_field
262       ,p_object_version_number	       => p_object_version_number
263       ,p_language_code                 => l_language_code
264       ,p_alias_type_id   	       => p_alias_type_id
265       );
266   exception
267     when hr_api.cannot_find_prog_unit then
268       hr_api.cannot_find_prog_unit_error
269         (p_module_name => 'update_alias_definition'
270         ,p_hook_type   => 'BP'
271         );
272   end;
273   --
274   if g_debug then
275 	hr_utility.set_location(l_proc, 30);
276   end if;
277   --
278   -- Validation in addition to Row Handlers
279   --
280 
281 
282 
283   --
284   -- Process Logic
285   --
286   if g_debug then
287 	hr_utility.set_location(l_proc, 40);
288   end if;
289   --
290   -- call row handler to update record.
291   --
292   hxc_had_upd.upd
293   (p_alias_definition_id            => p_alias_definition_id
294   ,p_object_version_number          => l_object_version_number
295   ,p_alias_definition_name          => p_alias_definition_name
296   ,p_alias_context_code            => p_alias_context_code
297   ,p_business_group_id              => p_business_group_id
298   ,p_legislation_code               => p_legislation_code
299   ,p_timecard_field                 => p_timecard_field
300   ,p_description                    => p_description
301   ,p_prompt                         => p_prompt
302   ,p_alias_type_id		    => p_alias_type_id
303   );
304   --
305   -- Call row handler to update into translated tables
306   --
307 /*
308   hxc_dtl_upd.upd_tl
309   (p_language_code                  => l_language_code
310   ,p_alias_definition_id            => p_alias_definition_id
311   ,p_alias_definition_name          => p_alias_definition_name
312   ,p_description                    => p_description
313   );
314 */
315   --
316   -- Call After Process User Hook
317   --
318   if g_debug then
319 	hr_utility.set_location(l_proc, 50);
320   end if;
321   --
322   begin
323     hxc_alias_definitions_bk_1.update_alias_definition_a
324       (p_alias_definition_id           => p_alias_definition_id
325       ,p_alias_definition_name         => p_alias_definition_name
326       ,p_alias_context_code            => p_alias_context_code
327       ,p_business_group_id             => p_business_group_id
328       ,p_legislation_code              => p_legislation_code
329       ,p_description                   => p_description
330       ,p_prompt                        => p_prompt
331       ,p_timecard_field                => p_timecard_field
332       ,p_object_version_number         => l_object_version_number
333       ,p_language_code                 => l_language_code
334       ,p_alias_type_id		       => p_alias_type_id
335       );
336   exception
337     when hr_api.cannot_find_prog_unit then
338       hr_api.cannot_find_prog_unit_error
339         (p_module_name => 'update_alias_definition'
340         ,p_hook_type   => 'AP'
341         );
342   end;
343   --
344   -- When in validation only mode raise the Validate_Enabled exception
345   --
346   if p_validate then
347     raise hr_api.validate_enabled;
348   end if;
349   --
350   -- Set all output arguments
351   --
352   p_object_version_number  := l_object_version_number;
353   -- p_some_warning           := <local_var_set_in_process_logic>
354   --
355   if g_debug then
356 	hr_utility.set_location(' Leaving:'||l_proc, 70);
357   end if;
358 exception
359   when hr_api.validate_enabled then
360     --
361     -- As the Validate_Enabled exception has been raised
362     -- we must rollback to the savepoint
363     --
364     rollback to update_alias_definition;
365     --
366     -- Only set output warning arguments
367     -- (Any key or derived arguments must be set to null
368     -- when validation only mode is being used.)
369     --
370     p_object_version_number  := null;
371     -- p_some_warning           := <local_var_set_in_process_logic>
372     if g_debug then
373 	hr_utility.set_location(' Leaving:'||l_proc, 80);
374     end if;
375   when others then
376     --
377     -- A validation or unexpected error has occured
378     --
379     rollback to update_alias_definition;
380     if g_debug then
381 	hr_utility.set_location(' Leaving:'||l_proc, 90);
382     end if;
383     raise;
384 end update_alias_definition;
385 --
386 -- ----------------------------------------------------------------------------
387 -- |------------------------< delete_alias_definition >------------------------|
388 -- ----------------------------------------------------------------------------
389 --
390 procedure delete_alias_definition
391   (p_validate                      in     boolean  default false
392   ,p_alias_definition_id           in     number
393   ,p_object_version_number         in     number
394   ) is
395   --
396   -- Declare cursors and local variables
397   --
398 
399   l_proc                varchar2(72);
400 
401 begin
402   g_debug:=hr_utility.debug_enabled;
403   if g_debug then
404 	l_proc := g_package||'delete_alias_definition';
405 	hr_utility.set_location('Entering:'|| l_proc, 10);
406   end if;
407   --
408   -- Issue a savepoint
409   --
410   savepoint delete_alias_definition;
411   --
412   -- Truncate the time portion from all IN date parameters
413   --
414 
415   --
416   -- Call Before Process User Hook
417   --
418   if g_debug then
419 	hr_utility.set_location('Entering:'|| l_proc, 20);
420   end if;
421   --
422   begin
423     hxc_alias_definitions_bk_1.delete_alias_definition_b
424       (p_alias_definition_id           => p_alias_definition_id
425       ,p_object_version_number         => p_object_version_number
426       );
427   exception
428     when hr_api.cannot_find_prog_unit then
429       hr_api.cannot_find_prog_unit_error
430         (p_module_name => 'delete_alias_definition'
431         ,p_hook_type   => 'BP'
432         );
433   end;
434   --
435   if g_debug then
436 	hr_utility.set_location(l_proc, 30);
437   end if;
438   --
439   -- Validation in addition to Row Handlers
440   --
441 
442   --
443   -- Process Logic
444   --
445   if g_debug then
446 	hr_utility.set_location(l_proc, 40);
447   end if;
448   --
449   -- call row handler to delete record.
450   --
451   hxc_had_del.del
452   (p_alias_definition_id            => p_alias_definition_id
453   ,p_object_version_number          => p_object_version_number
454   );
455 
456 /*
457   --  Remove all matching translation rows
458   hxc_dtl_del.del_tl
459   (p_alias_definition_id            => p_alias_definition_id
460   );
461 */  --
462   -- Call After Process User Hook
463   --
464   if g_debug then
465 	hr_utility.set_location(l_proc, 50);
466   end if;
467   --
468   begin
469     hxc_alias_definitions_bk_1.delete_alias_definition_a
470       (p_alias_definition_id           => p_alias_definition_id
471       ,p_object_version_number         => p_object_version_number
472       );
473   exception
474     when hr_api.cannot_find_prog_unit then
475       hr_api.cannot_find_prog_unit_error
476         (p_module_name => 'delete_alias_definition'
477         ,p_hook_type   => 'AP'
478         );
479   end;
480   --
481   -- When in validation only mode raise the Validate_Enabled exception
482   --
483   if p_validate then
484     raise hr_api.validate_enabled;
485   end if;
486   --
487   -- Set all output arguments
488   --
489   --
490   if g_debug then
491 	hr_utility.set_location(' Leaving:'||l_proc, 70);
492   end if;
493 exception
494   when hr_api.validate_enabled then
495     --
496     -- As the Validate_Enabled exception has been raised
497     -- we must rollback to the savepoint
498     --
499     rollback to delete_alias_definition;
500     --
501     -- Only set output warning arguments
502     -- (Any key or derived arguments must be set to null
503     -- when validation only mode is being used.)
504     --
505     if g_debug then
506 	hr_utility.set_location(' Leaving:'||l_proc, 80);
507     end if;
508   when others then
509     --
510     -- A validation or unexpected error has occured
511     --
512     rollback to delete_alias_definition;
513     if g_debug then
514 	hr_utility.set_location(' Leaving:'||l_proc, 90);
515     end if;
516     raise;
517 end delete_alias_definition;
518 --
519 end hxc_alias_definitions_api;