DBA Data[Home] [Help]

PACKAGE BODY: APPS.AME_FINAL_AUTHORITY_HANDLER

Source


1 package body ame_final_authority_handler as
2 /* $Header: ameefaha.pkb 120.1 2005/08/08 05:09:54 ubhat noship $ */
3   procedure handler as
4     actionParameters ame_util.stringList;
5     listModParameterOnes ame_util.stringList;
6     listModParameterTwos ame_util.longStringList;
7     ruleIds ame_util.idList;
8     ruleIndexes ame_util.idList;
9     tempApproverIndexes ame_util.idList;
10     tempLastForwardeeIndexes ame_util.idList;
11     begin
12       /*
13         This handler is for the final-authority list-modification action type.
14         For each input list-modification rule using this action type, the
15         handler truncates each chain of authority containing the target approver,
16         in the following sense.  First, the handler finds the end of any
17         forwarding chain starting with the target approver.  If the
18         allowFyiNotifications configuration variable is set to ame_util.yes, all
19         approvers after the forwarding chain are converted to FYI recipients.
20         Otherwise, the approvers are deleted.  (The target approver must be an
21         ame_util.approvalApproverCategory approver.)
22       */
23       ame_engine.getHandlerRules3(ruleIdsOut => ruleIds,
24                                   ruleIndexesOut => ruleIndexes,
25                                   parametersOut => actionParameters, /* The action parameters are null here. */
26                                   listModParameterOnesOut => listModParameterOnes,
27                                   listModParameterTwosOut => listModParameterTwos);
28       for i in 1 .. ruleIds.count loop
29         tempApproverIndexes.delete;
30         ame_engine.getHandlerLMApprovers(listModParameterOneIn => listModParameterOnes(i),
31                                          listModParameterTwoIn => listModParameterTwos(i),
32                                          includeFyiApproversIn => false,
33                                          includeApprovalGroupsIn => false,
34                                          returnForwardeesIn => true,
35                                          approverIndexesOut => tempApproverIndexes /* not used here */,
36                                          lastForwardeeIndexesOut => tempLastForwardeeIndexes);
37         /*
38           ame_engine.getHandlerLMApprovers returns tempLastForwardeeIndexes in ascending order.  Truncate
39           in the opposite order, to avoid having to recalculate the index of each remaining target approver
40           after each truncation.
41         */
42         for j in reverse 1 .. tempLastForwardeeIndexes.count loop
43           ame_engine.truncateChain(approverIndexIn => tempLastForwardeeIndexes(j),
44                                    ruleIdIn => ruleIds(i));
45         end loop;
46         if tempLastForwardeeIndexes.count > 0 then
47           ame_engine.setRuleApplied(ruleIndexIn => ruleIndexes(i));
48         end if;
49       end loop;
50       exception
51         when others then
52           ame_util.runtimeException(packageNameIn => 'ame_final_authority_handler',
53                                     routineNameIn => 'handler',
54                                     exceptionNumberIn => sqlcode,
55                                     exceptionStringIn => sqlerrm);
56           raise;
57     end handler;
58 end ame_final_authority_handler;