DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_SECURITY_ORGANIZATION_API

Source


1 Package Body HR_SECURITY_ORGANIZATION_API as
2 /* $Header: pepsoapi.pkb 115.1 2002/12/11 12:15:36 eumenyio noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'HR_SECURITY_ORGANIZATION_API.';
7 
8 --
9 -- ----------------------------------------------------------------------------
10 -- |-------------------< create_security_organization >-----------------------|
11 -- ----------------------------------------------------------------------------
12 --
13 procedure create_security_organization
14   ( p_validate                  in  boolean  default false
15   , p_security_profile_id	in  number
16   , p_organization_id		in  number
17   , p_entry_type                in  varchar2
18   , p_security_organization_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_security_organization';
25   l_object_version_number     number;
26   l_security_organization_id      number;
27 --
28 begin
29   hr_utility.set_location('Entering:'|| l_proc, 10);
30   --
31   -- Issue a savepoint
32   --
33   savepoint create_security_organization;
34   --
35   --
36   -- Call Before Process User Hook
37   --
38   begin
39     hr_security_organization_bk1.create_security_organization_b
40     (
41      p_security_profile_id  => p_security_profile_id
42     , p_organization_id      => p_organization_id
43     , p_entry_type           => p_entry_type
44     );
45   exception
46     when hr_api.cannot_find_prog_unit then
47       hr_api.cannot_find_prog_unit_error
48         (p_module_name => 'create_security_organization'
49         ,p_hook_type   => 'BP'
50         );
51   end;
52   --
53   -- Process Logic
54   --
55   per_pso_ins.ins
56     ( p_security_profile_id  	=> p_security_profile_id
57     , p_organization_id      	=> p_organization_id
58     , p_entry_type           	=> p_entry_type
59     , p_security_organization_id=> l_security_organization_id
60     , p_object_version_number   => l_object_version_number
61    );
62   --
63   -- Call After Process User Hook
64   --
65   begin
66     hr_security_organization_bk1.create_security_organization_b
67     ( p_security_profile_id     => p_security_profile_id
68     , p_organization_id         => p_organization_id
69     , p_entry_type              => p_entry_type
70     );
71   exception
72     when hr_api.cannot_find_prog_unit then
73       hr_api.cannot_find_prog_unit_error
74         (p_module_name => 'create_security_organization'
75         ,p_hook_type   => 'AP'
76         );
77   end;
78   --
79   -- When in validation only mode raise the Validate_Enabled exception
80   --
81   if p_validate then
82     raise hr_api.validate_enabled;
83   end if;
84   --
85   -- Set all output arguments
86   --
87   p_security_organization_id     := l_security_organization_id;
88   p_object_version_number        := l_object_version_number;
89   --
90   hr_utility.set_location(' Leaving:'||l_proc, 70);
91 exception
92   when hr_api.validate_enabled then
93     --
94     -- As the Validate_Enabled exception has been raised
95     -- we must rollback to the savepoint
96     --
97     rollback to create_security_profile_id;
98     --
99     -- Only set output warning arguments
100     -- (Any key or derived arguments must be set to null
101     -- when validation only mode is being used.)
102     --
103     p_security_organization_id   := null;
104     p_object_version_number  := null;
105     hr_utility.set_location(' Leaving:'||l_proc, 80);
106   when others then
107     --
108     -- A validation or unexpected error has occured
109     --
110     p_security_organization_id   := null;
111     p_object_version_number  := null;
112     rollback to create_security_organization;
113     hr_utility.set_location(' Leaving:'||l_proc, 90);
114     raise;
115 end create_security_organization;
116 --
117 -- ----------------------------------------------------------------------------
118 -- |-----------------< update_security_organization >-------------------------|
119 -- ----------------------------------------------------------------------------
120 --
121 procedure update_security_organization
122   (
123       p_validate                  in  boolean  default false
124     , p_security_profile_id       in  number   default hr_api.g_number
125     , p_organization_id           in  number   default hr_api.g_number
126     , p_entry_type                in  varchar2 default hr_api.g_varchar2
127     , p_security_organization_id  in  number
128     , p_object_version_number  in out nocopy number
129   ) is
130   --
131   -- Declare cursors and local variables
132   --
133   l_proc                varchar2(72) := g_package||'update_security_organization';
134   l_object_version_number  number       := p_object_version_number;
135   l_temp_ovn            number       := p_object_version_number;
136   --
137 begin
138   hr_utility.set_location('Entering:'|| l_proc, 10);
139   --
140   -- Issue a savepoint
141   --
142   savepoint update_security_organization;
143   --
144   -- Call Before Process User Hook
145   --
146   begin
147     hr_security_organization_bk2.update_security_organization_b
148     (
149       p_security_profile_id     => p_security_profile_id
150     , p_organization_id         => p_organization_id
151     , p_entry_type              => p_entry_type
152     , p_security_organization_id=> p_security_organization_id
153     , p_object_version_number   => l_object_version_number
154 );
155   exception
156     when hr_api.cannot_find_prog_unit then
157       hr_api.cannot_find_prog_unit_error
158         (p_module_name => 'update_security_organization'
159         ,p_hook_type   => 'BP'
160         );
161   end;
162   --
163   -- Process Logic
164   --
165   per_pso_upd.upd
166     ( p_security_organization_id=> p_security_organization_id
167     , p_security_profile_id     => p_security_profile_id
168     , p_organization_id         => p_organization_id
169     , p_entry_type              => p_entry_type
170     , p_object_version_number   => l_object_version_number
171     );
172   --
173   --  Call After Process User Hook
174   --
175   begin
176      hr_security_organization_bk2.update_security_organization_a
177     (
178       p_security_profile_id     => p_security_profile_id
179     , p_organization_id         => p_organization_id
180     , p_entry_type              => p_entry_type
181     , p_security_organization_id=> p_security_organization_id
182     , p_object_version_number   => l_object_version_number
183       );
184   exception
185     when hr_api.cannot_find_prog_unit then
186       hr_api.cannot_find_prog_unit_error
187         (p_module_name => 'update_security_organization'
188         ,p_hook_type   => 'AP'
189         );
190   end;
191   --
192   -- When in validation only mode raise the Validate_Enabled exception
193   --
194   if p_validate then
195     raise hr_api.validate_enabled;
196   end if;
197   --
198   -- Set all output arguments
199   --
200   p_object_version_number := l_object_version_number;
201   --
202   hr_utility.set_location(' Leaving:'||l_proc, 70);
203   --
204 exception
205   when hr_api.validate_enabled then
206     --
207     -- As the Validate_Enabled exception has been raised
208     -- we must rollback to the savepoint
209     --
210     rollback to update_security_organization;
211     --
212     -- Only set output warning arguments
213     -- (Any key or derived arguments must be set to null
214     -- when validation only mode is being used.)
215     --
216     hr_utility.set_location(' Leaving:'||l_proc, 80);
217   when others then
218     --
219     -- A validation or unexpected error has occured
220     --
221     p_object_version_number  := l_temp_ovn;
222     rollback to update_irc_asg_status;
223     hr_utility.set_location(' Leaving:'||l_proc, 90);
224     raise;
225 end update_security_organization;
226 --
227 -- ----------------------------------------------------------------------------
228 -- |-------------------< delete_security_organization >-----------------------|
229 -- ----------------------------------------------------------------------------
230 procedure delete_security_organization
231   (
232     p_validate                  in  boolean  default false
233   , p_security_organization_id	in  number
234   , p_object_version_number     in  number
235   ) is
236   --
237   -- Declare cursors and local variables
238   --
239   l_proc           varchar2(72) := g_package||'delete_security_organization';
240   --
241 begin
242   hr_utility.set_location('Entering:'|| l_proc, 10);
243   --
244   -- Issue a savepoint
245   --
246   savepoint delete_security_organization;
247   --
248   -- Call Before Process User Hook
249   --
250   begin
251     hr_security_organization_bk3.delete_security_organization_b
252       (
253         p_security_organization_id  => p_security_organization_id
254       , p_object_version_number     => p_object_version_number
255       );
256   exception
257     when hr_api.cannot_find_prog_unit then
258       hr_api.cannot_find_prog_unit_error
259         (p_module_name => 'delete_security_organization'
260         ,p_hook_type   => 'BP'
261         );
262   end;
263   --
264   -- Process Logic
265   --
266   per_pso_del.del
267     (p_security_organization_id  => p_security_organization_id
268     ,p_object_version_number            => p_object_version_number
269     );
270   --
271   -- Call After Process User Hook
272   --
273   begin
274   hr_security_organization_bk3.delete_security_organization_a
275       (
276         p_security_organization_id  => p_security_organization_id
277       , p_object_version_number     => p_object_version_number
278       );
279 exception
280     when hr_api.cannot_find_prog_unit then
281       hr_api.cannot_find_prog_unit_error
282         (p_module_name => 'delete_security_organization'
283         ,p_hook_type   => 'AP'
284         );
285   end;
286   --
287   -- When in validation only mode raise the Validate_Enabled exception
288   --
289   if p_validate then
290     raise hr_api.validate_enabled;
291   end if;
292   --
293   -- Set all output arguments
294   --
295   hr_utility.set_location(' Leaving:'||l_proc, 70);
296 exception
297   when hr_api.validate_enabled then
298     --
299     -- As the Validate_Enabled exception has been raised
300     -- we must rollback to the savepoint
301     --
302     rollback to delete_security_organization;
303     --
304     -- Only set output warning arguments
305     -- (Any key or derived arguments must be set to null
306     -- when validation only mode is being used.)
307     --
308     hr_utility.set_location(' Leaving:'||l_proc, 80);
309   when others then
310     --
311     -- A validation or unexpected error has occured
312     --
313     rollback to delete_security_organization;
314     hr_utility.set_location(' Leaving:'||l_proc, 90);
315     raise;
316 end delete_security_organization;
317 --
318 end HR_SECURITY_ORGANIZATION_API;