DBA Data[Home] [Help]

PACKAGE BODY: APPS.IRC_LOCATION_CRITERIA_VAL_API

Source


1 Package Body IRC_LOCATION_CRITERIA_VAL_API as
2 /* $Header: irlcvapi.pkb 120.0 2005/10/03 14:58:42 rbanda noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := '  IRC_LOCATION_CRITERIA_VAL_API.';
7 --
8 -- ----------------------------------------------------------------------------
9 -- |-------------------< CREATE_LOCATION_CRITERIA >---------------------|
10 -- ----------------------------------------------------------------------------
11 --
12 procedure CREATE_LOCATION_CRITERIA
13   (p_validate                      in     boolean  default false
14   ,p_search_criteria_id            in     number
15   ,p_derived_locale                in     varchar2
16   ,p_location_criteria_value_id       out nocopy   number
17   ,p_object_version_number            out nocopy   number
18   ) is
19   --
20   -- Declare cursors and local variables
21   --
22   l_proc                varchar2(72) := g_package||'CREATE_LOCATION_CRITERIA';
23   l_object_version_number irc_location_criteria_values.object_version_number%TYPE;
24   l_location_criteria_value_id irc_location_criteria_values.location_criteria_value_id%TYPE;
25 
26 begin
27   hr_utility.set_location('Entering:'|| l_proc, 10);
28   --
29   -- Issue a savepoint
30   --
31   savepoint CREATE_LOCATION_CRITERIA;
32   --
33   -- Call Before Process User Hook
34   --
35   begin
36     IRC_LOCATION_CRITERIA_VAL_BK1.CREATE_LOCATION_CRITERIA_B
37       (p_search_criteria_id            => p_search_criteria_id
38       ,p_derived_locale                => p_derived_locale
39       );
40   exception
41     when hr_api.cannot_find_prog_unit then
42       hr_api.cannot_find_prog_unit_error
43         (p_module_name => 'CREATE_LOCATION_CRITERIA'
44         ,p_hook_type   => 'BP'
45         );
46   end;
47   --
48   -- Validation in addition to Row Handlers
49   --
50   --
51   -- Process Logic
52   --
53   irc_lcv_ins.ins
54     (p_search_criteria_id            => p_search_criteria_id
55     ,p_derived_locale                => p_derived_locale
56     ,p_location_criteria_value_id    => l_location_criteria_value_id
57     ,p_object_version_number         => l_object_version_number
58     );
59   --
60   -- Call After Process User Hook
61   --
62   begin
63     IRC_LOCATION_CRITERIA_VAL_BK1.CREATE_LOCATION_CRITERIA_A
64       (p_location_criteria_value_id    => l_location_criteria_value_id
65       ,p_search_criteria_id            => p_search_criteria_id
66       ,p_derived_locale                => p_derived_locale
67       ,p_object_version_number         => l_object_version_number
68       );
69   exception
70     when hr_api.cannot_find_prog_unit then
71       hr_api.cannot_find_prog_unit_error
72         (p_module_name => 'CREATE_LOCATION_CRITERIA'
73         ,p_hook_type   => 'AP'
74         );
75   end;
76   --
77   -- When in validation only mode raise the Validate_Enabled exception
78   --
79   if p_validate then
80     raise hr_api.validate_enabled;
81   end if;
82   --
83   -- Set all IN OUT and OUT parameters with out values
84   --
85   p_location_criteria_value_id  := l_location_criteria_value_id;
86   p_object_version_number       := l_object_version_number;
87   --
88   hr_utility.set_location(' Leaving:'||l_proc, 70);
89 exception
90   when hr_api.validate_enabled then
91     --
92     -- As the Validate_Enabled exception has been raised
93     -- we must rollback to the savepoint
94     --
95     rollback to CREATE_LOCATION_CRITERIA;
96     --
97     -- Reset IN OUT parameters and set OUT parameters
98     -- (Any key or derived arguments must be set to null
99     -- when validation only mode is being used.)
100     --
101     p_location_criteria_value_id  := null;
102     p_object_version_number       := null;
103     hr_utility.set_location(' Leaving:'||l_proc, 80);
104   when others then
105     --
106     -- A validation or unexpected error has occured
107     --
108     rollback to CREATE_LOCATION_CRITERIA;
109     --
110     -- Reset IN OUT parameters and set all
111     -- OUT parameters, including warnings, to null
112     --
113     p_location_criteria_value_id  := null;
114     p_object_version_number       := null;
115     hr_utility.set_location(' Leaving:'||l_proc, 90);
116     raise;
117 end CREATE_LOCATION_CRITERIA;
118 --
119 -- ----------------------------------------------------------------------------
120 -- |-----------------< DELETE_LOCATION_CRITERIA >-----------------------|
121 -- ----------------------------------------------------------------------------
122 --
123 procedure DELETE_LOCATION_CRITERIA
124   (p_validate                      in     boolean  default false
125   ,p_location_criteria_value_id    in     number
126   ,p_object_version_number         in     number
127   ) is
128   --
129   -- Declare cursors and local variables
130   --
131   l_proc                varchar2(72) := g_package||'DELETE_LOCATION_CRITERIA';
132 begin
133   hr_utility.set_location('Entering:'|| l_proc, 10);
134   --
135   -- Issue a savepoint
136   --
137   savepoint DELETE_LOCATION_CRITERIA;
138   --
139   -- Call Before Process User Hook
140   --
141   begin
142     IRC_LOCATION_CRITERIA_VAL_BK2.DELETE_LOCATION_CRITERIA_B
143       (p_location_criteria_value_id    => p_location_criteria_value_id
144       ,p_object_version_number         => p_object_version_number
145       );
146   exception
147     when hr_api.cannot_find_prog_unit then
148       hr_api.cannot_find_prog_unit_error
149         (p_module_name => 'DELETE_LOCATION_CRITERIA'
150         ,p_hook_type   => 'BP'
151         );
152   end;
153   --
154   -- Validation in addition to Row Handlers
155   --
156   --
157   -- Process Logic
158   --
159   irc_lcv_del.del
160     (p_location_criteria_value_id    => p_location_criteria_value_id
161     ,p_object_version_number         => p_object_version_number
162     );
163   --
164   -- Call After Process User Hook
165   --
166   begin
167     IRC_LOCATION_CRITERIA_VAL_BK2.DELETE_LOCATION_CRITERIA_A
168       (p_location_criteria_value_id    => p_location_criteria_value_id
169       ,p_object_version_number         => p_object_version_number
170       );
171   exception
172     when hr_api.cannot_find_prog_unit then
173       hr_api.cannot_find_prog_unit_error
174         (p_module_name => 'DELETE_LOCATION_CRITERIA'
175         ,p_hook_type   => 'AP'
176         );
177   end;
178   --
179   -- When in validation only mode raise the Validate_Enabled exception
180   --
181   if p_validate then
182     raise hr_api.validate_enabled;
183   end if;
184   --
185   -- Set all IN OUT and OUT parameters with out values
186   --
187   hr_utility.set_location(' Leaving:'||l_proc, 70);
188 exception
189   when hr_api.validate_enabled then
190     --
191     -- As the Validate_Enabled exception has been raised
192     -- we must rollback to the savepoint
193     --
194     rollback to DELETE_LOCATION_CRITERIA;
195     --
196     -- Reset IN OUT parameters and set OUT parameters
197     -- (Any key or derived arguments must be set to null
198     -- when validation only mode is being used.)
199     --
200     hr_utility.set_location(' Leaving:'||l_proc, 80);
201   when others then
202     --
203     -- A validation or unexpected error has occured
204     --
205     rollback to DELETE_LOCATION_CRITERIA;
206     --
207     -- Reset IN OUT parameters and set all
208     -- OUT parameters, including warnings, to null
209     --
210     hr_utility.set_location(' Leaving:'||l_proc, 90);
211     raise;
212 end DELETE_LOCATION_CRITERIA;
213 --
214 end IRC_LOCATION_CRITERIA_VAL_API;