DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_KI_OPTIONS_SWI

Source


1 Package Body hr_ki_options_swi As
2 /* $Header: hroptswi.pkb 115.0 2004/01/09 02:36 vkarandi noship $ */
3 --
4 -- Package variables
5 --
6 g_package  varchar2(33) := 'hr_ki_options_swi.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-----------------------------< create_option >----------------------------|
10 -- ----------------------------------------------------------------------------
11 PROCEDURE create_option
12   (p_validate                     in     number    default hr_api.g_false_num
13   ,p_effective_date               in     date
14   ,p_option_type_id               in     number
15   ,p_option_level                 in     number
16   ,p_option_level_id              in     varchar2  default null
17   ,p_value                        in     varchar2  default null
18   ,p_encrypted                    in     varchar2  default 'N'
19   ,p_integration_id               in     number
20   ,p_option_id                    in     number
21   ,p_object_version_number           out nocopy number
22   ,p_return_status                   out nocopy varchar2
23   ) is
24   --
25   -- Variables for API Boolean parameters
26   l_validate                      boolean;
27   --
28   -- Variables for IN/OUT parameters
29   --
30   -- Other variables
31   l_option_id                    number;
32   l_proc    varchar2(72) := g_package ||'create_option';
33 Begin
34   hr_utility.set_location(' Entering:' || l_proc,10);
35   --
36   -- Issue a savepoint
37   --
38   savepoint create_option_swi;
39   --
40   -- Initialise Multiple Message Detection
41   --
42   hr_multi_message.enable_message_list;
43   --
44   -- Remember IN OUT parameter IN values
45   --
46   --
47   -- Convert constant values to their corresponding boolean value
48   --
49   l_validate :=
50     hr_api.constant_to_boolean
51       (p_constant_value => p_validate);
52   --
53   -- Register Surrogate ID or user key values
54   --
55   hr_opt_ins.set_base_key_value
56     (p_option_id => p_option_id
57     );
58   --
59   -- Call API
60   --
61   hr_ki_options_api.create_option
62     (p_validate                     => l_validate
63     ,p_effective_date               => p_effective_date
64     ,p_option_type_id               => p_option_type_id
65     ,p_option_level                 => p_option_level
66     ,p_option_level_id              => p_option_level_id
67     ,p_value                        => p_value
68     ,p_encrypted                    => p_encrypted
69     ,p_integration_id               => p_integration_id
70     ,p_option_id                    => l_option_id
71     ,p_object_version_number        => p_object_version_number
72     );
73   --
74   -- Convert API warning boolean parameter values to specific
75   -- messages and add them to Multiple Message List
76   --
77   --
78   -- Convert API non-warning boolean parameter values
79   --
80   --
81   -- Derive the API return status value based on whether
82   -- messages of any type exist in the Multiple Message List.
83   -- Also disable Multiple Message Detection.
84   --
85   p_return_status := hr_multi_message.get_return_status_disable;
86   hr_utility.set_location(' Leaving:' || l_proc,20);
87   --
88 exception
89   when hr_multi_message.error_message_exist then
90     --
91     -- Catch the Multiple Message List exception which
92     -- indicates API processing has been aborted because
93     -- at least one message exists in the list.
94     --
95     rollback to create_option_swi;
96     --
97     -- Reset IN OUT parameters and set OUT parameters
98     --
99     p_object_version_number        := null;
100     p_return_status := hr_multi_message.get_return_status_disable;
101     hr_utility.set_location(' Leaving:' || l_proc, 30);
102   when others then
103     --
104     -- When Multiple Message Detection is enabled catch
105     -- any Application specific or other unexpected
106     -- exceptions.  Adding appropriate details to the
107     -- Multiple Message List.  Otherwise re-raise the
108     -- error.
109     --
110     rollback to create_option_swi;
111     if hr_multi_message.unexpected_error_add(l_proc) then
112        hr_utility.set_location(' Leaving:' || l_proc,40);
113        raise;
114     end if;
115     --
116     -- Reset IN OUT and set OUT parameters
117     --
118     p_object_version_number        := null;
119     p_return_status := hr_multi_message.get_return_status_disable;
120     hr_utility.set_location(' Leaving:' || l_proc,50);
121 end create_option;
122 -- ----------------------------------------------------------------------------
123 -- |-----------------------------< delete_option >----------------------------|
124 -- ----------------------------------------------------------------------------
125 PROCEDURE delete_option
126   (p_validate                     in     number    default hr_api.g_false_num
127   ,p_option_id                    in     number
128   ,p_object_version_number        in     number
129   ,p_return_status                   out nocopy varchar2
130   ) is
131   --
132   -- Variables for API Boolean parameters
133   l_validate                      boolean;
134   --
135   -- Variables for IN/OUT parameters
136   --
137   -- Other variables
138   l_proc    varchar2(72) := g_package ||'delete_option';
139 Begin
140   hr_utility.set_location(' Entering:' || l_proc,10);
141   --
142   -- Issue a savepoint
143   --
144   savepoint delete_option_swi;
145   --
146   -- Initialise Multiple Message Detection
147   --
148   hr_multi_message.enable_message_list;
149   --
150   -- Remember IN OUT parameter IN values
151   --
152   --
153   -- Convert constant values to their corresponding boolean value
154   --
155   l_validate :=
156     hr_api.constant_to_boolean
157       (p_constant_value => p_validate);
158   --
159   -- Register Surrogate ID or user key values
160   --
161   --
162   -- Call API
163   --
164   hr_ki_options_api.delete_option
165     (p_validate                     => l_validate
166     ,p_option_id                    => p_option_id
167     ,p_object_version_number        => p_object_version_number
168     );
169   --
170   -- Convert API warning boolean parameter values to specific
171   -- messages and add them to Multiple Message List
172   --
173   --
174   -- Convert API non-warning boolean parameter values
175   --
176   --
177   -- Derive the API return status value based on whether
178   -- messages of any type exist in the Multiple Message List.
179   -- Also disable Multiple Message Detection.
180   --
181   p_return_status := hr_multi_message.get_return_status_disable;
182   hr_utility.set_location(' Leaving:' || l_proc,20);
183   --
184 exception
185   when hr_multi_message.error_message_exist then
186     --
187     -- Catch the Multiple Message List exception which
188     -- indicates API processing has been aborted because
189     -- at least one message exists in the list.
190     --
191     rollback to delete_option_swi;
192     --
193     -- Reset IN OUT parameters and set OUT parameters
194     --
195     p_return_status := hr_multi_message.get_return_status_disable;
196     hr_utility.set_location(' Leaving:' || l_proc, 30);
197   when others then
198     --
199     -- When Multiple Message Detection is enabled catch
200     -- any Application specific or other unexpected
201     -- exceptions.  Adding appropriate details to the
202     -- Multiple Message List.  Otherwise re-raise the
203     -- error.
204     --
205     rollback to delete_option_swi;
206     if hr_multi_message.unexpected_error_add(l_proc) then
207        hr_utility.set_location(' Leaving:' || l_proc,40);
208        raise;
209     end if;
210     --
211     -- Reset IN OUT and set OUT parameters
212     --
213     p_return_status := hr_multi_message.get_return_status_disable;
214     hr_utility.set_location(' Leaving:' || l_proc,50);
215 end delete_option;
216 -- ----------------------------------------------------------------------------
217 -- |-----------------------------< update_option >----------------------------|
218 -- ----------------------------------------------------------------------------
219 PROCEDURE update_option
220   (p_validate                     in     number    default hr_api.g_false_num
221   ,p_option_id                    in     number
222   ,p_value                        in     varchar2  default hr_api.g_varchar2
223   ,p_encrypted                    in     varchar2  default hr_api.g_varchar2
224   ,p_object_version_number        in out nocopy number
225   ,p_return_status                   out nocopy varchar2
226   ) is
227   --
228   -- Variables for API Boolean parameters
229   l_validate                      boolean;
230   --
231   -- Variables for IN/OUT parameters
232   l_object_version_number         number;
233   --
234   -- Other variables
235   l_proc    varchar2(72) := g_package ||'update_option';
236 Begin
237   hr_utility.set_location(' Entering:' || l_proc,10);
238   --
239   -- Issue a savepoint
240   --
241   savepoint update_option_swi;
242   --
243   -- Initialise Multiple Message Detection
244   --
245   hr_multi_message.enable_message_list;
246   --
247   -- Remember IN OUT parameter IN values
248   --
249   l_object_version_number         := p_object_version_number;
250   --
251   -- Convert constant values to their corresponding boolean value
252   --
253   l_validate :=
254     hr_api.constant_to_boolean
255       (p_constant_value => p_validate);
256   --
257   -- Register Surrogate ID or user key values
258   --
259   --
260   -- Call API
261   --
262   hr_ki_options_api.update_option
263     (p_validate                     => l_validate
264     ,p_option_id                    => p_option_id
265     ,p_value                        => p_value
266     ,p_encrypted                    => p_encrypted
267     ,p_object_version_number        => p_object_version_number
268     );
269   --
270   -- Convert API warning boolean parameter values to specific
271   -- messages and add them to Multiple Message List
272   --
273   --
274   -- Convert API non-warning boolean parameter values
275   --
276   --
277   -- Derive the API return status value based on whether
278   -- messages of any type exist in the Multiple Message List.
279   -- Also disable Multiple Message Detection.
280   --
281   p_return_status := hr_multi_message.get_return_status_disable;
282   hr_utility.set_location(' Leaving:' || l_proc,20);
283   --
284 exception
285   when hr_multi_message.error_message_exist then
286     --
287     -- Catch the Multiple Message List exception which
288     -- indicates API processing has been aborted because
289     -- at least one message exists in the list.
290     --
291     rollback to update_option_swi;
292     --
293     -- Reset IN OUT parameters and set OUT parameters
294     --
295     p_object_version_number        := l_object_version_number;
296     p_return_status := hr_multi_message.get_return_status_disable;
297     hr_utility.set_location(' Leaving:' || l_proc, 30);
298   when others then
299     --
300     -- When Multiple Message Detection is enabled catch
301     -- any Application specific or other unexpected
302     -- exceptions.  Adding appropriate details to the
303     -- Multiple Message List.  Otherwise re-raise the
304     -- error.
305     --
306     rollback to update_option_swi;
307     if hr_multi_message.unexpected_error_add(l_proc) then
308        hr_utility.set_location(' Leaving:' || l_proc,40);
309        raise;
310     end if;
311     --
312     -- Reset IN OUT and set OUT parameters
313     --
314     p_object_version_number        := l_object_version_number;
315     p_return_status := hr_multi_message.get_return_status_disable;
316     hr_utility.set_location(' Leaving:' || l_proc,50);
317 end update_option;
318 end hr_ki_options_swi;