[Home] [Help]
PACKAGE BODY: APPS.AME_RUL_BUS
Source
1 Package Body ame_rul_bus as
2 /* $Header: amrulrhi.pkb 120.6 2006/02/14 01:23 vboggava noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ame_rul_bus.'; -- Global package name
9 -- ---------------------------------------------------------------------------
10 -- |----------------------< chk_description >--------------------------|
11 -- ---------------------------------------------------------------------------
12 --
13 -- {Start Of Comments}
14 --
15 -- Description:
16 -- Validates that the Description is less than 100 characters.
17 -- It also checks that the description is not in use by any existing rule.
18 --
19 -- Prerequisites:
20 -- None.
21 --
22 -- In Parameters:
23 -- p_rule_id
24 -- p_object_version_number
25 -- p_description
26 --
27 -- Post Success:
28 -- Processing continues if description is valid.
29 --
30 -- Post Failure:
31 -- Log the error message.
32 --
33 -- Developer Implementation Notes:
34 -- None.
35 --
36 -- Access Status:
37 -- Internal Row Handler Use Only.
38 --
39 -- {End Of Comments}
40 -- ----------------------------------------------------------------------------
41 procedure chk_description
42 (p_rule_id in number,
43 p_object_version_number in number,
44 p_effective_date in date,
45 p_description in ame_rules.description%type) is
46 l_proc varchar2(72) := g_package||'chk_description';
47 l_descriptionCount number;
48 begin
49 -- check description is null
50 hr_api.mandatory_arg_error(p_api_name => l_proc
51 ,p_argument => 'description'
52 ,p_argument_value => p_description
53 );
54 -- check description not in use
55 select count(*)
56 into l_descriptionCount
57 from ame_rules
58 where upper(description) = upper(p_description)
59 and (p_rule_id is null or rule_id <> p_rule_id) /* allows for future start date */
60 and ((p_effective_date between start_date
61 and nvl(end_date - ame_util.oneSecond, p_effective_date))
62 or
63 (p_effective_date < start_date
64 and start_date < nvl(end_date,start_date + ame_util.oneSecond)));
65 --+
66 if l_descriptionCount > 0 then
67 fnd_message.set_name('PER','AME_400206_RUL_DESC_IN_USE');
68 fnd_message.raise_error;
69 end if;
70 -- check length
71 if(ame_util.isArgumentTooLong(tableNameIn => 'ame_rules'
72 ,columnNameIn => 'description'
73 ,argumentIn => p_description)) then
74 fnd_message.set_name('PER','AME_400207_RUL_DESC_LONG');
75 fnd_message.raise_error;
76 end if;
77 exception
78 when app_exception.application_exception then
79 if hr_multi_message.exception_add
80 (p_associated_column1 => 'DESCRIPTION') then
81 hr_utility.set_location(' Leaving:'|| l_proc, 50);
82 raise;
83 end if;
84 hr_utility.set_location(' Leaving:'|| l_proc, 60);
85 end chk_description;
86 -- ---------------------------------------------------------------------------
87 -- |----------------------<chk_item_class_id >--------------------------|
88 -- ---------------------------------------------------------------------------
89 --
90 -- {Start Of Comments}
91 --
92 -- Description:
93 -- Validates that the item_class_id is a foreign key to
94 -- ame_item_classes.item_class_id. Also check that ITEM_CLASS_ID is not
95 -- inserted for list modification and substitutions rules.
96 --
97 -- Prerequisites:
98 -- None.
99 --
100 -- In Parameters:
101 -- p_rule_id
102 -- p_object_version_number
103 -- p_effective_date
104 -- p_item_class_id
105 --
106 -- Post Success:
107 -- Processing continues.
108 --
109 -- Post Failure:
110 -- Log the error message.
111 --
112 -- Developer Implementation Notes:
113 -- None.
114 --
115 -- Access Status:
116 -- Internal Row Handler Use Only.
117 --
118 -- {End Of Comments}
119 -- ----------------------------------------------------------------------------
120 procedure chk_item_class_id
121 (p_rule_id in number,
122 p_object_version_number in number,
123 p_effective_date in date,
124 p_item_class_id in ame_rules.item_class_id%type,
125 p_rule_type in ame_rules.rule_type%type) is
126 l_proc varchar2(72) := g_package||'chk_item_class_id';
127 tempCount integer;
128 cursor c_sel1 is
129 select null
130 from ame_item_classes
131 where
132 item_class_id = p_item_class_id and
133 p_effective_date between start_date and
134 nvl(end_date - ame_util.oneSecond, p_effective_date) ;
135 l_exists varchar2(1);
136 begin
137 if p_item_class_id is not null or p_rule_type <> ame_util.combinationRuleType then
138 open c_sel1;
139 fetch c_sel1 into l_exists;
140 if c_sel1%notfound then
141 close c_sel1;
142 fnd_message.set_name('PER','AME_400472_INV_ITEM_CLASS');
143 fnd_message.raise_error;
144 end if;
145 close c_sel1;
146 end if;
147 exception
148 when app_exception.application_exception then
149 if hr_multi_message.exception_add
150 (p_associated_column1 => 'ITEM_CLASS_ID') then
151 hr_utility.set_location(' Leaving:'|| l_proc, 50);
152 raise;
153 end if;
154 hr_utility.set_location(' Leaving:'|| l_proc, 60);
155 end chk_item_class_id;
156 --
157 -- ---------------------------------------------------------------------------
158 -- |----------------------< chk_rule_key >--------------------------|
159 -- ---------------------------------------------------------------------------
160 --
161 -- {Start Of Comments}
162 --
163 -- Description:
164 -- Checks if there is a duplicate for the rule key.
165 --
166 -- Prerequisites:
167 -- None.
168 --
169 -- In Parameters:
170 -- p_rule_key
171 --
172 -- Post Success:
173 -- Processing continues if rule type is unique.
174 --
175 -- Post Failure:
176 -- Log the error message.
177 --
178 -- Developer Implementation Notes:
179 -- None.
180 --
181 -- Access Status:
182 -- Internal Row Handler Use Only.
183 --
184 -- {End Of Comments}
185 -- ----------------------------------------------------------------------------
186 procedure chk_rule_key(p_rule_key in varchar2) is
187 l_count number(2);
188 begin
189 select count(*)
190 into l_count
191 from ame_rules
192 where lower(p_rule_key) = lower(rule_key);
193 if l_count > 0 then
194 fnd_message.set_name('PER','AME_400359_RULE_KEY_EXIST');
195 fnd_message.raise_error;
196 end if;
197 end chk_rule_key;
198 --
199 -- ---------------------------------------------------------------------------
200 -- |----------------------< chk_rule_type >--------------------------|
201 -- ---------------------------------------------------------------------------
202 --
203 -- {Start Of Comments}
204 --
205 -- Description:
206 -- Validates that the rule type is one of the following:
207 -- ame_util.combinationRuleType
208 -- ame_util.authorityRuleType
209 -- ame_util.exceptionRuleType
210 -- ame_util.listModRuleType
211 -- ame_util.substitutionRuleType
212 -- ame_util.preListGroupRuleType
213 -- ame_util.postListGroupRuleType
214 -- ame_util.productionRuleType
215 --
216 -- Prerequisites:
217 -- None.
218 --
219 -- In Parameters:
220 -- p_rule_id
221 -- p_object_version_number
222 -- p_rule_type
223 --
224 -- Post Success:
225 -- Processing continues if attribute type is valid.
226 --
227 -- Post Failure:
228 -- Log the error message.
229 --
230 -- Developer Implementation Notes:
231 -- None.
232 --
233 -- Access Status:
234 -- Internal Row Handler Use Only.
235 --
236 -- {End Of Comments}
237 -- ----------------------------------------------------------------------------
238 procedure chk_rule_type
239 (p_rule_id in number,
240 p_object_version_number in number,
241 p_rule_type in ame_rules.rule_type%type) is
242 l_proc varchar2(72) := g_package||'chk_rule_type';
243 begin
244 if not (p_rule_type = ame_util.combinationRuleType or
245 p_rule_type = ame_util.authorityRuleType or
246 p_rule_type = ame_util.exceptionRuleType or
247 p_rule_type = ame_util.listModRuleType or
248 p_rule_type = ame_util.substitutionRuleType or
249 p_rule_type = ame_util.preListGroupRuleType or
250 p_rule_type = ame_util.postListGroupRuleType or
251 p_rule_type = ame_util.productionRuleType) then
252 fnd_message.set_name('PER','AME_400468_RULE_TYPE_INVALID');
253 fnd_message.raise_error;
254 end if;
255 exception
256 when app_exception.application_exception then
257 if hr_multi_message.exception_add
258 (p_associated_column1 => 'RULE_TYPE') then
259 hr_utility.set_location(' Leaving:'|| l_proc, 50);
260 raise;
261 end if;
262 hr_utility.set_location(' Leaving:'|| l_proc, 60);
263 end chk_rule_type;
264 --+
265 -- ---------------------------------------------------------------------------
266 -- |----------------------<chk_item_class_and_rule_type >--------------------------|
267 -- ---------------------------------------------------------------------------
268 --
269 -- {Start Of Comments}
270 --
271 -- Description:
272 -- Errors out if the item class id is not null for LM/Sub rules.
273 -- Errors out if the item class is not header for production rules.
274 -- Errors out if the item class is null for other rule types except comb.
275 --
276 -- Prerequisites:
277 -- None.
278 --
279 -- In Parameters:
280 -- rule_type
281 -- p_item_class_id
282 --
283 -- Post Success:
284 -- Processing continues.
285 --
286 -- Post Failure:
287 -- Log the error message.
288 --
289 -- Developer Implementation Notes:
290 -- None.
291 --
292 -- Access Status:
293 -- Internal Row Handler Use Only.
294 --
295 -- {End Of Comments}
296 -- ----------------------------------------------------------------------------
297 procedure chk_item_class_and_rule_type(p_item_class_id in number
298 ,p_rule_type in number) is
299
300 cursor getItemClassName(p_item_class_id in number) is
301 select name
302 from ame_item_classes
303 where sysdate between start_date and nvl(end_date-(1/84600),sysdate)
304 and item_class_id = p_item_class_id;
305 l_item_class_name ame_item_classes.name%type;
306
307 begin
308
309 if (p_rule_type = ame_util.listModRuleType or
310 p_rule_type = ame_util.substitutionRuleType) then
311 if p_item_class_id is not null then
312 fnd_message.set_name('PER','AME_400722_INV_IC_LM_SUB_RULE');
313 fnd_message.raise_error;
314 end if;
315 elsif p_rule_type = ame_util.combinationRuleType then
316 null;
317 elsif p_item_class_id is null then
318 fnd_message.set_name('PER','AME_400472_INV_ITEM_CLASS');
319 fnd_message.raise_error;
320 end if;
321
322 end chk_item_class_and_rule_type;
323 -- ---------------------------------------------------------------------------
324 -- |----------------------< chk_start_end_date_combination >-----------------|
325 -- ---------------------------------------------------------------------------
326 --
327 -- {Start Of Comments}
328 --
329 -- Description:
330 -- Validates that 1. start_date is greater than effective date
331 -- 2. end_date is either null or greater than start_date.
332 -- 3. end_date is either null or greater than effective date.
333 --
334 -- Prerequisites:
335 -- None.
336 --
337 -- In Parameters:
338 -- p_rule_id
339 -- p_effective_date
340 -- p_object_version_number
341 -- p_start_date
342 -- p_end_date
343 --
344 -- Post Success:
345 -- Processing continues if start date end date combination are valid
346 --
347 -- Post Failure:
348 -- Log the error message.
349 --
350 -- Developer Implementation Notes:
351 -- None.
352 --
353 -- Access Status:
354 -- Internal Row Handler Use Only.
355 --
356 -- {End Of Comments}
357 -- ----------------------------------------------------------------------------
358 procedure chk_start_end_date_combination
359 (p_rule_id in number,
360 p_object_version_number in number,
361 p_effective_date in date,
362 p_start_date in ame_rules.start_date%type,
363 p_end_date in ame_rules.end_date%type) is
364 l_proc varchar2(72) := g_package||'chk_start_end_date_combination';
365 begin
366 if(p_start_date is null or
367 p_start_date < p_effective_date ) then
368 fnd_message.set_name('PER','AME_400208_RUL_STRT_PREC_TDY');
369 fnd_message.raise_error;
370 end if;
371 if p_end_date is not null then
372 if ( p_end_date < p_start_date or
373 p_end_date < p_effective_date) then
374 fnd_message.set_name('PER','AME_400209_RUL_STRT_PREC_END');
375 fnd_message.raise_error;
376 end if;
377 end if;
378 exception
379 when app_exception.application_exception then
380 if hr_multi_message.exception_add
381 (p_associated_column1 => 'START_DATE') then
382 hr_utility.set_location(' Leaving:'|| l_proc, 50);
383 raise;
384 end if;
385 hr_utility.set_location(' Leaving:'|| l_proc, 60);
386 end chk_start_end_date_combination;
387 --
388 -- ---------------------------------------------------------------------------
389 -- |----------------------< chk_delete >--------------------------|
390 -- ---------------------------------------------------------------------------
391 --
392 -- {sTARt Of Comments}
393 --
394 -- Description:
395 -- check that 1. No rule Usages exist
396 -- 2. No condition Usages exist
400 -- None.
397 -- 3. No action Usages exist
398 --
399 -- Prerequisites:
401 --
402 -- In Parameters:
403 -- p_rule_id
404 -- p_object_version_number
405 -- p_effective_date
406 --
407 -- Post Success:
408 -- Processing continues.
409 --
410 -- Post Failure:
411 -- Log the error message.
412 --
413 -- Developer Implementation Notes:
414 -- None.
415 --
416 -- Access Status:
417 -- Internal Row Handler Use Only.
418 --
419 -- {End Of Comments}
420 -- ----------------------------------------------------------------------------
421 procedure chk_delete
422 (p_rule_id in number,
423 p_object_version_number in number,
424 p_effective_date in date) is
425 l_proc varchar2(72) := g_package||'chk_delete';
426 tempCount integer;
427 cursor c_sel1 is
428 select null
429 from ame_rule_usages
430 where
431 rule_id = p_rule_id and
432 p_effective_date between start_date and
433 nvl(end_date - ame_util.oneSecond, p_effective_date) ;
434 cursor c_sel2 is
435 select null
436 from ame_condition_usages
437 where
438 rule_id = p_rule_id and
439 p_effective_date between start_date and
440 nvl(end_date - ame_util.oneSecond, p_effective_date) ;
441 cursor c_sel3 is
442 select null
443 from ame_action_usages
444 where
445 rule_id = p_rule_id and
446 p_effective_date between start_date and
447 nvl(end_date - ame_util.oneSecond, p_effective_date) ;
448 l_exists varchar2(1);
449 begin
450 -- ame_rule_usages
451 open c_sel1;
452 fetch c_sel1 into l_exists;
453 if c_sel1%found then
454 close c_sel1;
455 fnd_message.set_name('PER','AME_400216_RUL_IN_USE');
456 fnd_message.raise_error;
457 end if;
458 close c_sel1;
459 -- ame_condition_usages
460 open c_sel2;
461 fetch c_sel2 into l_exists;
462 if c_sel2%found then
463 close c_sel2;
464 fnd_message.set_name('PER','AME_400216_RUL_IN_USE');
465 fnd_message.raise_error;
466 end if;
467 close c_sel2;
468 -- ame_action_usages
469 open c_sel3;
470 fetch c_sel3 into l_exists;
471 if c_sel3%found then
472 close c_sel3;
473 fnd_message.set_name('PER','AME_400216_RUL_IN_USE');
474 fnd_message.raise_error;
475 end if;
476 close c_sel3;
477 exception
478 when app_exception.application_exception then
479 if hr_multi_message.exception_add
480 (p_associated_column1 => 'ATTRIBUTE_ID') then
481 hr_utility.set_location(' Leaving:'|| l_proc, 50);
482 raise;
483 end if;
484 hr_utility.set_location(' Leaving:'|| l_proc, 60);
485 end chk_delete;
486 --
487 -- ----------------------------------------------------------------------------
488 -- |-----------------------< chk_non_updateable_args >------------------------|
489 -- ----------------------------------------------------------------------------
490 -- {Start Of Comments}
491 --
492 -- Description:
493 -- This procedure is used to ensure that non updateable attributes have
494 -- not been updated. If an attribute has been updated an error is generated.
495 --
496 -- Pre Conditions:
497 -- g_old_rec has been populated with details of the values currently in
498 -- the database.
499 --
500 -- In Arguments:
501 -- p_rec has been populated with the updated values the user would like the
502 -- record set to.
503 --
504 -- Post Success:
505 -- Processing continues if all the non updateable attributes have not
506 -- changed.
507 --
508 -- Post Failure:
509 -- An application error is raised if any of the non updatable attributes
510 -- have been altered.
511 --
512 -- {End Of Comments}
513 -- ----------------------------------------------------------------------------
514 Procedure chk_non_updateable_args
515 (p_effective_date in date
516 ,p_rec in ame_rul_shd.g_rec_type
517 ) IS
518 --
519 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
520 --
521 Begin
522 --
523 -- Only proceed with the validation if a row exists for the current
524 -- record in the HR Schema.
525 --
526 IF NOT ame_rul_shd.api_updating
527 (p_rule_id => p_rec.rule_id
528 ,p_effective_date => p_effective_date
529 ,p_object_version_number => p_rec.object_version_number
530 ) THEN
531 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
532 fnd_message.set_token('PROCEDURE ', l_proc);
533 fnd_message.set_token('STEP ', '5');
534 fnd_message.raise_error;
535 END IF;
536 --
537 -- checks to ensure non-updateable args have not been updated.
538 --
539 if (ame_rul_shd.g_old_rec.rule_key <> p_rec.rule_key) then
540 fnd_message.set_name('PER', 'AME_400467_NON_UPDATEABLE_FIELD');
541 fnd_message.set_token('FIELD_NAME ', 'RULE_KEY');
542 fnd_message.set_token('PROCEDURE ', l_proc);
543 fnd_message.set_token('STEP ', '5');
544 fnd_message.raise_error;
545 end if;
546 if (ame_rul_shd.g_old_rec.rule_type <> p_rec.rule_type) then
547 fnd_message.set_name('PER', 'AME_400467_NON_UPDATEABLE_FIELD');
548 fnd_message.set_token('FIELD_NAME ', 'RULE_TYPE');
549 fnd_message.set_token('PROCEDURE ', l_proc);
550 fnd_message.set_token('STEP ', '5');
551 fnd_message.raise_error;
552 end if;
553 if (ame_rul_shd.g_old_rec.item_class_id <> p_rec.item_class_id) then
557 fnd_message.set_token('STEP ', '5');
554 fnd_message.set_name('PER', 'AME_400467_NON_UPDATEABLE_FIELD');
555 fnd_message.set_token('FIELD_NAME ', 'ITEM_CLASS_ID');
556 fnd_message.set_token('PROCEDURE ', l_proc);
558 fnd_message.raise_error;
559 end if;
560 --
561 End chk_non_updateable_args;
562 --
563 -- ----------------------------------------------------------------------------
564 -- |--------------------------< dt_update_validate >--------------------------|
565 -- ----------------------------------------------------------------------------
566 -- {Start Of Comments}
567 --
568 -- Description:
569 -- This procedure is used for referential integrity of datetracked
570 -- parent entities when a datetrack update operation is taking place
571 -- and where there is no cascading of update defined for this entity.
572 --
573 -- Prerequisites:
574 -- This procedure is called from the update_validate.
575 --
576 -- In Parameters:
577 --
578 -- Post Success:
579 -- Processing continues.
580 --
581 -- Post Failure:
582 --
583 -- Developer Implementation Notes:
584 -- This procedure should not need maintenance unless the HR Schema model
585 -- changes.
586 --
587 -- Access Status:
588 -- Internal Row Handler Use Only.
589 --
590 -- {End Of Comments}
591 -- ----------------------------------------------------------------------------
592 Procedure dt_update_validate
593 (p_datetrack_mode in varchar2
594 ,p_validation_start_date in date
595 ,p_validation_end_date in date
596 ) Is
597 --
598 l_proc varchar2(72) := g_package||'dt_update_validate';
599 --
600 Begin
601 --
602 -- Ensure that the p_datetrack_mode argument is not null
603 --
604 hr_api.mandatory_arg_error
605 (p_api_name => l_proc
606 ,p_argument => 'datetrack_mode'
607 ,p_argument_value => p_datetrack_mode
608 );
609 --
610 -- Mode will be valid, as this is checked at the start of the upd.
611 --
612 -- Ensure the arguments are not null
613 --
614 hr_api.mandatory_arg_error
615 (p_api_name => l_proc
616 ,p_argument => 'validation_start_date'
617 ,p_argument_value => p_validation_start_date
618 );
619 --
620 /*hr_api.mandatory_arg_error
621 (p_api_name => l_proc
622 ,p_argument => 'validation_end_date'
623 ,p_argument_value => p_validation_end_date
624 );*/
625 --
626 Exception
627 When Others Then
628 --
629 -- An unhandled or unexpected error has occurred which
630 -- we must report
631 --
632 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
633 fnd_message.set_token('PROCEDURE', l_proc);
634 fnd_message.set_token('STEP','15');
635 fnd_message.raise_error;
636 End dt_update_validate;
637 --
638 -- ----------------------------------------------------------------------------
639 -- |--------------------------< dt_delete_validate >--------------------------|
640 -- ----------------------------------------------------------------------------
641 -- {Start Of Comments}
642 --
643 -- Description:
644 -- This procedure is used for referential integrity of datetracked
645 -- child entities when either a datetrack DELETE or ZAP is in operation
646 -- and where there is no cascading of delete defined for this entity.
647 -- For the datetrack mode of DELETE or ZAP we must ensure that no
648 -- datetracked child rows exist between the validation start and end
649 -- dates.
650 --
651 -- Prerequisites:
652 -- This procedure is called from the delete_validate.
653 --
654 -- In Parameters:
655 --
656 -- Post Success:
657 -- Processing continues.
658 --
659 -- Post Failure:
660 -- If a row exists by determining the returning Boolean value from the
661 -- generic dt_api.rows_exist function then we must supply an error via
662 -- the use of the local exception handler l_rows_exist.
663 --
664 -- Developer Implementation Notes:
665 -- This procedure should not need maintenance unless the HR Schema model
666 -- changes.
667 --
668 -- Access Status:
669 -- Internal Row Handler Use Only.
670 --
671 -- {End Of Comments}
672 -- ----------------------------------------------------------------------------
673 Procedure dt_delete_validate
674 (p_rule_id in number
675 ,p_datetrack_mode in varchar2
676 ,p_validation_start_date in date
677 ,p_validation_end_date in date
678 ) Is
679 --
680 l_proc varchar2(72) := g_package||'dt_delete_validate';
681 --
682 Begin
683 --
684 -- Ensure that the p_datetrack_mode argument is not null
685 --
686 hr_api.mandatory_arg_error
687 (p_api_name => l_proc
688 ,p_argument => 'datetrack_mode'
689 ,p_argument_value => p_datetrack_mode
690 );
691 --
692 -- Only perform the validation if the datetrack mode is either
693 -- DELETE or ZAP
694 --
695 If (p_datetrack_mode = hr_api.g_delete or
696 p_datetrack_mode = hr_api.g_zap) then
697 --
698 --
699 -- Ensure the arguments are not null
700 --
701 hr_api.mandatory_arg_error
702 (p_api_name => l_proc
703 ,p_argument => 'validation_start_date'
704 ,p_argument_value => p_validation_start_date
705 );
706 --
707 /*hr_api.mandatory_arg_error
708 (p_api_name => l_proc
709 ,p_argument => 'validation_end_date'
710 ,p_argument_value => p_validation_end_date
711 );*/
712 --
713 hr_api.mandatory_arg_error
714 (p_api_name => l_proc
715 ,p_argument => 'rule_id'
716 ,p_argument_value => p_rule_id
717 );
718 --
719 ame_rul_shd.child_rows_exist
720 (p_rule_id => p_rule_id
721 ,p_start_date => p_validation_start_date
722 ,p_end_date => p_validation_end_date);
723 --
724 --
725 End If;
726 --
727 Exception
728 When Others Then
729 --
730 -- An unhandled or unexpected error has occurred which
731 -- we must report
732 --
733 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
734 fnd_message.set_token('PROCEDURE', l_proc);
735 fnd_message.set_token('STEP','15');
736 fnd_message.raise_error;
737 --
738 End dt_delete_validate;
739 --
740 -- ----------------------------------------------------------------------------
741 -- |---------------------------< insert_validate >----------------------------|
742 -- ----------------------------------------------------------------------------
743 Procedure insert_validate
744 (p_rec in ame_rul_shd.g_rec_type
745 ,p_effective_date in date
746 ,p_datetrack_mode in varchar2
747 ,p_validation_start_date in date
748 ,p_validation_end_date in date
749 ) is
750 --
751 l_proc varchar2(72) := g_package||'insert_validate';
752 --
753 Begin
754 hr_utility.set_location('Entering:'||l_proc, 5);
755 --
756 ame_rul_bus.chk_description
757 (p_rule_id => p_rec.rule_id
758 ,p_object_version_number => p_rec.object_version_number
759 ,p_effective_date => p_effective_date
760 ,p_description => p_rec.description);
761 if p_rec.item_class_id is not null then
762 ame_rul_bus.chk_item_class_id
763 (p_rule_id => p_rec.rule_id
764 ,p_object_version_number => p_rec.object_version_number
765 ,p_effective_date => p_effective_date
766 ,p_item_class_id => p_rec.item_class_id
767 ,p_rule_type => p_rec.rule_type);
768 end if;
769
770 ame_rul_bus.chk_item_class_and_rule_type(p_item_class_id => p_rec.item_class_id
771 ,p_rule_type => p_rec.rule_type);
772
773 ame_rul_bus.chk_rule_type
774 (p_rule_id => p_rec.rule_id
775 ,p_object_version_number => p_rec.object_version_number
776 ,p_rule_type => p_rec.rule_type);
777 --
778 -- Validate Dependent Attributes
779 --
780 ame_rul_bus.chk_start_end_date_combination
781 (p_rule_id => p_rec.rule_id
782 ,p_object_version_number => p_rec.object_version_number
783 ,p_effective_date => p_effective_date
784 ,p_start_date => p_rec.start_date
785 ,p_end_date => p_rec.end_date);
786 --
787 ame_rul_bus.chk_rule_key(p_rule_key => p_rec.rule_key);
788 --
789 hr_utility.set_location(' Leaving:'||l_proc, 10);
790 End insert_validate;
791 --
792 -- ----------------------------------------------------------------------------
793 -- |---------------------------< update_validate >----------------------------|
794 -- ----------------------------------------------------------------------------
795 Procedure update_validate
796 (p_rec in ame_rul_shd.g_rec_type
797 ,p_effective_date in date
798 ,p_datetrack_mode in varchar2
799 ,p_validation_start_date in date
800 ,p_validation_end_date in date
801 ) is
802 --
803 l_proc varchar2(72) := g_package||'update_validate';
804 --
805 Begin
806 hr_utility.set_location('Entering:'||l_proc, 5);
807 --
808 -- Validate Dependent Attributes
809 --+
810 ame_rul_bus.chk_description
811 (p_rule_id => p_rec.rule_id
812 ,p_object_version_number => p_rec.object_version_number
813 ,p_effective_date => p_effective_date
814 ,p_description => p_rec.description);
815 --+
816 --
817 -- Call the datetrack update integrity operation
818 --
819 dt_update_validate
820 (p_datetrack_mode => p_datetrack_mode
821 ,p_validation_start_date => p_validation_start_date
822 ,p_validation_end_date => p_validation_end_date
823 );
824 --
825 chk_non_updateable_args
826 (p_effective_date => p_effective_date
827 ,p_rec => p_rec
828 );
829 --
830 ame_rul_bus.chk_start_end_date_combination
831 (p_rule_id => p_rec.rule_id
832 ,p_object_version_number => p_rec.object_version_number
833 ,p_effective_date => p_effective_date
834 ,p_start_date => p_rec.start_date
835 ,p_end_date => p_rec.end_date);
836 --
837 --
838 hr_utility.set_location(' Leaving:'||l_proc, 10);
839 End update_validate;
840 --
841 -- ----------------------------------------------------------------------------
842 -- |---------------------------< delete_validate >----------------------------|
843 -- ----------------------------------------------------------------------------
844 Procedure delete_validate
845 (p_rec in ame_rul_shd.g_rec_type
846 ,p_effective_date in date
847 ,p_datetrack_mode in varchar2
848 ,p_validation_start_date in date
849 ,p_validation_end_date in date
850 ) is
851 --
852 l_proc varchar2(72) := g_package||'delete_validate';
853 --
854 Begin
855 hr_utility.set_location('Entering:'||l_proc, 5);
856 --
857 -- Call all supporting business operations
858 --
859 dt_delete_validate
860 (p_datetrack_mode => p_datetrack_mode
861 ,p_validation_start_date => p_validation_start_date
862 ,p_validation_end_date => p_validation_end_date
863 ,p_rule_id => p_rec.rule_id
864 );
865 --
866 ame_rul_bus.chk_delete
867 (p_rule_id => p_rec.rule_id
868 ,p_object_version_number => p_rec.object_version_number
869 ,p_effective_date => p_effective_date);
870 --
871 hr_utility.set_location(' Leaving:'||l_proc, 10);
872 End delete_validate;
873 --
874 end ame_rul_bus;