DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_APPLICATION_SET_COMP_API

Source


4 -- Package Variables
1 Package Body hxc_application_set_comp_api as
2 /* $Header: hxcascapi.pkb 120.2 2005/09/23 08:06:17 sechandr noship $ */
3 --
5 --
9 
6 g_package  varchar2(33) := '  hxc_application_set_comp_api.';
7 
8 g_entity_type varchar2(16) := 'TIME_RECIPIENTS';
10 g_debug	boolean	:=hr_utility.debug_enabled;
11 -- ----------------------------------------------------------------------------
12 -- |--------------------< create_application_set_comp>--------------------------|
13 -- ----------------------------------------------------------------------------
14 --
15 procedure create_application_set_comp
16   (p_validate                       in  boolean   default false
17   ,p_effective_date                 in  date
18   ,p_application_set_comp_id          in  out nocopy number
19   ,p_object_version_number          in  out nocopy number
20   ,p_time_recipient_id             in     number
21   ,p_application_set_id       in     number
22   ,p_attribute_category             in     varchar2 default null
23   ,p_attribute1                     in     varchar2 default null
24   ,p_attribute2                     in     varchar2 default null
25   ,p_attribute3                     in     varchar2 default null
26   ,p_attribute4                     in     varchar2 default null
27   ,p_attribute5                     in     varchar2 default null
28   ,p_attribute6                     in     varchar2 default null
29   ,p_attribute7                     in     varchar2 default null
30   ,p_attribute8                     in     varchar2 default null
31   ,p_attribute9                     in     varchar2 default null
32   ,p_attribute10                    in     varchar2 default null
33   ,p_attribute11                    in     varchar2 default null
34   ,p_attribute12                    in     varchar2 default null
35   ,p_attribute13                    in     varchar2 default null
36   ,p_attribute14                    in     varchar2 default null
37   ,p_attribute15                    in     varchar2 default null
38   ,p_attribute16                    in     varchar2 default null
39   ,p_attribute17                    in     varchar2 default null
40   ,p_attribute18                    in     varchar2 default null
41   ,p_attribute19                    in     varchar2 default null
42   ,p_attribute20                    in     varchar2 default null
43   ,p_attribute21                    in     varchar2 default null
44   ,p_attribute22                    in     varchar2 default null
45   ,p_attribute23                    in     varchar2 default null
46   ,p_attribute24                    in     varchar2 default null
47   ,p_attribute25                    in     varchar2 default null
48   ,p_attribute26                    in     varchar2 default null
49   ,p_attribute27                    in     varchar2 default null
50   ,p_attribute28                    in     varchar2 default null
51   ,p_attribute29                    in     varchar2 default null
52   ,p_attribute30                    in     varchar2 default null
53   ,p_called_from_form               in     varchar2 default 'Y' -- NOTE: default to Y because no DF for Application Sets
54   ) is
55   --
56   -- Declare cursors and local variables
57   --
58 	l_proc varchar2(72);
59 	l_object_version_number hxc_entity_group_comps.object_version_number%TYPE;
60 	l_application_set_comp_id hxc_entity_group_comps.entity_group_comp_id%TYPE;
61   --
62 begin
63   --
64   g_debug:=hr_utility.debug_enabled;
65   if g_debug then
66 	l_proc := g_package||' create_application_set_comp';
67 	hr_utility.set_location('Entering:'|| l_proc, 10);
68   end if;
69   --
70   -- Issue a savepoint if operating in validation only mode
71   --
72   savepoint create_application_set_comp;
73   --
74   if g_debug then
75 	hr_utility.set_location(l_proc, 20);
76   end if;
77 
78 	chk_as_unique (  p_application_set_comp_id	        => p_application_set_comp_id
79 			,p_application_set_id	        => p_application_set_id
80 			,p_time_recipient_id	                => p_time_recipient_id );
81 
82   --
83   -- Call Before Process User Hook
84   --
85   begin
86     hxc_application_set_comp_BK_1.create_application_set_comp_b
87 	  (p_application_set_comp_id  => p_application_set_comp_id
88 	  ,p_object_version_number  => p_object_version_number
89           ,p_time_recipient_id         => p_time_recipient_id
90           ,p_application_set_id   => p_application_set_id
91           ,p_attribute_category    => p_attribute_category
92           ,p_attribute1            => p_attribute1
93           ,p_attribute2            => p_attribute2
94           ,p_attribute3            => p_attribute3
95           ,p_attribute4            => p_attribute4
96           ,p_attribute5            => p_attribute5
97           ,p_attribute6            => p_attribute6
98           ,p_attribute7            => p_attribute7
99           ,p_attribute8            => p_attribute8
100           ,p_attribute9            => p_attribute9
101           ,p_attribute10           => p_attribute10
102           ,p_attribute11           => p_attribute11
103           ,p_attribute12           => p_attribute12
104           ,p_attribute13           => p_attribute13
105           ,p_attribute14           => p_attribute14
106           ,p_attribute15           => p_attribute15
107           ,p_attribute16           => p_attribute16
108           ,p_attribute17           => p_attribute17
109           ,p_attribute18           => p_attribute18
110           ,p_attribute19           => p_attribute19
111           ,p_attribute20           => p_attribute20
112           ,p_attribute21           => p_attribute21
113           ,p_attribute22           => p_attribute22
114           ,p_attribute23           => p_attribute23
115           ,p_attribute24           => p_attribute24
116           ,p_attribute25           => p_attribute25
117           ,p_attribute26           => p_attribute26
121           ,p_attribute30           => p_attribute30
118           ,p_attribute27           => p_attribute27
119           ,p_attribute28           => p_attribute28
120           ,p_attribute29           => p_attribute29
122   );
123   exception
124     when hr_api.cannot_find_prog_unit then
125       hr_api.cannot_find_prog_unit_error
126         (p_module_name => 'create_application_set_comp'
127         ,p_hook_type   => 'BP'
128         );
129   end;
130   --
131   if g_debug then
132 	hr_utility.set_location(l_proc, 30);
133   end if;
134   --
135   -- Process Logic
136   --
137 --
138   if g_debug then
139 	hr_utility.set_location(l_proc, 40);
140   end if;
141 --
142 -- call row handler
143 --
144 hxc_egc_ins.ins (
145    p_effective_date       => p_effective_date
146   ,p_entity_id            => p_time_recipient_id
150   ,p_object_version_number => l_object_version_number
147   ,p_entity_type          => g_entity_type
148   ,p_entity_group_id  	  => p_application_set_id
149   ,p_entity_group_comp_id => l_application_set_comp_id
151   ,p_attribute_category    => p_attribute_category
152   ,p_attribute1            => p_attribute1
153   ,p_attribute2            => p_attribute2
154   ,p_attribute3            => p_attribute3
155   ,p_attribute4            => p_attribute4
156   ,p_attribute5            => p_attribute5
157   ,p_attribute6            => p_attribute6
158   ,p_attribute7            => p_attribute7
159   ,p_attribute8            => p_attribute8
160   ,p_attribute9            => p_attribute9
161   ,p_attribute10           => p_attribute10
162   ,p_attribute11           => p_attribute11
163   ,p_attribute12           => p_attribute12
164   ,p_attribute13           => p_attribute13
165   ,p_attribute14           => p_attribute14
166   ,p_attribute15           => p_attribute15
167   ,p_attribute16           => p_attribute16
168   ,p_attribute17           => p_attribute17
169   ,p_attribute18           => p_attribute18
170   ,p_attribute19           => p_attribute19
171   ,p_attribute20           => p_attribute20
172   ,p_attribute21           => p_attribute21
173   ,p_attribute22           => p_attribute22
174   ,p_attribute23           => p_attribute23
175   ,p_attribute24           => p_attribute24
176   ,p_attribute25           => p_attribute25
177   ,p_attribute26           => p_attribute26
178   ,p_attribute27           => p_attribute27
179   ,p_attribute28           => p_attribute28
180   ,p_attribute29           => p_attribute29
181   ,p_attribute30           => p_attribute30
182   ,p_called_from_form      => p_called_from_form );
183 --
184   if g_debug then
185 	hr_utility.set_location(l_proc, 50);
186   end if;
187   --
188   -- Call After Process User Hook
189   --
190   begin
191     hxc_application_set_comp_BK_1.create_application_set_comp_a
192 	  (p_application_set_comp_id  => l_application_set_comp_id
193 	  ,p_object_version_number          => l_object_version_number
194           ,p_time_recipient_id             => p_time_recipient_id
195           ,p_application_set_id       => p_application_set_id
196           ,p_attribute_category    => p_attribute_category
197           ,p_attribute1            => p_attribute1
198           ,p_attribute2            => p_attribute2
199           ,p_attribute3            => p_attribute3
200           ,p_attribute4            => p_attribute4
201           ,p_attribute5            => p_attribute5
202           ,p_attribute6            => p_attribute6
203           ,p_attribute7            => p_attribute7
204           ,p_attribute8            => p_attribute8
205           ,p_attribute9            => p_attribute9
206           ,p_attribute10           => p_attribute10
207           ,p_attribute11           => p_attribute11
208           ,p_attribute12           => p_attribute12
209           ,p_attribute13           => p_attribute13
210           ,p_attribute14           => p_attribute14
211           ,p_attribute15           => p_attribute15
212           ,p_attribute16           => p_attribute16
213           ,p_attribute17           => p_attribute17
214           ,p_attribute18           => p_attribute18
215           ,p_attribute19           => p_attribute19
216           ,p_attribute20           => p_attribute20
217           ,p_attribute21           => p_attribute21
218           ,p_attribute22           => p_attribute22
219           ,p_attribute23           => p_attribute23
220           ,p_attribute24           => p_attribute24
221           ,p_attribute25           => p_attribute25
222           ,p_attribute26           => p_attribute26
223           ,p_attribute27           => p_attribute27
224           ,p_attribute28           => p_attribute28
225           ,p_attribute29           => p_attribute29
226           ,p_attribute30           => p_attribute30 );
227   exception
228     when hr_api.cannot_find_prog_unit then
229       hr_api.cannot_find_prog_unit_error
230         (p_module_name => 'create_application_set_comp'
231         ,p_hook_type   => 'AP'
232         );
233   end;
234   --
235   if g_debug then
236 	hr_utility.set_location(l_proc, 60);
237   end if;
238   --
239   -- When in validation only mode raise the Validate_Enabled exception
240   --
241   if p_validate then
242     raise hr_api.validate_enabled;
243   end if;
244   --
245   if g_debug then
246 	hr_utility.set_location(' Leaving:'||l_proc, 70);
247   end if;
248   --
249   -- Set all output arguments
250   --
251   p_application_set_comp_id := l_application_set_comp_id;
252   p_object_version_number := l_object_version_number;
253   --
254 exception
255   --
256   when hr_api.validate_enabled then
257     --
258     -- As the Validate_Enabled exception has been raised
259     -- we must rollback to the savepoint
260     --
261     ROLLBACK TO create_application_set_comp;
262     --
263     -- Only set output warning arguments
264     -- (Any key or derived arguments must be set to null
265     -- when validation only mode is being used.)
266     --
267     p_application_set_comp_id := null;
268     p_object_version_number  := null;
269     --
270     if g_debug then
271 	hr_utility.set_location(' Leaving:'||l_proc, 80);
272     end if;
273     --
274   when others then
275     --
276     -- A validation or unexpected error has occured
277     --
278 if g_debug then
279 	hr_utility.trace('In exeception');
280 end if;
281     ROLLBACK TO create_application_set_comp;
282     raise;
283     --
284 END create_application_set_comp;
285 --
286 -- ----------------------------------------------------------------------------
287 -- |---------------------< update_application_set_comp>-------------------------|
288 -- ----------------------------------------------------------------------------
289 --
290 procedure update_application_set_comp
291   (p_validate                       in  boolean   default false
292   ,p_effective_date                 in  date
293   ,p_application_set_comp_id  in  number
294   ,p_object_version_number          in  out nocopy number
295   ,p_time_recipient_id             in      number
296   ,p_application_set_id       in      number
297   ,p_attribute_category             in     varchar2 default null
298   ,p_attribute1                     in     varchar2 default null
299   ,p_attribute2                     in     varchar2 default null
300   ,p_attribute3                     in     varchar2 default null
301   ,p_attribute4                     in     varchar2 default null
302   ,p_attribute5                     in     varchar2 default null
306   ,p_attribute9                     in     varchar2 default null
303   ,p_attribute6                     in     varchar2 default null
304   ,p_attribute7                     in     varchar2 default null
305   ,p_attribute8                     in     varchar2 default null
307   ,p_attribute10                    in     varchar2 default null
308   ,p_attribute11                    in     varchar2 default null
309   ,p_attribute12                    in     varchar2 default null
310   ,p_attribute13                    in     varchar2 default null
311   ,p_attribute14                    in     varchar2 default null
312   ,p_attribute15                    in     varchar2 default null
313   ,p_attribute16                    in     varchar2 default null
314   ,p_attribute17                    in     varchar2 default null
315   ,p_attribute18                    in     varchar2 default null
316   ,p_attribute19                    in     varchar2 default null
317   ,p_attribute20                    in     varchar2 default null
318   ,p_attribute21                    in     varchar2 default null
322   ,p_attribute25                    in     varchar2 default null
319   ,p_attribute22                    in     varchar2 default null
320   ,p_attribute23                    in     varchar2 default null
321   ,p_attribute24                    in     varchar2 default null
323   ,p_attribute26                    in     varchar2 default null
324   ,p_attribute27                    in     varchar2 default null
325   ,p_attribute28                    in     varchar2 default null
326   ,p_attribute29                    in     varchar2 default null
327   ,p_attribute30                    in     varchar2 default null
328   ,p_called_from_form               in     varchar2 default 'Y' -- NOTE: default to Y because no DF for Application Sets
329   ) is
330   --
331   -- Declare cursors and local variables
332   --
333 	l_proc varchar2(72);
334 	l_object_version_number hxc_entity_group_comps.object_version_number%TYPE := p_object_version_number;
335   --
336 begin
337   --
338   g_debug:=hr_utility.debug_enabled;
339   if g_debug then
340 	l_proc := g_package||' update_application_set_comp';
341 	hr_utility.set_location('Entering:'|| l_proc, 10);
342   end if;
343   --
344   -- Issue a savepoint if operating in validation only mode
345   --
346   savepoint update_application_set_comp;
347   --
348   if g_debug then
349 	hr_utility.set_location(l_proc, 20);
350   end if;
351 
352 	chk_as_unique (  p_application_set_comp_id	=> p_application_set_comp_id
353 			,p_application_set_id	        => p_application_set_id
354 			,p_time_recipient_id	        	=> p_time_recipient_id );
355 
356   --
357   -- Call Before Process User Hook
358   --
359   begin
360     hxc_application_set_comp_BK_2.update_application_set_comp_b
361 	  (p_application_set_comp_id  => p_application_set_comp_id
362 	  ,p_object_version_number  => p_object_version_number
363           ,p_time_recipient_id         => p_time_recipient_id
364           ,p_application_set_id   => p_application_set_id
365           ,p_attribute_category    => p_attribute_category
366           ,p_attribute1            => p_attribute1
367           ,p_attribute2            => p_attribute2
368           ,p_attribute3            => p_attribute3
369           ,p_attribute4            => p_attribute4
370           ,p_attribute5            => p_attribute5
371           ,p_attribute6            => p_attribute6
372           ,p_attribute7            => p_attribute7
373           ,p_attribute8            => p_attribute8
374           ,p_attribute9            => p_attribute9
375           ,p_attribute10           => p_attribute10
376           ,p_attribute11           => p_attribute11
377           ,p_attribute12           => p_attribute12
378           ,p_attribute13           => p_attribute13
379           ,p_attribute14           => p_attribute14
380           ,p_attribute15           => p_attribute15
381           ,p_attribute16           => p_attribute16
382           ,p_attribute17           => p_attribute17
383           ,p_attribute18           => p_attribute18
384           ,p_attribute19           => p_attribute19
385           ,p_attribute20           => p_attribute20
386           ,p_attribute21           => p_attribute21
387           ,p_attribute22           => p_attribute22
388           ,p_attribute23           => p_attribute23
389           ,p_attribute24           => p_attribute24
390           ,p_attribute25           => p_attribute25
391           ,p_attribute26           => p_attribute26
392           ,p_attribute27           => p_attribute27
393           ,p_attribute28           => p_attribute28
394           ,p_attribute29           => p_attribute29
395           ,p_attribute30           => p_attribute30
396   );
397   exception
398     when hr_api.cannot_find_prog_unit then
399       hr_api.cannot_find_prog_unit_error
400         (p_module_name => 'update_application_set_comp'
401         ,p_hook_type   => 'BP'
402         );
403   end;
404   --
405   if g_debug then
406 	hr_utility.set_location(l_proc, 30);
407   end if;
408   --
409   -- Process Logic
410 --
411 -- call row handler
412 --
413 hxc_egc_upd.upd (
414    p_effective_date        => p_effective_date
415   ,p_entity_group_id       => p_application_set_id
416   ,p_entity_group_comp_id  => p_application_set_comp_id
417   ,p_object_version_number => l_object_version_number
418   ,p_attribute_category    => p_attribute_category
419   ,p_attribute1            => p_attribute1
420   ,p_attribute2            => p_attribute2
421   ,p_attribute3            => p_attribute3
422   ,p_attribute4            => p_attribute4
423   ,p_attribute5            => p_attribute5
424   ,p_attribute6            => p_attribute6
425   ,p_attribute7            => p_attribute7
426   ,p_attribute8            => p_attribute8
427   ,p_attribute9            => p_attribute9
428   ,p_attribute10           => p_attribute10
429   ,p_attribute11           => p_attribute11
430   ,p_attribute12           => p_attribute12
431   ,p_attribute13           => p_attribute13
432   ,p_attribute14           => p_attribute14
433   ,p_attribute15           => p_attribute15
434   ,p_attribute16           => p_attribute16
435   ,p_attribute17           => p_attribute17
436   ,p_attribute18           => p_attribute18
437   ,p_attribute19           => p_attribute19
438   ,p_attribute20           => p_attribute20
439   ,p_attribute21           => p_attribute21
440   ,p_attribute22           => p_attribute22
441   ,p_attribute23           => p_attribute23
442   ,p_attribute24           => p_attribute24
443   ,p_attribute25           => p_attribute25
444   ,p_attribute26           => p_attribute26
445   ,p_attribute27           => p_attribute27
449   ,p_called_from_form      => p_called_from_form );
446   ,p_attribute28           => p_attribute28
447   ,p_attribute29           => p_attribute29
448   ,p_attribute30           => p_attribute30
450 --
451   --
452   if g_debug then
453 	hr_utility.set_location(l_proc, 40);
454   end if;
455   --
456   -- Call After Process User Hook
457   --
458   begin
459     hxc_application_set_comp_BK_2.update_application_set_comp_a
460 	  (p_application_set_comp_id  => p_application_set_comp_id
461 	  ,p_object_version_number  => l_object_version_number
462           ,p_time_recipient_id         => p_time_recipient_id
463           ,p_application_set_id   => p_application_set_id
464           ,p_attribute_category    => p_attribute_category
465           ,p_attribute1            => p_attribute1
466           ,p_attribute2            => p_attribute2
467           ,p_attribute3            => p_attribute3
468           ,p_attribute4            => p_attribute4
469           ,p_attribute5            => p_attribute5
470           ,p_attribute6            => p_attribute6
471           ,p_attribute7            => p_attribute7
472           ,p_attribute8            => p_attribute8
473           ,p_attribute9            => p_attribute9
474           ,p_attribute10           => p_attribute10
475           ,p_attribute11           => p_attribute11
476           ,p_attribute12           => p_attribute12
477           ,p_attribute13           => p_attribute13
478           ,p_attribute14           => p_attribute14
479           ,p_attribute15           => p_attribute15
480           ,p_attribute16           => p_attribute16
481           ,p_attribute17           => p_attribute17
482           ,p_attribute18           => p_attribute18
483           ,p_attribute19           => p_attribute19
484           ,p_attribute20           => p_attribute20
485           ,p_attribute21           => p_attribute21
486           ,p_attribute22           => p_attribute22
487           ,p_attribute23           => p_attribute23
488           ,p_attribute24           => p_attribute24
489           ,p_attribute25           => p_attribute25
490           ,p_attribute26           => p_attribute26
491           ,p_attribute27           => p_attribute27
492           ,p_attribute28           => p_attribute28
493           ,p_attribute29           => p_attribute29
494           ,p_attribute30           => p_attribute30
495   );
496   exception
497     when hr_api.cannot_find_prog_unit then
498       hr_api.cannot_find_prog_unit_error
499         (p_module_name => 'update_application_set_comp'
500         ,p_hook_type   => 'AP'
501         );
502   end;
503   --
504   if g_debug then
505 	hr_utility.set_location(l_proc, 50);
506   end if;
507   --
508   -- When in validation only mode raise the Validate_Enabled exception
509   --
510   if p_validate then
511     raise hr_api.validate_enabled;
512   end if;
513   --
514   if g_debug then
515 	hr_utility.set_location(' Leaving:'||l_proc, 60);
516   end if;
517   --
518   -- Set all output arguments
519   --
520   p_object_version_number := l_object_version_number;
521   --
522 exception
523   --
524   when hr_api.validate_enabled then
525     --
526     -- As the Validate_Enabled exception has been raised
527     -- we must rollback to the savepoint
528     --
529     ROLLBACK TO update_application_set_comp;
530     --
531     -- Only set output warning arguments
532     -- (Any key or derived arguments must be set to null
533     -- when validation only mode is being used.)
534     --
535     p_object_version_number  := null;
536     --
537     if g_debug then
538 	hr_utility.set_location(' Leaving:'||l_proc, 60);
539     end if;
540     --
541   when others then
542     --
543     -- A validation or unexpected error has occured
544     --
545 if g_debug then
546 	hr_utility.trace('In exeception');
547 end if;
548     ROLLBACK TO update_application_set_comp;
549     raise;
550     --
551 END update_application_set_comp;
552 --
553 -- ----------------------------------------------------------------------------
554 -- |----------------< delete_application_set_comp >---------------------|
555 -- ----------------------------------------------------------------------------
556 --
557 procedure delete_application_set_comp
558   (p_validate                       in  boolean  default false
559   ,p_application_set_comp_id  in  number
560   ,p_application_set_id       in  number
561   ,p_object_version_number          in  number
562   ) is
563   --
564   -- Declare cursors and local variables
565   --
566   l_proc varchar2(72);
567   --
568 begin
569   --
570   g_debug:=hr_utility.debug_enabled;
571   if g_debug then
572 	l_proc := g_package||'delete_application_set_comp';
573 	hr_utility.set_location('Entering:'|| l_proc, 10);
574   end if;
575   --
576   -- Issue a savepoint if operating in validation only mode
577   --
578   savepoint delete_application_set_comp;
579   --
580   if g_debug then
581 	hr_utility.set_location(l_proc, 20);
582   end if;
583 
584   -- Call Before Process User Hook
585 
586   begin
587   --
588     hxc_application_set_comp_BK_3.delete_application_set_comp_b
589 	  (p_application_set_comp_id => p_application_set_comp_id
590 	  ,p_object_version_number => p_object_version_number
591 	  );
592   exception
593     when hr_api.cannot_find_prog_unit then
594       hr_api.cannot_find_prog_unit_error
595         (p_module_name => 'delete_application_set_comp_b'
596         ,p_hook_type   => 'BP'
597         );
598   end;
599   --
600   if g_debug then
601 	hr_utility.set_location(l_proc, 30);
602   end if;
603   --
604   -- Process Logic
605   --
606   hxc_egc_del.del
607     (
608      p_entity_group_comp_id => p_application_set_comp_id
609     ,p_object_version_number => p_object_version_number
610     );
611   --
612   if g_debug then
613 	hr_utility.set_location(l_proc, 40);
614   end if;
615   --
616   -- Call After Process User Hook
617   --
618   begin
619   --
620   hxc_application_set_comp_BK_3.delete_application_set_comp_a
621 	  (p_application_set_comp_id => p_application_set_comp_id
622 	  ,p_object_version_number => p_object_version_number
623 	  );
624   exception
625     when hr_api.cannot_find_prog_unit then
626       hr_api.cannot_find_prog_unit_error
627         (p_module_name => 'delete_application_set_comp_a'
628         ,p_hook_type   => 'AP'
629         );
630   end;
631   --
632   -- When in validation only mode raise the Validate_Enabled exception
633   --
637   --
634   if p_validate then
635     raise hr_api.validate_enabled;
636   end if;
638   if g_debug then
639 	hr_utility.set_location(' Leaving:'||l_proc, 50);
640   end if;
641   --
642 exception
643   --
644   when hr_api.validate_enabled then
645     --
646     -- As the Validate_Enabled exception has been raised
647     -- we must rollback to the savepoint
648     --
649     ROLLBACK TO delete_application_set_comp;
650     --
651   when others then
652     --
653     -- A validation or unexpected error has occured
654     --
655     ROLLBACK TO delete_application_set_comp;
656     raise;
657     --
658 end delete_application_set_comp;
659 --
660 -- ----------------------------------------------------------------------------
661 -- |------------------------< chk_as_unique >---------------------------------|
662 -- ----------------------------------------------------------------------------
663 --
664 -- Description:
665 --   This procedure insures a unique application set per grouping
666 --
667 -- Pre Conditions:
668 --   None
669 --
670 -- In Arguments:
671 --   application_set_comp_id
672 --   application_set_id
673 --   time_recipient_id
674 --
675 -- Post Success:
676 --   Processing continues if the entity id business rules
677 --   have not been violated
678 --
679 -- Post Failure:
680 --   An application error is raised if the as id is not unique
681 --
682 -- ----------------------------------------------------------------------------
683 Procedure chk_as_unique
684   (
685    p_application_set_comp_id    in hxc_entity_group_comps.entity_group_comp_id%TYPE
686 ,  p_application_set_id    in hxc_entity_group_comps.entity_group_id%TYPE
687 ,  p_time_recipient_id          in hxc_entity_group_comps.entity_id%TYPE
688   ) IS
689 --
690   l_proc  varchar2(72);
691 --
692 -- cursor to check as name is unique
693 --
694 CURSOR  csr_chk_as IS
695 SELECT 'error'
696 FROM	sys.dual
697 WHERE EXISTS (
698 	SELECT	'x'
699 	FROM	hxc_entity_group_comps egc
700 	WHERE	egc.entity_group_id	= p_application_set_id
701 	AND	egc.entity_id		= p_time_recipient_id
702 	AND	(  egc.entity_group_comp_id <> p_application_set_comp_id
703 		OR p_application_set_comp_id IS NULL ));
704 
705 --
706  l_error varchar2(5) := NULL;
707 --
708 BEGIN
709   g_debug:=hr_utility.debug_enabled;
710   if g_debug then
711 	l_proc := g_package||'chk_as_unique';
712 	hr_utility.set_location('Entering:'||l_proc, 5);
713   end if;
714 --
715 -- check that ter is unique within the grouping
716 --
717   OPEN  csr_chk_as;
718   FETCH csr_chk_as INTO l_error;
719   CLOSE csr_chk_as;
720 --
721 IF l_error IS NOT NULL
722 THEN
723 --
724       hr_utility.set_message(809, 'HXC_EGC_AS_NOT_UNIQUE');
725       hr_utility.raise_error;
726 --
727 END IF;
728 --
729   if g_debug then
730 	hr_utility.set_location('Leaving:'||l_proc, 20);
731   end if;
732 --
733 END chk_as_unique;
734 --
735 --
736 -- added by ksethi ver 115.5
737 -- ----------------------------------------------------------------------------
738 -- |------------------------< chk_appl_as_unique >-----------------------------|
739 -- ----------------------------------------------------------------------------
740 --
741 -- Description:
742 --   This procedure insures a unique application set in the system
743 --
744 -- Pre Conditions:
745 --   None
746 --
747 -- In Arguments:
748 --
749 --   application_set_id
750 --
751 --
752 -- Post Success:
753 --   Processing continues if the application set business rules
754 --   have not been violated
755 --
756 -- Post Failure:
757 --   An application error is raised if already another applicatio set
758 --   is present in the system with the same Time Recipients
759 --
760 -- ----------------------------------------------------------------------------
761 Procedure chk_appl_as_unique
762   (
763   p_application_set_id in hxc_entity_group_comps.entity_group_id%TYPE
764   ) IS
765 --
766   l_proc  varchar2(72);
767 --
768 -- cursor to check as name is unique
769 --
770 CURSOR  csr_chk_as IS
771 SELECT 'error'
772 FROM	sys.dual
773 WHERE EXISTS (select a
774 from (select APPLICATION_SET_ID a, count(*) CNT
775 	  from HXC_APPLICATION_SET_COMPS_V
776 	  where  TIME_RECIPIENT_ID in
777 	            ( select distinct time_recipient_id
778 				   from HXC_APPLICATION_SET_COMPS_V
779 				   where application_set_id = p_application_set_id
780 				  )
784 where CNT = ( select count(distinct time_recipient_id)
781           and application_set_id <> p_application_set_id
782 	  group by application_set_id
783      )
785               from HXC_APPLICATION_SET_COMPS_V
786 			  where application_set_id = p_application_set_id
787 	  	  	 )
788 and a not in (
789 	  	  	   select APPLICATION_SET_ID a
790 			   from HXC_APPLICATION_SET_COMPS_V
791 			   where  TIME_RECIPIENT_ID not in
792  						  ( select distinct time_recipient_id
793 						    from HXC_APPLICATION_SET_COMPS_V
794    						    where application_set_id = p_application_set_id
795 	   					          )
796 			   and application_set_id <> p_application_set_id
797 		      ));
798 
799 --
800  l_error varchar2(5) := NULL;
801 --
802 BEGIN
803   if g_debug then
804 	l_proc := g_package||'chk_appl_as_unique';
805 	hr_utility.set_location('Entering:'||l_proc, 5);
806   end if;
807 --
808 -- check that list of time recipients in the currnet application set are not present
809 -- in any other Application Set in the system
810 --
811   OPEN  csr_chk_as;
812   FETCH csr_chk_as INTO l_error;
813   CLOSE csr_chk_as;
814 --
815 IF l_error IS NOT NULL
816 THEN
817 --
818       hr_utility.set_message(809, 'HXC_APPL_AS_NOT_UNIQUE');
819       hr_utility.raise_error;
820 --
821 END IF;
822 --
823   if g_debug then
824 	hr_utility.set_location('Leaving:'||l_proc, 20);
825   end if;
826 --
827 END chk_appl_as_unique;
828 --
829 --
830 END hxc_application_set_comp_api;