DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_WCI_OCCUPATIONS_API

Source


1 Package Body pay_wci_occupations_api as
2 /* $Header: pypwoapi.pkb 115.2 2002/12/05 14:58:06 swinton noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'pay_wci_occupations_api';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |--------------------------< create_wci_occupation >--------------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure create_wci_occupation
13   (p_validate                      in     boolean  default false
14   ,p_effective_date                in     date
15   ,p_rate_id                       in     number
16   ,p_job_id                        in     number
17   ,p_comments                      in     varchar2 default null
18   ,p_occupation_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||'update_wci_occupation';
25   l_effective_date        date;
26   l_business_group_id     number;
27   --
28   cursor csr_business_group_id is
29     select business_group_id
30     from pay_wci_rates
31     where rate_id = p_rate_id;
32 
33 begin
34 
35   hr_utility.set_location('Entering:'|| l_proc, 10);
36   --
37   -- Derive necessary parameters
38   --
39   open csr_business_group_id;
40   fetch csr_business_group_id into l_business_group_id;
41   close csr_business_group_id;
42   --
43   -- Issue a savepoint
44   --
45   savepoint create_wci_occupation;
46   hr_utility.set_location(l_proc, 20);
47   --
48   -- Truncate the time portion from all IN date parameters
49   --
50   l_effective_date := trunc(p_effective_date);
51   --
52   -- Call Before Process User Hook
53   --
54   begin
55     pay_wci_occupations_bk1.create_wci_occupation_b
56       (p_effective_date                => l_effective_date
57       ,p_object_version_number         => p_object_version_number
58       ,p_business_group_id             => l_business_group_id
59       ,p_rate_id                       => p_rate_id
60       ,p_job_id                        => p_job_id
61       ,p_comments                      => p_comments
62       );
63   exception
64     when hr_api.cannot_find_prog_unit then
65       hr_api.cannot_find_prog_unit_error
66         (p_module_name => 'create_wci_occupation'
67         ,p_hook_type   => 'BP'
68         );
69   end;
70   hr_utility.set_location(l_proc, 30);
71   --
72   -- Validation in addition to Row Handlers
73   --
74   hr_utility.set_location(l_proc, 40);
75   --
76   -- Process Logic
77   --
78   -- Call the row handler
79   --
80   pay_pwo_ins.ins
81      (p_business_group_id            => l_business_group_id
82      ,p_rate_id                      => p_rate_id
83      ,p_job_id                       => p_job_id
84      ,p_comments                     => p_comments
85      ,p_object_version_number        => p_object_version_number
86      ,p_occupation_id                => p_occupation_id
87     );
88 
89   hr_utility.set_location(l_proc, 50);
90   --
91   -- Call After Process User Hook
92   --
93   begin
94     pay_wci_occupations_bk1.create_wci_occupation_a
95        (p_effective_date                => l_effective_date
96        ,p_occupation_id                 => p_occupation_id
97        ,p_object_version_number         => p_object_version_number
98        ,p_business_group_id             => l_business_group_id
99        ,p_rate_id                       => p_rate_id
100        ,p_job_id                        => p_job_id
101        ,p_comments                      => p_comments
102        );
103   exception
104     when hr_api.cannot_find_prog_unit then
105       hr_api.cannot_find_prog_unit_error
106         (p_module_name => 'create_wci_occupation'
107         ,p_hook_type   => 'AP'
108         );
109   end;
110   hr_utility.set_location(l_proc, 60);
111   --
112   -- When in validation only mode raise the Validate_Enabled exception
113   --
114   if p_validate then
115     raise hr_api.validate_enabled;
116   end if;
117   --
118   -- Set all output arguments
119   --
120   hr_utility.set_location(' Leaving:'||l_proc, 70);
121 
122 exception
123 
124   when hr_api.validate_enabled then
125     --
126     -- As the Validate_Enabled exception has been raised
127     -- we must rollback to the savepoint
128     --
129     rollback to create_wci_occupation;
130     --
131     -- Only set output warning arguments
132     -- (Any key or derived arguments must be set to null
133     -- when validation only mode is being used.)
134     --
135     p_occupation_id          := null;
136     p_object_version_number  := null;
137     hr_utility.set_location(' Leaving:'||l_proc, 80);
138   when others then
139     --
140     -- A validation or unexpected error has occured
141     --
142     rollback to create_wci_occupation;
143     --
144     -- Bugfix 2692195
145     -- Reset all OUT/IN OUT parameters
146     --
147     p_occupation_id := null;
148     p_object_version_number := null;
149     --
150     hr_utility.set_location(' Leaving:'||l_proc, 90);
151     raise;
152 end create_wci_occupation;
153 --
154 -- ----------------------------------------------------------------------------
155 -- |--------------------------< update_wci_occupation >--------------------------|
156 -- ----------------------------------------------------------------------------
157 --
158 procedure update_wci_occupation
159   (p_validate                      in     boolean  default false
160   ,p_effective_date                in     date
161   ,p_occupation_id                 in     number
162   ,p_object_version_number         in out nocopy number
163   ,p_job_id                        in     number   default hr_api.g_number
164   ,p_comments                      in     varchar2 default hr_api.g_varchar2
165   ) is
166   --
167   -- Declare cursors and local variables
168   --
169   l_proc                  varchar2(72) := g_package||'update_wci_occupation';
170   l_business_group_id     number;
171   l_effective_date        date;
172   l_rate_id               number;
173   l_object_version_number number;
174   --
175   cursor csr_record_details is
176     select business_group_id,rate_id
177     from pay_wci_occupations
178     where occupation_id = p_occupation_id;
179 
180 begin
181 
182   hr_utility.set_location('Entering:'|| l_proc, 10);
183   --
184   -- Store in out parameters
185   --
186   l_object_version_number := p_object_version_number;
187   --
188   -- Issue a savepoint
189   --
190   savepoint update_wci_occupation;
191   hr_utility.set_location(l_proc, 20);
192   --
193   -- Truncate the time portion from all IN date parameters
194   --
195   l_effective_date := trunc(p_effective_date);
196   --
197   -- Derive necessary parameters
198   --
199   open csr_record_details;
200   fetch csr_record_details into l_business_group_id, l_rate_id;
201   close csr_record_details;
202   --
203   -- Call Before Process User Hook
204   --
205   begin
206     pay_wci_occupations_bk2.update_wci_occupation_b
207       (p_effective_date                => l_effective_date
208       ,p_occupation_id                 => p_occupation_id
209       ,p_object_version_number         => p_object_version_number
210       ,p_business_group_id             => l_business_group_id
211       ,p_rate_id                       => l_rate_id
212       ,p_job_id                        => p_job_id
213       ,p_comments                      => p_comments
214       );
215   exception
216     when hr_api.cannot_find_prog_unit then
217       hr_api.cannot_find_prog_unit_error
218         (p_module_name => 'update_wci_occupation'
219         ,p_hook_type   => 'BP'
220         );
221   end;
222   hr_utility.set_location(l_proc, 30);
223   --
224   -- Validation in addition to Row Handlers
225   --
226   hr_utility.set_location(l_proc, 40);
227   --
228   -- Process Logic
229   --
230   -- Call the row handler
231   --
232   pay_pwo_upd.upd
233      (p_occupation_id                   => p_occupation_id
234      ,p_job_id                          => p_job_id
235      ,p_comments                        => p_comments
236      ,p_object_version_number           => p_object_version_number
237      );
238 
239   hr_utility.set_location(l_proc, 50);
240   --
241   -- Call After Process User Hook
242   --
243   begin
244     pay_wci_occupations_bk2.update_wci_occupation_a
245        (p_effective_date                => l_effective_date
246        ,p_occupation_id                 => p_occupation_id
247        ,p_object_version_number         => p_object_version_number
248        ,p_business_group_id             => l_business_group_id
249        ,p_rate_id                       => l_rate_id
250        ,p_job_id                        => p_job_id
251        ,p_comments                      => p_comments
252        );
253   exception
254     when hr_api.cannot_find_prog_unit then
255       hr_api.cannot_find_prog_unit_error
256         (p_module_name => 'update_wci_occupation'
257         ,p_hook_type   => 'AP'
258         );
259   end;
260   hr_utility.set_location(l_proc, 60);
261   --
262   -- When in validation only mode raise the Validate_Enabled exception
263   --
264   if p_validate then
265     raise hr_api.validate_enabled;
266   end if;
267   --
268   -- Set all output arguments
269   --
270   hr_utility.set_location(' Leaving:'||l_proc, 70);
271 
272 exception
273 
274   when hr_api.validate_enabled then
275     --
276     -- As the Validate_Enabled exception has been raised
277     -- we must rollback to the savepoint
278     --
279     rollback to update_wci_occupation;
280     --
281     -- Only set output warning arguments
282     -- (Any key or derived arguments must be set to null
283     -- when validation only mode is being used.)
284     --
285     p_object_version_number  := l_object_version_number;
286     hr_utility.set_location(' Leaving:'||l_proc, 80);
287   when others then
288     --
289     -- A validation or unexpected error has occured
290     --
291     rollback to update_wci_occupation;
292     --
293     -- Bugfix 2692195
294     -- Reset all OUT/IN OUT parameters
295     --
296     p_object_version_number := l_object_version_number;
297     --
298     hr_utility.set_location(' Leaving:'||l_proc, 90);
299     raise;
300 end update_wci_occupation;
301 --
302 -- ----------------------------------------------------------------------------
303 -- |--------------------------< delete_wci_occupation >--------------------------|
304 -- ----------------------------------------------------------------------------
305 --
306 procedure delete_wci_occupation
307   (p_validate                      in     boolean  default false
308   ,p_occupation_id                 in     number
309   ,p_object_version_number         in     number
310   ) is
311   --
312   -- Declare cursors and local variables
313   --
314 
315   l_proc                  varchar2(72) := g_package||'delete_wci_occupation';
316   l_business_group_id     number;
317   --
318   cursor csr_business_group_id is
319     select business_group_id
320     from pay_wci_occupations
321     where occupation_id = p_occupation_id;
322 
323 begin
324 
325   hr_utility.set_location('Entering:'|| l_proc, 10);
326   --
327   -- Issue a savepoint
328   --
329   savepoint delete_wci_occupation;
330   hr_utility.set_location(l_proc, 20);
331   --
332   -- Truncate the time portion from all IN date parameters
333   --
334   -- Derive necessary parameters
335   --
336   open csr_business_group_id;
337   fetch csr_business_group_id into l_business_group_id;
338   close csr_business_group_id;
339   --
340   -- Call Before Process User Hook
341   --
342   begin
343     pay_wci_occupations_bk3.delete_wci_occupation_b
344       (p_occupation_id                 => p_occupation_id
345       ,p_object_version_number         => p_object_version_number
346       ,p_business_group_id             => l_business_group_id
347       );
348   exception
349     when hr_api.cannot_find_prog_unit then
350       hr_api.cannot_find_prog_unit_error
351         (p_module_name => 'delete_wci_occupation'
352         ,p_hook_type   => 'BP'
353         );
354   end;
355   hr_utility.set_location(l_proc, 30);
356   --
357   -- Validation in addition to Row Handlers
358   --
359   hr_utility.set_location(l_proc, 40);
360   --
361   -- Process Logic
362   --
363   -- Call the row handler
364   --
365   pay_pwo_del.del
366      (p_occupation_id                => p_occupation_id
367      ,p_object_version_number        => p_object_version_number
368     );
369 
370   hr_utility.set_location(l_proc, 50);
371   --
372   -- Call After Process User Hook
373   --
374   begin
375     pay_wci_occupations_bk3.delete_wci_occupation_a
376       (p_occupation_id                 => p_occupation_id
377       ,p_object_version_number         => p_object_version_number
378       ,p_business_group_id             => l_business_group_id
379       );
380   exception
381     when hr_api.cannot_find_prog_unit then
382       hr_api.cannot_find_prog_unit_error
383         (p_module_name => 'delete_wci_occupation'
384         ,p_hook_type   => 'AP'
385         );
386   end;
387   hr_utility.set_location(l_proc, 60);
388   --
389   -- When in validation only mode raise the Validate_Enabled exception
390   --
391   if p_validate then
392     raise hr_api.validate_enabled;
393   end if;
394   --
395   -- Set all output arguments
396   --
397   hr_utility.set_location(' Leaving:'||l_proc, 70);
398 
399 exception
400 
401   when hr_api.validate_enabled then
402     --
403     -- As the Validate_Enabled exception has been raised
404     -- we must rollback to the savepoint
405     --
406     rollback to delete_wci_occupation;
407     --
408     -- Only set output warning arguments
409     -- (Any key or derived arguments must be set to null
410     -- when validation only mode is being used.)
411     --
412     hr_utility.set_location(' Leaving:'||l_proc, 80);
413   when others then
414     --
415     -- A validation or unexpected error has occured
416     --
417     rollback to delete_wci_occupation;
418     hr_utility.set_location(' Leaving:'||l_proc, 90);
419     raise;
420 
421 end delete_wci_occupation;
422 --
423 end pay_wci_occupations_api;