The approveOrder
pipeline determines whether the given order already is approved. If the order isn’t 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 list describes each processor in the pipeline chain:
PipelineLink name:
verifyApproval
This processor checks whether the given order has already been approved.
Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/VerifyApproval
PipelineProcessor object:
atg.b2bcommerce.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 theprocessOrder
chain to complete checkout. Returns a value of 1 if the order has not already been approved; this executes the next processor,runCheckRequiresApprovalChain
.PipelineLink name:
runCheckRequiresApprovalChain
This processor executes the
checkRequiresApproval
pipeline chain. The properties file for the/atg/commerce/approval/processor/RunCheckRequiresApproval
component specifiescheckRequiresApproval
in thechainToRun
property.Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/RunCheckRequiresApprovalChain
PipelineProcessor object:
atg.commerce.order.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
.PipelineLink name:
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’sauthorizedApproverIds
property.If the customer’s
approvers
profile property is unset and theAddApproverIdsToOrder.allowCheckoutIfApproversNotDefined
property is set to false (which it is by default), then anApprovalException
is thrown.Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/AddApproverIdsToOrder
PipelineProcessor object:
atg.b2bcommerce.approval.processor.ProcAddApproverIdsToOrder
Transitions: Return value of 1 executes
changeOrderToPendingApproval
next. However, if the customer’sapprovers
profile property is unset and theAddApproverIdsToOrder.allowCheckoutIfApproversNotDefined
property is set to true, the processor returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT); this stops execution ofapproveOrder
so the order can proceed through checkout.PipelineLink name:
changeOrderToPendingApproval
This processor sets the order’s state to PENDING_APPROVAL.
Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/ChangeOrderToPendingApproval
PipelineProcessor object:
atg.commerce.order.processor.ProcChangeOrderState
Transitions: Return value of 1 executes
addApprovalSystemMessagesToOrder
next.PipelineLink name:
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 thecheckRequiresApproval
pipeline chain.Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/AddApprovalSystemMessagesToOrder
PipelineProcessor object:
atg.b2bcommerce.approval.processor.ProcAddApprovalSystemMessagesToOrder
Transitions: Return value of 1 executes
saveOrder
next.PipelineLink name:
saveOrder
This processor saves the order in its present state to the Order Repository.
Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/order/processor/UpdateOrder
PipelineProcessor object:
atg.commerce.order.processor.ProcUpdateOrder
Transitions: Return value of 1 executes
sendApprovalRequiredMessage
next.PipelineLink name:
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
Nucleus component:
/atg/commerce/approval/processor/SendApprovalRequiredMessage
PipelineProcessor object:
atg.b2bcommerce.approval.processor.ProcSendApprovalRequiredMessage
Transitions: None. This is the last processor in the pipeline, which causes the
ApprovalPipelineManager
to return to the caller.