DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_TEMPLATES_API

Source


1 Package Body pqh_TEMPLATES_api as
2 /* $Header: pqtemapi.pkb 115.11 2002/12/03 20:43:42 rpasapul noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  pqh_TEMPLATES_api.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |------------------------< create_GENERIC_TEMPLATE >----------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_GENERIC_TEMPLATE
13   (p_validate                       in  boolean   default false
14   ,p_template_name                  in  varchar2
15   ,p_short_name                     in  varchar2
16   ,p_template_id                    out nocopy number
17   ,p_attribute_only_flag            in  varchar2  default null
18   ,p_enable_flag                    in  varchar2  default 'Y'
19   ,p_create_flag                    in  varchar2  default null
20   ,p_transaction_category_id        in  number
21   ,p_under_review_flag              in  varchar2  default null
22   ,p_object_version_number          out nocopy number
23   ,p_freeze_status_cd               in  varchar2  default null
24   ,p_template_type_cd               in  varchar2
25   ,p_legislation_code               in  varchar2  default null
26   ,p_effective_date                 in  date
27   ,p_language_code                  in  varchar2  default hr_api.userenv_lang
28   ) is
29   --
30   -- Declare cursors and local variables
31   --
32   l_template_id pqh_templates.template_id%TYPE;
33   l_proc varchar2(72) := g_package||'create_GENERIC_TEMPLATE';
34   l_object_version_number pqh_templates.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_TEMPLATES;
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_GENERIC_TEMPLATE
51     --
52     PQH_TEMPLATES_BK1.create_GENERIC_TEMPLATE_b
53       (
54        p_template_name                  =>  p_template_name
55       ,p_short_name                  =>  p_short_name
56       ,p_attribute_only_flag            =>  p_attribute_only_flag
57       ,p_enable_flag                    =>  p_enable_flag
58       ,p_create_flag                    =>  p_create_flag
59       ,p_transaction_category_id        =>  p_transaction_category_id
60       ,p_under_review_flag              =>  p_under_review_flag
61       ,p_freeze_status_cd               =>  p_freeze_status_cd
62       ,p_template_type_cd               =>  p_template_type_cd
63       ,p_legislation_code               =>  p_legislation_code
64       ,p_effective_date               => trunc(p_effective_date)
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_GENERIC_TEMPLATE'
71         ,p_hook_type   => 'BP'
72         );
73     --
74     -- End of API User Hook for the before hook of create_GENERIC_TEMPLATE
75     --
76   end;
77   --
78   pqh_tem_ins.ins
79     (
80      p_template_id                   => l_template_id
81     ,p_template_name                 => p_template_name
82       ,p_short_name                  =>  p_short_name
83     ,p_attribute_only_flag           => p_attribute_only_flag
84     ,p_enable_flag                   => p_enable_flag
85     ,p_create_flag                   => p_create_flag
86     ,p_transaction_category_id       => p_transaction_category_id
87     ,p_under_review_flag             => p_under_review_flag
88     ,p_object_version_number         => l_object_version_number
89     ,p_freeze_status_cd              => p_freeze_status_cd
90     ,p_template_type_cd              => p_template_type_cd
91     ,p_legislation_code              => p_legislation_code
92     ,p_effective_date                => trunc(p_effective_date)
93     );
94   --
95   p_template_id := l_template_id;
96   --
97   pqh_ttl_ins.ins_tl
98        (
99        p_language_code         => p_language_code,
100        p_template_id           => l_template_id ,
101        p_template_name         => p_template_name );
102   --
103 
104   begin
105     --
106     -- Start of API User Hook for the after hook of create_GENERIC_TEMPLATE
107     --
108     PQH_TEMPLATES_BK1.create_GENERIC_TEMPLATE_a
109       (
110        p_template_name                  =>  p_template_name
111       ,p_short_name                  =>  p_short_name
112       ,p_template_id                    =>  l_template_id
113       ,p_attribute_only_flag            =>  p_attribute_only_flag
114       ,p_enable_flag                    =>  p_enable_flag
115       ,p_create_flag                    =>  p_create_flag
116       ,p_transaction_category_id        =>  p_transaction_category_id
117       ,p_under_review_flag              =>  p_under_review_flag
118       ,p_object_version_number          =>  l_object_version_number
119       ,p_freeze_status_cd               =>  p_freeze_status_cd
120       ,p_template_type_cd               =>  p_template_type_cd
121       ,p_legislation_code               =>  p_legislation_code
122       ,p_effective_date                 => trunc(p_effective_date)
123       );
124   exception
125     when hr_api.cannot_find_prog_unit then
126       hr_api.cannot_find_prog_unit_error
127         (p_module_name => 'CREATE_GENERIC_TEMPLATE'
128         ,p_hook_type   => 'AP'
129         );
130     --
131     -- End of API User Hook for the after hook of create_GENERIC_TEMPLATE
132     --
133   end;
134   --
135   hr_utility.set_location(l_proc, 60);
136   --
137   -- When in validation only mode raise the Validate_Enabled exception
138   --
139   if p_validate then
140     raise hr_api.validate_enabled;
141   end if;
142   --
143   -- Set all output arguments
144   --
145   p_template_id := l_template_id;
146   p_object_version_number := l_object_version_number;
147   --
148   hr_utility.set_location(' Leaving:'||l_proc, 70);
149   --
150 exception
151   --
152   when hr_api.validate_enabled then
153     --
154     -- As the Validate_Enabled exception has been raised
155     -- we must rollback to the savepoint
156     --
157     ROLLBACK TO create_TEMPLATES;
158     --
159     -- Only set output warning arguments
160     -- (Any key or derived arguments must be set to null
161     -- when validation only mode is being used.)
162     --
163     p_template_id := null;
164     p_object_version_number  := null;
165     hr_utility.set_location(' Leaving:'||l_proc, 80);
166     --
167   when others then
168     p_template_id := null;
169     p_object_version_number  := null;
170     --
171     -- A validation or unexpected error has occured
172     --
173     ROLLBACK TO create_TEMPLATES;
174     raise;
175     --
176 end create_GENERIC_TEMPLATE;
177 -- ----------------------------------------------------------------------------
178 -- |------------------------< update_GENERIC_TEMPLATE >--- ------------------|
179 -- ----------------------------------------------------------------------------
180 --
181 procedure update_GENERIC_TEMPLATE
182   (p_validate                       in  boolean   default false
183   ,p_template_name                  in  varchar2  default hr_api.g_varchar2
184   ,p_short_name                     in  varchar2  default hr_api.g_varchar2
185   ,p_template_id                    in  number
186   ,p_attribute_only_flag            in  varchar2  default hr_api.g_varchar2
187   ,p_enable_flag                    in  varchar2  default hr_api.g_varchar2
188   ,p_create_flag                    in  varchar2  default hr_api.g_varchar2
189   ,p_transaction_category_id        in  number    default hr_api.g_number
190   ,p_under_review_flag              in  varchar2  default hr_api.g_varchar2
191   ,p_object_version_number          in out nocopy number
192   ,p_freeze_status_cd               in  varchar2  default hr_api.g_varchar2
193   ,p_template_type_cd               in  varchar2
194   ,p_legislation_code               in  varchar2  default hr_api.g_varchar2
195   ,p_effective_date                 in  date
196   ,p_language_code                  in  varchar2  default hr_api.userenv_lang
197   ) is
198   --
199   -- Declare cursors and local variables
200   --
201   l_proc varchar2(72) := g_package||'update_GENERIC_TEMPLATE';
202   l_object_version_number pqh_templates.object_version_number%TYPE;
203   --
204 begin
205   --
206   hr_utility.set_location('Entering:'|| l_proc, 10);
207   --
208   -- Issue a savepoint if operating in validation only mode
209   --
210   savepoint update_TEMPLATES;
211   --
212   hr_utility.set_location(l_proc, 20);
213   --
214   -- Process Logic
215   --
216   l_object_version_number := p_object_version_number;
217   --
218   begin
219     --
220     -- Start of API User Hook for the before hook of update_GENERIC_TEMPLATE
221     --
222     pqh_TEMPLATES_bk2.update_GENERIC_TEMPLATE_b
223       (
224        p_template_name                  =>  p_template_name
225       ,p_short_name                     =>  p_short_name
226       ,p_template_id                    =>  p_template_id
227       ,p_attribute_only_flag            =>  p_attribute_only_flag
228       ,p_enable_flag                    =>  p_enable_flag
229       ,p_create_flag                    =>  p_create_flag
230       ,p_transaction_category_id        =>  p_transaction_category_id
231       ,p_under_review_flag              =>  p_under_review_flag
232       ,p_object_version_number          =>  p_object_version_number
233       ,p_freeze_status_cd               =>  p_freeze_status_cd
234       ,p_template_type_cd               =>  p_template_type_cd
235       ,p_legislation_code               =>  p_legislation_code
236     ,p_effective_date                 => trunc(p_effective_date)
237       );
238   exception
239     when hr_api.cannot_find_prog_unit then
240       hr_api.cannot_find_prog_unit_error
241         (p_module_name => 'UPDATE_GENERIC_TEMPLATE'
242         ,p_hook_type   => 'BP'
243         );
244     --
245     -- End of API User Hook for the before hook of update_GENERIC_TEMPLATE
246     --
247   end;
248   --
249   pqh_tem_upd.upd
250     (
251      p_template_id                   => p_template_id
252     ,p_template_name                 => p_template_name
253       ,p_short_name                     =>  p_short_name
254     ,p_attribute_only_flag           => p_attribute_only_flag
255     ,p_enable_flag                   => p_enable_flag
256     ,p_create_flag                   => p_create_flag
257     ,p_transaction_category_id       => p_transaction_category_id
258     ,p_under_review_flag             => p_under_review_flag
259     ,p_object_version_number         => l_object_version_number
260     ,p_freeze_status_cd              => p_freeze_status_cd
261     ,p_template_type_cd              => p_template_type_cd
262     ,p_legislation_code              => p_legislation_code
263     ,p_effective_date                => trunc(p_effective_date)
264     );
265    --
266   pqh_ttl_upd.upd_tl
267        (
268        p_language_code             => p_language_code,
269        p_template_id               => p_template_id ,
270        p_template_name             => p_template_name );
271   --
272 
273   begin
274     --
275     -- Start of API User Hook for the after hook of update_GENERIC_TEMPLATE
276     --
277     pqh_TEMPLATES_bk2.update_GENERIC_TEMPLATE_a
278       (
279        p_template_name                  =>  p_template_name
280       ,p_short_name                     =>  p_short_name
281       ,p_template_id                    =>  p_template_id
282       ,p_attribute_only_flag            =>  p_attribute_only_flag
283       ,p_enable_flag                    =>  p_enable_flag
284       ,p_create_flag                    =>  p_create_flag
285       ,p_transaction_category_id        =>  p_transaction_category_id
286       ,p_under_review_flag              =>  p_under_review_flag
287       ,p_object_version_number          =>  l_object_version_number
288       ,p_freeze_status_cd               =>  p_freeze_status_cd
289       ,p_template_type_cd               =>  p_template_type_cd
290       ,p_legislation_code               =>  p_legislation_code
291       ,p_effective_date                => trunc(p_effective_date)
292       );
293   exception
294     when hr_api.cannot_find_prog_unit then
295       hr_api.cannot_find_prog_unit_error
296         (p_module_name => 'UPDATE_GENERIC_TEMPLATE'
297         ,p_hook_type   => 'AP'
298         );
299     --
300     -- End of API User Hook for the after hook of update_GENERIC_TEMPLATE
301     --
302   end;
303   --
304   hr_utility.set_location(l_proc, 60);
305   --
306   -- When in validation only mode raise the Validate_Enabled exception
307   --
308   if p_validate then
309     raise hr_api.validate_enabled;
310   end if;
311   --
312   -- Set all output arguments
313   --
314   p_object_version_number := l_object_version_number;
315   --
316   hr_utility.set_location(' Leaving:'||l_proc, 70);
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_TEMPLATES;
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     hr_utility.set_location(' Leaving:'||l_proc, 80);
332     --
333   when others then
334      p_object_version_number := l_object_version_number;
335     --
336     -- A validation or unexpected error has occured
337     --
338     ROLLBACK TO update_TEMPLATES;
339     raise;
340     --
341 end update_GENERIC_TEMPLATE;
342 -- ----------------------------------------------------------------------------
343 -- |------------------------< delete_GENERIC_TEMPLATE >----------------------|
344 -- ----------------------------------------------------------------------------
345 --
346 procedure delete_GENERIC_TEMPLATE
347   (p_validate                       in  boolean  default false
348   ,p_template_id                    in  number
349   ,p_object_version_number          in  number
350   ,p_effective_date                 in  date
351   ) is
352   --
353   -- Declare cursors and local variables
354   --
355   l_proc varchar2(72) := g_package||'delete_GENERIC_TEMPLATE';
359   --
356   l_object_version_number pqh_templates.object_version_number%TYPE;
357   --
358 begin
360   hr_utility.set_location('Entering:'|| l_proc, 10);
361   --
362   -- Issue a savepoint if operating in validation only mode
363   --
364   savepoint delete_TEMPLATES;
365   --
366   hr_utility.set_location(l_proc, 20);
367   --
368   -- Process Logic
369   --
370   l_object_version_number := p_object_version_number;
371   --
372   --
373   begin
374     --
375     -- Start of API User Hook for the before hook of delete_GENERIC_TEMPLATE
376     --
377     pqh_TEMPLATES_bk3.delete_GENERIC_TEMPLATE_b
378       (
379        p_template_id                    =>  p_template_id
380       ,p_object_version_number          =>  p_object_version_number
381     ,p_effective_date                      => trunc(p_effective_date)
382       );
383   exception
384     when hr_api.cannot_find_prog_unit then
385       hr_api.cannot_find_prog_unit_error
386         (p_module_name => 'DELETE_GENERIC_TEMPLATE'
387         ,p_hook_type   => 'BP'
388         );
389     --
390     -- End of API User Hook for the before hook of delete_GENERIC_TEMPLATE
391     --
392   end;
393   --
394   --
395   -- Lock the base table
396   --
397   pqh_tem_shd.lck
398     (
399       p_template_id                => p_template_id
400      ,p_object_version_number      => p_object_version_number
401     );
402   --
403   -- Delete row from translatable table.
404   --
405   pqh_ttl_del.del_tl
406   (
407    p_template_id   => p_template_id);
408   --
409   -- Delete row from base table.
410   --
411   pqh_tem_del.del
412     (
413      p_template_id                   => p_template_id
414     ,p_object_version_number         => l_object_version_number
415     ,p_effective_date                => p_effective_date
416     );
417   --
418   begin
419     --
420     -- Start of API User Hook for the after hook of delete_GENERIC_TEMPLATE
421     --
422     pqh_TEMPLATES_bk3.delete_GENERIC_TEMPLATE_a
423       (
424        p_template_id                    =>  p_template_id
425       ,p_object_version_number          =>  l_object_version_number
426     ,p_effective_date                      => trunc(p_effective_date)
427       );
428   exception
429     when hr_api.cannot_find_prog_unit then
430       hr_api.cannot_find_prog_unit_error
431         (p_module_name => 'DELETE_GENERIC_TEMPLATE'
432         ,p_hook_type   => 'AP'
433         );
434     --
435     -- End of API User Hook for the after hook of delete_GENERIC_TEMPLATE
436     --
437   end;
438   --
439   hr_utility.set_location(l_proc, 60);
440   --
441   -- When in validation only mode raise the Validate_Enabled exception
442   --
443   if p_validate then
444     raise hr_api.validate_enabled;
445   end if;
446   --
447   hr_utility.set_location(' Leaving:'||l_proc, 70);
448   --
449 exception
450   --
451   when hr_api.validate_enabled then
452     --
453     -- As the Validate_Enabled exception has been raised
454     -- we must rollback to the savepoint
455     --
456     ROLLBACK TO delete_TEMPLATES;
457     --
458     -- Only set output warning arguments
459     -- (Any key or derived arguments must be set to null
460     -- when validation only mode is being used.)
461     --
462     --
463   when others then
464     --
465     -- A validation or unexpected error has occured
466     --
467     ROLLBACK TO delete_TEMPLATES;
468     raise;
469     --
470 end delete_GENERIC_TEMPLATE;
471 --
472 /**
473 -- ----------------------------------------------------------------------------
474 -- |-------------------------------< lck >------------------------------------|
475 -- ----------------------------------------------------------------------------
476 --
477 procedure lck
478   (
479    p_template_id                   in     number
480   ,p_object_version_number          in     number
481   ) is
482   --
483   --
484   -- Declare cursors and local variables
485   --
486   l_proc varchar2(72) := g_package||'lck';
487   --
488 begin
489   --
490   hr_utility.set_location('Entering:'|| l_proc, 10);
491   --
492   pqh_tem_shd.lck
493     (
497   --
494       p_template_id                 => p_template_id
495      ,p_object_version_number      => p_object_version_number
496     );
498   hr_utility.set_location(' Leaving:'||l_proc, 70);
499   --
500 end lck;
501 --
502 **/
503 --
504 end pqh_TEMPLATES_api;