atg.commerce.fulfillment
Class OrderChangeHandler

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.messaging.SourceSinkTemplate
              extended by atg.commerce.fulfillment.OrderChangeHandler
All Implemented Interfaces:
MessageSink, MessageSource, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class OrderChangeHandler
extends SourceSinkTemplate

This component will be one of the destination of the ModifyOrderNotification message. Upon receipt of this message, this component will assess if the modification is worthy of generating an event for data collection or scenarios.

See Also:
ModifyOrderNotification

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String DEFAULT_PAYMENT_GROUP_CREDIT_STATUS_PROPERTY
           
 
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
OrderChangeHandler()
           
 
Method Summary
protected  void checkForSplitShippingGroup(Order pOrder, GenericAdd pAddModification, Modification[] pModifications)
          Checks if the GenericAdd was the result of a split shipping group.
 ClientLockManager getClientLockManager()
          The ClientLockManager is used to obtain locks on orders being modified as a results of a message.
 CommerceItemStates getCommerceItemStates()
          The object containing all the states of an item
 java.lang.String getDefaultProfileType()
          The default profile repository view that is used in retrieving profiles.
 java.io.Serializable getKeyForMessage(javax.jms.ObjectMessage pMessage)
          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.
 OrderFulfillmentTools getOrderFulfillmentTools()
           
 OrderManager getOrderManager()
          The OrderManager used by this fulfillment class to access order information.
 OrderStates getOrderStates()
          The object containing all the states of an order
 java.lang.String getPaymentGroupCreditStatusPropertyName()
          The name of the property in PaymentGroups for CreditStatus
 PaymentGroupStates getPaymentGroupStates()
          The object containing all the states of an payment group
 Repository getProfileRepository()
          The profile repository used to retrieve profile information.
 java.lang.String getScenarioEventPort()
          The port to which all scenario events will be sent.
 ShipItemRelationshipStates getShipItemRelationshipStates()
          The object containing all the states of an shipping group
 ShippingGroupStates getShippingGroupStates()
          The object containing all the states of an shipping group
protected  void handleFulfillOrderFragment(java.lang.String pPortName, javax.jms.ObjectMessage pMessage)
           
protected  void handleItemModification(java.lang.String pOrderId, Modification pModification)
           
protected  void handleModifyOrder(java.lang.String pPortName, javax.jms.ObjectMessage pMessage)
           
protected  void handleModifyOrderNotification(java.lang.String pPortName, javax.jms.ObjectMessage pMessage)
           
protected  void handleNewMessageType(java.lang.String pPortName, javax.jms.ObjectMessage pMessage)
           
protected  void handleOrderModification(java.lang.String pOrderId, Modification pModification)
           
protected  void handlePaymentGroupModification(java.lang.String pOrderId, Modification pModification, java.util.List pCreditList, java.util.List pDebitList, java.util.List pDebitFailedList)
           
protected  void handleRelationshipModification(java.lang.String pOrderId, Modification pModification, java.util.Collection pUnavailable)
           
protected  void handleShipItemRelModification(java.lang.String pOrderId, Modification pModification, java.util.Collection pUnavailable)
           
protected  void handleShippingGroupModification(java.lang.String pOrderId, Modification pModification, Modification[] pModifications)
           
protected  void handleSubmitOrder(java.lang.String pPortName, javax.jms.ObjectMessage pMessage)
           
protected  void handleUpdateInventory(java.lang.String pPortName, javax.jms.ObjectMessage pMessage)
           
 boolean isSendEventsWithNoProfile()
          It is possible for some orders to have a null profile (if the user was anonymous).
 void receiveMessage(java.lang.String pPortName, javax.jms.Message pMessage)
           This is called to notify the component that a Message has arrived through the given input port.
 void sendScenarioEvent(ScenarioEvent pMessage)
          This method sets the id of the event and sends it to the scenario engine.
 void setClientLockManager(ClientLockManager pClientLockManager)
           
 void setCommerceItemStates(CommerceItemStates pCommerceItemStates)
           
 void setDefaultProfileType(java.lang.String pDefaultProfileType)
           
 void setOrderFulfillmentTools(OrderFulfillmentTools pOrderFulfillmentTools)
           
 void setOrderManager(OrderManager pOrderManager)
           
 void setOrderStates(OrderStates pOrderStates)
           
 void setPaymentGroupCreditStatusPropertyName(java.lang.String pPaymentGroupCreditStatusPropertyName)
           
 void setPaymentGroupStates(PaymentGroupStates pPaymentGroupStates)
           
 void setProfileRepository(Repository pProfileRepository)
           
 void setScenarioEventPort(java.lang.String pScenarioEventPort)
           
 void setSendEventsWithNoProfile(boolean pSendEventsWithNoProfile)
           
 void setShipItemRelationshipStates(ShipItemRelationshipStates pShipItemRelationshipStates)
           
 void setShippingGroupStates(ShippingGroupStates pShippingGroupStates)
           
 
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.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


