Friday, November 22, 2013

Droplets and Form Handlers for Approving Orders : ATG

Droplets and Form Handlers for Approving Orders


When an order has been determined to require approval, and its order state has been set to PENDING_APPROVAL, an approver must then review the order and approve or reject it. ApprovalRequiredDroplet and ApprovalFormHandler are provided for this purpose.

Additionally, an approver might want to view a historical list of the orders he or she has approved and/or rejected. ApprovedDroplet is provided for this purpose.

ApprovalRequiredDroplet:


Use the ApprovalRequiredDroplet servlet bean to retrieve all orders requiring approval by a given approver. ApprovalRequiredDroplet queries the order repository and returns all orders that meet the following two criteria:

1. The order’s authorizedApproverIds property contains the approver’s ID.

2. he state of the order requires approval, meaning that the state is defined in the ApprovalRequiredDroplet orderStatesRequiringApproval property. The order’s state is held by the property of the order that is specified in the ApprovalRequireDroplet orderStatePropertyName property. The default value is PENDING_APPROVAL.

ApprovedDroplet:


Use the ApprovedDroplet servlet bean to retrieve all orders that have been approved and/or rejected by a given approver. ApprovedDroplet queries the order repository and returns all orders that have the approver’s profile ID in the approverIds property.

ApprovalFormHandler:


The ApprovalFormHandler form handler  processes an approver’s approval or rejection of an order. The ApprovalFormHandler class contains two handle methods, handleApproveOrder and handleRejectOrder.


You can associate these handle methods with Submit properties in the following manner:


<input type=submit bean="ApprovalFormHandler.approveOrder" value=" Approve Order">
<input type=submit bean="ApprovalFormHandler.rejectOrder" value=" Reject Order">


If the handleApproveOrder method is called for ApprovalFormHandler.approveOrder, the handleApproveOrder method executes the orderApproved pipeline chain. Similarly, if the handleRejectOrder method is called for ApprovalFormHandler.rejectOrder, the handleRejectOrder method executes the orderRejected pipeline chain.


Use JMS Messages in the Order Approval Process


ApprovalRequiredMessage :

JMS Type: atg.commerce.approval.ApprovalRequired

This message includes the order requiring approval and the profile repository item for the customer associated with the order as order and profile message properties, respectively. If you are using multisite, the siteId property is populated as well.

This message is sent to the /Approval/Scenarios JMS message topic, which allows the scenario server to interact with the message using SQL JMS and obtain the profile outside the current thread.


ApprovalMessage :

JMS Type: atg.commerce.approval.ApprovalUpdate

This message includes the order requiring approval and the profile repository item for the customer associated with the order as order and profile message properties, respectively. It also includes an approvalStatus message property.If you are using multisite, the siteId property is populated as well.

A message with a JMSType of either ApprovalUpdate or ApprovalComplete is sent to the /Approval/Scenarios JMS message topic, which allows the scenario server to interact with the message using SQL JMS and obtain the profile outside the current thread.

A message with a JMSType of ApprovalUpdate is also sent to the /Approval/ApprovalUpdate JMS message queue. ApprovalCompleteService listens for messages on this queue




Popular Posts