DBA Data[Home] [Help]

PACKAGE: APPS.AME_ENGINE

Source


1 package ame_engine AUTHID CURRENT_USER as
2 /* $Header: ameeengi.pkh 120.11 2011/07/26 05:33:42 kkananth ship $ */
3   /*************************************************************************************
4   functions
5   *************************************************************************************/
6   /******************************** boolean functions *********************************/
7   function approversMatch(approverRecord1In in ame_util.approverRecord2,
8                           approverRecord2In in ame_util.approverRecord2) return boolean;
9   function checkAttributeVariant(attributeIdIn in integer) return varchar2;
10   function evalPrioritiesPerItem return boolean;
11   function insertionExists(orderTypeIn in varchar2,
12                            parameterIn in varchar2) return boolean;
13   function isLocalTransaction return boolean;
14   function isStaticAttUsage(attributeIdIn in integer) return boolean;
15   function isTestTransaction return boolean;
16   function processPriorities return boolean;
17   function processProductionActions return boolean;
18   function processProductionRules return boolean;
19   /********************************** get functions ***********************************/
20   function getActionTypeChainOrderMode(actionTypeIdIn in integer) return varchar2;
21   function getActionTypeId(actionTypeNameIn in varchar2) return integer;
22   function getActionTypeName(actionTypeIdIn in integer) return varchar2;
23   function getActionTypeOrderNumber(actionTypeIdIn in integer) return integer;
24   function getActionTypePackageName(actionTypeIdIn in integer) return varchar2;
25   function getActionTypeUsage(actionTypeIdIn in integer) return integer;
26   function getActionTypeVotingRegime(actionTypeIdIn in integer) return varchar2;
27   function getAmeApplicationId return integer;
28   function getApprovalProcessCompleteYN return varchar2; /* for API use only */
29   function getAttributeIdByName(attributeNameIn in varchar2) return integer;
30   function getAttributeName(attributeIdIn in integer) return varchar2;
31   function getAttributeType(attributeIdIn in integer) return varchar2;
32   /*
33     getConfigVarValue only works in a PL/SQL session that has been initialized by a call
34     to updateTransactionState.
35   */
36   function getConfigVarValue(configVarNameIn in varchar2) return varchar2;
37   function getEffectiveRuleDate return date;
38   function getFndApplicationId return integer;
39   /*
40     getForwardingBehavior only works in a PL/SQL session that has been initialized by a
41     call to updateTransactionState.  The allowed values for forwarderTypeIn are
42       ame_util.chainOfAuthorityForwarder
43       ame_util.adHocForwarder
44     The allowed values for forwardeeTypeIn are
45       ame_util.previousSameChainForwardee
46       ame_util.subordSameHierarchyForwardee
47       ame_util.alreadyInListForwardee
48     The allowed values for approvalStatus in are
49       ame_util.approveAndForwardStatus
50       ame_util.forwardStatus
51   */
52   function getForwardingBehavior(forwarderTypeIn in varchar2,
53                                  forwardeeTypeIn in varchar2,
54                                  approvalStatusIn in varchar2) return varchar2;
55   /* Only action-type handlers should call the getHandler functions.  See also the getHandler procedures. */
56   function getHandlerActionTypeId return integer;
57   function getHandlerActionTypeOrderNum return integer;
58   function getHandlerApprovalStatus(approverIn in ame_util.approverRecord2
59                                    ,votingRegimeIn in varchar2 default null
60 				   ,isInsertionapprover in boolean default false) return varchar2;
61   /* Only call getHandlerAuthority for action types that always generate approvers within a fixed sublist. */
65     the item that satisfies the rule.  These items differ for header-level rules with conditions
62   function getHandlerAuthority return varchar2;
63   /*
64     The getHandlerItem[Whatever] functions relate to the item to which a rule applies, <<not>> to
66     on subordinate-item-class attributes, when per-item evaluation is enabled.
67   */
68   function getHandlerItemClassId return integer;
69   function getHandlerItemClassName return varchar2;
70   function getHandlerItemClassOrderNumber return integer;
71   function getHandlerItemId return varchar2;
72   function getHandlerItemOrderNumber return integer;
73   /*
74     If any of the default-null inputs to getHandlerOccurrence is null, the function returns the next
75     occurrence value for the group or chain most recently added to the approver list.  If all of the
76     default-null inputs are non-null, the function returns the next occurrence for the group or chain
77     identified by the inputs.
78   */
79   function getHandlerOccurrence(nameIn in varchar2,
80                                 itemClassIn in varchar2 default null,
81                                 itemIdIn in varchar2 default null,
82                                 actionTypeIdIn in integer default null,
83                                 groupOrChainIdIn in integer default null) return integer;
84   function getHandlerRuleType return integer;
85   /*
86     getHandlerState is included in this version of the engine for architectural backwards compatibility
87     for custom handlers only.  The engine's handler-state functionality is deprecated.  Please use
88     package variables to maintain handler state instead.
89   */
90   function getHandlerState(handlerNameIn in varchar2,
91                            parameterIn in varchar2 default null) return varchar2;
92   /*
93     Only call getHandlerSublistOrderNum for action types that always generate approvers within a fixed sublist.
94     This function returns the sublist order number determined by the sublist-ordering mode for the item class
95     to which a rule applies.
96   */
97   function getHandlerSublistOrderNum return integer;
98   /*
99     The following attribute-value-fetching functions only work for attributes
100     that are not of the currency attribute type.  For attributes that may be
101     of that type, use the corresponding getHeaderAttValues or getItemAttValues
102     procedures.
103   */
104   function getHeaderAttValue1(attributeIdIn in integer) return varchar2;
105   function getHeaderAttValue2(attributeNameIn in varchar2) return varchar2;
106   function getItemAttValue1(attributeIdIn in integer,
107                             itemIdIn in varchar2) return varchar2;
108   function getItemAttValue2(attributeNameIn in varchar2,
109                             itemIdIn in varchar2) return varchar2;
110   function getItemClassId(itemClassNameIn in varchar2) return integer;
111   function getItemClassName(itemClassIdIn in integer) return varchar2;
112   function getItemClassOrderNumber(itemClassIdIn in integer) return integer;
113   function getItemClassParMode(itemClassIdIn in integer) return varchar2;
114   function getItemClassSublistMode(itemClassIdIn in integer) return varchar2;
115   function getItemOrderNumber(itemClassNameIn in varchar2,
116                               itemIdIn in varchar2) return integer;
117   /* Call updateTransactionState with fetchInsertionsIn set true, before calling getNextInsertionOrder. */
118   function getNextInsertionOrder return integer;
119   function getNullActionTypeOrderNumber return integer;
120   function getRuntimeGroupCount(groupIdIn in integer) return integer;
121   function getSublistOrderNum(itemClassNameIn in varchar2,
122                               authorityIn in varchar2) return integer;
123   function getTransactionId return varchar2;
124   function getTransactionTypeId return varchar2;
125   function getVariantAttributeValue(attributeIdIn in integer,
126                                     itemClassIn in varchar2,
127                                     itemIdIn in varchar2) return number;
128   /*************************************************************************************
129   procedures
130   *************************************************************************************/
131   procedure checkApprover(approverIn in ame_util.approverRecord2);
132   /*
133     The following procedures are for API use only.  Their output arguments correspond to API
134     output arguments.  The API calls updateApprovalProcessState and then calls one or more
135     of these procedures to populate API output arguments as required.  See also the function
136     getApprovalProcessCompleteYN.
137   */
138   procedure getApprovers(approversOut out nocopy ame_util.approversTable2);
139   /* This procedure will be called by the API's to fetch the approver tree from the engine */
140   procedure getApprovers2(approversOut     out nocopy ame_util.approversTable2
141                          ,approversTreeOut out nocopy ame_util.approversTreeTable);
142   /* Procedure to return applicable rules and their descriptions */
143   procedure getApplicableRules
144     (ruleIdsOut             out nocopy ame_util.idList
145     ,ruleDescriptionsOut    out nocopy ame_util.stringList);
146   procedure getInsertions
150     ,availableInsertionsOut    out nocopy ame_util.insertionsTable2
147     (positionIn             in            number
148     ,orderTypeIn            in            varchar2 default null
149     ,coaInsertionsYNIn      in            varchar2 default ame_util.booleanTrue
151     );
152   procedure getItemAppProcessCompleteYN(itemAppProcessCompleteYNOut out nocopy ame_util.charList);
153   procedure getItemClasses(itemClassesOut out nocopy ame_util.stringList);
154   procedure getItemIds(itemIdsOut out nocopy ame_util.stringList);
155   procedure getItemIndexes(itemIndexesOut out nocopy ame_util.idList);
156   /* Procedure's to return all itemids and itemclasses or the current transaction */
157   procedure getAllItemClasses(itemClassNamesOut out nocopy ame_util.stringList);
158   procedure getAllItemIds(itemIdsOut out nocopy ame_util.stringList);
159   procedure getItemSources(itemSourcesOut out nocopy ame_util.longStringList);
160   procedure getProductionIndexes(productionIndexesOut out nocopy ame_util.idList);
161   /* getRepeatedIndexes is Added for asynch */
162   procedure getRepeatedIndexes(repeatedIndexesOut out nocopy ame_util.idList
163                               ,repeatedAppIndexesOut out nocopy ame_util.idList);
164   procedure getRuleDescriptions(ruleDescriptionsOut out nocopy ame_util.stringList);
165   procedure getRuleIds(ruleIdsOut out nocopy ame_util.idList);
166   procedure getRuleIndexes(ruleIndexesOut out nocopy ame_util.idList);
167   procedure getSourceTypes(sourceTypesOut out nocopy ame_util.stringList);
168   procedure getTransVariableNames(transVariableNamesOut out nocopy ame_util.stringList);
169   procedure getTransVariableValues(transVariableValuesOut out nocopy ame_util.stringList);
170   procedure getVariableNames(variableNamesOut out nocopy ame_util.stringList);
171   procedure getVariableValues(variableValuesOut out nocopy ame_util.stringList);
172   /*
173     The following procedures are for the test tab's use and the action-type handlers' use.
174     They let the handlers manipulate the approver list, query for approver insertions and
175     deletions, etc.
176   */
177   /* addApprover adds an approver to the end of the list. */
178   procedure addApprover(approverIn in ame_util.approverRecord2);
179   /*
180     clearHandlerState is included in this version of the engine for architectural backwards compatibility
181     for custom handlers only.  The engine's handler-state functionality is deprecated.  Please use
182     package variables to maintain handler state instead.
183   */
184   procedure clearHandlerState(handlerNameIn in varchar2,
185                               parameterIn in varchar2 default null);
186   /* getAllApprovers is for amem0013.sql backwards compatibility only.  Do not use it elsewhere. */
187   procedure getAllApprovers(approversOut out nocopy ame_util.approversTable);
188   /*
189     getApprovalGroupConfigs returns the input group IDs in groupIdsInOut, as well as the
190     output arguments, sorted first by group order number, second by group ID.  So approval-group
191     handlers can process the groups in the order this procedure returns them.
192     BUG : 4491715 modified to sort sources and approver categories with the group ids
193   */
194   procedure getApprovalGroupConfigs(groupIdsInOut in out nocopy ame_util.idList,
195                                     sourcesInOut in out nocopy ame_util.longStringList,
196                                     approverCategoriesInOut in out nocopy ame_util.charList,
197                                     orderNumbersOut out nocopy ame_util.idList,
198                                     votingRegimesOut out nocopy ame_util.charList);
199   /* Only action-type handlers should call the getHandler procedures.  See also the getHandler functions. */
200   /* getHandlerCOAFirstApprover only returns inserted approvers with the ame_util.firstAuthority order type. */
201   procedure getHandlerCOAFirstApprover(itemClassIn in varchar2,
202                                        itemIdIn in varchar2,
203                                        actionTypeIdIn in integer,
204                                        groupOrChainIdIn in integer,
205                                        nameOut out nocopy varchar2,
206                                        origSystemOut out nocopy varchar2,
207                                        origSystemIdOut out nocopy integer,
208                                        displayNameOut out nocopy varchar2,
209                                        sourceOut out nocopy varchar2);
210   /* getHandlerCOAInsertion only returns inserted approvers with the ame_util.afterApprover order type. */
211   procedure getHandlerCOAInsertion(nameIn in varchar2,
212                                    itemClassIn in varchar2,
213                                    itemIdIn in varchar2,
214                                    actionTypeIdIn in integer,
215                                    groupOrChainIdIn in integer,
216                                    occurrenceIn in integer,
217                                    approvalStatusIn in varchar2,
218                                    nameOut out nocopy varchar2,
219                                    origSystemOut out nocopy varchar2,
220                                    origSystemIdOut out nocopy integer,
221                                    displayNameOut out nocopy varchar2,
222                                    sourceOut out nocopy varchar2);
223   procedure getHandlerRules(ruleIdsOut out nocopy ame_util.idList,
224                             approverCategoriesOut out nocopy ame_util.charList,
225                             parametersOut out nocopy ame_util.stringList,
226                             parameterTwosOut out nocopy ame_util.stringList);
227   procedure getHandlerRules2(ruleIdsOut out nocopy ame_util.idList,
228                              approverCategoriesOut out nocopy ame_util.charList,
229                              parametersOut out nocopy ame_util.stringList);
230   procedure getHandlerRules3(ruleIdsOut out nocopy ame_util.idList,
231                              ruleIndexesOut out nocopy ame_util.idList,
232                              parametersOut out nocopy ame_util.stringList,
233                              listModParameterOnesOut out nocopy ame_util.stringList,
234                              listModParameterTwosOut out nocopy ame_util.longStringList);
235   /*
236     getHandlerLMApprovers returns the indexes of the approvers in engStApprovers that
237     have the wf_roles.name value listModParameterTwoIn, at the positions within an approval
238     group or chain of authority required by listModParameterOneIn, and satisfying the
239     includeFyiApproversIn and includeApprovalGroupsIn arguments' requirements.  Each
240     matched approver's index is written to approverIndexesOut.  If the calling handler
241     needs to know also the last approver in a chain of forwardees following a matched
242     approver who forwards (with or without approval), the handler should set
243     returnForwardeesIn true.  Then lastForwardeeIndexesOut(i) will be the index of the
244     last forwardee in engStApprovers corresponding to the matched approver at
245     engStApprovers(approverIndexesOut(i)).
246   */
247   procedure getHandlerLMApprovers(listModParameterOneIn in varchar2,
248                                   listModParameterTwoIn in varchar2,
249                                   includeFyiApproversIn in boolean,
250                                   includeApprovalGroupsIn in boolean,
251                                   returnForwardeesIn in boolean,
252                                   approverIndexesOut out nocopy ame_util.idList,
253                                   lastForwardeeIndexesOut out nocopy ame_util.idList);
254   /*
255     The following attribute-value-fetching procedures work for attributes of all
256     types (including currency types).  If you know the attribute whose value you want
257     to fetch is not of currency type, and either (1) the attribute is header level or
258     (2) you want to fetch its value for just one item ID, you can use one of the
259     getHeaderAttValue or getItemAttValue functions declared above.
260   */
261   procedure getHeaderAttValues1(attributeIdIn in integer,
262                                 attributeValue1Out out nocopy varchar2,
263                                 attributeValue2Out out nocopy varchar2,
264                                 attributeValue3Out out nocopy varchar2);
265   procedure getHeaderAttValues2(attributeNameIn in varchar2,
266                                 attributeValue1Out out nocopy varchar2,
267                                 attributeValue2Out out nocopy varchar2,
268                                 attributeValue3Out out nocopy varchar2);
269   procedure getItemAttValues1(attributeIdIn in integer,
270                               itemIdIn in varchar2,
271                               attributeValue1Out out nocopy varchar2,
272                               attributeValue2Out out nocopy varchar2,
273                               attributeValue3Out out nocopy varchar2);
274   procedure getItemAttValues2(attributeNameIn in varchar2,
275                               itemIdIn in varchar2,
276                               attributeValue1Out out nocopy varchar2,
277                               attributeValue2Out out nocopy varchar2,
278                               attributeValue3Out out nocopy varchar2);
279   procedure getItemAttValues3(attributeIdIn in integer,
283                               attributeValue3Out out nocopy varchar2);
280                               itemIndexIn in varchar2,
281                               attributeValue1Out out nocopy varchar2,
282                               attributeValue2Out out nocopy varchar2,
284   /*
285     Use the getItemClassAttValues procedures to fetch all of the attribute values
286     of a given item class.  Use one of the first two variants for attributes known
287     not to be currency attributes, and one of the other two for attributes of
288     unknown type.
289   */
290   procedure getItemClassAttValues1(attributeIdIn in integer,
291                                    attributeValuesOut out nocopy ame_util.attributeValueList);
292   procedure getItemClassAttValues2(attributeNameIn in varchar2,
293                                    attributeValuesOut out nocopy ame_util.attributeValueList);
294   procedure getItemClassAttValues3(attributeIdIn in integer,
295                                    attributeValues1Out out nocopy ame_util.attributeValueList,
296                                    attributeValues2Out out nocopy ame_util.attributeValueList,
297                                    attributeValues3Out out nocopy ame_util.attributeValueList);
298   procedure getItemClassAttValues4(attributeNameIn in varchar2,
299                                    attributeValues1Out out nocopy ame_util.attributeValueList,
300                                    attributeValues2Out out nocopy ame_util.attributeValueList,
301                                    attributeValues3Out out nocopy ame_util.attributeValueList);
302   procedure getItemClassItemIds(itemClassIdIn in integer,
303                                 itemIdsOut out nocopy ame_util.stringList);
304   --+
305   procedure getAllProductions(productionsOut out nocopy ame_util2.productionsTable);
306   procedure getProductions(itemClassIn    in  varchar2
307                           ,itemIdIn       in  varchar2
308                           ,productionsOut out nocopy ame_util2.productionsTable);
309   /*
310     Runtime code should call ame_engine.getRuntimeGroupMembers, <<not>> ame_approval_group_pkg.getRuntimeGroupMembers,
311     to fetch an approval group's membership.  (The engine version only performs the fetch the first time it is called,
312     in a given PL/SQL context.  Thereafter it returns values cached in an engine package variable.)
313   */
314   procedure getRuntimeGroupMembers(groupIdIn in integer,
315                                    approverNamesOut out nocopy ame_util.longStringList,
316                                    approverOrderNumbersOut out nocopy ame_util.idList,
317                                    approverDisplayNamesOut out nocopy ame_util.longStringList,
318                                    origSystemIdsOut out nocopy ame_util.idList,
319                                    origSystemsOut out nocopy ame_util.stringList);
320   /*
321     Only the test-tab object layer should call getTestTransApplicableRules.  It should first call
322     updateTransactionState.  The itemClassIdsOut and itemIdsOut variables identify the items that
323     satisfy the rules.
324   */
325   procedure getTestTransApplicableRules(ruleItemClassIdsOut out nocopy ame_util.idList,
326                                         itemClassIdsOut out nocopy ame_util.idList,
327                                         itemIdsOut out nocopy ame_util.stringList,
328                                         ruleIdsOut out nocopy ame_util.idList,
329                                         ruleTypesOut out nocopy ame_util.idList,
330                                         ruleDescriptionsOut out nocopy ame_util.stringList);
331   /*
332     Only the test-tab object layer should call getTestTransApprovers.  No call to updateTransactionState
333     should precede it.  The approverListStageIn argument should be an integer between one and five
334     (inclusive), indicating which step in the approver-list algorithm the engine should complete before
335     getTestTransApprovers returns the approver list as of that stage.  Here are the stages:
336       stage    operations completed
337       -----    --------------------
338       1        generation of default approver list, accounting for chain-of-authority insertions
339       2        ad-hoc insertions (including surrogates)
340       3        ad-hoc deletions
341       4        elimination of repeated approvers per configuration-variable values
342       5        generation of approver order numbers
343     The test tab should skip stages 2-3 for test transactions.
344   */
345   procedure getTestTransApprovers(isTestTransactionIn in boolean,
346                                   transactionIdIn in varchar2,
347                                   ameApplicationIdIn in integer,
348                                   approverListStageIn in integer,
349                                   approversOut out nocopy ame_util.approversTable2,
350                                   productionIndexesOut out nocopy ame_util.idList,
351                                   variableNamesOut out nocopy ame_util.stringList,
352                                   variableValuesOut out nocopy ame_util.stringList);
353   /* initializePlsqlContext is for amem0013.sql backwards compatibility only.  Do not use it elsewhere. */
354   procedure initializePlsqlContext(ameApplicationIdIn in integer default null,
355                                    fndApplicationIdIn in integer default null,
356                                    transactionIdIn in varchar2 default null,
357                                    transactionTypeIdIn in varchar2 default null,
358                                    fetchConfigVarsIn in boolean default true,
359                                    fetchOldApproversIn in boolean default true,
360                                    fetchInsertionsIn in boolean default true,
361                                    fetchDeletionsIn in boolean default true,
362                                    fetchAttributeValuesIn in boolean default true,
363                                    fetchInactiveAttValuesIn in boolean default false);
364   /*
368     values of the approvers at and above indexIn, in the same group or chain as approverIn,
365     insertApprover inserts a single approver at an arbitrary location in the current
366     approver list.  Insertion may occur after the last approver.  If adjustMemberOrderNumbersIn
367     is true, insertApprover performs the insertion and then adjusts the member_order_number
369     according to the following rules:
370     1.  If engStApprovers(indexIn) (i.e. approverIn after the insertion) is the only approver
371         in its group or chain, set its member_order_number to one.
372     2.  Otherwise, if the previous approver but not the subsequent approver (if any) is in
373         the same group or chain, set engStApprovers(indexIn).member_order_number to
374         engStApprovers(indexIn - 1).member_order_number + 1.
375     3.  Otherwise, if the next approver but not the previous approver (if any) is in the
376         same group or chain, set engStApprovers(indexIn).member_order_number to
377         engStApprovers(indexIn + 1).member_order_number - 1.
378     4.  Otherwise, if the approvers on either side of engStApprovers(indexIn) have the same
379         member_order_number, set engStApprovers(indexIn).member_order_number to that value.
380         (Basically, preserve parallel group-or-chain ordering if it exists.)
381     5.  Otherwise, set engStApprovers(indexIn).member_order_number to follow the previous
382         approver, and increment the member_order_number values of any subsequent approvers
383         in the same chain, so they follow engStApprovers(indexIn).  (Basically, preserve
384         serial group-or-chain ordering if it exists.)
385   */
386   procedure insertApprover(indexIn in integer,
387                            approverIn in ame_util.approverRecord2,
388                            adjustMemberOrderNumbersIn in boolean default false,
389                            approverLocationIn in boolean default ame_util.lastAmongEquals,
390                            inserteeIndexIn in number default null,
391                            currentInsIndex in integer default null);
392   /*
393     insertApprovers inserts a list of approvers at an arbitrary location in the current
394     approver list.  approversIn(1) will have the index firstIndexIn in engStApprovers.
395     Insertion may occur after the last approver.
396   */
397   procedure insertApprovers(firstIndexIn in integer,
398                             approversIn in ame_util.approversTable2);
399   /*
400     Any API routine that could change transactional data in any of the ame_temp tables
401     must call lockTransaction right after the routine's begin statement, and must call
402     unlockTransaction right before returning (in both cases even if the routine calls another
403     API routine that also calls lockTransaction).  Make sure every possible return calls
404     unlockTransaction, including the exception handlers.
405   */
406   procedure lockTransaction(fndApplicationIdIn in integer,
407                             transactionIdIn in varchar2,
408                             transactionTypeIdIn in varchar2 default null);
409   procedure logTransaction;
410   /* parseFields parses stringIn into strings separated by ame_util.fieldDelimiter. */
411   procedure parseFields(stringIn in varchar2,
412                         fieldsOut out nocopy ame_util.longStringList);
413   procedure updateInsertions(indexIn in integer);
414   procedure processExceptions;
415   /*
416     setHandlerState is included in this version of the engine for architectural backwards compatibility
417     for custom handlers only.  The engine's handler-state functionality is deprecated.  Please use
418     package variables to maintain handler state instead.
419   */
420   procedure setHandlerState(handlerNameIn in varchar2,
421                             parameterIn in varchar2 default null,
422                             stateIn in varchar2 default null);
423   /* Procedure called by LM /substitution handlers to indicate that the rule is applied */
424   procedure setRuleApplied(ruleIndexIn in integer);
425   procedure substituteApprover(approverIndexIn in integer,
426                                nameIn in varchar2,
427                                actionTypeIdIn in varchar2,
428                                ruleIdIn in integer);
429   /*
430     truncateChain truncates the chain of authority in engStApprovers including
431     the approver at approverIndexIn, starting with the first approver after that
432     approver (if any).  If the allowFyiNotifications configuration variable is
433     set to ame_util.yes, truncation means changing to ame_util.fyiApproverCategory
434     the approver_category of the rest of the chain.  Otherwise it means deleting
435     the rest of the chain.  Note that if a routine calls truncateChain repeatedly,
436     it will need to account for the fact that truncation changes the indexes of
437     approvers occurring after the point of truncation.  This suggests sorting the
438     target indexes in descending order, and truncating in that order. . . .
439   */
440   procedure truncateChain(approverIndexIn in integer,
441                           ruleIdIn in integer);
442   procedure unlockTransaction(fndApplicationIdIn in integer,
443                               transactionIdIn in varchar2,
444                               transactionTypeIdIn in varchar2 default null);
445   /*
446     All API calls and test functions should call updateTransactionState to cycle the engine,
447     before calling other engine routines to fetch transaction-state values.
448   */
449   procedure updateTransactionState(isTestTransactionIn in boolean,
450                                    isLocalTransactionIn in boolean,
451                                    fetchConfigVarsIn in boolean,
452                                    fetchOldApproversIn in boolean,
453                                    fetchInsertionsIn in boolean,
454                                    fetchDeletionsIn in boolean,
455                                    fetchAttributeValuesIn in boolean,
456                                    fetchInactiveAttValuesIn in boolean,
457                                    processProductionActionsIn in boolean,
458                                    processProductionRulesIn in boolean,
459                                    updateCurrentApproverListIn in boolean,
460                                    updateOldApproverListIn in boolean,
461                                    processPrioritiesIn in boolean,
462                                    prepareItemDataIn in boolean,
463                                    prepareRuleIdsIn in boolean,
464                                    prepareRuleDescsIn in boolean,
465                                    prepareApproverTreeIn in boolean default false,
466                                    transactionIdIn in varchar2,
467                                    ameApplicationIdIn in integer default null,
468                                    fndApplicationIdIn in integer default null,
469                                    transactionTypeIdIn in varchar2 default null);
470   /* test procedure */
471   procedure testEngine(printContextYNIn in varchar2 default 'N',
472                        printAppRulesYNIn in varchar2 default 'N',
473                        printApproversYNIn in varchar2 default 'N');
474   /* getNext Approvers */
475   procedure getNextApprovers(
476             applicationIdIn   in number
477            ,transactionTypeIn in varchar2
478            ,transactionIdIn   in varchar2
479            ,nextApproversType in number
480            ,flagApproversAsNotifiedIn in varchar2 default ame_util.booleanTrue
481            ,approvalProcessCompleteYNOut out nocopy varchar2
482            ,nextApproversOut             out nocopy ame_util.approversTable2
483            ,itemIndexesOut               out nocopy ame_util.idList
484            ,itemClassesOut               out nocopy ame_util.stringList
485            ,itemIdsOut                   out nocopy ame_util.stringList
486            ,itemSourcesOut               out nocopy ame_util.longStringList
487            ,productionIndexesOut         out nocopy ame_util.idList
488            ,variableNamesOut             out nocopy ame_util.stringList
489            ,variableValuesOut            out nocopy ame_util.stringList
490            ,transVariableNamesOut        out nocopy ame_util.stringList
491            ,transVariableValuesOut       out nocopy ame_util.stringList);
492   /* updateApprovalStatus */
493   procedure updateApprovalStatus(applicationIdIn in number,
494                                  transactionTypeIn in varchar2,
495                                  transactionIdIn in varchar2,
496                                  approverIn in ame_util.approverRecord2,
497                                  notificationIn in ame_util2.notificationRecord
498                                          default ame_util2.emptyNotificationRecord,
499                                  forwardeeIn in ame_util.approverRecord2 default
500                                              ame_util.emptyApproverRecord2,
501                                  updateItemIn in boolean default false) ;
502   procedure setDeviationReasonDate(reasonIn in varchar2,dateIn in date);
503 end ame_engine;