DEFAULT_PAYMENT_GROUP_CREDIT_STATUS_PROPERTY

public static java.lang.String DEFAULT_PAYMENT_GROUP_CREDIT_STATUS_PROPERTY
Constructor Detail

OrderChangeHandler

public OrderChangeHandler()
Method Detail

setOrderManager

public void setOrderManager(OrderManager pOrderManager)

setOrderFulfillmentTools

public void setOrderFulfillmentTools(OrderFulfillmentTools pOrderFulfillmentTools)

getOrderFulfillmentTools

public OrderFulfillmentTools getOrderFulfillmentTools()

setScenarioEventPort

public void setScenarioEventPort(java.lang.String pScenarioEventPort)

getScenarioEventPort

public java.lang.String getScenarioEventPort()
The port to which all scenario events will be sent.


getOrderManager

public OrderManager getOrderManager()
The OrderManager used by this fulfillment class to access order information. The OrderManager is used to load and save orders.

See Also:
OrderManager

setClientLockManager

public void setClientLockManager(ClientLockManager pClientLockManager)

getClientLockManager

public ClientLockManager getClientLockManager()
The ClientLockManager is used to obtain locks on orders being modified as a results of a message. This prevents one order from being modified simultaneously as a result of two separate messages being received. This will ensure that changes as a result of one message do not begin until the changes performed as a result of a previous message are complete.


setProfileRepository

public void setProfileRepository(Repository pProfileRepository)

getProfileRepository

public Repository getProfileRepository()
The profile repository used to retrieve profile information.


setDefaultProfileType

public void setDefaultProfileType(java.lang.String pDefaultProfileType)

getDefaultProfileType

public java.lang.String getDefaultProfileType()
The default profile repository view that is used in retrieving profiles.


setOrderStates

public void setOrderStates(OrderStates pOrderStates)

getOrderStates

public OrderStates getOrderStates()
The object containing all the states of an order


setCommerceItemStates

public void setCommerceItemStates(CommerceItemStates pCommerceItemStates)

getCommerceItemStates

public CommerceItemStates getCommerceItemStates()
The object containing all the states of an item


setShippingGroupStates

public void setShippingGroupStates(ShippingGroupStates pShippingGroupStates)

getShippingGroupStates

public ShippingGroupStates getShippingGroupStates()
The object containing all the states of an shipping group


setPaymentGroupStates

public void setPaymentGroupStates(PaymentGroupStates pPaymentGroupStates)

getPaymentGroupStates

public PaymentGroupStates getPaymentGroupStates()
The object containing all the states of an payment group


setShipItemRelationshipStates

public void setShipItemRelationshipStates(ShipItemRelationshipStates pShipItemRelationshipStates)

getShipItemRelationshipStates

public ShipItemRelationshipStates getShipItemRelationshipStates()
The object containing all the states of an shipping group


setSendEventsWithNoProfile

public void setSendEventsWithNoProfile(boolean pSendEventsWithNoProfile)

isSendEventsWithNoProfile

public boolean isSendEventsWithNoProfile()
It is possible for some orders to have a null profile (if the user was anonymous). If this property is false, those event on those orders will not be sent. If true, all events are sent, regardless of the order's profile. The default value is false.


setPaymentGroupCreditStatusPropertyName

public void setPaymentGroupCreditStatusPropertyName(java.lang.String pPaymentGroupCreditStatusPropertyName)

getPaymentGroupCreditStatusPropertyName

public java.lang.String getPaymentGroupCreditStatusPropertyName()
The name of the property in PaymentGroups for CreditStatus


receiveMessage

public void receiveMessage(java.lang.String pPortName,
                           javax.jms.Message pMessage)
                    throws javax.jms.JMSException

This is called to notify the component that a Message has arrived through the given input port. The MessageSink should be prepared to handle concurrent calls of this method from multiple Threads.

receiveMessage can be extended to handle extra types of messages by overriding the handleNewMessageType method.

Specified by:
receiveMessage in interface MessageSink
Overrides:
receiveMessage in class SourceSinkTemplate
Throws:
javax.jms.JMSException

