DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_PREF_HIERARCHIES_API

Source


1 Package Body hxc_pref_hierarchies_api as
2 /* $Header: hxchphapi.pkb 120.2 2005/09/23 10:42:34 sechandr noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  hxc_pref_hierarchies_api.';
7 g_debug	boolean	:=hr_utility.debug_enabled;
8 --
9 -- ----------------------------------------------------------------------------
10 -- |-----------------------------< get_node_data >----------------------------|
11 -- ----------------------------------------------------------------------------
12 -- {Start Of Comments}
13 --
14 -- Description:
15 -- This enhancement is to allow the use of the API to load seed data easily.
16 -- This procedure gets the ID of a node in the hierarchy given the full name
17 -- of the Preference.get_node_data takes the full name of the preference
18 -- hierarchy node such as A.B.C and returns the id of the node C in A.B.C
19 -- So now if node D needs to be added as the child of C ,then id of the node
20 -- C becomes the p_parent_pref_hierarchy_id for node D.
21 --
22 -- Pre Conditions:
23 --   None
24 --
25 -- In Arguments:
26 --   preference_full_name
27 --   p_name
28 --
29 -- Post Success:
30 --   Processing continues if the ID of a preference is determined
31 --
32 -- Post Failure:
33 --   An application error is raised for no_data_found or invalid data
34 --
35 -- {End Of Comments}
36 -- ----------------------------------------------------------------------------
37 Procedure get_node_data
38   (
39    p_preference_full_name     in varchar2
40   ,p_name                     in varchar2
41   ,p_business_group_id	      in number
42   ,p_legislation_code         in varchar2
43   ,p_mode                     out nocopy varchar2
44   ,p_pref_hierarchy_id        out nocopy number
45   ,p_parent_pref_hierarchy_id out nocopy number
46   ,p_object_version_number    out nocopy number
47    ) IS
48 --
49   l_proc  varchar2(72);
50 
51   l_period                   number;
52   l_next_period              number;
53   l_name                     varchar2(80);
54 
55   l_parent_pref_hierarchy_id number       := null;
56   l_pref_hierarchy_id        number       := null;
57   l_object_version_number    number       := null;
58   l_mode                     varchar2(50) := null;
59 
60   cursor c_top_node(l_name varchar2) is
61        SELECT pref_hierarchy_id,object_version_number
62        FROM   hxc_pref_hierarchies
63        WHERE  parent_pref_hierarchy_id is null
64        AND    name = l_name;
65 
66   cursor c_child_nodes(l_parent_pref_hierarchy_id number,l_name varchar2) is
67        SELECT pref_hierarchy_id,object_version_number
68        FROM   hxc_pref_hierarchies
69        WHERE  parent_pref_hierarchy_id = l_parent_pref_hierarchy_id
70        AND    name = l_name;
71 
72 --
73 begin
74 --
75 g_debug:=hr_utility.debug_enabled;
76 if g_debug then
77 	l_proc := g_package||'get_node_data';
78 end if;
79 if p_preference_full_name is not null then
80 
81    if g_debug then
82 	hr_utility.set_location('Entering:'||l_proc, 5);
83    end if;
84 
85    -- Consider preference_full_name A.B.C being passed.In this case the ID of node
86    -- C needs to be calculated.
87    -- Loop till the instr function,which gives the position of the next period in
88    -- the string,returns 0 implying that the end of the string is reached.
89 
90    l_period := 0;
91 
92    -- This loop gives the parent_pref_hierarchy_id for new node to be created
93 
94     WHILE l_period <> (length(p_preference_full_name) + 1) LOOP
95 
96       -- find the position of the delimiter
97 
98       l_next_period := instr(p_preference_full_name,'.',l_period + 1,1);
99 
100       -- if l_next_period is 0,i.e.,another delimiter could not be found,implies
101       -- that end of the sring is reached.
102 
103       if (l_next_period = 0) then
104           l_next_period := length(p_preference_full_name) + 1;
105       end if;
106 
107       -- get the name of the preference(i.e., the text between the two delimiters)
108 
109       l_name := substr(p_preference_full_name,l_period + 1,l_next_period
110                                                            - (l_period + 1));
111 
112       -- get the id of the preference with this name(l_name)
113 
114       if (l_parent_pref_hierarchy_id is null) then
115 
116          open c_top_node(l_name);
117          fetch c_top_node into l_parent_pref_hierarchy_id,l_object_version_number;
118          close c_top_node;
119 
120       else
121 
122          open c_child_nodes(l_parent_pref_hierarchy_id,l_name);
123          fetch c_child_nodes into l_parent_pref_hierarchy_id,l_object_version_number;
124          if c_child_nodes%notfound then
125             close c_child_nodes;
126 
127             -- since no data found therefore we must error
128             fnd_message.set_name('HXC', 'HXC_PREF_FULL_NAME_NOT_EXIST');
129             fnd_message.raise_error;
130          end if;
131 
132          close c_child_nodes;
133 
134       end if;
135 
136       l_period := l_next_period;
137 
138     end loop;
139 
140     open c_child_nodes(l_parent_pref_hierarchy_id,p_name);
141     fetch c_child_nodes into l_pref_hierarchy_id,l_object_version_number;
142 
143     -- set the OUT parameter
144     if c_child_nodes%found then
145        l_mode                     := 'UPDATE';
146     else
147        l_mode                     := 'INSERT';
148        l_pref_hierarchy_id        := null;
149        l_object_version_number    := null;
150     end if;
151     close c_child_nodes;
152 
153 elsif p_preference_full_name is null then
154     l_name := p_name;
155     open c_top_node(l_name);
156     fetch c_top_node into l_pref_hierarchy_id,l_object_version_number;
157 
158        if l_pref_hierarchy_id is null then
159         l_mode := 'INSERT';
160        else
161         l_mode := 'UPDATE';
162        end if;
163     close c_top_node;
164 
165 end if;
166 
167 p_mode                     := l_mode;
168 p_pref_hierarchy_id        := l_pref_hierarchy_id;
169 p_object_version_number    := l_object_version_number;
170 p_parent_pref_hierarchy_id := l_parent_pref_hierarchy_id;
171 
172 if g_debug then
173 	hr_utility.set_location('Leaving :'||l_proc, 10);
174 end if;
175 
176 end get_node_data;
177 --
178 -- ----------------------------------------------------------------------------
179 -- |--------------------------< create_pref_hierarchies >---------------------|
180 -- ----------------------------------------------------------------------------
181 --
182 procedure create_pref_hierarchies
183   (p_validate                      in     boolean  default false
184   ,p_pref_hierarchy_id             in out nocopy number
185   ,p_object_version_number         in out nocopy number
186   ,p_type                          in     varchar2 default null
187   ,p_name                          in     varchar2
188   ,p_business_group_id	           in     number   default null
189   ,p_legislation_code              in     varchar2 default null
190   ,p_parent_pref_hierarchy_id      in     number   default null
191   ,p_edit_allowed                  in     varchar2
192   ,p_displayed                     in     varchar2
193   ,p_pref_definition_id            in     number   default null
194   ,p_attribute_category            in     varchar2 default null
195   ,p_attribute1                    in     varchar2 default null
196   ,p_attribute2                    in     varchar2 default null
197   ,p_attribute3                    in     varchar2 default null
198   ,p_attribute4                    in     varchar2 default null
199   ,p_attribute5                    in     varchar2 default null
200   ,p_attribute6                    in     varchar2 default null
201   ,p_attribute7                    in     varchar2 default null
202   ,p_attribute8                    in     varchar2 default null
203   ,p_attribute9                    in     varchar2 default null
204   ,p_attribute10                   in     varchar2 default null
205   ,p_attribute11                   in     varchar2 default null
206   ,p_attribute12                   in     varchar2 default null
207   ,p_attribute13                   in     varchar2 default null
208   ,p_attribute14                   in     varchar2 default null
209   ,p_attribute15                   in     varchar2 default null
210   ,p_attribute16                   in     varchar2 default null
211   ,p_attribute17                   in     varchar2 default null
212   ,p_attribute18                   in     varchar2 default null
213   ,p_attribute19                   in     varchar2 default null
214   ,p_attribute20                   in     varchar2 default null
215   ,p_attribute21                   in     varchar2 default null
216   ,p_attribute22                   in     varchar2 default null
217   ,p_attribute23                   in     varchar2 default null
218   ,p_attribute24                   in     varchar2 default null
219   ,p_attribute25                   in     varchar2 default null
220   ,p_attribute26                   in     varchar2 default null
221   ,p_attribute27                   in     varchar2 default null
222   ,p_attribute28                   in     varchar2 default null
223   ,p_attribute29                   in     varchar2 default null
224   ,p_attribute30                   in     varchar2 default null
225   ,p_orig_pref_hierarchy_id        in     number   default null
226   ,p_orig_parent_hierarchy_id      in     number   default null
227   ,p_effective_date                in     date     default null
228   ,p_top_level_parent_id           in     number   default null --Performance Fix
229   ,p_code	                   in     varchar2 default null
230   ) is
231   --
232   -- Declare cursors and local variables
233   --
234 
235   l_proc                  varchar2(72);
236   l_object_version_number hxc_pref_hierarchies.object_version_number%TYPE;
237   l_pref_hierarchy_id     hxc_pref_hierarchies.pref_hierarchy_id%TYPE;
238 begin
239   g_debug:=hr_utility.debug_enabled;
240   if g_debug then
241 	l_proc := g_package||'create_pref_hierarchies';
242 	hr_utility.set_location('Entering:'|| l_proc, 10);
243   end if;
244   --
245   -- Issue a savepoint
246   --
247   savepoint create_pref_hierarchies;
248   --
249   if g_debug then
250 	hr_utility.set_location(l_proc, 20);
251   end if;
252   --
253   --
254   -- Truncate the time portion from all IN date parameters
255   --
256 
257   --
258   -- Call Before Process User Hook
259   --
260   begin
261     hxc_pref_hierarchies_bk_1.create_pref_hierarchies_b
262       (p_pref_hierarchy_id        => p_pref_hierarchy_id
263       ,p_object_version_number    => p_object_version_number
264       ,p_type                     => p_type
265       ,p_name                     => p_name
266       ,p_business_group_id        => p_business_group_id
267       ,p_legislation_code         => p_legislation_code
268       ,p_parent_pref_hierarchy_id => p_parent_pref_hierarchy_id
269       ,p_edit_allowed             => p_edit_allowed
270       ,p_displayed                => p_displayed
271       ,p_pref_definition_id       => p_pref_definition_id
272       ,p_attribute_category       => p_attribute_category
273       ,p_attribute1               => p_attribute1
274       ,p_attribute2               => p_attribute2
275       ,p_attribute3               => p_attribute3
276       ,p_attribute4               => p_attribute4
277       ,p_attribute5               => p_attribute5
278       ,p_attribute6               => p_attribute6
279       ,p_attribute7               => p_attribute7
280       ,p_attribute8               => p_attribute8
281       ,p_attribute9               => p_attribute9
282       ,p_attribute10              => p_attribute10
283       ,p_attribute11              => p_attribute11
284       ,p_attribute12              => p_attribute12
285       ,p_attribute13              => p_attribute13
286       ,p_attribute14              => p_attribute14
287       ,p_attribute15              => p_attribute15
288       ,p_attribute16              => p_attribute16
289       ,p_attribute17              => p_attribute17
290       ,p_attribute18              => p_attribute18
291       ,p_attribute19              => p_attribute19
292       ,p_attribute20              => p_attribute20
293       ,p_attribute21              => p_attribute21
294       ,p_attribute22              => p_attribute22
295       ,p_attribute23              => p_attribute23
296       ,p_attribute24              => p_attribute24
297       ,p_attribute25              => p_attribute25
298       ,p_attribute26              => p_attribute26
299       ,p_attribute27              => p_attribute27
300       ,p_attribute28              => p_attribute28
301       ,p_attribute29              => p_attribute29
302       ,p_attribute30              => p_attribute30
303       ,p_orig_pref_hierarchy_id   => p_orig_pref_hierarchy_id
304       ,p_orig_parent_hierarchy_id => p_orig_parent_hierarchy_id
305       ,p_effective_date           => p_effective_date
306       ,p_top_level_parent_id      => p_top_level_parent_id --Performance Fix
307       ,p_code	                  => p_code
308       );
309   exception
310     when hr_api.cannot_find_prog_unit then
311       hr_api.cannot_find_prog_unit_error
312         (p_module_name => 'create_pref_hierarchies'
313         ,p_hook_type   => 'BP'
314         );
315   end;
316   --
317   if g_debug then
318 	hr_utility.set_location(l_proc, 30);
319   end if;
320   --
321   --
322   -- Validation in addition to Row Handlers
323   --
324 
325 
326 
327   --
328   -- Process Logic
329   --
330   if g_debug then
331 	hr_utility.set_location(l_proc, 40);
332   end if;
333   --
334   -- call row handler
335   --
336   hxc_hph_ins.ins
337       (p_pref_hierarchy_id        => l_pref_hierarchy_id
338       ,p_object_version_number    => l_object_version_number
339       ,p_type                     => p_type
340       ,p_name                     => p_name
341       ,p_business_group_id        => p_business_group_id
342       ,p_legislation_code         => p_legislation_code
343       ,p_parent_pref_hierarchy_id => p_parent_pref_hierarchy_id
344       ,p_edit_allowed             => p_edit_allowed
345       ,p_displayed                => p_displayed
346       ,p_pref_definition_id       => p_pref_definition_id
347       ,p_attribute_category       => p_attribute_category
348       ,p_attribute1               => p_attribute1
349       ,p_attribute2               => p_attribute2
350       ,p_attribute3               => p_attribute3
351       ,p_attribute4               => p_attribute4
352       ,p_attribute5               => p_attribute5
353       ,p_attribute6               => p_attribute6
354       ,p_attribute7               => p_attribute7
355       ,p_attribute8               => p_attribute8
356       ,p_attribute9               => p_attribute9
357       ,p_attribute10              => p_attribute10
358       ,p_attribute11              => p_attribute11
359       ,p_attribute12              => p_attribute12
360       ,p_attribute13              => p_attribute13
361       ,p_attribute14              => p_attribute14
362       ,p_attribute15              => p_attribute15
363       ,p_attribute16              => p_attribute16
364       ,p_attribute17              => p_attribute17
365       ,p_attribute18              => p_attribute18
366       ,p_attribute19              => p_attribute19
367       ,p_attribute20              => p_attribute20
368       ,p_attribute21              => p_attribute21
369       ,p_attribute22              => p_attribute22
370       ,p_attribute23              => p_attribute23
371       ,p_attribute24              => p_attribute24
372       ,p_attribute25              => p_attribute25
373       ,p_attribute26              => p_attribute26
374       ,p_attribute27              => p_attribute27
375       ,p_attribute28              => p_attribute28
379       ,p_orig_parent_hierarchy_id => p_orig_parent_hierarchy_id
376       ,p_attribute29              => p_attribute29
377       ,p_attribute30              => p_attribute30
378       ,p_orig_pref_hierarchy_id   => p_orig_pref_hierarchy_id
380       ,p_effective_date           => p_effective_date
381       ,p_top_level_parent_id      => p_top_level_parent_id --Performance Fix
382       ,p_code	                  => p_code
383       );
384   --
385   if g_debug then
386 	hr_utility.set_location(l_proc, 50);
387   end if;
388   --
389   -- Call After Process User Hook
390   --
391   begin
392     hxc_pref_hierarchies_bk_1.create_pref_hierarchies_a
393       (p_pref_hierarchy_id        => p_pref_hierarchy_id
394       ,p_object_version_number    => p_object_version_number
395       ,p_type                     => p_type
396       ,p_name                     => p_name
397       ,p_business_group_id        => p_business_group_id
398       ,p_legislation_code         => p_legislation_code
399       ,p_parent_pref_hierarchy_id => p_parent_pref_hierarchy_id
400       ,p_edit_allowed             => p_edit_allowed
401       ,p_displayed                => p_displayed
402       ,p_pref_definition_id       => p_pref_definition_id
403       ,p_attribute_category       => p_attribute_category
404       ,p_attribute1               => p_attribute1
405       ,p_attribute2               => p_attribute2
406       ,p_attribute3               => p_attribute3
407       ,p_attribute4               => p_attribute4
408       ,p_attribute5               => p_attribute5
409       ,p_attribute6               => p_attribute6
410       ,p_attribute7               => p_attribute7
411       ,p_attribute8               => p_attribute8
412       ,p_attribute9               => p_attribute9
413       ,p_attribute10              => p_attribute10
414       ,p_attribute11              => p_attribute11
415       ,p_attribute12              => p_attribute12
416       ,p_attribute13              => p_attribute13
417       ,p_attribute14              => p_attribute14
418       ,p_attribute15              => p_attribute15
419       ,p_attribute16              => p_attribute16
420       ,p_attribute17              => p_attribute17
421       ,p_attribute18              => p_attribute18
422       ,p_attribute19              => p_attribute19
423       ,p_attribute20              => p_attribute20
424       ,p_attribute21              => p_attribute21
425       ,p_attribute22              => p_attribute22
426       ,p_attribute23              => p_attribute23
427       ,p_attribute24              => p_attribute24
428       ,p_attribute25              => p_attribute25
429       ,p_attribute26              => p_attribute26
430       ,p_attribute27              => p_attribute27
431       ,p_attribute28              => p_attribute28
432       ,p_attribute29              => p_attribute29
433       ,p_attribute30              => p_attribute30
434       ,p_orig_pref_hierarchy_id   => p_orig_pref_hierarchy_id
435       ,p_orig_parent_hierarchy_id => p_orig_parent_hierarchy_id
436       ,p_effective_date           => p_effective_date
437       ,p_top_level_parent_id      => p_top_level_parent_id --Performance Fix
438       ,p_code	                  => p_code
439       );
440   exception
441     when hr_api.cannot_find_prog_unit then
442       hr_api.cannot_find_prog_unit_error
443         (p_module_name => 'create_pref_hierarchies'
444         ,p_hook_type   => 'AP'
445         );
446   end;
447   --
448   if g_debug then
449 	hr_utility.set_location(l_proc, 60);
450   end if;
451   --
452   -- When in validation only mode raise the Validate_Enabled exception
453   --
454   if p_validate then
455     raise hr_api.validate_enabled;
456   end if;
457   --
458   --if g_debug then
459 	--hr_utility.set_location(' Leaving:'||l_proc, 70);
460   --end if;
461   --
462   --
463   -- Set all output arguments
464   --
465   p_pref_hierarchy_id      := l_pref_hierarchy_id;
466   p_object_version_number  := l_object_version_number;
467   --
468   if g_debug then
469 	hr_utility.set_location(' Leaving:'||l_proc, 70);
470   end if;
471 exception
472   when hr_api.validate_enabled then
473     --
474     -- As the Validate_Enabled exception has been raised
475     -- we must rollback to the savepoint
476     --
477     rollback to create_pref_hierarchies;
478     --
479     -- Only set output warning arguments
480     -- (Any key or derived arguments must be set to null
481     -- when validation only mode is being used.)
482     --
483     p_pref_hierarchy_id      := null;
484     p_object_version_number  := null;
485     if g_debug then
486 	hr_utility.set_location(' Leaving:'||l_proc, 80);
487     end if;
488   when others then
489     --
490     -- A validation or unexpected error has occured
491     --
492     rollback to create_pref_hierarchies;
493     if g_debug then
494 	hr_utility.set_location(' Leaving:'||l_proc, 90);
495     end if;
496     raise;
497     --
498 end create_pref_hierarchies;
499 --
500 --
501 -- ----------------------------------------------------------------------------
502 -- |------------------------< update_pref_hierarchies>------------------------|
503 -- ----------------------------------------------------------------------------
504 --
505 procedure update_pref_hierarchies
509   ,p_type                          in     varchar2 default null
506   (p_validate                      in     boolean  default false
507   ,p_pref_hierarchy_id             in     number
508   ,p_object_version_number         in out nocopy number
510   ,p_name                          in     varchar2
511   ,p_business_group_id             in     number   default null
512   ,p_legislation_code              in     varchar2 default null
513   ,p_parent_pref_hierarchy_id      in     number   default null
514   ,p_edit_allowed                  in     varchar2
515   ,p_displayed                     in     varchar2
516   ,p_pref_definition_id            in     number   default null
517   ,p_attribute_category            in     varchar2 default null
518   ,p_attribute1                    in     varchar2 default null
519   ,p_attribute2                    in     varchar2 default null
520   ,p_attribute3                    in     varchar2 default null
521   ,p_attribute4                    in     varchar2 default null
522   ,p_attribute5                    in     varchar2 default null
523   ,p_attribute6                    in     varchar2 default null
524   ,p_attribute7                    in     varchar2 default null
525   ,p_attribute8                    in     varchar2 default null
526   ,p_attribute9                    in     varchar2 default null
527   ,p_attribute10                   in     varchar2 default null
528   ,p_attribute11                   in     varchar2 default null
529   ,p_attribute12                   in     varchar2 default null
530   ,p_attribute13                   in     varchar2 default null
531   ,p_attribute14                   in     varchar2 default null
532   ,p_attribute15                   in     varchar2 default null
533   ,p_attribute16                   in     varchar2 default null
534   ,p_attribute17                   in     varchar2 default null
535   ,p_attribute18                   in     varchar2 default null
536   ,p_attribute19                   in     varchar2 default null
537   ,p_attribute20                   in     varchar2 default null
538   ,p_attribute21                   in     varchar2 default null
539   ,p_attribute22                   in     varchar2 default null
540   ,p_attribute23                   in     varchar2 default null
541   ,p_attribute24                   in     varchar2 default null
542   ,p_attribute25                   in     varchar2 default null
543   ,p_attribute26                   in     varchar2 default null
544   ,p_attribute27                   in     varchar2 default null
545   ,p_attribute28                   in     varchar2 default null
546   ,p_attribute29                   in     varchar2 default null
547   ,p_attribute30                   in     varchar2 default null
548   ,p_orig_pref_hierarchy_id        in     number   default null
549   ,p_orig_parent_hierarchy_id      in     number   default null
550   ,p_effective_date                in     date     default null
551   ,p_top_level_parent_id           in     number   default null --Performance Fix
552   ,p_code	                   in     varchar2 default null
553   ) is
554   --
555   -- Declare cursors and local variables
556   --
557   l_proc varchar2(72);
558   l_object_version_number hxc_pref_hierarchies.object_version_number%TYPE := p_object_version_number;
559   --
560 Begin
561   --
562   g_debug:=hr_utility.debug_enabled;
563   if g_debug then
564 	l_proc := g_package||' update_pref_hierarchies';
565 	hr_utility.set_location('Entering:'|| l_proc, 10);
566   end if;
567   --
568   -- Issue a savepoint if operating in validation only mode
569   --
570   savepoint update_pref_hierarchies;
571   --
572   if g_debug then
573 	hr_utility.set_location(l_proc, 20);
574   end if;
575   --
576   -- Call Before Process User Hook
577   --
578   begin
579    hxc_pref_hierarchies_bk_1.update_pref_hierarchies_b
580       (p_pref_hierarchy_id        => p_pref_hierarchy_id
581       ,p_object_version_number    => p_object_version_number
582       ,p_type                     => p_type
583       ,p_name                     => p_name
584       ,p_business_group_id        => p_business_group_id
585       ,p_legislation_code         => p_legislation_code
586       ,p_parent_pref_hierarchy_id => p_parent_pref_hierarchy_id
587       ,p_edit_allowed             => p_edit_allowed
588       ,p_displayed                => p_displayed
589       ,p_pref_definition_id       => p_pref_definition_id
590       ,p_attribute_category       => p_attribute_category
591       ,p_attribute1               => p_attribute1
592       ,p_attribute2               => p_attribute2
593       ,p_attribute3               => p_attribute3
594       ,p_attribute4               => p_attribute4
595       ,p_attribute5               => p_attribute5
596       ,p_attribute6               => p_attribute6
597       ,p_attribute7               => p_attribute7
598       ,p_attribute8               => p_attribute8
599       ,p_attribute9               => p_attribute9
600       ,p_attribute10              => p_attribute10
601       ,p_attribute11              => p_attribute11
602       ,p_attribute12              => p_attribute12
603       ,p_attribute13              => p_attribute13
604       ,p_attribute14              => p_attribute14
605       ,p_attribute15              => p_attribute15
606       ,p_attribute16              => p_attribute16
607       ,p_attribute17              => p_attribute17
608       ,p_attribute18              => p_attribute18
609       ,p_attribute19              => p_attribute19
613       ,p_attribute23              => p_attribute23
610       ,p_attribute20              => p_attribute20
611       ,p_attribute21              => p_attribute21
612       ,p_attribute22              => p_attribute22
614       ,p_attribute24              => p_attribute24
615       ,p_attribute25              => p_attribute25
616       ,p_attribute26              => p_attribute26
617       ,p_attribute27              => p_attribute27
618       ,p_attribute28              => p_attribute28
619       ,p_attribute29              => p_attribute29
620       ,p_attribute30              => p_attribute30
621       ,p_orig_pref_hierarchy_id   => p_orig_pref_hierarchy_id
622       ,p_orig_parent_hierarchy_id => p_orig_parent_hierarchy_id
623       ,p_effective_date           => p_effective_date
624       ,p_top_level_parent_id      => p_top_level_parent_id  --Performance Fix
625       ,p_code	                  => p_code
626       );
627 
628   exception
629     when hr_api.cannot_find_prog_unit then
630       hr_api.cannot_find_prog_unit_error
631         (p_module_name => 'update_pref_hierarchies'
632         ,p_hook_type   => 'BP'
633         );
634   end;
635   --
636   --insert into mtemp values('out of comp_b');
637   --commit;
638   --if g_debug then
639 	--hr_utility.set_location(l_proc, 30);
640   --end if;
641   --
642   -- Process Logic
643 --
644 -- call row handler
645 --
646 --insert into mtemp values('calling hxc_hac_upd.upd');
647  -- commit;
648 hxc_hph_upd.upd
649       (p_pref_hierarchy_id        => p_pref_hierarchy_id
650       ,p_object_version_number    => l_object_version_number
651       ,p_type                     => p_type
652       ,p_name                     => p_name
653       ,p_business_group_id        => p_business_group_id
654       ,p_legislation_code         => p_legislation_code
655       ,p_parent_pref_hierarchy_id => p_parent_pref_hierarchy_id
656       ,p_edit_allowed             => p_edit_allowed
657       ,p_displayed                => p_displayed
658       ,p_pref_definition_id       => p_pref_definition_id
659       ,p_attribute_category       => p_attribute_category
660       ,p_attribute1               => p_attribute1
661       ,p_attribute2               => p_attribute2
662       ,p_attribute3               => p_attribute3
663       ,p_attribute4               => p_attribute4
664       ,p_attribute5               => p_attribute5
665       ,p_attribute6               => p_attribute6
666       ,p_attribute7               => p_attribute7
667       ,p_attribute8               => p_attribute8
668       ,p_attribute9               => p_attribute9
669       ,p_attribute10              => p_attribute10
670       ,p_attribute11              => p_attribute11
671       ,p_attribute12              => p_attribute12
672       ,p_attribute13              => p_attribute13
673       ,p_attribute14              => p_attribute14
674       ,p_attribute15              => p_attribute15
675       ,p_attribute16              => p_attribute16
676       ,p_attribute17              => p_attribute17
677       ,p_attribute18              => p_attribute18
678       ,p_attribute19              => p_attribute19
679       ,p_attribute20              => p_attribute20
680       ,p_attribute21              => p_attribute21
681       ,p_attribute22              => p_attribute22
682       ,p_attribute23              => p_attribute23
683       ,p_attribute24              => p_attribute24
684       ,p_attribute25              => p_attribute25
685       ,p_attribute26              => p_attribute26
686       ,p_attribute27              => p_attribute27
687       ,p_attribute28              => p_attribute28
688       ,p_attribute29              => p_attribute29
689       ,p_attribute30              => p_attribute30
690       ,p_orig_pref_hierarchy_id   => p_orig_pref_hierarchy_id
691       ,p_orig_parent_hierarchy_id => p_orig_parent_hierarchy_id
692       ,p_effective_date           => p_effective_date
693       ,p_top_level_parent_id      => p_top_level_parent_id --Performance Fix
694       ,p_code	                  => p_code
695       );
696 --
697   --
698   --insert into mtemp values('out of hax_hac_upd');
699   --commit;
700 
701   if g_debug then
702 	hr_utility.set_location(l_proc, 40);
703   end if;
704   --
705   -- Call After Process User Hook
706   --
707   begin
708    hxc_pref_hierarchies_bk_1.update_pref_hierarchies_a
709       (p_pref_hierarchy_id        => p_pref_hierarchy_id
710       ,p_object_version_number    => p_object_version_number
711       ,p_type                     => p_type
712       ,p_name                     => p_name
713       ,p_business_group_id        => p_business_group_id
714       ,p_legislation_code         => p_legislation_code
715       ,p_parent_pref_hierarchy_id => p_parent_pref_hierarchy_id
716       ,p_edit_allowed             => p_edit_allowed
717       ,p_displayed                => p_displayed
718       ,p_pref_definition_id       => p_pref_definition_id
719       ,p_attribute_category       => p_attribute_category
720       ,p_attribute1               => p_attribute1
721       ,p_attribute2               => p_attribute2
722       ,p_attribute3               => p_attribute3
723       ,p_attribute4               => p_attribute4
724       ,p_attribute5               => p_attribute5
725       ,p_attribute6               => p_attribute6
726       ,p_attribute7               => p_attribute7
727       ,p_attribute8               => p_attribute8
731       ,p_attribute12              => p_attribute12
728       ,p_attribute9               => p_attribute9
729       ,p_attribute10              => p_attribute10
730       ,p_attribute11              => p_attribute11
732       ,p_attribute13              => p_attribute13
733       ,p_attribute14              => p_attribute14
734       ,p_attribute15              => p_attribute15
735       ,p_attribute16              => p_attribute16
736       ,p_attribute17              => p_attribute17
737       ,p_attribute18              => p_attribute18
738       ,p_attribute19              => p_attribute19
739       ,p_attribute20              => p_attribute20
740       ,p_attribute21              => p_attribute21
741       ,p_attribute22              => p_attribute22
742       ,p_attribute23              => p_attribute23
743       ,p_attribute24              => p_attribute24
744       ,p_attribute25              => p_attribute25
745       ,p_attribute26              => p_attribute26
746       ,p_attribute27              => p_attribute27
747       ,p_attribute28              => p_attribute28
748       ,p_attribute29              => p_attribute29
749       ,p_attribute30              => p_attribute30
750       ,p_orig_pref_hierarchy_id   => p_orig_pref_hierarchy_id
751       ,p_orig_parent_hierarchy_id => p_orig_parent_hierarchy_id
752       ,p_effective_date           => p_effective_date
753       ,p_top_level_parent_id      => p_top_level_parent_id --Performance Fix
754       ,p_code	                  => p_code
755       );
756   exception
757     when hr_api.cannot_find_prog_unit then
758       hr_api.cannot_find_prog_unit_error
759         (p_module_name => 'update_pref_hierarchies'
760         ,p_hook_type   => 'AP'
761         );
762   end;
763   --
764   --insert into mtemp values('out of comp_a');
765   --commit;
766 
767   if g_debug then
768 	hr_utility.set_location(l_proc, 50);
769   end if;
770   --
771   -- When in validation only mode raise the Validate_Enabled exception
772   --
773   if p_validate then
774     raise hr_api.validate_enabled;
775   end if;
776   --
777   if g_debug then
778 	hr_utility.set_location(' Leaving:'||l_proc, 60);
779   end if;
780   --
781   -- Set all output arguments
782   --
783   --
784   --insert into mtemp values('setting OVN value ');
785   --commit;
786 
787   p_object_version_number := l_object_version_number;
788   --
789   --insert into mtemp values('OVN value set');
790   --commit;
791 
792 exception
793   --
794   when hr_api.validate_enabled then
795     --
796     -- As the Validate_Enabled exception has been raised
797     -- we must rollback to the savepoint
798     --
799     ROLLBACK TO update_pref_hierarchies;
800     --
801     -- Only set output warning arguments
802     -- (Any key or derived arguments must be set to null
803     -- when validation only mode is being used.)
804     --
805     p_object_version_number  := null;
806     --
807     --insert into mtemp values('OVN set to null');
808     --commit;
809 
810     if g_debug then
811 	hr_utility.set_location(' Leaving:'||l_proc, 60);
812     end if;
813     --
814   when others then
815     --
816     -- A validation or unexpected error has occured
817     --
818     ROLLBACK TO update_pref_hierarchies;
819     if g_debug then
820 	hr_utility.set_location(' Leaving:'||l_proc, 70);
821     end if;
822     raise;
823     --
824 END update_pref_hierarchies;
825 --
826 -- ----------------------------------------------------------------------------
827 -- |------------------------< delete_pref_hierarchies >-----------------------|
828 -- ----------------------------------------------------------------------------
829 --
830 procedure delete_pref_hierarchies
831   (p_validate                       in  boolean  default false
832   ,p_pref_hierarchy_id              in  number
833   ,p_object_version_number          in  number
834   ) is
835   --
836   -- Declare cursors and local variables
837   --
838   l_proc varchar2(72);
839   --
840 begin
841   --
842   --
843   g_debug:=hr_utility.debug_enabled;
844   if g_debug then
845 	l_proc := g_package||'delete_pref_hierarchies';
846 	hr_utility.set_location('Entering:'|| l_proc, 10);
847   end if;
848   --
849   -- Issue a savepoint if operating in validation only mode
850   --
851   savepoint delete_pref_hierarchies;
852   --
853   if g_debug then
854 	hr_utility.set_location(l_proc, 20);
855   end if;
856   --
857   -- Call Before Process User Hook
858   --
859   begin
860   --
861          hxc_pref_hierarchies_bk_1.delete_pref_hierarchies_b
862           (p_pref_hierarchy_id     => p_pref_hierarchy_id
863           ,p_object_version_number => p_object_version_number
864           );
865   exception
866     when hr_api.cannot_find_prog_unit then
867       hr_api.cannot_find_prog_unit_error
868         (p_module_name => 'delete_pref_hierarchies'
869         ,p_hook_type   => 'BP'
870         );
871   end;
872   --
873   if g_debug then
874 	hr_utility.set_location(l_proc, 30);
875   end if;
876   --
877   -- Process Logic
878   --
879   hxc_hph_del.del
880     (
881      p_pref_hierarchy_id           => p_pref_hierarchy_id
882     ,p_object_version_number       => p_object_version_number
883     );
884   --
885   if g_debug then
886 	hr_utility.set_location(l_proc, 40);
887   end if;
888   --
889   -- Call After Process User Hook
890   --
891   begin
892   --
893          hxc_pref_hierarchies_bk_1.delete_pref_hierarchies_a
894           (p_pref_hierarchy_id      => p_pref_hierarchy_id
895           ,p_object_version_number  => p_object_version_number
896           );
897   exception
898     when hr_api.cannot_find_prog_unit then
899       hr_api.cannot_find_prog_unit_error
900         (p_module_name => 'delete_pref_hierarchies'
901         ,p_hook_type   => 'AP'
902         );
903   end;
904   --
905   -- When in validation only mode raise the Validate_Enabled exception
906   --
907   if p_validate then
908     raise hr_api.validate_enabled;
909   end if;
910   --
911   if g_debug then
912 	hr_utility.set_location(' Leaving:'||l_proc, 50);
913   end if;
914   --
915 exception
916   --
917   when hr_api.validate_enabled then
918     --
919     -- As the Validate_Enabled exception has been raised
920     -- we must rollback to the savepoint
921     --
922     ROLLBACK TO delete_pref_hierarchies;
923     --
924   when others then
925     --
926     -- A validation or unexpected error has occured
927     --
928     ROLLBACK TO delete_pref_hierarchies;
929     raise;
930     --
931 end delete_pref_hierarchies;
932 --
933 end hxc_pref_hierarchies_api;