DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_KI_OPTIONS_API

Source


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