handleSubmitOrder

protected void handleSubmitOrder(java.lang.String pPortName,
                                 javax.jms.ObjectMessage pMessage)
Parameters:
pPortName - the port from which this message arrived
pMessage - the message that was just received

handleFulfillOrderFragment

protected void handleFulfillOrderFragment(java.lang.String pPortName,
                                          javax.jms.ObjectMessage pMessage)
Parameters:
pPortName - the port from which this message arrived
pMessage - the message that was just received

handleModifyOrder

protected void handleModifyOrder(java.lang.String pPortName,
                                 javax.jms.ObjectMessage pMessage)
Parameters:
pPortName - the port from which this message arrived
pMessage - the message that was just received

handleModifyOrderNotification

protected void handleModifyOrderNotification(java.lang.String pPortName,
                                             javax.jms.ObjectMessage pMessage)
                                      throws javax.jms.JMSException
Parameters:
pPortName - the port from which this message arrived
pMessage - the message that was just received
Throws:
javax.jms.JMSException

handleUpdateInventory

protected void handleUpdateInventory(java.lang.String pPortName,
                                     javax.jms.ObjectMessage pMessage)
Parameters:
pPortName - the port from which this message arrived
pMessage - the message that was just received

handleNewMessageType

protected void handleNewMessageType(java.lang.String pPortName,
                                    javax.jms.ObjectMessage pMessage)
Parameters:
pPortName - the port from which this message arrived
pMessage - the message that was just received

getKeyForMessage

public java.io.Serializable getKeyForMessage(javax.jms.ObjectMessage pMessage)
                                      throws javax.jms.JMSException
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.

Parameters:
pMessage - the ObjectMessage containing the CommerceMessage.
Returns:
an Object which serves as the key for the message
Throws:
javax.jms.JMSException

handleOrderModification

protected void handleOrderModification(java.lang.String pOrderId,
                                       Modification pModification)
Parameters:
pOrderId - the id of the order that this message refers to
pModification - the modification within the message we are handling

handleShippingGroupModification

protected void handleShippingGroupModification(java.lang.String pOrderId,
                                               Modification pModification,
                                               Modification[] pModifications)
Parameters:
pOrderId - the id of the order that this message refers to
pModification - the modification within the message we are handling
pModifications - the entire array of modifications. Necessary for checking for a split

handlePaymentGroupModification

protected void handlePaymentGroupModification(java.lang.String pOrderId,
                                              Modification pModification,
                                              java.util.List pCreditList,
                                              java.util.List pDebitList,
                                              java.util.List pDebitFailedList)
Parameters:
pOrderId - the id of the order that this message refers to
pModification - the modification within the message we are handling
pCreditList -
pDebitList -
pDebitFailedList -

handleItemModification

protected void handleItemModification(java.lang.String pOrderId,
                                      Modification pModification)
Parameters:
pOrderId - the id of the order that this message refers to
pModification - the modification within the message we are handling

handleRelationshipModification

protected void handleRelationshipModification(java.lang.String pOrderId,
                                              Modification pModification,
                                              java.util.Collection pUnavailable)
Parameters:
pOrderId - the id of the order that this message refers to
pModification - the modification within the message we are handling
pUnavailable - A place to store any unavailable (backordered, preordered, outofstock, discontinued) items

handleShipItemRelModification

protected void handleShipItemRelModification(java.lang.String pOrderId,
                                             Modification pModification,
                                             java.util.Collection pUnavailable)
Parameters:
pOrderId - the id of the order that this message refers to
pModification - the modification within the message we are handling
pUnavailable - A place to store any unavailable (backordered, preordered, outofstock, discontinued) items

sendScenarioEvent

public void sendScenarioEvent(ScenarioEvent pMessage)
                       throws CommerceException
This method sets the id of the event and sends it to the scenario engine. If sendEventsWithNoProfile is false and the profile of pMessage then the event will not be sent.

Parameters:
pMessage - The ScenarioEvent that just happened.
Throws:
CommerceException
See Also:
ScenarioEvent

checkForSplitShippingGroup

protected void checkForSplitShippingGroup(Order pOrder,
                                          GenericAdd pAddModification,
                                          Modification[] pModifications)
Checks if the GenericAdd was the result of a split shipping group. Assumes the the target type of the modification is SHIPPING_GROUP.

Parameters:
pOrder - The order containing the shipping group.
pAddModification - The GenericAdd of a shipping group to the order.
pModifications - The array of modifications to the order.