[Home] [Help]
PACKAGE BODY: APPS.PER_RI_CONFIGURATION_API
Source
1 Package Body per_ri_configuration_api AS
2 /* $Header: pecnfapi.pkb 120.0 2005/05/31 06:46:23 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package VARCHAR2(33) := 'per_ri_configuration_api.';
7 --
8 --------------------------------------------------------------------------------
9 g_dummy number(1); -- Dummy for cursor returns which are not needed
10 g_business_group_id number(15); -- For validating translation;
11 g_legislation_code varchar2(150); -- For validating translation;
12 --------------------------------------------------------------------------------
13 -- ----------------------------------------------------------------------------------
14 -- |-----------------------------< create_configurations >--------------------------|
15 -- ----------------------------------------------------------------------------------
16 --
17 Procedure create_configuration
18 ( p_validate In Boolean Default False
19 ,p_configuration_code In Varchar2
20 ,p_configuration_type In Varchar2
21 ,p_configuration_status In Varchar2
22 ,p_configuration_name In Varchar2
23 ,p_configuration_description In Varchar2
24 ,p_language_code In Varchar2 Default hr_api.userenv_lang
25 ,p_effective_date In Date
26 ,p_object_version_number Out Nocopy Number
27
28 ) Is
29 --
30 -- Declare cursors and local variables
31 --
32 l_proc Varchar2(72) := g_package||'create_configuration';
33 l_object_version_number hr_locations_all.object_version_number%TYPE;
34 l_language_code per_ri_configurations_tl.language%TYPE;
35 l_effective_date Date;
36
37 --
38 Begin
39 --
40 hr_utility.set_location('Entering:'|| l_proc, 10);
41 --
42 -- Issue a savepoint
43 --
44 Savepoint create_configuration;
45 --
46 hr_utility.set_location(l_proc, 15);
47 per_cnf_ins.set_base_key_value (p_configuration_code => p_configuration_code );
48 --
49 -- All date input parameters must be truncated to remove time elements
50 --
51 l_effective_date := trunc (p_effective_date);
52 --
53 --
54 -- Validate the language parameter. l_language_code should be passed to functions
55 -- instead of p_language_code from now on, to allow an IN OUT parameter to
56 -- be passed through.
57 --
58 l_language_code := p_language_code;
59 hr_api.validate_language_code(p_language_code => l_language_code);
60 --
61 hr_utility.set_location(l_proc, 20);
62
63 -- Process Logic
64 --
65 -- Insert non-translatable rows into PER_RI_configurationS first
66 per_cnf_ins.ins
67 (p_effective_date => l_effective_date
68 ,p_configuration_code => p_configuration_code
69 ,p_configuration_type => p_configuration_type
70 ,p_configuration_status => p_configuration_status
71 ,p_object_version_number => l_object_version_number
72 );
73 --
74 -- Now insert translatable rows in PER_RI_configurationS_TL table
75 per_cnt_ins.ins_tl
76 ( p_effective_date => l_effective_date
77 ,p_configuration_code => p_configuration_code
78 ,p_configuration_name => p_configuration_name
79 ,p_configuration_description => p_configuration_description
80 ,p_language_code => l_language_code
81 );
82
83 hr_utility.set_location(l_proc, 60);
84 --
85 -- When in validation only mode raise the Validate_Enabled exception
86 --
87 If p_validate Then
88 Raise hr_api.validate_enabled;
89 End If;
90 --
91 -- Set all output arguments
92 --
93 p_object_version_number := l_object_version_number;
94 --
95 hr_utility.set_location(' Leaving:'||l_proc, 70);
96 --
97 Exception
98 --
99 When hr_api.validate_enabled Then
100 --
101 -- As the Validate_Enabled exception has been raised
102 -- we must rollback to the savepoint
103 --
104 Rollback To create_configuration;
105 --
106 -- Only set output warning arguments
107 -- (Any key or derived arguments must be set to null
108 -- when validation only mode is being used.)
109 --
110 p_object_version_number := Null;
111 hr_utility.set_location(' Leaving:'||l_proc, 80);
112 When Others Then
113 --
114 -- A validation or unexpected error has occurred
115 Rollback To create_configuration;
116 -- Set OUT parameters.
117 p_object_version_number := Null;
118 hr_utility.set_location(' Leaving:'||l_proc, 90);
119 Raise;
120 --
121 End create_configuration;
122 -- ----------------------------------------------------------------------------
123 -- |--------------------------< update_configurations >-----------------------------|
124 -- ----------------------------------------------------------------------------
125 --
126 Procedure update_configuration
127 ( p_validate In Boolean Default False
128 ,p_configuration_code In Varchar2
129 ,p_configuration_type In Varchar2 Default hr_api.g_varchar2
130 ,p_configuration_status In Varchar2 Default hr_api.g_varchar2
131 ,p_configuration_name In Varchar2 Default hr_api.g_varchar2
132 ,p_configuration_description In Varchar2 Default hr_api.g_varchar2
133 ,p_language_code In Varchar2 Default hr_api.userenv_lang
134 ,p_effective_date In Date
135 ,p_object_version_number In Out Nocopy Number
136 ) Is
137 --
138 -- Declare cursors and local variables
139 --
140 l_proc VARCHAR2(72) := g_package||'update_configuration';
141 l_object_version_number hr_locations.object_version_number%TYPE;
142 l_language_code hr_locations_all_tl.language%TYPE;
143 l_configuration_creation_date Date;
144 l_effective_date DATE;
145
146 l_temp_ovn number := p_object_version_number;
147 --
148 BEGIN
149 --
150 hr_utility.set_location('Entering:'|| l_proc, 10);
151 --
152 -- Issue a savepoint.
153 --
154 savepoint update_configuration;
155 --
156 --
157 -- All date input parameters must be truncated to remove time elements
158 --
159 l_effective_date := trunc (p_effective_date);
160
161 --
162 -- Validate the language parameter. l_language_code should be passed to functions
163 -- instead of p_language_code from now on, to allow an IN OUT parameter to be
164 -- passed through.
165 --
166 l_language_code := p_language_code;
167 hr_api.validate_language_code(p_language_code => l_language_code);
168 hr_utility.set_location(l_proc, 20);
169 --
170 --
171 -- Process Logic
172 --
173 l_object_version_number := p_object_version_number;
174 --
175 -- Insert non-translatable rows in PER_RI_configurationS Table
176 --
177 per_cnf_upd.upd
178 ( p_configuration_code => p_configuration_code
179 ,p_configuration_type => p_configuration_type
180 ,p_configuration_status => p_configuration_status
181 ,p_effective_date => l_effective_date
182 ,p_object_version_number => l_object_version_number);
183 --
184 -- Now insert translatable rows in PER_RI_configurationS_TL table
185
186 per_cnt_upd.upd_tl
187 ( p_configuration_code => p_configuration_code
188 ,p_configuration_name => p_configuration_name
189 ,p_configuration_description => p_configuration_description
190 ,p_language_code => l_language_code
191 ,p_effective_date => l_effective_date
192 );
193
194 --
195
196 hr_utility.set_location(l_proc, 60);
197 --
198 -- When in validation only mode raise the Validate_Enabled exception
199 --
200 If p_validate Then
201 Raise hr_api.validate_enabled;
202 End If;
203 --
204 -- Set all output arguments. If p_validate was TRUE, this bit is
205 -- never reached, so p_object_version_number is passed back unchanged.
206 --
207 p_object_version_number := l_object_version_number;
208 --
209 hr_utility.set_location(' Leaving:'||l_proc, 70);
210 --
211 Exception
212 --
213 When hr_api.validate_enabled Then
214 --
215 -- As the Validate_Enabled exception has been raised
216 -- we must rollback to the savepoint
217 --
218 Rollback To update_configuration;
219 --
220 -- Only set output warning arguments
221 -- (Any key or derived arguments must be set to null
222 -- when validation only mode is being used.)
223 -- Reset IN OUT parameters.
224 p_object_version_number := l_temp_ovn;
225 hr_utility.set_location(' Leaving:'||l_proc, 80);
226 When Others Then
227 --
228 -- A validation or unexpected error has occurred
229 Rollback To update_configuration;
230 -- Reset IN OUT parameters.
231 p_object_version_number := l_temp_ovn;
232 hr_utility.set_location(' Leaving:'||l_proc, 90);
233 Raise;
234 --
235 --
236 End update_configuration;
237 -- ----------------------------------------------------------------------------
238 -- |-------------------------< delete_location >------------------------------|
239 -- ----------------------------------------------------------------------------
240 --
241 Procedure delete_configuration
242 ( p_validate In Boolean Default False
243 ,p_configuration_code In Varchar2
244 ,p_object_version_number IN Number )
245
246 Is
247 --
248 --
249 -- Declare cursors and local variables
250 --
251 l_proc Varchar2(72) := g_package||'delete_configuration';
252 --
253 Begin
254 --
255 hr_utility.set_location('Entering:'|| l_proc, 10);
256 --
257 -- Issue a savepoint
258 --
259 Savepoint delete_configuration;
260
261 --
262 -- Process Logic
263 -- =============
264 --
265 -- Need to lock main table to maintain the locking ladder order
266 --
267 hr_utility.set_location( l_proc, 30);
268 per_cnf_shd.lck ( p_configuration_code => p_configuration_code,
269 p_object_version_number => p_object_version_number );
270 --
271 -- Remove all matching translation rows
272 --
273 hr_utility.set_location( l_proc, 35);
274
275 per_cnt_del.del_tl( p_configuration_code => p_configuration_code );
276 --
277 -- Remove non-translated data row
278 --
279 hr_utility.set_location( l_proc, 40);
280
281 per_cnf_del.del(p_configuration_code => p_configuration_code,
282 p_object_version_number => p_object_version_number );
283 --
284 --
285 hr_utility.set_location(' Leaving:'||l_proc, 60);
286 --
287 -- When in validation only mode raise the Validate_Enabled exception
288 --
289 If p_validate Then
290 Raise hr_api.validate_enabled;
291 End If;
292 --
293 --
294 Exception
295 --
296 When hr_api.validate_enabled Then
297 --
298 -- As the Validate_Enabled exception has been raised
299 -- we must rollback to the savepoint
300 --
301 Rollback To delete_configuration;
302 --
303 -- Only set output warning arguments
304 -- (Any key or derived arguments must be set to null
305 -- when validation only mode is being used.)
306 --
307 hr_utility.set_location(' Leaving:'||l_proc, 80);
308 When Others Then
309 --
310 -- A validation or unexpected error has occurred
311 Rollback To delete_configuration;
312 hr_utility.set_location(' Leaving:'||l_proc, 90);
313 Raise;
314 --
315 End delete_configuration;
316
317 --
318
319 End per_ri_configuration_api;