The approveOrder pipeline determines whether the given order already is approved. If the order is not already approved, it determines whether an approval for the order is required.

The approveOrder pipeline chain is executed by the executeApproveOrderChain processor in the processOrder pipeline chain. The approveOrder() method adds the given Order and the ApprovalPipelineManager to its parameter list, which is supplied to the executing chain. The pipeline chain’s transaction mode is TX_REQUIRED.

The following sections describe each processor in the pipeline chain.

verifyApproval

This processor checks whether the given order has already been approved.

Transactional Mode

TX_MANDATORY

Component

/atg/commerce/approval/processor/VerifyApproval

Object

atg.commerce.approval.processor.ProcVerifyApproval

Transitions

Returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT) if the order has already been approved; this stops execution of the approveOrder chain and resumes the processOrder chain to complete checkout. Returns a value of 1 if the order has not already been approved; this executes the next processor, runCheckRequiresApprovalChain.

runCheckRequiresApprovalChain

This processor executes the checkRequiresApproval pipeline chain. The properties file for the /atg/commerce/approval/processor/RunCheckRequiresApproval component specifies checkRequiresApproval in the chainToRun property.

Transactional Mode

TX_MANDATORY

Component

/atg/commerce/approval/processor/RunCheckRequiresApprovalChain

Object

atg.commerce.approval.processor.ProcExecuteChain

Transitions

Returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT) if the order does not require approval; this stops execution of approveOrder so the order can proceed through checkout. Returns a value of 1 if the order requires approval; this executes the next processor, addApproverIdsToOrder.

addApproverIdsToOrder

This processor adds to the order the list of profile IDs for the users who can approve the customer’s order. This list is obtained from the customer’s approvers profile property and is added to the order’s authorizedApproverIds property.

If the customer’s approvers profile property is unset and the AddApproverIdsToOrder.allowCheckoutIfApproversNotDefined property is set to false (which it is by default), then an ApprovalException is thrown.

Transactional Mode

TX_MANDATORY

Component

/atg/commerce/approval/processor/AddApproverIdsToOrder

Object

atg.commerce.approval.processor.ProcAddApproverIdsToOrder

Transitions

Return value of 1 executes changeOrderToPendingApproval next. However, if the customer’s approvers profile property is unset and the AddApproverIdsToOrder.allowCheckoutIfApproversNotDefined property is set to true, the processor returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT); this stops execution of approveOrder so the order can proceed through checkout.

changeOrderToPendingApproval

This processor sets the order’s state to PENDING_APPROVAL.

Transactional Mode

TX_MANDATORY

Component

/atg/commerce/approval/processor/ChangeOrderToPendingApproval

Object

atg.commerce.order.processor.ProcChangeOrderState

Transitions

Return value of 1 executes addApprovalSystemMessagesToOrder next.

addApprovalSystemMessagesToOrder

This processor adds to the order the list of system messages that correspond to the conditions that triggered an approval being required. An example might be “order limit exceeded.” This list is added to the order’s approvalSystemMessages property. The system messages are defined by the processors in the checkRequiresApproval pipeline chain.

Transactional Mode

TX_MANDATORY

Component

/atg/commerce/approval/processor/AddApprovalSystemMessagesToOrder

Object

atg.commerce.approval.processor.ProcAddApprovalSystemMessagesToOrder

Transitions

Return value of 1 executes saveOrder next.

saveOrder

This processor saves the order in its present state to the Order Repository.

Transactional Mode

TX_MANDATORY

Component

/atg/commerce/approval/processor/UpdateOrder

Object

atg.commerce.approval.processor.ProcUpdateOrder

Transitions

Return value of 1 executes sendApprovalRequiredMessage next.

sendApprovalRequiredMessage

This processor sends a message to the /Approval/Scenarios JMS message topic; the message includes the order requiring approval and the profile repository item for the customer associated with the order. The message can then be used to execute scenarios.

Transactional Mode

TX_MANDATORY

Component

/atg/commerce/approval/processor/SendApprovalRequiredMessage

Object

atg.commerce.approval.processor.ProcSendApprovalRequiredMessage

Transitions

None. This is the last processor in the pipeline, which causes the ApprovalPipelineManager to return to the caller.


Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices