[Home] [Help]
PACKAGE BODY: APPS.HXC_TIME_CATEGORY_COMP_API
Source
1 Package Body hxc_time_category_comp_api as
2 /* $Header: hxctccapi.pkb 120.2.12020000.8 2013/01/23 09:34:00 jnerella ship $ */
3 --
4 -- Package Variables
5 --
6 g_package varchar2(33) := ' hxc_time_category_comp_api.';
7
8 g_debug boolean := hr_utility.debug_enabled;
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< create_time_category_comp>----------------------|
12 -- ----------------------------------------------------------------------------
13 --
14 procedure create_time_category_comp
15 (p_validate in boolean default false
16 ,p_time_category_comp_id in out nocopy number
17 ,p_object_version_number in out nocopy number
18 ,p_time_category_id in number
19 ,p_ref_time_category_id in number
20 ,p_component_type_id number
21 ,p_flex_value_set_id number
22 ,p_value_id Varchar2
23 ,p_is_null in varchar2
24 ,p_equal_to in varchar2
25 ,p_type in varchar2
26 ) is
27 --
28 -- Declare cursors and local variables
29 --
30 l_proc varchar2(72);
31 l_object_version_number hxc_time_category_comps.object_version_number%TYPE;
32 l_time_category_comp_id hxc_time_category_comps.time_category_comp_id%TYPE;
33 --
34
35 l_validation_type varchar2(5) := NULL;
36
37 begin
38 g_debug := hr_utility.debug_enabled;
39 --
40 if g_debug then
41 l_proc := g_package||' create_time_category_comp';
42 hr_utility.set_location('Entering:'|| l_proc, 10);
43 end if;
44 --
45 -- Issue a savepoint if operating in validation only mode
46 --
47 savepoint create_time_category_comp;
48 --
49 if g_debug then
50 hr_utility.set_location(l_proc, 20);
51 end if;
52
53 --Changes for bug 14524515 start
54 /*
55 if g_debug then
56 hr_utility.trace('p_type: '||p_type||' p_flex_value_set_id: '||p_flex_value_set_id);
57 end if;
58
59 if (p_type = 'MC' and nvl(p_flex_value_set_id,0) > 0 )
60 then
61
62 raise_application_error('-20009','ERROR: You cannot use valid flex value set with time category component of type MC');
63
64 end if;
65
66 if (nvl(p_flex_value_set_id,0) > 0)
67 then
68
69 begin
70 select VALIDATION_TYPE
71 into l_validation_type
72 from fnd_flex_value_sets
73 where FLEX_VALUE_SET_ID = p_flex_value_set_id
74 and validation_type = 'F';
75
76 exception
77 when no_data_found then
78 raise_application_error('-20010','ERROR: Invalid flex value set');
79
80 end;
81
82 end if;
83 */
84 --Changes for bug 14524515 end
85
86 -- Bug 16002606 start
87
88 if g_debug then
89 hr_utility.trace('p_type: '||p_type||' p_flex_value_set_id: '||p_flex_value_set_id);
90 end if;
91
92
93 /* IF p_type = 'MC'
94 AND p_value_id IS NULL
95 THEN
96
97 RAISE_APPLICATION_ERROR('-20009','ERROR: Time Category Component of Mapping Component type must have a valid value specified for the Mapping Component.');
98
99 END IF;*/---- Commented this validation since timecategory of Type MC is allowed to have NULL in value column.
100
101 IF p_type = 'MC_VS'
102 AND NVL(p_flex_value_set_id,0) > 0
103 THEN
104
105 BEGIN
106 SELECT validation_type
107 INTO l_validation_type
108 FROM fnd_flex_value_sets
109 WHERE flex_value_set_id = p_flex_value_set_id
110 AND validation_type = 'F';
111
112 EXCEPTION
113 WHEN NO_DATA_FOUND
114 THEN
115 RAISE_APPLICATION_ERROR('-20010','ERROR: Invalid Flex Value Set. Please Validate.');
116
117 END;
118
119 END IF;
120
121 -- Bug 16002606 End
122
123 --
124 -- Call Before Process User Hook
125 --
126 begin
127 hxc_time_category_comp_BK_1.create_time_category_comp_b
128 (p_time_category_comp_id => p_time_category_comp_id
129 ,p_object_version_number => p_object_version_number
130 ,p_time_category_id => p_time_category_id
131 ,p_ref_time_category_id => p_ref_time_category_id
132 ,p_component_type_id => p_component_type_id
133 ,p_flex_value_set_id => p_flex_value_set_id
134 ,p_value_id => p_value_id
135 ,p_is_null => p_is_null
136 ,p_equal_to => p_equal_to
137 ,p_type => p_type
138 );
139 exception
140 when hr_api.cannot_find_prog_unit then
141 hr_api.cannot_find_prog_unit_error
142 (p_module_name => 'create_time_category_comp'
143 ,p_hook_type => 'BP'
144 );
145 end;
146 --
147 if g_debug then
148 hr_utility.set_location(l_proc, 30);
149 end if;
150 --
151 -- Process Logic
152 --
153 --
154 if g_debug then
155 hr_utility.set_location(l_proc, 40);
156 end if;
157 --
158 -- call row handler
159 --
160 hxc_tcc_ins.ins (
161 p_time_category_id => p_time_category_id
162 ,p_ref_time_category_id => p_ref_time_category_id
163 ,p_component_type_id => p_component_type_id
164 ,p_flex_value_set_id => p_flex_value_set_id
165 ,p_value_id => p_value_id
166 ,p_is_null => p_is_null
167 ,p_equal_to => p_equal_to
168 ,p_type => p_type
169 ,p_time_category_comp_id => l_time_category_comp_id
170 ,p_object_version_number => l_object_version_number
171 );
172 --
173 if g_debug then
174 hr_utility.set_location(l_proc, 50);
175 end if;
176
177
178 -- Bug 13817976
179 IF p_type IN ('AN','MC')
180 THEN
181 hxc_time_category_utils_pkg.insert_tc_comps2(p_tc_id => p_time_category_id,
182 p_tcc_id =>l_time_category_comp_id,
183 p_value_id => p_value_id,
184 p_type => p_type,
185 p_component_type_id => p_component_type_id);
186
187 END IF;
188
189 --
190 -- Call After Process User Hook
191 --
192 begin
193 hxc_time_category_comp_BK_1.create_time_category_comp_a
194 (p_time_category_comp_id => l_time_category_comp_id
195 ,p_object_version_number => l_object_version_number
196 ,p_time_category_id => p_time_category_id
197 ,p_ref_time_category_id => p_ref_time_category_id
198 ,p_component_type_id => p_component_type_id
199 ,p_flex_value_set_id => p_flex_value_set_id
200 ,p_value_id => p_value_id
201 ,p_is_null => p_is_null
202 ,p_equal_to => p_equal_to
203 ,p_type => p_type
204 );
205 exception
206 when hr_api.cannot_find_prog_unit then
207 hr_api.cannot_find_prog_unit_error
208 (p_module_name => 'create_time_category_comp'
209 ,p_hook_type => 'AP'
210 );
211 end;
212 --
213 if g_debug then
214 hr_utility.set_location(l_proc, 60);
215 end if;
216 --
217 -- When in validation only mode raise the Validate_Enabled exception
218 --
219 if p_validate then
220 raise hr_api.validate_enabled;
221 end if;
222 --
223 if g_debug then
224 hr_utility.set_location(' Leaving:'||l_proc, 70);
225 end if;
226 --
227 -- Set all output arguments
228 --
229 p_time_category_comp_id := l_time_category_comp_id;
230 p_object_version_number := l_object_version_number;
231 --
232 exception
233 --
234 when hr_api.validate_enabled then
235 --
236 -- As the Validate_Enabled exception has been raised
237 -- we must rollback to the savepoint
238 --
239 ROLLBACK TO create_time_category_comp;
240 --
241 -- Only set output warning arguments
242 -- (Any key or derived arguments must be set to null
243 -- when validation only mode is being used.)
244 --
245 p_time_category_comp_id := null;
246 p_object_version_number := null;
247 --
248 if g_debug then
249 hr_utility.set_location(' Leaving:'||l_proc, 80);
250 end if;
251 --
252 when others then
253 --
254 -- A validation or unexpected error has occured
255 --
256 if g_debug then
257 hr_utility.trace('In exeception');
258 end if;
259 ROLLBACK TO create_time_category_comp;
260 raise;
261 --
262 END create_time_category_comp;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |------------------------< update_time_category_comp>-----------------------|
266 -- ----------------------------------------------------------------------------
267 --
268 procedure update_time_category_comp
269 (p_validate in boolean default false
270 ,p_time_category_comp_id in number
271 ,p_object_version_number in out nocopy number
272 ,p_time_category_id number
273 ,p_ref_time_category_id number
274 ,p_component_type_id number
275 ,p_flex_value_set_id number
276 ,p_value_id Varchar2
277 ,p_is_null in varchar2
278 ,p_equal_to in varchar2
279 ,p_type in varchar2
280 ) is
281 --
282 -- Declare cursors and local variables
283 --
284 l_proc varchar2(72);
285 l_object_version_number hxc_time_category_comps.object_version_number%TYPE := p_object_version_number;
286 --
287 l_validation_type varchar2(5) := NULL;
288 begin
289 g_debug := hr_utility.debug_enabled;
290
291 if g_debug then
292 l_proc := g_package||' update_time_category_comp';
293 hr_utility.set_location('Entering:'|| l_proc, 10);
294 end if;
295 --
296 -- Issue a savepoint if operating in validation only mode
297 --
298 savepoint update_time_category_comp;
299 --
300 if g_debug then
301 hr_utility.set_location(l_proc, 20);
302 end if;
303
304 -- Bug 16002606 start
305
306 if g_debug then
307 hr_utility.trace('p_type: '||p_type||' p_flex_value_set_id: '||p_flex_value_set_id);
308 end if;
309
310
311 /* IF p_type = 'MC'
312 AND p_value_id IS NULL
313 THEN
314
315 RAISE_APPLICATION_ERROR('-20009','ERROR: Time Category Component of Mapping Component type must have a valid value specified for the Mapping Component.');
316
317 END IF;*/ ---- Commented this validation since timecategory of Type MC is allowed to have NULL in value column.
318
319 IF p_type = 'MC_VS'
320 AND NVL(p_flex_value_set_id,0) > 0
321 THEN
322
323 BEGIN
324 SELECT validation_type
325 INTO l_validation_type
326 FROM fnd_flex_value_sets
327 WHERE flex_value_set_id = p_flex_value_set_id
328 AND validation_type = 'F';
329
330 EXCEPTION
331 WHEN NO_DATA_FOUND
332 THEN
333 RAISE_APPLICATION_ERROR('-20010','ERROR: Invalid Flex Value Set. Please Validate.');
334
335 END;
336
337 END IF;
338
339 -- Bug 16002606 End
340
341
342 --
343 -- Call Before Process User Hook
344 --
345 begin
346 hxc_time_category_comp_BK_2.update_time_category_comp_b
347 (p_time_category_comp_id => p_time_category_comp_id
348 ,p_object_version_number => p_object_version_number
349 ,p_time_category_id => p_time_category_id
350 ,p_ref_time_category_id => p_ref_time_category_id
351 ,p_component_type_id => p_component_type_id
352 ,p_flex_value_set_id => p_flex_value_set_id
353 ,p_value_id => p_value_id
354 ,p_is_null => p_is_null
355 ,p_equal_to => p_equal_to
356 ,p_type => p_type
357 );
358 exception
359 when hr_api.cannot_find_prog_unit then
360 hr_api.cannot_find_prog_unit_error
361 (p_module_name => 'update_time_category_comp'
362 ,p_hook_type => 'BP'
363 );
364 end;
365 --
366 if g_debug then
367 hr_utility.set_location(l_proc, 30);
368 end if;
369 --
370 -- Process Logic
371 --
372 -- call row handler
373 --
374 hxc_tcc_upd.upd (
375 p_time_category_id => p_time_category_id
376 ,p_ref_time_category_id => p_ref_time_category_id
377 ,p_component_type_id => p_component_type_id
378 ,p_flex_value_set_id => p_flex_value_set_id
379 ,p_value_id => p_value_id
380 ,p_is_null => p_is_null
381 ,p_equal_to => p_equal_to
382 ,p_type => p_type
383 ,p_time_category_comp_id => p_time_category_comp_id
384 ,p_object_version_number => l_object_version_number
385 );
386 --
387 --
388 if g_debug then
389 hr_utility.set_location(l_proc, 40);
390 end if;
391
392 -- Bug 13817976
393 IF p_type IN ('AN','MC')
394 THEN
395 hxc_time_category_utils_pkg.insert_tc_comps2(p_tc_id => p_time_category_id,
396 p_tcc_id =>p_time_category_comp_id,
397 p_value_id => p_value_id,
398 p_type => p_type,
399 p_component_type_id => p_component_type_id);
400
401 END IF;
402
403
404 --
405 -- Call After Process User Hook
406 --
407 begin
408 hxc_time_category_comp_BK_2.update_time_category_comp_a
409 (p_time_category_comp_id => p_time_category_comp_id
410 ,p_object_version_number => l_object_version_number
411 ,p_time_category_id => p_time_category_id
412 ,p_ref_time_category_id => p_ref_time_category_id
413 ,p_component_type_id => p_component_type_id
414 ,p_flex_value_set_id => p_flex_value_set_id
415 ,p_value_id => p_value_id
416 ,p_is_null => p_is_null
417 ,p_equal_to => p_equal_to
418 ,p_type => p_type
419 );
420 exception
421 when hr_api.cannot_find_prog_unit then
422 hr_api.cannot_find_prog_unit_error
423 (p_module_name => 'update_time_category_comp'
424 ,p_hook_type => 'AP'
425 );
426 end;
427 --
428 if g_debug then
429 hr_utility.set_location(l_proc, 50);
430 end if;
431 --
432 -- When in validation only mode raise the Validate_Enabled exception
433 --
434 if p_validate then
435 raise hr_api.validate_enabled;
436 end if;
437 --
438 if g_debug then
439 hr_utility.set_location(' Leaving:'||l_proc, 60);
440 end if;
441 --
442 -- Set all output arguments
443 --
444 p_object_version_number := l_object_version_number;
445 --
446 exception
447 --
448 when hr_api.validate_enabled then
449 --
450 -- As the Validate_Enabled exception has been raised
451 -- we must rollback to the savepoint
452 --
453 ROLLBACK TO update_time_category_comp;
454 --
455 -- Only set output warning arguments
456 -- (Any key or derived arguments must be set to null
457 -- when validation only mode is being used.)
458 --
459 p_object_version_number := null;
460 --
461 if g_debug then
462 hr_utility.set_location(' Leaving:'||l_proc, 60);
463 end if;
464 --
465 when others then
466 --
467 -- A validation or unexpected error has occured
468 --
469 if g_debug then
470 hr_utility.trace('In exeception');
471 end if;
472 ROLLBACK TO update_time_category_comp;
473 raise;
474 --
475 END update_time_category_comp;
476 --
477 -- ----------------------------------------------------------------------------
478 -- |------------------------< delete_time_category_comp >----------------------|
479 -- ----------------------------------------------------------------------------
480 --
481 procedure delete_time_category_comp
482 (p_validate in boolean default false
483 ,p_time_category_comp_id in number
484 ,p_object_version_number in number
485 ) is
486 --
487 -- Declare cursors and local variables
488 --
489 l_proc varchar2(72);
490 --
491 begin
492 g_debug := hr_utility.debug_enabled;
493 --
494 if g_debug then
495 l_proc := g_package||'delete_time_category_comp';
496 hr_utility.set_location('Entering:'|| l_proc, 10);
497 end if;
498 --
499 -- Issue a savepoint if operating in validation only mode
500 --
501 savepoint delete_time_category_comp;
502 --
503 if g_debug then
504 hr_utility.set_location(l_proc, 20);
505 end if;
506 --
507 -- Call Before Process User Hook
508 --
509 begin
510 --
511 hxc_time_category_comp_BK_3.delete_time_category_comp_b
512 (p_time_category_comp_id => p_time_category_comp_id
513 ,p_object_version_number => p_object_version_number
514 );
515 exception
516 when hr_api.cannot_find_prog_unit then
517 hr_api.cannot_find_prog_unit_error
518 (p_module_name => 'delete_time_category_comp_b'
519 ,p_hook_type => 'BP'
520 );
521 end;
522 --
523 if g_debug then
524 hr_utility.set_location(l_proc, 30);
525 end if;
526 --
527 -- Process Logic
528 --
529 hxc_tcc_del.del
530 (
531 p_time_category_comp_id => p_time_category_comp_id
532 ,p_object_version_number => p_object_version_number
533 );
534 --
535 if g_debug then
536 hr_utility.set_location(l_proc, 40);
537 end if;
538
539 -- Bug 13817976
540 hxc_time_category_utils_pkg.delete_tc_comps2(p_time_category_comp_id);
541
542 --
543 -- Call After Process User Hook
544 --
545 begin
546 --
547 hxc_time_category_comp_BK_3.delete_time_category_comp_a
548 (p_time_category_comp_id => p_time_category_comp_id
549 ,p_object_version_number => p_object_version_number
550 );
551 exception
552 when hr_api.cannot_find_prog_unit then
553 hr_api.cannot_find_prog_unit_error
554 (p_module_name => 'delete_time_category_comp_a'
555 ,p_hook_type => 'AP'
556 );
557 end;
558 --
559 -- When in validation only mode raise the Validate_Enabled exception
560 --
561 if p_validate then
562 raise hr_api.validate_enabled;
563 end if;
564 --
565 if g_debug then
566 hr_utility.set_location(' Leaving:'||l_proc, 50);
567 end if;
568 --
569 exception
570 --
571 when hr_api.validate_enabled then
572 --
573 -- As the Validate_Enabled exception has been raised
574 -- we must rollback to the savepoint
575 --
576 ROLLBACK TO delete_time_category_comp;
577 --
578 when others then
579 --
580 -- A validation or unexpected error has occured
581 --
582 ROLLBACK TO delete_time_category_comp;
583 raise;
584 --
585 end delete_time_category_comp;
586 --
587 END hxc_time_category_comp_api;