DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_DATA_APP_RULE_USAGES_API

Source


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