atg.b2bcommerce.order.scheduled
Class ScheduledOrderTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.messaging.SourceSinkTemplate
              extended by atg.commerce.messaging.MessageSender
                  extended by atg.b2bcommerce.order.scheduled.ScheduledOrderTools
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 ScheduledOrderTools
extends MessageSender

This class is a low level business layer class. It provides the raw functionality for manipulating a Scheduled Order. The methods in this class are not meant for direct use, but rather are used primarily by the ScheduledOrderService. This class does all the work like creating, updating and deleting the Scheduled Order in the ScheduledOrder repository. In addition to the raw functionality, it also implements the MessageSender interface. That means that it can be used to send the ScheduledOrder message to a destination. For example, it is used to send Order added, updated, deleted and processed messages. It also provides the functionality to reprice the Scheduled Order and place the Schedule Order via going through the corresponding chain in the PipelineManager.

See Also:
MessageSender

Field Summary
static java.lang.String CLASS_VERSION
           
 
Fields inherited from class atg.commerce.messaging.MessageSender
DEFAULT_MESSAGE_SOURCE_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
ScheduledOrderTools()
          Constructs an empty ScheduleOrderTools
 
Method Summary
 void changeOriginToScheduledOrder(Order pOrder)
          This method changes the originOfOrder property of an order to scheduledOrder.
 Order cloneOrder(Order pOrder, RepositoryItem pProfile, DynamoHttpServletRequest pRequest)
          This method actually makes the current order as the cloned order and create an empty order as the current order.
 Order cloneOrder(java.lang.String pOrderId)
          This method clones an existing order.
