192: firstAuthInsExists boolean := false;
193: coaInsAuthForward boolean := false;
194: begin
195: includeAllJobLevelApprovers :=
196: ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.includeAllApproversAttribute) =
197: ame_util.booleanAttributeTrue;
198: /* Populate some of the package variables. */
199: topDogPersonId := to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.topSupPersonIdAttribute));
200: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
195: includeAllJobLevelApprovers :=
196: ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.includeAllApproversAttribute) =
197: ame_util.booleanAttributeTrue;
198: /* Populate some of the package variables. */
199: topDogPersonId := to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.topSupPersonIdAttribute));
200: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
201: tempApprover.orig_system := ame_util.perOrigSystem;
202: tempApprover.authority := ame_util.authorityApprover;
203: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
199: topDogPersonId := to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.topSupPersonIdAttribute));
200: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
201: tempApprover.orig_system := ame_util.perOrigSystem;
202: tempApprover.authority := ame_util.authorityApprover;
203: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
204: tempApprover.item_class := ame_engine.getHandlerItemClassName;
205: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
206: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
207: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
200: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
201: tempApprover.orig_system := ame_util.perOrigSystem;
202: tempApprover.authority := ame_util.authorityApprover;
203: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
204: tempApprover.item_class := ame_engine.getHandlerItemClassName;
205: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
206: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
207: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
208: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
201: tempApprover.orig_system := ame_util.perOrigSystem;
202: tempApprover.authority := ame_util.authorityApprover;
203: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
204: tempApprover.item_class := ame_engine.getHandlerItemClassName;
205: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
206: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
207: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
208: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
209: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
202: tempApprover.authority := ame_util.authorityApprover;
203: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
204: tempApprover.item_class := ame_engine.getHandlerItemClassName;
205: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
206: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
207: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
208: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
209: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
210: chainOrderMode := ame_engine.getActionTypeChainOrderMode(actionTypeIdIn => tempApprover.action_type_id);
203: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
204: tempApprover.item_class := ame_engine.getHandlerItemClassName;
205: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
206: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
207: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
208: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
209: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
210: chainOrderMode := ame_engine.getActionTypeChainOrderMode(actionTypeIdIn => tempApprover.action_type_id);
211: /*
204: tempApprover.item_class := ame_engine.getHandlerItemClassName;
205: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
206: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
207: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
208: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
209: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
210: chainOrderMode := ame_engine.getActionTypeChainOrderMode(actionTypeIdIn => tempApprover.action_type_id);
211: /*
212: The engine only calls a handler if a rule requiring it exists, so we can assume that
205: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
206: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
207: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
208: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
209: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
210: chainOrderMode := ame_engine.getActionTypeChainOrderMode(actionTypeIdIn => tempApprover.action_type_id);
211: /*
212: The engine only calls a handler if a rule requiring it exists, so we can assume that
213: the package variables that ame_engine.getHandlerRules initializes are nonempty.
206: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
207: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
208: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
209: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
210: chainOrderMode := ame_engine.getActionTypeChainOrderMode(actionTypeIdIn => tempApprover.action_type_id);
211: /*
212: The engine only calls a handler if a rule requiring it exists, so we can assume that
213: the package variables that ame_engine.getHandlerRules initializes are nonempty.
214: Fetch the rules and sort them in increasing parameter order. (Duplicate parameters
209: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
210: chainOrderMode := ame_engine.getActionTypeChainOrderMode(actionTypeIdIn => tempApprover.action_type_id);
211: /*
212: The engine only calls a handler if a rule requiring it exists, so we can assume that
213: the package variables that ame_engine.getHandlerRules initializes are nonempty.
214: Fetch the rules and sort them in increasing parameter order. (Duplicate parameters
215: are harmless here.)
216: */
217: ame_engine.getHandlerRules2(ruleIdsOut => ruleIds,
213: the package variables that ame_engine.getHandlerRules initializes are nonempty.
214: Fetch the rules and sort them in increasing parameter order. (Duplicate parameters
215: are harmless here.)
216: */
217: ame_engine.getHandlerRules2(ruleIdsOut => ruleIds,
218: approverCategoriesOut => approverCategories,
219: parametersOut => parameters);
220: parametersCount := parameters.count;
221: /* get the Item class Id for Line Item Item class */
218: approverCategoriesOut => approverCategories,
219: parametersOut => parameters);
220: parametersCount := parameters.count;
221: /* get the Item class Id for Line Item Item class */
222: itemClassId := ame_engine.getItemClassId(itemClassNameIn => ame_util.lineItemItemClassName);
223: /* call ame_engine.getItemClassItemIds() to get the item Id list */
224: ame_engine.getItemClassItemIds(itemClassIdIn => itemClassId,
225: itemIdsOut => itemIds);
226: for chainCounter in 1..itemIds.count loop
219: parametersOut => parameters);
220: parametersCount := parameters.count;
221: /* get the Item class Id for Line Item Item class */
222: itemClassId := ame_engine.getItemClassId(itemClassNameIn => ame_util.lineItemItemClassName);
223: /* call ame_engine.getItemClassItemIds() to get the item Id list */
224: ame_engine.getItemClassItemIds(itemClassIdIn => itemClassId,
225: itemIdsOut => itemIds);
226: for chainCounter in 1..itemIds.count loop
227: firstAuthInsExists := false;
220: parametersCount := parameters.count;
221: /* get the Item class Id for Line Item Item class */
222: itemClassId := ame_engine.getItemClassId(itemClassNameIn => ame_util.lineItemItemClassName);
223: /* call ame_engine.getItemClassItemIds() to get the item Id list */
224: ame_engine.getItemClassItemIds(itemClassIdIn => itemClassId,
225: itemIdsOut => itemIds);
226: for chainCounter in 1..itemIds.count loop
227: firstAuthInsExists := false;
228: coaInsAuthForward := false;
228: coaInsAuthForward := false;
229: finalAuthorityApproverCategory := null;
230: finalAuthoritySource := null;
231: /* Set the tempApprover variables for this line item cycle */
232: tempApprover.item_id := ame_engine.getHandlerItemId;
233: tempApprover.group_or_chain_id := chainCounter;
234: /* Check for COA 'firstAuthority' insertions */
235: ame_engine.getHandlerCOAFirstApprover(itemClassIn => tempApprover.item_class,
236: itemIdIn => tempApprover.item_id,
231: /* Set the tempApprover variables for this line item cycle */
232: tempApprover.item_id := ame_engine.getHandlerItemId;
233: tempApprover.group_or_chain_id := chainCounter;
234: /* Check for COA 'firstAuthority' insertions */
235: ame_engine.getHandlerCOAFirstApprover(itemClassIn => tempApprover.item_class,
236: itemIdIn => tempApprover.item_id,
237: actionTypeIdIn =>tempApprover.action_type_id,
238: groupOrChainIdIn => chainCounter,
239: nameOut => COAInsertee.name,
241: origSystemIdOut =>COAInsertee.orig_system_id,
242: displayNameOut => COAInsertee.display_name,
243: sourceOut => COAInsertee.source);
244: if COAInsertee.name is null then
245: /* call ame_engine.getItemAttValue2() inside the loop to get the line
246: item starting point person id */
247: lineItemStartingPointPersonId := to_number(ame_engine.getItemAttValue2(
248: attributeNameIn => ame_util.lineItemStartingPointAttribute,
249: itemIdIn => itemIds(chainCounter)));
243: sourceOut => COAInsertee.source);
244: if COAInsertee.name is null then
245: /* call ame_engine.getItemAttValue2() inside the loop to get the line
246: item starting point person id */
247: lineItemStartingPointPersonId := to_number(ame_engine.getItemAttValue2(
248: attributeNameIn => ame_util.lineItemStartingPointAttribute,
249: itemIdIn => itemIds(chainCounter)));
250: if(lineItemStartingPointPersonId is null ) then
251: raise nullFirstIdException;
304: tempApprover.approver_category := finalAuthorityApproverCategory;
305: tempApprover.source := finalAuthoritySource;
306: end if;
307: tempApprover.api_insertion := ame_util.oamGenerated;
308: tempApprover.occurrence := ame_engine.getHandlerOccurrence(
309: nameIn=>tempApprover.name,
310: itemClassIn => tempApprover.item_class,
311: itemIdIn => tempApprover.item_id,
312: actionTypeIdIn => tempApprover.action_type_id,
316: tempApprover.member_order_number := tempMemberOrderNumber;
317: else /* votingRegimeType in (ame_util.consensusVoting, ame_util.firstApproverVoting) */
318: tempApprover.member_order_number := 1;
319: end if;
320: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
321: /* The engine will set tempApprover.approver_order_number; leave it null here. */
322: ame_engine.addApprover(approverIn => tempApprover);
323: /* check to see if there is a COA insertion after this approver. If a COA
324: insertion is found, keep checking till no more COA insertions. The check
318: tempApprover.member_order_number := 1;
319: end if;
320: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
321: /* The engine will set tempApprover.approver_order_number; leave it null here. */
322: ame_engine.addApprover(approverIn => tempApprover);
323: /* check to see if there is a COA insertion after this approver. If a COA
324: insertion is found, keep checking till no more COA insertions. The check
325: for final authority will need to be done again. */
326: loop
326: loop
327: /* Initialize COAInsertee approverRecord2 */
328: COAInsertee := ame_util.emptyApproverRecord2;
329: /* Check if there are any COAInsertions */
330: ame_engine.getHandlerCOAInsertion(nameIn => tempApprover.name,
331: itemClassIn => tempApprover.item_class,
332: itemIdIn => tempApprover.item_id,
333: actionTypeIdIn => tempApprover.action_type_id,
334: groupOrChainIdIn => tempApprover.group_or_chain_id,
365: tempApprover.member_order_number := tempMemberOrderNumber;
366: else /* votingRegimeType in (ame_util.consensusVoting, ame_util.firstApproverVoting) */
367: tempApprover.member_order_number := 1;
368: end if;
369: tempApprover.occurrence := ame_engine.getHandlerOccurrence(nameIn => tempApprover.name,
370: itemClassIn => tempApprover.item_class,
371: itemIdIn => tempApprover.item_id,
372: actionTypeIdIn => tempApprover.action_type_id,
373: groupOrChainIdIn => tempApprover.group_or_chain_id);
370: itemClassIn => tempApprover.item_class,
371: itemIdIn => tempApprover.item_id,
372: actionTypeIdIn => tempApprover.action_type_id,
373: groupOrChainIdIn => tempApprover.group_or_chain_id);
374: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
375: /* If approver has a status of ame_util.approve or ame_util.approveAndForwardStatus or
376: ame_util.nullStatus check to see if approver could have final authority */
377: if ((tempApprover.approval_status is null) or
378: (tempApprover.approval_status in
386: tempHasFinalAuthorityYN = ame_util.booleanTrue) then
387: finalAuthorityFound := true;
388: end if;
389: end if;
390: ame_engine.addApprover(approverIn => tempApprover);
391: coaInsAuthForward := true;
392: end if;
393: end loop;
394: /* Decide whether to end the chain. */
424: origSystemIdIn => tempApprover.orig_system_id,
425: nameOut => tempApprover.name,
426: displayNameOut => tempApprover.display_name);
427: if firstAuthInsExists then
428: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.firstauthHandlerInsReason,null);
429: end if;
430: if coaInsAuthForward then
431: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.forwarHandlerAuthInsReason,null);
432: end if;
427: if firstAuthInsExists then
428: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.firstauthHandlerInsReason,null);
429: end if;
430: if coaInsAuthForward then
431: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.forwarHandlerAuthInsReason,null);
432: end if;
433: end loop;
434: end loop;
435: exception