DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_GDS_API

Source


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