protected  java.util.Map createMap()
          This method is a helper method which is used by the cloneOrder method.
 RepositoryItem createScheduledOrder()
          Create a Scheduled Order in the ScheduledOrder Repository
 void deleteScheduledOrder(RepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Delete the Scheduled Order from the scheduled order Repository
 CommerceProfileTools getCommerceProfileTools()
          returns the property CommerceProfileTools
 java.util.Locale getDefaultLocale()
          Retrieve the default Locale
 java.util.Properties getExcludedOrderProperties()
          returns the property ExcludedOrderProperties
 java.util.Map getExcludedOrderPropertiesMap()
          returns the property ExcludedOrderPropertiesMap
 PricingEngineService getItemPricingEngineService()
          returns the property ItemPricingEngineService
 java.lang.String getOrderItemDescriptor()
          Returns property OrderItemDescriptor
 B2BOrderManager getOrderManager()
          Returns property OrderManager
 PricingEngineService getOrderPricingEngineService()
          returns the property OrderPricingEngineService
 PaymentGroupManager getPaymentGroupManager()
          Returns property PaymentGroupManager
 PipelineManager getPipelineManager()
          Retrieve the PipelineManager
 PricingTools getPricingTools()
          returns the property PricingTools
 java.lang.String getProcessOrderChainId()
          returns the property ProcessOrderChainId
 RepositoryItem getProfile(RepositoryItem pScheduledOrder)
          Get the Profile information from the Scheduled Order
 java.lang.String getProfileType()
          Retrieve the Profile Type
 java.lang.String getRepriceOrderChainId()
          returns the property RepriceOrderChainId
 java.lang.String getScheduledOrderItemDescriptor()
          Returns property ScheduledOrderItemDescriptor
 MutableRepository getScheduledOrderRepository()
          Returns property ScheduledOrderRepository
 java.lang.String getScheduleOrderPort()
          returns the property ScheduleOrderPort
 PricingEngineService getShippingPricingEngineService()
          returns the property ShippingPricingEngineService
 PricingEngineService getTaxPricingEngineService()
          returns the property TaxPricingEngineService
 java.lang.String getTemplateOrder(RepositoryItem pScheduledOrder)
          Get the template order from the Scheduled Order
 javax.transaction.TransactionManager getTransactionManager()
          Returns property TransactionManager
 boolean isApplyGlobalPricingModels()
          returns the property ApplyGlobalPricingModels
 boolean isApplyUserPricingModels()
          returns the property ApplyUserPricingModels
 boolean isRepriceOnClone()
          returns the property RepriceOnClone
 java.util.Collection parseString(java.lang.String pString)
          Parse a String which is delimited by "|" into a collection of strings.
 PipelineResult processScheduledOrder(RepositoryItem pScheduledOrder, Order pClonedOrder, java.util.Locale pLocale)
          This method processes the Scheduled Order via executing the processOrder pipeline chain.
 void repriceScheduledOrder(Order pScheduledOrder, RepositoryItem pProfile, java.util.Locale pLocale)
          Reprice the scheduled order
protected  void scheduledOrderAdded(RepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Send the messahe that the Scheduled Order is Added
 void scheduledOrderDeleted(RepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Send the message that the Scheduled Order is Deleted
 void scheduledOrderProcessed(RepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Send the message that the Scheduled Order is Processed
protected  void scheduledOrderUpdated(RepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Send the message that the Scheduled Order is Updateded
 void sendScheduledOrderMessage(CommerceMessage pMessage)
          Send the Scheduled Order Message
 void setApplyGlobalPricingModels(boolean pApplyGlobalPricingModels)
          set the property ApplyGlobalPricingModels
 void setApplyUserPricingModels(boolean pApplyUserPricingModels)
          set the property ApplyUserPricingModels
 void setCommerceProfileTools(CommerceProfileTools pCommerceProfileTools)
          Set property CommerceProfileTools
 void setExcludedOrderProperties(java.util.Properties pExcludedOrderProperties)
          set the property ExcludedOrderProperties
 void setItemPricingEngineService(PricingEngineService pItemPricingEngineService)
          set the property ItemPricingEngineService
 void setOrderItemDescriptor(java.lang.String pOrderItemDescriptor)
          Sets property OrderItemDescriptor
 void setOrderManager(B2BOrderManager pOrderManager)
          Sets property OrderManager
 void setOrderPricingEngineService(PricingEngineService pOrderPricingEngineService)
          set the property OrderPricingEngineService
 void setPaymentGroupManager(PaymentGroupManager pPaymentGroupManager)
          Sets property PaymentGroupManager
 void setPricingTools(PricingTools pPricingTools)
          set the property PricingTools
 void setProcessOrderChainId(java.lang.String pProcessOrderChainId)
          set the property ProcessOrderChainId
 void setRepriceOnClone(boolean pRepriceOnClone)
          set the property RepriceOnClone
 void setRepriceOrderChainId(java.lang.String pRepriceOrderChainId)
          set the property RepriceOrderChainId
 void setScheduledOrderItemDescriptor(java.lang.String pScheduledOrderItemDescriptor)
          Sets property ScheduledOrderItemDescriptor
 void setScheduledOrderRepository(MutableRepository pScheduledOrderRepository)
          Sets property ScheduledOrderRepository
 void setScheduleOrderPort(java.lang.String pScheduleOrderPort)
          set the property ScheduleOrderPort
 void setShippingPricingEngineService(PricingEngineService pShippingPricingEngineService)
          set the property ShippingPricingEngineService
 void setTaxPricingEngineService(PricingEngineService pTaxPricingEngineService)
          set the property TaxPricingEngineService
 void updateScheduledOrder(MutableRepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Update the Scheduled Order in the schedule order Repository
 
Methods inherited from class atg.commerce.messaging.MessageSender
getMessageIdGenerator, getMessageIdSpaceName, getMessageSourceContext, getMessageSourceName, getNextMessageId, getPortName, isAllowMessageSending, sendCommerceMessage, setAllowMessageSending, setMessageIdGenerator, setMessageIdSpaceName, setMessageSourceContext, setMessageSourceName, setPortName, startMessageSource, stopMessageSource
 
Methods inherited from class atg.commerce.messaging.SourceSinkTemplate
getDelayOnSendRetry, receiveMessage, sendCommerceMessage, sendObjectMessage, setDelayOnSendRetry, setTransactionManager
 
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
Constructor Detail

ScheduledOrderTools

public ScheduledOrderTools()
Constructs an empty ScheduleOrderTools

Method Detail

setPaymentGroupManager

public void setPaymentGroupManager(PaymentGroupManager pPaymentGroupManager)
Sets property PaymentGroupManager

Parameters:
pPaymentGroupManager - the value to set for property PaymentGroupManager

getPaymentGroupManager

public PaymentGroupManager getPaymentGroupManager()
Returns property PaymentGroupManager

Returns:
returns property PaymentGroupManager

setOrderManager

public void setOrderManager(B2BOrderManager pOrderManager)
Sets property OrderManager

Parameters:
pOrderManager - the value to set for property OrderManager

getOrderManager

public B2BOrderManager getOrderManager()
Returns property OrderManager

Returns:
returns property OrderManager

getScheduledOrderRepository

public MutableRepository getScheduledOrderRepository()
Returns property ScheduledOrderRepository

Returns:
returns property ScheduledOrderRepository

setScheduledOrderRepository

public void setScheduledOrderRepository(MutableRepository pScheduledOrderRepository)
Sets property ScheduledOrderRepository

Parameters:
pScheduledOrderRepository - the value to set for property ScheduledOrderRepository

getScheduledOrderItemDescriptor

public java.lang.String getScheduledOrderItemDescriptor()
Returns property ScheduledOrderItemDescriptor

Returns:
returns property ScheduledOrderItemDescriptor

setScheduledOrderItemDescriptor

public void setScheduledOrderItemDescriptor(java.lang.String pScheduledOrderItemDescriptor)
Sets property ScheduledOrderItemDescriptor

Parameters:
pScheduledOrderItemDescriptor - the value to set for property ScheduledOrderItemDescriptor

getOrderItemDescriptor

public java.lang.String getOrderItemDescriptor()
Returns property OrderItemDescriptor

Returns:
returns property OrderItemDescriptor

setOrderItemDescriptor

public void setOrderItemDescriptor(java.lang.String pOrderItemDescriptor)
Sets property OrderItemDescriptor

Parameters:
pOrderItemDescriptor - the value to set for property OrderItemDescriptor

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns property TransactionManager

Overrides:
getTransactionManager in class SourceSinkTemplate
Returns:
returns property TransactionManager

setCommerceProfileTools

public void setCommerceProfileTools(CommerceProfileTools pCommerceProfileTools)
Set property CommerceProfileTools

Parameters:
pCommerceProfileTools - the value to set for property CommerceProfileTools

getCommerceProfileTools

public CommerceProfileTools getCommerceProfileTools()
returns the property CommerceProfileTools

Returns:
returns property CommerceProfileTools

setApplyUserPricingModels

public void setApplyUserPricingModels(boolean pApplyUserPricingModels)
set the property ApplyUserPricingModels

Parameters:
pApplyUserPricingModels - the value to set for property ApplyUserPricingModels

isApplyUserPricingModels

public boolean isApplyUserPricingModels()
returns the property ApplyUserPricingModels

Returns:
returns property ApplyUserPricingModels

setApplyGlobalPricingModels

public void setApplyGlobalPricingModels(boolean pApplyGlobalPricingModels)
set the property ApplyGlobalPricingModels

Parameters:
pApplyGlobalPricingModels - the value to set for property ApplyGlobalPricingModels

isApplyGlobalPricingModels

public boolean isApplyGlobalPricingModels()
returns the property ApplyGlobalPricingModels

Returns:
returns property ApplyGlobalPricingModels

setRepriceOnClone

public void setRepriceOnClone(boolean pRepriceOnClone)
set the property RepriceOnClone

Parameters:
pRepriceOnClone - the value to set for property RepriceOnClone

isRepriceOnClone

public boolean isRepriceOnClone()
returns the property RepriceOnClone

Returns:
returns property RepriceOnClone

setRepriceOrderChainId

public void setRepriceOrderChainId(java.lang.String pRepriceOrderChainId)
set the property RepriceOrderChainId

Parameters:
pRepriceOrderChainId - the value to set for proeprty RepriceOrderChainId

getRepriceOrderChainId

public java.lang.String getRepriceOrderChainId()
returns the property RepriceOrderChainId

Returns:
returns property RepriceOrderChainId

setProcessOrderChainId

public void setProcessOrderChainId(java.lang.String pProcessOrderChainId)
set the property ProcessOrderChainId

Parameters:
pProcessOrderChainId - the value to set for property ProcessOrderChainId

getProcessOrderChainId

public java.lang.String getProcessOrderChainId()
returns the property ProcessOrderChainId

Returns:
returns property ProcessOrderChainId

setScheduleOrderPort

public void setScheduleOrderPort(java.lang.String pScheduleOrderPort)
set the property ScheduleOrderPort

Parameters:
pScheduleOrderPort - the value to set for property ScheduleOrderPort

getScheduleOrderPort

public java.lang.String getScheduleOrderPort()
returns the property ScheduleOrderPort

Returns:
returns property ScheduleOrderPort

setExcludedOrderProperties

public void setExcludedOrderProperties(java.util.Properties pExcludedOrderProperties)
set the property ExcludedOrderProperties

Parameters:
pExcludedOrderProperties - the value to set for property ExcludedOrderProperties

getExcludedOrderProperties

public java.util.Properties getExcludedOrderProperties()
returns the property ExcludedOrderProperties

Returns:
returns property ExcludedOrderProperties

getExcludedOrderPropertiesMap

public java.util.Map getExcludedOrderPropertiesMap()
returns the property ExcludedOrderPropertiesMap

Returns:
returns property ExcludedOrderProperties

setItemPricingEngineService

public void setItemPricingEngineService(PricingEngineService pItemPricingEngineService)
set the property ItemPricingEngineService

Parameters:
pItemPricingEngineService - the value to set for property ItemPricingEngineService

getItemPricingEngineService

public PricingEngineService getItemPricingEngineService()
returns the property ItemPricingEngineService

Returns:
returns property ItemPricingEngineService

setShippingPricingEngineService

public void setShippingPricingEngineService(PricingEngineService pShippingPricingEngineService)
set the property ShippingPricingEngineService

Parameters:
pShippingPricingEngineService - the value to set for property ShippingPricingEngineService

getShippingPricingEngineService

public PricingEngineService getShippingPricingEngineService()
returns the property ShippingPricingEngineService

Returns:
returns property ShippingPricingEngineService

setOrderPricingEngineService

public void setOrderPricingEngineService(PricingEngineService pOrderPricingEngineService)
set the property OrderPricingEngineService

Parameters:
pOrderPricingEngineService - the value to set for property OrderPricingEngineService

getOrderPricingEngineService

public PricingEngineService getOrderPricingEngineService()
returns the property OrderPricingEngineService

Returns:
returns property OrderPricingEngineService

setTaxPricingEngineService

public void setTaxPricingEngineService(PricingEngineService pTaxPricingEngineService)
set the property TaxPricingEngineService

Parameters:
pTaxPricingEngineService - the value to set for property TaxPricingEngineService

getTaxPricingEngineService

public PricingEngineService getTaxPricingEngineService()
returns the property TaxPricingEngineService

Returns:
returns property TaxPricingEngineService

setPricingTools

public void setPricingTools(PricingTools pPricingTools)
set the property PricingTools

Parameters:
pPricingTools - the value to set for property PricingTools

getPricingTools

public PricingTools getPricingTools()
returns the property PricingTools

Returns:
returns property PricingTools

parseString

public java.util.Collection parseString(java.lang.String pString)
Parse a String which is delimited by "|" into a collection of strings.


getProfileType

public java.lang.String getProfileType()
Retrieve the Profile Type


getDefaultLocale

public java.util.Locale getDefaultLocale()
Retrieve the default Locale


getPipelineManager

public PipelineManager getPipelineManager()
Retrieve the PipelineManager


createScheduledOrder

public RepositoryItem createScheduledOrder()
                                    throws RepositoryException
Create a Scheduled Order in the ScheduledOrder Repository

Returns:
the repositoryItem of the Scheduled Order
Throws:
RepositoryException - if there was an error while dealing with the Repository

getProfile

public RepositoryItem getProfile(RepositoryItem pScheduledOrder)
                          throws RepositoryException,
                                 CommerceException
Get the Profile information from the Scheduled Order

Parameters:
pScheduledOrder - The Scheduled Order
Returns:
the repositoryItem of the Profile
Throws:
RepositoryException - if there was an error while dealing with the Repository
CommerceException - if there was a general error

getTemplateOrder

public java.lang.String getTemplateOrder(RepositoryItem pScheduledOrder)
                                  throws RepositoryException,
                                         CommerceException
Get the template order from the Scheduled Order

Parameters:
pScheduledOrder - The Scheduled Order
Returns:
the template Order
Throws:
RepositoryException - if there was an error while dealing with the Repository
CommerceException - if there was a general error

updateScheduledOrder

public void updateScheduledOrder(MutableRepositoryItem pScheduledOrder,
                                 RepositoryItem pProfile)
                          throws CommerceException
Update the Scheduled Order in the schedule order Repository

Parameters:
pScheduledOrder - The Schedule Order
pProfile - The Profile
Throws:
CommerceException - if there was a general error

deleteScheduledOrder

public void deleteScheduledOrder(RepositoryItem pScheduledOrder,
                                 RepositoryItem pProfile)
                          throws CommerceException
Delete the Scheduled Order from the scheduled order Repository

Parameters:
pScheduledOrder - The Scheduled Order
pProfile - The Profile
Throws:
CommerceException - if there was a general error

sendScheduledOrderMessage

public void sendScheduledOrderMessage(CommerceMessage pMessage)
                               throws CommerceException
Send the Scheduled Order Message

Parameters:
pMessage - Message related to the action about the scheduled order
Throws:
CommerceException - if there was a general error

scheduledOrderAdded

protected void scheduledOrderAdded(RepositoryItem pScheduledOrder,
                                   RepositoryItem pProfile)
                            throws CommerceException
Send the messahe that the Scheduled Order is Added

Parameters:
pScheduledOrder - The Scheduled Order
pProfile - The Profile
Throws:
CommerceException - if there was a general error

scheduledOrderUpdated

protected void scheduledOrderUpdated(RepositoryItem pScheduledOrder,
                                     RepositoryItem pProfile)
                              throws CommerceException
Send the message that the Scheduled Order is Updateded

Parameters:
pScheduledOrder - The Scheduled Order
pProfile - The Profile
Throws:
CommerceException - if there was a general error

scheduledOrderProcessed

public void scheduledOrderProcessed(RepositoryItem pScheduledOrder,
                                    RepositoryItem pProfile)
                             throws CommerceException
Send the message that the Scheduled Order is Processed

Parameters:
pScheduledOrder - The Scheduled Order
pProfile - The Profile
Throws:
CommerceException - if there was a general error

scheduledOrderDeleted

public void scheduledOrderDeleted(RepositoryItem pScheduledOrder,
                                  RepositoryItem pProfile)
                           throws CommerceException
Send the message that the Scheduled Order is Deleted

Parameters:
pScheduledOrder - The Scheduled Order
pProfile - The Profile
Throws:
CommerceException - if there was a general error

processScheduledOrder

public PipelineResult processScheduledOrder(RepositoryItem pScheduledOrder,
                                            Order pClonedOrder,
                                            java.util.Locale pLocale)
                                     throws CommerceException
This method processes the Scheduled Order via executing the processOrder pipeline chain.

Parameters:
pScheudledOrder - the scheduled order
pLocale - the locale of the user
pClonedOrder - the cloned order
Returns:
the PipelineResult object from the execution of the pipeline
Throws:
CommerceException - thrown if an error occurs while checking out the Order

repriceScheduledOrder

public void repriceScheduledOrder(Order pScheduledOrder,
                                  RepositoryItem pProfile,
                                  java.util.Locale pLocale)
                           throws CommerceException
Reprice the scheduled order

Parameters:
pScheduledOrder - The Schedule Order
pProfile - the user's profile
pLocale - the user's locale
Throws:
CommerceException - if an error occurs

cloneOrder

public Order cloneOrder(java.lang.String pOrderId)
                 throws CommerceException
This method clones an existing order. It invokes the cloneItem method in RepositoryUtils class. It also reprice the cloned order if the flag repriceOnClone is set to be true

Parameters:
pOrderId - the id of the order whom will be cloned
Returns:
the cloned order
Throws:
CommerceException - if an error occurs
See Also:
RepositoryUtils

cloneOrder

public Order cloneOrder(Order pOrder,
                        RepositoryItem pProfile,
                        DynamoHttpServletRequest pRequest)
                 throws CommerceException
This method actually makes the current order as the cloned order and create an empty order as the current order. It is only used when the user wants to create a scheduled order via the current order.

Parameters:
pOrder - the current order
pProfile - the user's profile
pRequest - the HttpDynamoRequest
Returns:
the cloned order
Throws:
CommerceException - if an error occurs

createMap

protected java.util.Map createMap()
This method is a helper method which is used by the cloneOrder method. It creates a Map that will be used by the cloneItem method in RepositoryUtils class as a PropExceptions parameter. The user should override this method if the order item descriptor has changed or some properties which previously requires deep copy now requires shallow copy or vice versa.

Returns:
the Map
See Also:
RepositoryUtils

changeOriginToScheduledOrder

public void changeOriginToScheduledOrder(Order pOrder)
                                  throws RepositoryException
This method changes the originOfOrder property of an order to scheduledOrder. It will be used to differentiate between the order that has been placed through the normal checkout process and the order that has been placed within a scheduledOrder.

Parameters:
pOrder - the order that will be changed for its originOfOrder property to scheduledOrder
Throws:
RepositoryException
See Also:
RepositoryUtils