[Home] [Help]
PACKAGE BODY: APPS.GHR_PDC_API
Source
4 -- PAckage Variables
1 PACKAGE BODY ghr_pdc_api AS
2 /* $Header: ghpdcapi.pkb 120.1.12010000.1 2009/05/25 12:01:00 utokachi noship $ */
3
5
6 g_package varchar2(100) := 'ghr_pdc_api';
10
7 l_pd_classification_id number;
8 l_position_description_id number;
9 l_pdc_object_version_number number;
11 PROCEDURE create_pdc
12 (p_validate IN BOOLEAN default false,
13 p_pd_classification_id OUT NOCOPY ghr_pd_classifications.pd_classification_id%TYPE,
14 p_position_description_id IN number,
15 p_class_grade_by IN ghr_pd_classifications.class_grade_by%TYPE,
16 p_official_title IN ghr_pd_classifications.official_title%TYPE,
17 p_pay_plan IN ghr_pd_classifications.pay_plan%TYPE,
18 p_occupational_code IN ghr_pd_classifications.occupational_code%TYPE,
19 p_grade_level IN ghr_pd_classifications.grade_level%TYPE,
20 p_pdc_object_version_number out NOCOPY number)
21 IS
22 l_proc varchar2(72);
23 l_pdc_object_version_number number;
24 l_position_description_id number;
25 l_pd_classification_id number;
26 BEGIN
27 l_proc := g_package||' create_pdc';
28 hr_utility.set_location('Entering:'||l_proc,5);
29 --
30 -- Issue a savepoint if operating in validation only mode
31 --
32 -- IF p_validate THEN
33 -- Bug# 671537
34 -- END IF;
35 SAVEPOINT create_pdc;
36 -- Call Before Process User Hook
37 --
38 begin
39 ghr_pdc_bk1.create_pdc_b (
40 p_position_description_id => p_position_description_id,
41 p_class_grade_by => p_class_grade_by,
42 p_official_title => p_official_title,
43 p_pay_plan => p_pay_plan,
44 p_occupational_code => p_occupational_code,
45 p_grade_level => p_grade_level
46 );
47 exception
48 when hr_api.cannot_find_prog_unit then
49 hr_api.cannot_find_prog_unit_error
50 (p_module_name => 'create_pdc',
51 p_hook_type => 'BP'
52 );
53 end;
54 --
55 -- End of Before Process User Hook call
56 --
57 --
58
59
60 hr_utility.set_location(l_proc,6);
61
62 -- Validation in Addition to Row Handlers:
63
64 IF p_position_description_id is NULL THEN
65
66 hr_utility.set_message(8301,'GHR_POS_DESC_ID_INVALID');
67 hr_utility.raise_error;
68 END IF;
69
70 -- Process Logic
71 -- Insert a row into GHR_PD_CLASSIFICATIONS using the row handler.
72
73 ghr_pdc_ins.ins
74 (p_pd_classification_id => l_pd_classification_id,
75 p_position_description_id => p_position_description_id,
76 p_class_grade_by => p_class_grade_by,
77 p_official_title => p_official_title,
78 p_pay_plan => p_pay_plan,
79 p_occupational_code => p_occupational_code,
80 p_grade_level => p_grade_level,
81 p_object_version_number => l_pdc_object_version_number);
82
83 p_pd_classification_id := l_pd_classification_id;
84
85 --
86 -- Call After Process User Hook
87 --
88 begin
89 ghr_pdc_bk1.create_pdc_a (
90 p_pd_classification_id => l_pd_classification_id,
91 p_position_description_id => p_position_description_id,
92 p_class_grade_by => p_class_grade_by,
93 p_official_title => p_official_title,
94 p_pay_plan => p_pay_plan,
95 p_occupational_code => p_occupational_code,
96 p_grade_level => p_grade_level,
97 p_pdc_object_version_number => l_pdc_object_version_number
98 );
99 exception
100 when hr_api.cannot_find_prog_unit then
101 hr_api.cannot_find_prog_unit_error
102 (p_module_name => 'create_pdc',
103 p_hook_type => 'AP'
104 );
105 end;
106 --
107 -- End of After Process User Hook call
108 --
109 --
110 IF p_validate THEN
111
112 RAISE hr_api.validate_enabled;
113
114 END IF;
115
116 --
117 -- Set All output Arguments
118 --
119
120 p_pdc_object_version_number := l_pdc_object_version_number;
121 p_pd_classification_id := l_pd_classification_id;
122
123
124 hr_utility.set_location ('Leaving:'|| l_proc,11);
125
126 EXCEPTION
127
128 WHEN hr_api.validate_enabled THEN
129
130 -- As the validation exception has been raised
131 -- We must rollback to the Savepoint set.
132
133 ROLLBACK TO create_pdc;
134
135
136 -- Only Set Output warning arguments.
137 -- (Any key or derived arguments must be set to NULL
138 -- When validation only mode is being used.)
139 --
140
141 p_pdc_object_version_number := NULL;
142 p_pd_classification_id := NULL;
143 --
144 when others then
145 rollback to create_pdc;
146 p_pdc_object_version_number := NULL;
147 p_pd_classification_id := NULL;
148 raise;
149 hr_utility.set_location('Leaving:' || l_proc,12);
150 --
151 END create_pdc;
152
153
154 PROCEDURE
155 update_pdc(p_validate IN BOOLEAN default false,
156 p_pd_classification_id IN ghr_pd_classifications.pd_classification_id%TYPE,
157 p_position_description_id IN ghr_position_descriptions.position_description_id%TYPE,
158 p_class_grade_by IN ghr_pd_classifications.class_grade_by%TYPE,
159 p_official_title IN ghr_pd_classifications.official_title%TYPE,
160 p_pay_plan IN ghr_pd_classifications.pay_plan%TYPE,
161 p_occupational_code IN ghr_pd_classifications.occupational_code%TYPE,
162 p_grade_level IN ghr_pd_classifications.grade_level%TYPE,
163 p_pdc_object_version_number IN out NOCOPY number)
164
165 IS
166 l_proc varchar2(72);
167 l_object_version_number number;
168 l_pd_classification_id ghr_pd_classifications.pd_classification_id%TYPE;
172 l_proc := g_package||'Update_pdc';
169 l_pdc_object_version_number NUMBER;
170
171 BEGIN
173 hr_utility.set_location('Entering:'||l_proc,5);
174 l_pdc_object_version_number := p_pdc_object_version_number;
175 --
176 -- Issue a savepoint if operating in validation only mode
177 -- Bug # 671537
178 -- IF p_validate THEN
179 -- END IF;
180 SAVEPOINT update_pdc;
181 --
182 -- Call Before Process User Hook
183 --
184 begin
185 ghr_pdc_bk2.update_pdc_b (
186 p_pd_classification_id => p_pd_classification_id,
187 p_position_description_id => p_position_description_id,
188 p_class_grade_by => p_class_grade_by,
189 p_official_title => p_official_title,
190 p_pay_plan => p_pay_plan,
191 p_occupational_code => p_occupational_code,
192 p_grade_level => p_grade_level,
193 p_pdc_object_version_number => p_pdc_object_version_number
194 );
195 exception
196 when hr_api.cannot_find_prog_unit then
197 p_pdc_object_version_number := l_pdc_object_version_number; -- Nocopy changes
198 hr_api.cannot_find_prog_unit_error
199 (p_module_name => 'update_pdc',
200 p_hook_type => 'BP'
201 );
202 end;
203 --
204 -- End of Before Process User Hook call
205 --
206 --
207
208 hr_utility.set_location(l_proc,6);
209
210 -- Validation in Addition to Row Handlers:
211
212 IF (p_pd_classification_id is NULL )
213 AND (p_position_description_id is NULL OR p_class_grade_by is NULL)
214 THEN
215
216 hr_utility.set_message(8301,'GHR_INSUFFICIENT_INFORMATION');
217 END IF;
218
219 -- Process Logic
220
221 l_object_version_number := p_pdc_object_version_number;
222
223 ghr_pdc_upd.upd
224 ( p_pd_classification_id => p_pd_classification_id,
225 p_position_description_id => p_position_description_id,
226 p_class_grade_by => p_class_grade_by,
227 p_official_title => p_official_title,
228 p_pay_plan => p_pay_plan,
229 p_occupational_code => p_occupational_code,
230 p_grade_level => p_grade_level,
231 p_object_version_number => l_object_version_number);
232
233
234 hr_utility.set_location(l_proc,8);
235
236 --When in validation only mode raise the Validate_Enabled exception.
237 --
238
239 --
240 -- Call After Process User Hook
241 --
242 begin
243 ghr_pdc_bk2.update_pdc_a (
244 p_pd_classification_id => p_pd_classification_id,
245 p_position_description_id => p_position_description_id,
246 p_class_grade_by => p_class_grade_by,
247 p_official_title => p_official_title,
248 p_pay_plan => p_pay_plan,
249 p_occupational_code => p_occupational_code,
250 p_grade_level => p_grade_level,
251 p_pdc_object_version_number => l_object_version_number
252 );
253 exception
254 when hr_api.cannot_find_prog_unit then
255 p_pdc_object_version_number := l_pdc_object_version_number; -- Nocopy changes
256 hr_api.cannot_find_prog_unit_error
257 (p_module_name => 'update_pdc',
258 p_hook_type => 'AP'
259 );
260 end;
261 --
262 -- End of After Process User Hook call
263 --
264 IF p_validate THEN
265
266 RAISE hr_api.validate_enabled;
267
268 END IF;
269
270 --
271 -- Set all output arguments
272 --
273
274 p_pdc_object_version_number := l_object_version_number;
275
276 --
277 hr_utility.set_location('Leaving:'|| l_proc,11);
278
279 EXCEPTION
280
281 WHEN hr_api.validate_enabled THEN
282
283 --
284 -- As the Validate_Enabled exception has been raised
285 -- We must rollback to the savepoint
286 --
287 ROLLBACK to update_pdc;
288 p_pdc_object_version_number := l_pdc_object_version_number; -- Nocopy changes
289 --
290 when others then
291 rollback to update_pdc;
292 p_pdc_object_version_number := l_pdc_object_version_number; -- Nocopy changes
293 raise;
294 hr_utility.set_location('Leaving:' || l_proc,12);
295 --
296 hr_utility.set_location('Leaving:'||l_proc,12);
297 end update_pdc;
298
299 PROCEDURE delete_pdc
300 ( p_validate IN BOOLEAN default false,
301 p_pd_classification_id IN ghr_pd_classifications.pd_classification_id%TYPE,
302 p_pdc_object_version_number in number)
303 IS
304
305 l_proc varchar2(72) ;
306 l_object_version_number number;
307 l_pd_classification_id ghr_pd_classifications.pd_classification_id%TYPE;
308
309
310 BEGIN
311 l_proc := g_package||'Delete_pdc';
312 hr_utility.set_location('Entering:'||l_proc,5);
313
314 SAVEPOINT delete_pdc;
315 --
316 -- Call Before Process User Hook
317 --
318 begin
319 ghr_pdc_bk3.delete_pdc_b (
320 p_pd_classification_id => p_pd_classification_id,
321 p_pdc_object_version_number => l_object_version_number
322 );
323 exception
324 when hr_api.cannot_find_prog_unit then
325 hr_api.cannot_find_prog_unit_error
326 (p_module_name => 'delete_pdc',
327 p_hook_type => 'BP'
328 );
329 end;
330 --
331 -- End of Before Process User Hook call
332 --
333
334 hr_utility.set_location(l_proc,6);
335
336 -- Validation in Addition to Row Handlers:
337
341
338 IF (p_pd_classification_id is NULL )
339 AND (p_pdc_object_version_number is NULL)
340 THEN
342 hr_utility.set_message(8301,'GHR_INSUFFICIENT_INFORMATION');
343 END IF;
344
345 -- Process Logic
346
347 l_object_version_number := p_pdc_object_version_number;
348
349 ghr_pdc_del.del
350 ( p_pd_classification_id => p_pd_classification_id,
351 p_object_version_number => l_object_version_number);
352
353
354 hr_utility.set_location(l_proc,8);
355
356 --When in validation only mode raise the Validate_Enabled exception.
357 --
358
359 --
360 -- Call After Process User Hook
361 --
362 begin
363 ghr_pdc_bk3.delete_pdc_a (
364 p_pd_classification_id => p_pd_classification_id,
365 p_pdc_object_version_number => l_object_version_number
366 );
367 exception
368 when hr_api.cannot_find_prog_unit then
369 hr_api.cannot_find_prog_unit_error
370 (p_module_name => 'delete_pdc',
371 p_hook_type => 'AP'
372 );
373 end;
374 --
375 -- End of After Process User Hook call
376 --
377 IF p_validate THEN
378
379 RAISE hr_api.validate_enabled;
380
381 END IF;
382
383
384 --
385 hr_utility.set_location('Leaving:'|| l_proc,11);
386
387 EXCEPTION
388
389 WHEN hr_api.validate_enabled THEN
390 --
391 -- As the Validate_Enabled exception has been raised
392 -- We must rollback to the savepoint
393 --
394 ROLLBACK to delete_pdc;
395 --
396 when others then
397 rollback to delete_pdc;
398 raise;
399 hr_utility.set_location('Leaving:' || l_proc,12);
400 --
401 hr_utility.set_location('Leaving:'||l_proc,12);
402 end delete_pdc;
403
404 end ghr_pdc_api;