|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.messaging.SourceSinkTemplate atg.commerce.fulfillment.FulfillerSystem atg.commerce.fulfillment.OrderFulfiller
public class OrderFulfiller
This class handles the start of the fulfillment process and is responsible for the routing of various requests made to the fulfillment subsystem. In a sense, the OrderFulfiller is the hub of communication relating to fulfillment. The order to be fulfilled is received through a SubmitOrder message and is handled by the handleSubmitOrder method . The OrderFulfiller is responsible for farming out FulfillOrderFragment messages to the various fulfillers interested in pieces of the order.
Different fulfillers such as HardgoodFulfiller receive the FulfillOrderFragment message and begin processing of the shipping groups specified within.
Additionally the OrderFulfiller receives ModifyOrderNotification and ModifyOrder messages. These messages are handled by the OrderFulfillerModificationHandler which is then responsible for making the changes requested or forwarding them to the fulfillers who currently own the responsibility for the areas in which the modifications are to be made.
Once the FulfillOrderFragment messages are sent, the OrderFulfiller loses control of the shipping groups and of the ShippingGroupCommerceItemRelationships. Control of these objects is regained once the shipping group ships or an error occurs. (i.e. the state of the shipping group is set to NO_PENDING_ACTION or PENDING_MERHANT_ACTION)
The order is settled (paid for) according to the value of the settleOnFirstShipment property. If this property is true, the order is settled after the first shipping group in the order ships. If this property is false, the order is settled after the last shipping group in the order ships.
SubmitOrder
,
handleSubmitOrder(java.lang.String, javax.jms.ObjectMessage)
,
FulfillOrderFragment
,
HardgoodFulfiller
,
ModifyOrder
,
ModifyOrderNotification
,
OrderFulfillerModificationHandler
,
isSettleOnFirstShipment()
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
Fields inherited from class atg.commerce.fulfillment.FulfillerSystem |
---|
mModifyOrderNotificationPort, mModifyOrderPort, NUCLEUS_NAME |
Fields inherited from class atg.nucleus.GenericService |
---|
SERVICE_INFO_KEY |
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
---|
DEFAULT_LOG_TRACE_STATUS |
Fields inherited from interface atg.nucleus.logging.ApplicationLogging |
---|
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS |
Constructor Summary | |
---|---|
OrderFulfiller()
|
Method Summary | |
---|---|
protected void |
finishOrder(Order pOrder,
java.util.List pModificationList)
Deprecated. Replaced by the pipeline processor |
java.util.Properties |
getChainToRunMap()
|
java.io.Serializable |
getKeyForMessage(javax.jms.ObjectMessage oMessage)
This method will return the key to be used for locking out other messages with the same key while a thread is handling this message. |
ModificationHandler |
getModificationHandler()
The ModificationHandler that will be used to deal with all ModifyOrder and ModifyOrderNotification messages. |
protected java.io.Serializable |
getOrderIdFromMessage(SubmitOrder cMessage)
This is called only for the submitOrder messages |
protected boolean |
handleMessage(java.lang.String pPortName,
javax.jms.ObjectMessage pMessage)
This is called to handle a newly received message. |
void |
handleSubmitOrder(java.lang.String pPortName,
javax.jms.ObjectMessage pMessage)
This method is called to handle all messages of type SubmitOrder. |
boolean |
isAllowRemoveOrderWithPendingShipment()
A ModifyOrder request, requesting that an order be removed should be processed even if there exists a shipping group that is in a PENDING_SHIPMENT state. |
boolean |
isSettleOnFirstShipment()
This property determines whether the order should be settled on the first shipment of a shipping group in the order or after the last shipment of the shipping groups. |
protected Order |
loadOrder(java.lang.String pId)
Deprecated. Replaced by the pipeline processor |
protected java.util.List |
retrieveShippingGroupsToBeSplit(Order pOrder)
Deprecated. Replaced by the pipeline processor |
void |
sendOrderToFulfiller(Order pOrder,
java.lang.String pFulfiller,
java.util.List pShippingGroupIds,
SubmitOrder pSubmitOrder,
java.util.List pModificationList)
This method will set the states of the shipping groups to processing, send a ModifyOrderNotification using OrderFulfillmentTools.sendModifyOrderNotification and will send a FulfillOrderFragment for the port of the fulfiller name passed in. |
void |
setAllowRemoveOrderWithPendingShipment(boolean pAllowRemoveOrderWithPendingShipment)
|
void |
setChainToRunMap(java.util.Properties pChainToRunMap)
|
void |
setModificationHandler(ModificationHandler pModificationHandler)
|
void |
setSettleOnFirstShipment(boolean pSettleOnFirstShipment)
|
protected void |
setShippingGroupStateProcessing(Order pOrder,
java.util.List pListShipGroupIds,
java.util.List pModificationList)
Deprecated. Replaced by the pipeline processor |
protected void |
setShippingGroupSubmittedDate(ShippingGroup pShippingGroup,
java.util.List pModificationList)
Deprecated. Replaced by the pipeline processor |
protected void |
settleOrder(Order pOrder,
java.util.List pModificationList)
Deprecated. Replaced by the pipeline processor |
protected java.util.List |
splitShippingGroups(Order pOrder,
java.util.List pShippingGroupsToBeSplit,
java.util.List pModificationList)
Deprecated. Replaced by the pipeline processor |
protected void |
updateOrder(Order pOrder)
Deprecated. Replaced by the pipeline processor |
void |
verifyOrderFulfillment(Order pOrder)
This method verifies that the order to be fulfilled is in a state which allows it to be fulfilled. |
Methods inherited from class atg.commerce.messaging.SourceSinkTemplate |
---|
getDelayOnSendRetry, getMessageSourceContext, getMessageSourceName, getTransactionManager, isAllowMessageSending, sendCommerceMessage, sendObjectMessage, setAllowMessageSending, setDelayOnSendRetry, setMessageSourceContext, setMessageSourceName, setTransactionManager, startMessageSource, stopMessageSource |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String CLASS_VERSION
Constructor Detail |
---|
public OrderFulfiller()
Method Detail |
---|
public void setSettleOnFirstShipment(boolean pSettleOnFirstShipment)
public boolean isSettleOnFirstShipment()
OrderFulfillmentTools.isOrderSettleable(atg.commerce.order.Order, boolean)
public void setAllowRemoveOrderWithPendingShipment(boolean pAllowRemoveOrderWithPendingShipment)
public boolean isAllowRemoveOrderWithPendingShipment()
public void setModificationHandler(ModificationHandler pModificationHandler)
public ModificationHandler getModificationHandler()
ModifyOrder
,
ModifyOrderNotification
,
OrderFulfillerModificationHandler
public java.util.Properties getChainToRunMap()
public void setChainToRunMap(java.util.Properties pChainToRunMap)
protected boolean handleMessage(java.lang.String pPortName, javax.jms.ObjectMessage pMessage) throws javax.jms.JMSException
This is called to handle a newly received message. Before this method is called, the message is subjected to basic validity checks, a transaction is established, and an exclusive lock is acquired for the message's key.
The OrderFulfiller handles the following types of messages: SubmitOrder, ModifyOrder and ModifyOrderNotification. Handling messages of different types can be done by extending the handleNewMessageType method and adding whatever logic is required in there.
handleMessage
in class FulfillerSystem
pPortName
- - the port on which this message was receivedpMessage
- - the message that was sent on the port
javax.jms.JMSException
SubmitOrder
,
ModifyOrder
,
ModifyOrderNotification
,
FulfillerSystem#receive
,
FulfillerSystem.handleNewMessageType(java.lang.String, javax.jms.ObjectMessage)
public java.io.Serializable getKeyForMessage(javax.jms.ObjectMessage oMessage) throws javax.jms.JMSException
getKeyForMessage
in class FulfillerSystem
pMessage
- the ObjectMessage containing the CommerceMessage.
javax.jms.JMSException
protected java.io.Serializable getOrderIdFromMessage(SubmitOrder cMessage)
public void handleSubmitOrder(java.lang.String pPortName, javax.jms.ObjectMessage pMessage) throws javax.jms.JMSException
This method is called to handle all messages of type SubmitOrder. It will call the pipeline chain to process the message. Should developers wish to change the behavior of the OrderFulfiller class in handling a SubmitOrder message this method should be overridden
The order is verified using verifyOrderFulfillment to make sure it is in a state where fulfillment is possble. If it isn't an error is logged and no processing is done to that order. Next a list of shipping groups that need to be split are determined using the retrieveShippingGroupsToBeSplit method. If the method returns any shipping groups that need to be split, the splitShippingGroups method is called with the order and the returned shipping groups, followed by a repricing of the order.
The chain then determines which fulfillers need to get which shipping groups and uses the OrderFulfillmentTools.getFulfillersForShippingGroups to return the HashMap which contains this information about the various fulfillers and the shipping groups that those fulfillers should be receiving. The OrderFulfillmentTools.getFulfillerPort will return the port on which the message is sent for each fulfiller, and sendOrderToFulfiller.
The order is written back to the repository using updateOrder
pPortName
- - the port on which this message is receivedpMessage
- - the object message which should contain a SubmitOrder message
javax.jms.JMSException
- is thrown on a failure to send a messageSubmitOrder
,
verifyOrderFulfillment(atg.commerce.order.Order)
,
retrieveShippingGroupsToBeSplit(atg.commerce.order.Order)
,
OrderFulfillmentTools.getFulfillersForShippingGroups(java.util.List)
,
OrderFulfillmentTools.getFulfillerPort(java.lang.String)
,
sendOrderToFulfiller(atg.commerce.order.Order, java.lang.String, java.util.List, atg.commerce.fulfillment.SubmitOrder, java.util.List)
,
updateOrder(atg.commerce.order.Order)
public void verifyOrderFulfillment(Order pOrder) throws IllegalOrderStateException
This method verifies that the order to be fulfilled is in a state which allows it to be fulfilled. If the order is in an incomplete state or a no pending action state then an exception is thrown.
pOrder
- - the order to be verified.
atg.commerce.IllegalOrderStateException
- if the order is in an illegal state
IllegalOrderStateException
public void sendOrderToFulfiller(Order pOrder, java.lang.String pFulfiller, java.util.List pShippingGroupIds, SubmitOrder pSubmitOrder, java.util.List pModificationList) throws CommerceException, javax.jms.JMSException
This method will set the states of the shipping groups to processing, send a ModifyOrderNotification using OrderFulfillmentTools.sendModifyOrderNotification and will send a FulfillOrderFragment for the port of the fulfiller name passed in. This method uses the OrderFulfillmentTools.getFulfillerPort to determine which port to send the message out on.
pOrder
- - the order to be fulfilledpFulfiller
- - the fulfiller namepShippingGroupIds
- - the ids of the shipping groups to be serviced by the fulfillerpSubmitOrder
- - the original message that this is a fragment of
javax.jms.JMSException
- is thrown on failure to send the message to the fulfiller.
CommerceException
ModifyOrderNotification
,
OrderFulfillmentTools.sendModifyOrderNotification(java.lang.String, java.util.List, atg.commerce.fulfillment.ModifyOrder, atg.commerce.messaging.SourceSinkTemplate, java.lang.String, atg.commerce.fulfillment.ModifyOrderNotification)
,
FulfillOrderFragment
,
OrderFulfillmentTools.getFulfillerPort(java.lang.String)
protected void setShippingGroupStateProcessing(Order pOrder, java.util.List pListShipGroupIds, java.util.List pModificationList)
pOrder
- the order to be operated on.pShipGroupIds
- the ids of the shipping groups whose state will changepModificationList
- the list to which the modification objects created will be added.protected void setShippingGroupSubmittedDate(ShippingGroup pShippingGroup, java.util.List pModificationList)
pShippingGroup
- The shipping group to set.pModificationList
- Place to store new modifications.protected java.util.List retrieveShippingGroupsToBeSplit(Order pOrder)
pOrder
- the order that contains the shipping groups
OrderFulfillmentTools.isShippingGroupSingleFulfiller(atg.commerce.order.ShippingGroup)
protected java.util.List splitShippingGroups(Order pOrder, java.util.List pShippingGroupsToBeSplit, java.util.List pModificationList) throws CommerceException
pOrder
- the order which contains the shipping groups to be splitpShippingGroupsToBeSplit
- the List of @see ShippingGroup objects that need to be split
CommerceException
OrderFulfillmentTools.splitShippingGroupsByFulfiller(atg.commerce.order.Order, java.util.List, java.util.List)
protected void settleOrder(Order pOrder, java.util.List pModificationList) throws PaymentException
pOrder
- The order to settlepModificationList
- place to store all new modifications
PaymentException
OrderFulfillmentTools.isOrderSettleable(atg.commerce.order.Order, boolean)
,
atg.payment.PaymentManager
protected void finishOrder(Order pOrder, java.util.List pModificationList)
pOrder
- The order to finish.pModificationList
- A place to store all modifications madeOrderStates.NO_PENDING_ACTION
,
OrderFulfillmentTools.isOrderFinished(atg.commerce.order.Order)
protected Order loadOrder(java.lang.String pId) throws CommerceException
pId
- the id of the order to be retrieved
CommerceException
protected void updateOrder(Order pOrder) throws CommerceException
pOrder
- - the order to be saved
CommerceException
- is thrown if the order fails to save for any reason.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |