117: coaInsAuthForward boolean := false;
118: begin
119: /*
120: The engine only calls a handler if a rule requiring it exists, so we can assume that
121: the package variables that ame_engine.getHandlerRules2 initializes are nonempty.
122: Fetch the rules and sort them in increasing parameter order. (Duplicate parameters
123: are harmless here.)
124: */
125: ame_engine.getHandlerRules2(ruleIdsOut => ruleIds,
121: the package variables that ame_engine.getHandlerRules2 initializes are nonempty.
122: Fetch the rules and sort them in increasing parameter order. (Duplicate parameters
123: are harmless here.)
124: */
125: ame_engine.getHandlerRules2(ruleIdsOut => ruleIds,
126: approverCategoriesOut => approverCategories,
127: parametersOut => parameters);
128: /* Populate some of the package variables. */
129: parametersCount := parameters.count;
133: end loop;
134: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
135: tempApprover.orig_system := ame_util.posOrigSystem;
136: tempApprover.authority := ame_util.authorityApprover;
137: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
138: tempApprover.item_class := ame_engine.getHandlerItemClassName;
139: tempApprover.item_id := ame_engine.getHandlerItemId;
140: tempApprover.group_or_chain_id := 1;
141: --
134: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
135: tempApprover.orig_system := ame_util.posOrigSystem;
136: tempApprover.authority := ame_util.authorityApprover;
137: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
138: tempApprover.item_class := ame_engine.getHandlerItemClassName;
139: tempApprover.item_id := ame_engine.getHandlerItemId;
140: tempApprover.group_or_chain_id := 1;
141: --
142: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
135: tempApprover.orig_system := ame_util.posOrigSystem;
136: tempApprover.authority := ame_util.authorityApprover;
137: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
138: tempApprover.item_class := ame_engine.getHandlerItemClassName;
139: tempApprover.item_id := ame_engine.getHandlerItemId;
140: tempApprover.group_or_chain_id := 1;
141: --
142: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
143: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
138: tempApprover.item_class := ame_engine.getHandlerItemClassName;
139: tempApprover.item_id := ame_engine.getHandlerItemId;
140: tempApprover.group_or_chain_id := 1;
141: --
142: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
143: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
144: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
145: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
146: tempApprover.group_or_chain_order_number := 1;
139: tempApprover.item_id := ame_engine.getHandlerItemId;
140: tempApprover.group_or_chain_id := 1;
141: --
142: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
143: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
144: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
145: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
146: tempApprover.group_or_chain_order_number := 1;
147: /* Fetch some of the required attributes. */
140: tempApprover.group_or_chain_id := 1;
141: --
142: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
143: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
144: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
145: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
146: tempApprover.group_or_chain_order_number := 1;
147: /* Fetch some of the required attributes. */
148: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
141: --
142: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
143: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
144: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
145: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
146: tempApprover.group_or_chain_order_number := 1;
147: /* Fetch some of the required attributes. */
148: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
149: /* Check for COA Insertions */
144: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
145: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
146: tempApprover.group_or_chain_order_number := 1;
147: /* Fetch some of the required attributes. */
148: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
149: /* Check for COA Insertions */
150: ame_engine.getHandlerCOAFirstApprover(itemClassIn => tempApprover.item_class,
151: itemIdIn => tempApprover.item_id,
152: actionTypeIdIn => tempApprover.action_type_id,
146: tempApprover.group_or_chain_order_number := 1;
147: /* Fetch some of the required attributes. */
148: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
149: /* Check for COA Insertions */
150: ame_engine.getHandlerCOAFirstApprover(itemClassIn => tempApprover.item_class,
151: itemIdIn => tempApprover.item_id,
152: actionTypeIdIn => tempApprover.action_type_id,
153: groupOrChainIdIn => tempApprover.group_or_chain_id,
154: nameOut => COAInsertee.name,
161: isRequestor := true;
162: if COAInsertee.name is null then
163: /* Fetch some of the required attributes. */
164: startingPointId :=
165: to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.nonDefStartingPointPosAttr));
166: if(startingPointId is null) then
167: requestorId :=
168: to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.transactionReqPositionAttr));
169: if (requestorId is null) then
164: startingPointId :=
165: to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.nonDefStartingPointPosAttr));
166: if(startingPointId is null) then
167: requestorId :=
168: to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.transactionReqPositionAttr));
169: if (requestorId is null) then
170: raise nullFirstIdException;
171: end if;
172: tempApprover.orig_system_id := requestorId;
171: end if;
172: tempApprover.orig_system_id := requestorId;
173: /* Check if requestor can self approve. If so, insert the approver as the
174: only approver, with a status of approved, and return.*/
175: if(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.allowAutoApprovalAttribute)
176: = ame_util.booleanAttributeTrue)
177: then
178: getCatSourceAndAuthority(positionIdIn => requestorId,
179: categoryOut => tempApprover.approver_category,
185: origSystemIn => ame_util.posOrigSystem,
186: origSystemIdIn => requestorId,
187: nameOut => tempApprover.name,
188: displayNameOut => tempApprover.display_name);
189: tempApprover.occurrence := ame_engine.getHandlerOccurrence(
190: nameIn => tempApprover.name,
191: itemClassIn => tempApprover.item_class,
192: itemIdIn => tempApprover.item_id,
193: actionTypeIdIn => tempApprover.action_type_id,
193: actionTypeIdIn => tempApprover.action_type_id,
194: groupOrChainIdIn => tempApprover.group_or_chain_id);
195: tempApprover.member_order_number := 1;
196: tempApprover.approval_status := ame_util.approvedStatus;
197: ame_engine.addApprover(approverIn => tempApprover);
198: return;
199: end if;
200: isRequestor := false;
201: end if;
232: if firstApproverSource is not null then
233: tempApprover.source := firstApproverSource;
234: firstApproverSource := null;
235: end if;
236: tempApprover.occurrence := ame_engine.getHandlerOccurrence(
237: nameIn => tempApprover.name,
238: itemClassIn => tempApprover.item_class,
239: itemIdIn => tempApprover.item_id,
240: actionTypeIdIn => tempApprover.action_type_id,
244: tempApprover.member_order_number := tempMemberOrderNumber;
245: else /* votingRegimeType in (ame_util.consensusVoting, ame_util.firstApproverVoting) */
246: tempApprover.member_order_number := 1;
247: end if;
248: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
249: /* The engine will set tempApprover.approver_order_number; leave it null here. */
250: ame_engine.addApprover(approverIn => tempApprover);
251: /* check to see if there is a COA insertion after this approver. If a COA insertion is
252: found, keep checking till no more COA insertions. The check for final authority
246: tempApprover.member_order_number := 1;
247: end if;
248: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
249: /* The engine will set tempApprover.approver_order_number; leave it null here. */
250: ame_engine.addApprover(approverIn => tempApprover);
251: /* check to see if there is a COA insertion after this approver. If a COA insertion is
252: found, keep checking till no more COA insertions. The check for final authority
253: will need to be done again. */
254: loop
254: loop
255: /* Initialize COAInsertee approverRecord2 */
256: COAInsertee := ame_util.emptyApproverRecord2;
257: /* Check if there are any COAInsertions */
258: ame_engine.getHandlerCOAInsertion(nameIn => tempApprover.name,
259: itemClassIn => tempApprover.item_class,
260: itemIdIn => tempApprover.item_id,
261: actionTypeIdIn => tempApprover.action_type_id,
262: groupOrChainIdIn => tempApprover.group_or_chain_id,
286: tempApprover.member_order_number := tempMemberOrderNumber;
287: else /* votingRegimeType in (ame_util.consensusVoting, ame_util.firstApproverVoting) */
288: tempApprover.member_order_number := 1;
289: end if;
290: tempApprover.occurrence := ame_engine.getHandlerOccurrence(nameIn => tempApprover.name,
291: itemClassIn => tempApprover.item_class,
292: itemIdIn => tempApprover.item_id,
293: actionTypeIdIn => tempApprover.action_type_id,
294: groupOrChainIdIn => tempApprover.group_or_chain_id);
291: itemClassIn => tempApprover.item_class,
292: itemIdIn => tempApprover.item_id,
293: actionTypeIdIn => tempApprover.action_type_id,
294: groupOrChainIdIn => tempApprover.group_or_chain_id);
295: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn =>
296: tempApprover);
297: /* If approver has a status of ame_util.approve or ame_util.approveAndForwardStatus or
298: ame_util.nullStatus check to see if approver could have final authority */
299: if tempApprover.approval_status in (ame_util.approvedStatus, ame_util.approveAndForwardStatus,
303: tempHasFinalAuthorityYN = ame_util.booleanTrue) then
304: finalAuthorityFound := true;
305: end if;
306: end if;
307: ame_engine.addApprover(approverIn => tempApprover);
308: end if;
309: end loop;
310: /* Decide whether to end the chain. */
311: if(tempHasFinalAuthorityYN = ame_util.booleanTrue ) then
316: origSystemIdIn => tempApprover.orig_system_id,
317: nameOut => tempApprover.name,
318: displayNameOut => tempApprover.display_name);
319: if firstAuthInsExists then
320: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.firstauthHandlerInsReason,null);
321: end if;
322: if coaInsAuthForward then
323: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.forwarHandlerAuthInsReason,null);
324: end if;
319: if firstAuthInsExists then
320: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.firstauthHandlerInsReason,null);
321: end if;
322: if coaInsAuthForward then
323: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.forwarHandlerAuthInsReason,null);
324: end if;
325: tempApprover.api_insertion := ame_util.oamGenerated;
326: end loop;
327: exception