DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_ATTRIBUTES_API

Source


1 Package Body pqh_ATTRIBUTES_api as
2 /* $Header: pqattapi.pkb 115.13 2003/03/25 04:16:57 sgoyal ship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  pqh_ATTRIBUTES_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< create_ATTRIBUTE >----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_ATTRIBUTE
13   (p_validate                       in  boolean   default false
14   ,p_attribute_id                   out nocopy number
15   ,p_attribute_name                 in  varchar2
16   ,p_master_attribute_id            in  number    default null
17   ,p_master_table_route_id          in  number    default null
18   ,p_column_name                    in  varchar2  default null
19   ,p_column_type                    in  varchar2  default null
20   ,p_enable_flag                    in  varchar2  default null
21   ,p_width                          in  number    default null
22   ,p_object_version_number          out nocopy number
23   ,p_effective_date                 in  date
24   ,p_language_code                  in  varchar2  default hr_api.userenv_lang
25   ,p_region_itemname                in varchar2   default null
26   ,p_attribute_itemname             in varchar2   default null
27   ,p_decode_function_name           in varchar2   default null
28   ) is
29   --
30   -- Declare cursors and local variables
31   --
32   l_attribute_id pqh_attributes.attribute_id%TYPE;
33   l_proc varchar2(72) := g_package||'create_ATTRIBUTE';
34   l_object_version_number pqh_attributes.object_version_number%TYPE;
35   --
36 begin
37   --
38   hr_utility.set_location('Entering:'|| l_proc, 10);
39   --
40   -- Issue a savepoint if operating in validation only mode
41   --
42   savepoint create_ATTRIBUTE;
43   --
44   hr_utility.set_location(l_proc, 20);
45   --
46   -- Process Logic
47   --
48   begin
49     --
50     -- Start of API User Hook for the before hook of create_ATTRIBUTE
51     --
52     pqh_ATTRIBUTES_bk1.create_ATTRIBUTE_b
53       (
54        p_attribute_name                 =>  p_attribute_name
55       ,p_master_attribute_id            =>  p_master_attribute_id
56       ,p_master_table_route_id          =>  p_master_table_route_id
57       ,p_column_name                    =>  p_column_name
58       ,p_column_type                    =>  p_column_type
59       ,p_enable_flag                    =>  p_enable_flag
60       ,p_width                          =>  p_width
61       ,p_effective_date                 =>  trunc(p_effective_date)
62       ,p_region_itemname                =>  p_region_itemname
63       ,p_attribute_itemname             =>  p_attribute_itemname
64       ,p_decode_function_name           =>  p_decode_function_name
65       );
66   exception
67     when hr_api.cannot_find_prog_unit then
68       hr_api.cannot_find_prog_unit_error
69         (
70          p_module_name => 'CREATE_ATTRIBUTE'
71         ,p_hook_type   => 'BP'
72         );
73     --
74     -- End of API User Hook for the before hook of create_ATTRIBUTE
75     --
76   end;
77   --
78   pqh_att_ins.ins
79     (
80      p_attribute_id                  => l_attribute_id
81     ,p_attribute_name                => p_attribute_name
82     ,p_master_attribute_id           => p_master_attribute_id
83     ,p_master_table_route_id         => p_master_table_route_id
84     ,p_column_name                   => p_column_name
85     ,p_column_type                   => p_column_type
86     ,p_enable_flag                   => p_enable_flag
87     ,p_width                         => p_width
88     ,p_object_version_number         => l_object_version_number
89     ,p_effective_date                => trunc(p_effective_date)
90     ,p_region_itemname               => p_region_itemname
91     ,p_attribute_itemname            => p_attribute_itemname
92     ,p_decode_function_name          => p_decode_function_name
93     );
94   --
95     p_attribute_id  := l_attribute_id ;
96   --
97     pqh_atl_ins.ins_tl(
98        p_language_code  => p_language_code,
99        p_attribute_id   => l_attribute_id ,
100        p_attribute_name => p_attribute_name );
101 
102   begin
103     --
104     -- Start of API User Hook for the after hook of create_ATTRIBUTE
105     --
106     pqh_ATTRIBUTES_bk1.create_ATTRIBUTE_a
107       (
108        p_attribute_id                   =>  l_attribute_id
109       ,p_attribute_name                 =>  p_attribute_name
110       ,p_master_attribute_id            =>  p_master_attribute_id
111       ,p_master_table_route_id          =>  p_master_table_route_id
112       ,p_column_name                    =>  p_column_name
113       ,p_column_type                    =>  p_column_type
114       ,p_enable_flag                    =>  p_enable_flag
115       ,p_width                          =>  p_width
116       ,p_object_version_number          =>  l_object_version_number
117       ,p_effective_date                 => trunc(p_effective_date)
118     ,p_region_itemname               => p_region_itemname
119     ,p_attribute_itemname            => p_attribute_itemname
120     ,p_decode_function_name          => p_decode_function_name
121       );
122   exception
123     when hr_api.cannot_find_prog_unit then
124       hr_api.cannot_find_prog_unit_error
125         (p_module_name => 'CREATE_ATTRIBUTE'
126         ,p_hook_type   => 'AP'
127         );
128     --
129     -- End of API User Hook for the after hook of create_ATTRIBUTE
130     --
131   end;
132   --
133   hr_utility.set_location(l_proc, 60);
134   --
135   -- When in validation only mode raise the Validate_Enabled exception
136   --
137   if p_validate then
138     raise hr_api.validate_enabled;
139   end if;
140   --
141   -- Set all output arguments
142   --
143   p_attribute_id := l_attribute_id;
144   p_object_version_number := l_object_version_number;
145   --
146   hr_utility.set_location(' Leaving:'||l_proc, 70);
147   --
148 exception
149   --
150   when hr_api.validate_enabled then
151     --
152     -- As the Validate_Enabled exception has been raised
153     -- we must rollback to the savepoint
154     --
155     ROLLBACK TO create_ATTRIBUTE;
156     --
157     -- Only set output warning arguments
158     -- (Any key or derived arguments must be set to null
159     -- when validation only mode is being used.)
160     --
161     p_attribute_id := null;
162     p_object_version_number  := null;
163     hr_utility.set_location(' Leaving:'||l_proc, 80);
164     --
165   when others then
166     p_attribute_id := null;
167     p_object_version_number  := null;
168     --
169     -- A validation or unexpected error has occured
170     --
171     ROLLBACK TO create_ATTRIBUTE;
172     raise;
173     --
174 end create_ATTRIBUTE;
175 -- ----------------------------------------------------------------------------
176 -- |------------------------< update_ATTRIBUTE >--- ------------------|
177 -- ----------------------------------------------------------------------------
178 --
179 procedure update_ATTRIBUTE
180   (p_validate                       in  boolean   default false
181   ,p_attribute_id                   in  number
182   ,p_attribute_name                 in  varchar2  default hr_api.g_varchar2
183   ,p_master_attribute_id            in  number    default hr_api.g_number
184   ,p_master_table_route_id          in  number    default hr_api.g_number
185   ,p_column_name                    in  varchar2  default hr_api.g_varchar2
186   ,p_column_type                    in  varchar2  default hr_api.g_varchar2
187   ,p_enable_flag                    in  varchar2  default hr_api.g_varchar2
188   ,p_width                          in  number    default hr_api.g_number
189   ,p_object_version_number          in out nocopy number
190   ,p_effective_date                 in  date
191   ,p_language_code                  in  varchar2  default hr_api.userenv_lang
192   ,p_region_itemname                in varchar2   default hr_api.g_varchar2
193   ,p_attribute_itemname             in varchar2   default hr_api.g_varchar2
194   ,p_decode_function_name           in varchar2   default hr_api.g_varchar2
195   ) is
196   --
197   -- Declare cursors and local variables
198   --
199   l_proc varchar2(72) := g_package||'update_ATTRIBUTE';
200   l_object_version_number pqh_attributes.object_version_number%TYPE;
201   --
202 begin
203   --
204   hr_utility.set_location('Entering:'|| l_proc, 10);
205   --
206   -- Issue a savepoint if operating in validation only mode
207   --
208   savepoint update_ATTRIBUTE;
209   --
210   hr_utility.set_location(l_proc, 20);
211   --
212   -- Process Logic
213   --
214   l_object_version_number := p_object_version_number;
215   --
216   begin
217     --
218     -- Start of API User Hook for the before hook of update_ATTRIBUTE
219     --
220     pqh_ATTRIBUTES_bk2.update_ATTRIBUTE_b
221       (
222        p_attribute_id                   =>  p_attribute_id
223       ,p_attribute_name                 =>  p_attribute_name
224       ,p_master_attribute_id            =>  p_master_attribute_id
225       ,p_master_table_route_id          =>  p_master_table_route_id
226       ,p_column_name                    =>  p_column_name
227       ,p_column_type                    =>  p_column_type
228       ,p_enable_flag                    =>  p_enable_flag
229       ,p_width                          =>  p_width
230       ,p_object_version_number          =>  p_object_version_number
231     ,p_effective_date                 => trunc(p_effective_date)
232     ,p_region_itemname               => p_region_itemname
233     ,p_attribute_itemname            => p_attribute_itemname
234     ,p_decode_function_name          => p_decode_function_name
235       );
236   exception
237     when hr_api.cannot_find_prog_unit then
238       hr_api.cannot_find_prog_unit_error
239         (p_module_name => 'UPDATE_ATTRIBUTE'
240         ,p_hook_type   => 'BP'
241         );
242     --
243     -- End of API User Hook for the before hook of update_ATTRIBUTE
244     --
245   end;
246   --
247   pqh_att_upd.upd
248     (
249      p_attribute_id                  => p_attribute_id
250     ,p_attribute_name                => p_attribute_name
251     ,p_master_attribute_id           => p_master_attribute_id
252     ,p_master_table_route_id         => p_master_table_route_id
253     ,p_column_name                   => p_column_name
254     ,p_column_type                   => p_column_type
255     ,p_enable_flag                   => p_enable_flag
256     ,p_width                         => p_width
257     ,p_object_version_number         => l_object_version_number
258     ,p_effective_date                => trunc(p_effective_date)
259     ,p_region_itemname               => p_region_itemname
260     ,p_attribute_itemname            => p_attribute_itemname
261     ,p_decode_function_name          => p_decode_function_name
262     );
263   --
264      pqh_atl_upd.upd_tl
265        (
266        p_language_code  => p_language_code,
267        p_attribute_id   => p_attribute_id ,
268        p_attribute_name => p_attribute_name );
269   --
270 
271   begin
272     --
273     -- Start of API User Hook for the after hook of update_ATTRIBUTE
274     --
275     pqh_ATTRIBUTES_bk2.update_ATTRIBUTE_a
276       (
277        p_attribute_id                   =>  p_attribute_id
278       ,p_attribute_name                 =>  p_attribute_name
279       ,p_master_attribute_id            =>  p_master_attribute_id
280       ,p_master_table_route_id          =>  p_master_table_route_id
281       ,p_column_name                    =>  p_column_name
282       ,p_column_type                    =>  p_column_type
283       ,p_enable_flag                    =>  p_enable_flag
284       ,p_width                          =>  p_width
285       ,p_object_version_number          =>  l_object_version_number
286       ,p_effective_date                => trunc(p_effective_date)
287     ,p_region_itemname               => p_region_itemname
288     ,p_attribute_itemname            => p_attribute_itemname
289     ,p_decode_function_name          => p_decode_function_name
290       );
291   exception
292     when hr_api.cannot_find_prog_unit then
293       hr_api.cannot_find_prog_unit_error
294         (p_module_name => 'UPDATE_ATTRIBUTE'
295         ,p_hook_type   => 'AP'
296         );
297     --
298     -- End of API User Hook for the after hook of update_ATTRIBUTE
299     --
300   end;
301   --
302   hr_utility.set_location(l_proc, 60);
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   -- Set all output arguments
311   --
312   p_object_version_number := l_object_version_number;
313   --
314   hr_utility.set_location(' Leaving:'||l_proc, 70);
315   --
316 exception
317   --
318   when hr_api.validate_enabled then
319     --
320     -- As the Validate_Enabled exception has been raised
321     -- we must rollback to the savepoint
322     --
323     ROLLBACK TO update_ATTRIBUTE;
324     --
325     -- Only set output warning arguments
326     -- (Any key or derived arguments must be set to null
327     -- when validation only mode is being used.)
328     --
329     hr_utility.set_location(' Leaving:'||l_proc, 80);
330     --
331   when others then
332   p_object_version_number := l_object_version_number;
333     --
334     -- A validation or unexpected error has occured
335     --
336     ROLLBACK TO update_ATTRIBUTE;
337     raise;
338     --
339 end update_ATTRIBUTE;
340 -- ----------------------------------------------------------------------------
341 -- |------------------------< delete_ATTRIBUTE >----------------------|
342 -- ----------------------------------------------------------------------------
343 --
344 procedure delete_ATTRIBUTE
345   (p_validate                       in  boolean  default false
346   ,p_attribute_id                   in  number
347   ,p_object_version_number          in  number
348   ,p_effective_date                 in  date
349   ) is
350   --
351   -- Declare cursors and local variables
352   --
353   l_proc varchar2(72) := g_package||'delete_ATTRIBUTE';
354   l_object_version_number pqh_attributes.object_version_number%TYPE;
355   --
356 begin
357   --
358   hr_utility.set_location('Entering:'|| l_proc, 10);
359   --
360   -- Issue a savepoint if operating in validation only mode
361   --
362   savepoint delete_ATTRIBUTE;
363   --
364   hr_utility.set_location(l_proc, 20);
365   --
366   -- Process Logic
367   --
368   l_object_version_number := p_object_version_number;
369   --
370   --
371   begin
372     --
373     -- Start of API User Hook for the before hook of delete_ATTRIBUTE
374     --
375     pqh_ATTRIBUTES_bk3.delete_ATTRIBUTE_b
376       (
377        p_attribute_id                   =>  p_attribute_id
378       ,p_object_version_number          =>  p_object_version_number
379     ,p_effective_date                      => trunc(p_effective_date)
380       );
381   exception
382     when hr_api.cannot_find_prog_unit then
383       hr_api.cannot_find_prog_unit_error
384         (p_module_name => 'DELETE_ATTRIBUTE'
385         ,p_hook_type   => 'BP'
386         );
387     --
388     -- End of API User Hook for the before hook of delete_ATTRIBUTE
389     --
390   end;
391   --
392   --
393   pqh_att_shd.lck
394     (
395       p_attribute_id               => p_attribute_id
396      ,p_object_version_number      => p_object_version_number
397     );
398   --
399   pqh_atl_del.del_tl
400     (
401        p_attribute_id               => p_attribute_id
402     );
403   --
404   pqh_att_del.del
405     (
406      p_attribute_id                  => p_attribute_id
407     ,p_object_version_number         => l_object_version_number
408     ,p_effective_date                => p_effective_date
409     );
410   --
411 
412   begin
413     --
414     -- Start of API User Hook for the after hook of delete_ATTRIBUTE
415     --
416     pqh_ATTRIBUTES_bk3.delete_ATTRIBUTE_a
417       (
418        p_attribute_id                   =>  p_attribute_id
419       ,p_object_version_number          =>  l_object_version_number
420     ,p_effective_date                      => trunc(p_effective_date)
421       );
422   exception
423     when hr_api.cannot_find_prog_unit then
424       hr_api.cannot_find_prog_unit_error
425         (p_module_name => 'DELETE_ATTRIBUTE'
426         ,p_hook_type   => 'AP'
427         );
428     --
429     -- End of API User Hook for the after hook of delete_ATTRIBUTE
430     --
431   end;
432   --
433   hr_utility.set_location(l_proc, 60);
434   --
435   -- When in validation only mode raise the Validate_Enabled exception
436   --
437   if p_validate then
438     raise hr_api.validate_enabled;
439   end if;
440   --
441   hr_utility.set_location(' Leaving:'||l_proc, 70);
442   --
443 exception
444   --
445   when hr_api.validate_enabled then
446     --
447     -- As the Validate_Enabled exception has been raised
448     -- we must rollback to the savepoint
449     --
450     ROLLBACK TO delete_ATTRIBUTE;
451     --
452     -- Only set output warning arguments
453     -- (Any key or derived arguments must be set to null
454     -- when validation only mode is being used.)
455     --
456     --
457   when others then
458     --
459     -- A validation or unexpected error has occured
460     --
461     ROLLBACK TO delete_ATTRIBUTE;
462     raise;
463     --
464 end delete_ATTRIBUTE;
465 --
466 -- ----------------------------------------------------------------------------
467 -- |-------------------------------< lck >------------------------------------|
468 -- ----------------------------------------------------------------------------
469 --
470 procedure lck
471   (
472    p_attribute_id                   in     number
473   ,p_object_version_number          in     number
474   ) is
475   --
476   --
477   -- Declare cursors and local variables
478   --
479   l_proc varchar2(72) := g_package||'lck';
480   --
481 begin
482   --
483   hr_utility.set_location('Entering:'|| l_proc, 10);
484   --
485   pqh_att_shd.lck
486     (
487       p_attribute_id                 => p_attribute_id
488      ,p_object_version_number      => p_object_version_number
489     );
490   --
491   hr_utility.set_location(' Leaving:'||l_proc, 70);
492   --
493 end lck;
494 --
495 end pqh_ATTRIBUTES_api;