DBA Data[Home] [Help]

PACKAGE BODY: APPS.GHR_PDC_API

Source


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