DBA Data[Home] [Help]

PACKAGE BODY: APPS.HR_NL_ABSENCE_ACTION_API

Source


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