DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_HIERARCHY_ELEMENT_SWI

Source


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