DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_KI_OPTION_TYPES_API

Source


1 Package Body HR_KI_OPTION_TYPES_API as
2 /* $Header: hrotyapi.pkb 115.0 2004/01/09 02:19:43 vkarandi noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'HR_KI_OPTION_TYPES_API';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< CREATE_OPTION_TYPE >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_option_type
13     (p_validate                      in     boolean  default false
14     ,p_language_code                 in     varchar2 default hr_api.userenv_lang
15     ,p_option_type_key               in     varchar2
16     ,p_display_type                  in     varchar2
17     ,p_option_name                   in     varchar2
18     ,p_option_type_id                out    nocopy   number
19     ,p_object_version_number         out    nocopy   number
20   ) is
21   --
22   -- Declare cursors and local variables
23   --
24   l_proc                varchar2(72) := g_package||'create_option_type';
25   l_option_type_id      number;
26   l_language_code       varchar2(30);
27   l_object_version_number number;
28 
29 begin
30   hr_utility.set_location('Entering:'|| l_proc, 10);
31   --
32   -- Issue a savepoint
33   --
34   savepoint create_option_type;
35   --
36   -- Remember IN OUT parameter IN values
37   --
38   --l_in_out_parameter := p_in_out_parameter;
39   l_language_code:=p_language_code;
40 
41   hr_api.validate_language_code(p_language_code => l_language_code);
42 
43   --
44   -- Call Before Process User Hook
45   --
46   begin
47     hr_ki_option_types_bk1.create_option_type_b
48       ( p_language_code   => l_language_code
49        ,p_option_type_key => p_option_type_key
50        ,p_display_type    => p_display_type
51        ,p_option_name     => p_option_name
52       );
53   exception
54     when hr_api.cannot_find_prog_unit then
55       hr_api.cannot_find_prog_unit_error
56         (p_module_name => 'create_option_type'
57         ,p_hook_type   => 'BP'
58         );
59   end;
60 
61   --
62   -- Process Logic
63   --
64   hr_oty_ins.ins
65      (p_option_type_key         => p_option_type_key
66       ,p_display_type            => p_display_type
67       ,p_option_type_id          => l_option_type_id
68       ,p_object_version_number   => l_object_version_number
69       );
70 
71   hr_ott_ins.ins_tl(
72       p_language_code           => l_language_code
73       ,p_option_type_id          => l_option_type_id
74       ,p_option_name             => p_option_name
75       );
76 
77 
78   --
79   -- Call After Process User Hook
80   --
81   begin
82     hr_ki_option_types_bk1.create_option_type_a
83       (
84        p_language_code           =>    l_language_code
85       ,p_option_type_key         =>    p_option_type_key
86       ,p_display_type            =>    p_display_type
87       ,p_option_name             =>    p_option_name
88       ,p_option_type_id          =>    l_option_type_id
89       ,p_object_version_number   =>    l_object_version_number
90       );
91   exception
92     when hr_api.cannot_find_prog_unit then
93       hr_api.cannot_find_prog_unit_error
94         (p_module_name => 'create_option_type'
95         ,p_hook_type   => 'AP'
96         );
97   end;
98   --
99   -- When in validation only mode raise the Validate_Enabled exception
100   --
101   if p_validate then
102     raise hr_api.validate_enabled;
103   end if;
104   --
105   -- Set all IN OUT and OUT parameters with out values
106   --
107   p_option_type_id         := l_option_type_id;
108   p_object_version_number  := l_object_version_number;
109 
110   --
111   hr_utility.set_location(' Leaving:'||l_proc, 70);
112 exception
113   when hr_api.validate_enabled then
114     --
115     -- As the Validate_Enabled exception has been raised
116     -- we must rollback to the savepoint
117     --
118     rollback to create_option_type;
119     --
120     -- Reset IN OUT parameters and set OUT parameters
121     -- (Any key or derived arguments must be set to null
122     -- when validation only mode is being used.)
123     --
124 
125     p_option_type_id         := null;
126     p_object_version_number  := null;
127 
128     hr_utility.set_location(' Leaving:'||l_proc, 80);
129   when others then
130     --
131     -- A validation or unexpected error has occured
132     --
133     rollback to create_option_type;
134     --
135     -- Reset IN OUT parameters and set all
136     -- OUT parameters, including warnings, to null
137     --
138 
139     p_option_type_id         := null;
140     p_object_version_number  := null;
141 
142     hr_utility.set_location(' Leaving:'||l_proc, 90);
143     raise;
144 end create_option_type;
145 --
146 --
147 -- ----------------------------------------------------------------------------
148 -- |--------------------------< UPDATE_OPTION_TYPE >--------------------------|
149 -- ----------------------------------------------------------------------------
150 --
151 procedure update_option_type
152   (p_validate                      in     boolean  default false
153   ,p_language_code                 in     varchar2 default hr_api.userenv_lang
154   ,p_display_type                  in     varchar2 default hr_api.g_varchar2
155   ,p_option_name                   in     varchar2 default hr_api.g_varchar2
156   ,p_option_type_id                in     number
157   ,p_object_version_number         in out nocopy   number
158   ) is
159   --
160   -- Declare cursors and local variables
161   --
162   l_proc                varchar2(72) := g_package||'update_option_type';
163   l_language_code       varchar2(30);
164   l_object_version_number number := p_object_version_number;
165 
166 begin
167   hr_utility.set_location('Entering:'|| l_proc, 10);
168   --
169   -- Issue a savepoint
170   --
171   savepoint update_option_type;
172   --
173   -- Remember IN OUT parameter IN values
174   --
175   --l_in_out_parameter := p_in_out_parameter;
176   l_language_code:=p_language_code;
177 
178   hr_api.validate_language_code(p_language_code => l_language_code);
179 
180   --
181   -- Call Before Process User Hook
182   --
183   begin
184     hr_ki_option_types_bk2.update_option_type_b
185       ( p_language_code          => l_language_code
186        ,p_display_type           => p_display_type
187        ,p_option_name            => p_option_name
188        ,p_option_type_id         => p_option_type_id
189        ,p_object_version_number  => p_object_version_number
190 
191       );
192   exception
193     when hr_api.cannot_find_prog_unit then
194       hr_api.cannot_find_prog_unit_error
195         (p_module_name => 'update_option_type'
196         ,p_hook_type   => 'BP'
197         );
198   end;
199 
200   --
201   -- Process Logic
202   --
203   hr_oty_upd.upd
204      (
205       p_option_type_id          => p_option_type_id
206      ,p_display_type            => p_display_type
207      ,p_object_version_number   => p_object_version_number
208       );
209 
210   hr_ott_upd.upd_tl(
211       p_language_code            => l_language_code
212       ,p_option_type_id          => p_option_type_id
213       ,p_option_name             => p_option_name
214       );
215 
216 
217   --
218   -- Call After Process User Hook
219   --
220   begin
221     hr_ki_option_types_bk2.update_option_type_a
222       (
223        p_language_code           =>    l_language_code
224       ,p_display_type            =>    p_display_type
225       ,p_option_name             =>    p_option_name
226       ,p_option_type_id          =>    p_option_type_id
227       ,p_object_version_number   =>    p_object_version_number
228       );
229   exception
230     when hr_api.cannot_find_prog_unit then
231       hr_api.cannot_find_prog_unit_error
232         (p_module_name => 'update_option_type'
233         ,p_hook_type   => 'AP'
234         );
235   end;
236   --
237   -- When in validation only mode raise the Validate_Enabled exception
238   --
239   if p_validate then
240     raise hr_api.validate_enabled;
241   end if;
242   --
243   -- Set all IN OUT and OUT parameters with out values
244   --
245 
246   --
247   hr_utility.set_location(' Leaving:'||l_proc, 70);
248 exception
249   when hr_api.validate_enabled then
250     --
251     -- As the Validate_Enabled exception has been raised
252     -- we must rollback to the savepoint
253     --
254     rollback to update_option_type;
255     --
256     -- Reset IN OUT parameters and set OUT parameters
257     -- (Any key or derived arguments must be set to null
258     -- when validation only mode is being used.)
259     --
260 
261     p_object_version_number  := l_object_version_number;
262 
263     hr_utility.set_location(' Leaving:'||l_proc, 80);
264   when others then
265     --
266     -- A validation or unexpected error has occured
267     --
268     rollback to update_option_type;
269     --
270     -- Reset IN OUT parameters and set all
271     -- OUT parameters, including warnings, to null
272     --
273 
274     p_object_version_number  := l_object_version_number;
275 
276     hr_utility.set_location(' Leaving:'||l_proc, 90);
277     raise;
278 end update_option_type;
279 --
280 --
281 -- ----------------------------------------------------------------------------
282 -- |--------------------------< DELETE_OPTION_TYPE >--------------------------|
283 -- ----------------------------------------------------------------------------
284 --
285 procedure delete_option_type
286   (
287    p_validate                 in boolean         default false
288   ,p_option_type_id           in number
289   ,p_object_version_number    in number
290   ) is
291   --
292   -- Declare cursors and local variables
293   --
294   l_proc                varchar2(72) := g_package||'delete_option_type';
295 
296 begin
297   hr_utility.set_location('Entering:'|| l_proc, 10);
298   --
299   -- Issue a savepoint
300   --
301   savepoint delete_option_type;
302   --
303   -- Remember IN OUT parameter IN values
304   --
305 
306   -- Call Before Process User Hook
307   --
308   begin
309     hr_ki_option_types_bk3.delete_option_type_b
310       (
311        p_option_type_id          => p_option_type_id
312        ,p_object_version_number  => p_object_version_number
313 
314       );
315   exception
316     when hr_api.cannot_find_prog_unit then
317       hr_api.cannot_find_prog_unit_error
318         (p_module_name => 'delete_option_type'
319         ,p_hook_type   => 'BP'
320         );
321   end;
322 
323   --
324   -- Process Logic
325   --
326   hr_oty_shd.lck
327      (
328       p_option_type_id          => p_option_type_id
329      ,p_object_version_number   => p_object_version_number
330      );
331   hr_ott_del.del_tl(
332       p_option_type_id          => p_option_type_id
333       );
334   hr_oty_del.del
335      (
336       p_option_type_id          => p_option_type_id
337      ,p_object_version_number   => p_object_version_number
338       );
339 
340 
341   --
342   -- Call After Process User Hook
343   --
344   begin
345     hr_ki_option_types_bk3.delete_option_type_a
346       (
347        p_option_type_id          =>    p_option_type_id
348       ,p_object_version_number   =>    p_object_version_number
349       );
350   exception
351     when hr_api.cannot_find_prog_unit then
352       hr_api.cannot_find_prog_unit_error
353         (p_module_name => 'delete_option_type'
354         ,p_hook_type   => 'AP'
355         );
356   end;
357   --
358   -- When in validation only mode raise the Validate_Enabled exception
359   --
360   if p_validate then
361     raise hr_api.validate_enabled;
362   end if;
363   --
364   -- Set all IN OUT and OUT parameters with out values
365   --
366 
367   --
368   hr_utility.set_location(' Leaving:'||l_proc, 70);
369 exception
370   when hr_api.validate_enabled then
371     --
372     -- As the Validate_Enabled exception has been raised
373     -- we must rollback to the savepoint
374     --
375     rollback to delete_option_type;
376     --
377     -- Reset IN OUT parameters and set OUT parameters
378     -- (Any key or derived arguments must be set to null
379     -- when validation only mode is being used.)
380     --
381 
382     hr_utility.set_location(' Leaving:'||l_proc, 80);
383   when others then
384     --
385     -- A validation or unexpected error has occured
386     --
387     rollback to delete_option_type;
388     --
389     -- Reset IN OUT parameters and set all
390     -- OUT parameters, including warnings, to null
391     --
392     hr_utility.set_location(' Leaving:'||l_proc, 90);
393     raise;
394 end delete_option_type;
395 end HR_KI_OPTION_TYPES_API;