atg.commerce.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.commerce.order.scheduled.ScheduledOrderTools
All Implemented Interfaces:
MessageSink, MessageSource, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, 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 Scheduled Order via going through the corresponding chain in the PipelineManager.

See Also:
MessageSender

Field Summary
static java.lang.String CLASS_VERSION
           
static int ERROR_MAX_LENGTH
           
protected  RqlStatement mSchedulesByProfileQuery
           
protected  RqlStatement mSchedulesByTemplateQuery
           
protected  boolean mSendMessages
          Determines whether to send ScneduledOrder JMS messages
protected  SiteContextManager mSiteContextManager
           
protected  SiteManager mSiteManager
           
protected  boolean mUseOrderPriceListsFirst
           
 
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 activateSchedule(java.lang.String pScheduledOrderItemId)
          Activates the given scheduled order item.
protected  void addErrorToScheduledOrderErrorItem(RepositoryItem pScheduledOrderItem, MutableRepositoryItem pScheduledOrderErrorItem, java.lang.Object pError)
          Creates a new error string from the given error object and adds to the list of errors contained in the given scheduled order error item.
 boolean areAllDatesSelected(CalendarSchedule pCalendarSchedule)
          Returns true if all dates are selected in the schedule
 boolean areAllDaysSelected(CalendarSchedule pCalendarSchedule)
          Returns true if all of the days of the week are selected.
 boolean areAllMonthsSelected(CalendarSchedule pCalendarSchedule)
          Returns true if all months are selected in the calendar
 boolean areAllOccurrencesSelected(CalendarSchedule pCalendarSchedule)
          Returns true if all occurrences are currently selected in the schedule
 boolean areAnyDatesSelected(CalendarSchedule pCalendarSchedule)
          Returns true if some dates, but not all are selected in the schedule
 boolean areAnyDaysSelected(CalendarSchedule pCalendarSchedule)
          Returns true if some of the days of the week are selected.
 boolean areAnyOccurrencesSelected(CalendarSchedule pCalendarSchedule)
          Returns true if only some, but not all occurrences are currently selected in the schedule
 long calculateEndTimeForOccurrences(Schedule pSchedule, long pNumberOfOccurrences, long pStartingFrom)
          Calculates the time that would result from executing the given schedule for the given number of occurrences.
 void changeOriginToScheduledOrder(Order pOrder)
          This method changes the originOfOrder property of an order to scheduledOrder.
protected  void clearLastError(MutableRepositoryItem pScheduledOrderItem)
          Sets the error item property on the scheduled order item to null.
 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.
 Order cloneOrderObject(java.lang.String pOrderId)
          This method prepares the clone order from the given order id.
protected  java.util.Map createMap()
          This method is a helper method which is used by the cloneOrder method.
 java.util.Map createParameterMapForCloneOrderPricing(Order pCloneOrder, Order pParentOrder, RepositoryItem pProfile)
          Creates the extra parameter map that is used to an order created by the cloneOrder API.
protected  java.util.HashMap createParameterMapForProcessingScheduledOrder(RepositoryItem pScheduledOrder, Order pClonedOrder, java.util.Locale pLocale)
          Creates the extra parameter map that is passed to processOrder in processScheduledOrder
 java.util.Map createParameterMapForTemplateOrderPricing(Order pTemplateOrder, RepositoryItem pProfile)
          Creates a parameter map for pricing a template order.
 RepositoryItem createScheduledOrder()
          Create a Scheduled Order in the ScheduledOrder Repository
 void deactivateSchedule(java.lang.String pScheduledOrderItemId)
          Deactivates the given scheduled order item.
 void deleteScheduledOrder(RepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Delete the Scheduled Order from the scheduled order Repository
 RepositoryItem determineListPriceListForOrderPricing(Order pOrder, RepositoryItem pProfile)
          Determines the list price list to use for pricing the order.
protected  RepositoryItem determinePriceListForOrderPricing(Order pOrder, RepositoryItem pProfile, java.lang.String pPriceListPropertyName)
          Determines the price list that should be used to pricing the given order.
 RepositoryItem determineSalePriceListForOrderPricing(Order pOrder, RepositoryItem pProfile)
          Determines the sale price list to use for pricing the order.
 Query generateQueryForOrdersCreatedByTemplate(java.lang.String pTemplateOrderId, QueryBuilder pQueryBuilder)
          Generates a Query for all orders created by the template.
 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
 Order getLastOrderSubmittedFromTemplate(java.lang.String pTemplateOrderId)
          Finds the latest order that was submitted from the given template.
 java.lang.String getOrderItemDescriptor()
          Returns property OrderItemDescriptor
 OrderManager getOrderManager()
          Returns property OrderManager
 PricingEngineService getOrderPricingEngineService()
          returns the property OrderPricingEngineService
 PaymentGroupManager getPaymentGroupManager()
          Returns property PaymentGroupManager
 PipelineManager getPipelineManager()
          Retrieve the PipelineManager
protected  RepositoryItem getPriceListFromOrder(Order pOrder, java.lang.String pPriceListPropertyName)
          Returns a price list from the order
protected  RepositoryItem getPriceListFromSite(Order pOrder, RepositoryItem pProfile, java.lang.String pPricelistPropertyName)
          Returns a price list that is appropriate for a profile and order's site.
 PriceListManager getPriceListManager()
          returns the property PriceListManager
 java.util.Locale getPricingLocale(RepositoryItem pProfile)
          Returns the locale that should be used to price the given order.
 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
 RepositoryItem getProfileFromOrder(Order pOrder)
          Extracts the profile from the given order.
 java.lang.String getProfileType()
          Retrieve the Profile Type
 java.lang.String getRepriceOrderChainId()
          returns the property RepriceOrderChainId
 java.lang.String getScheduleClassType(RepositoryItem pScheduledOrderItem, java.util.Locale pLocale)
          Returns the schedule class type for the given scheduled order item
 java.lang.String getScheduledOrderErrorItemDescriptor()
          Returns property ScheduledOrderErrorItemDescriptor
 RepositoryItem getScheduledOrderItem(java.lang.String pScheduledOrderItemId)
          Returns the schedule repository item
 java.lang.String getScheduledOrderItemDescriptor()
          Returns property ScheduledOrderItemDescriptor
 RepositoryItem[] getScheduledOrderItemsByProfileId(java.lang.String pProfileId)
          Returns all scheduled order items for the given profile id
 RepositoryItem[] getScheduledOrderItemsByProfileId(java.lang.String pProfileId, java.util.Collection<java.lang.String> pSiteIds)
          Returns all scheduled order items for the given profile id in the given sites
 RepositoryItem[] getScheduledOrderItemsByTemplateId(java.lang.String pTemplateId)
          Returns all scheduled order items for the given order template id
 MutableRepository getScheduledOrderRepository()
          Returns property ScheduledOrderRepository
 Schedule getScheduleFromScheduledOrder(RepositoryItem pScheduledOrderItem)
           
 Schedule getScheduleFromScheduledOrder(RepositoryItem pScheduledOrderItem, java.util.Locale pLocale)
          Returns the schedule object from the given scheduled order repository item
 Schedule getScheduleFromScheduleString(java.lang.String pSchedule, java.util.Locale pLocale)
          Returns a schedule object based on the schedule string provided.
 java.lang.String getScheduleOrderPort()
          returns the property ScheduleOrderPort
 RqlStatement getSchedulesByProfileQuery()
          Returns property SchedulesByProfileQuery.
 RqlStatement getSchedulesByTemplateQuery()
          Returns property SchedulesByTemplateQuery.
 PricingEngineService getShippingPricingEngineService()
          returns the property ShippingPricingEngineService
 SiteContextManager getSiteContextManager()
          returns SiteContextManager
 SiteManager getSiteManager()
          returns SiteManager
 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
 boolean isScheduledForEveryDay(CalendarSchedule pCalendarSchedule)
          Determines if the schedule is setup to run every day.
 boolean isScheduledOrderTemplate(Order pOrder)
          Determines if an order is a scheduled order template.
 boolean isSendMessages()
           
 boolean isUseOrderPriceListsFirst()
          The property controls how the price lists are determined when pricing a scheduled order.
 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.
protected  void processScheduledOrderErrors(MutableRepositoryItem pScheduledOrderItem, java.lang.Throwable pThrownException, PipelineResult pResult)
          Processes errors that occurred when processing a scheduled order.
 void repriceCloneOrder(Order pCloneOrder, Order pParentOrder, RepositoryItem pProfile, java.util.Locale pPricingLocale)
          Reprices the clone order
 void repriceScheduledOrder(Order pScheduledOrder, RepositoryItem pProfile, java.util.Locale pPricingLocale)
           
 void repriceScheduledOrder(Order pScheduledOrder, RepositoryItem pProfile, java.util.Locale pPricingLocale, java.util.Map pExtraParameters)
          Reprices the given scheduled order using the available promotions for the profile.
protected  void scheduledOrderAdded(RepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Send the message 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(OrderManager pOrderManager)
          Sets property OrderManager
 void setOrderPricingEngineService(PricingEngineService pOrderPricingEngineService)
          set the property OrderPricingEngineService
 void setPaymentGroupManager(PaymentGroupManager pPaymentGroupManager)
          Sets property PaymentGroupManager
 void setPriceListManager(PriceListManager pPriceListManager)
          set the property PriceListManager
 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 setScheduledOrderErrorItemDescriptor(java.lang.String pScheduledOrderErrorItemDescriptor)
          Sets property ScheduledOrderErrorItemDescriptor
 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 setSchedulesByProfileQuery(RqlStatement pSchedulesByProfileQuery)
          Sets property SchedulesByProfileQuery
 void setSchedulesByTemplateQuery(RqlStatement pSchedulesByTemplateQuery)
          Sets property SchedulesByTemplateQuery
 void setSendMessages(boolean pSendMessages)
          set sendMessages flag
 void setShippingPricingEngineService(PricingEngineService pShippingPricingEngineService)
          set the property ShippingPricingEngineService
 void setSiteContextManager(SiteContextManager pSiteContextManager)
          Set SiteContextManager
 void setSiteManager(SiteManager pSiteManager)
          Set SiteManager
 void setTaxPricingEngineService(PricingEngineService pTaxPricingEngineService)
          set the property TaxPricingEngineService
 void setUseOrderPriceListsFirst(boolean pUseOrderPriceListsFirst)
           
 boolean shouldProcessOrder(java.lang.String pOrderId)
          Checks to see if an order should be processed based on its site's state (if any).
 void updateScheduledOrder(MutableRepositoryItem pScheduledOrder, RepositoryItem pProfile)
          Update the Scheduled Order in the scheduled 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, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
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

CLASS_VERSION

public static java.lang.String CLASS_VERSION

ERROR_MAX_LENGTH

public static final int ERROR_MAX_LENGTH
See Also:
Constant Field Values

mUseOrderPriceListsFirst

protected boolean mUseOrderPriceListsFirst

mSchedulesByTemplateQuery

protected RqlStatement mSchedulesByTemplateQuery

mSchedulesByProfileQuery

protected RqlStatement mSchedulesByProfileQuery

mSiteContextManager

protected SiteContextManager mSiteContextManager

mSiteManager

protected SiteManager mSiteManager

mSendMessages

protected boolean mSendMessages
Determines whether to send ScneduledOrder JMS messages

Constructor Detail

ScheduledOrderTools

public ScheduledOrderTools()
Constructs an empty ScheduleOrderTools

Method Detail

isUseOrderPriceListsFirst

public boolean isUseOrderPriceListsFirst()
The property controls how the price lists are determined when pricing a scheduled order.

If true, the list and sale price lists will first be extracted from the scheduled order template and will take precedence over the profile's assigned price list.

If false, the list and sale price lists will be determined from the profile's assigned price lists.

Note that extracting the price lists from the scheduled order template requires that its pricing information must be persisted in the order repository.

Default configuration is false


setUseOrderPriceListsFirst

public void setUseOrderPriceListsFirst(boolean pUseOrderPriceListsFirst)

getSchedulesByTemplateQuery

public RqlStatement getSchedulesByTemplateQuery()
Returns property SchedulesByTemplateQuery.

Returns:
returns property SchedulesByTemplateQuery

setSchedulesByTemplateQuery

public void setSchedulesByTemplateQuery(RqlStatement pSchedulesByTemplateQuery)
Sets property SchedulesByTemplateQuery

Parameters:
pSchedulesByTemplateQuery - the value to set for property SchedulesByTemplateQuery

getSchedulesByProfileQuery

public RqlStatement getSchedulesByProfileQuery()
Returns property SchedulesByProfileQuery.

Returns:
returns property SchedulesByProfileQuery

setSchedulesByProfileQuery

public void setSchedulesByProfileQuery(RqlStatement pSchedulesByProfileQuery)
Sets property SchedulesByProfileQuery

Parameters:
pSchedulesByProfileQuery - the value to set for property SchedulesByProfileQuery

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(OrderManager pOrderManager)
Sets property OrderManager

Parameters:
pOrderManager - the value to set for property OrderManager

getOrderManager

public OrderManager 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

getScheduledOrderErrorItemDescriptor

public java.lang.String getScheduledOrderErrorItemDescriptor()
Returns property ScheduledOrderErrorItemDescriptor

Returns:
returns property ScheduledOrderErrorItemDescriptor

setScheduledOrderErrorItemDescriptor

public void setScheduledOrderErrorItemDescriptor(java.lang.String pScheduledOrderErrorItemDescriptor)
Sets property ScheduledOrderErrorItemDescriptor

Parameters:
pScheduledOrderErrorItemDescriptor - the value to set for property ScheduledOrderErrorItemDescriptor

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

setPriceListManager

public void setPriceListManager(PriceListManager pPriceListManager)
set the property PriceListManager

Parameters:
pPriceListManager - the value to set for property PriceListManager

getPriceListManager

public PriceListManager getPriceListManager()
returns the property PriceListManager

Returns:
returns property PriceListManager

getSiteContextManager

public SiteContextManager getSiteContextManager()
returns SiteContextManager

Returns:
the SiteContextManager

setSiteContextManager

public void setSiteContextManager(SiteContextManager pSiteContextManager)
Set SiteContextManager

Parameters:
pSiteContextManager - the SiteContextManager to set

getSiteManager

public SiteManager getSiteManager()
returns SiteManager

Returns:
the SiteManager

setSiteManager

public void setSiteManager(SiteManager pSiteManager)
Set SiteManager

Parameters:
pSiteManager - the SiteManager to set

isSendMessages

public boolean isSendMessages()
Returns:
sendMessages flag

setSendMessages

public void setSendMessages(boolean pSendMessages)
set sendMessages flag

Parameters:
pSendMessages - true to send ScheduledOrder messages, false to suppress them

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

getProfileFromOrder

public RepositoryItem getProfileFromOrder(Order pOrder)
                                   throws RepositoryException,
                                          CommerceException
Extracts the profile from the given order. If the profile cannot be found (because the template is for an anonymous profile) a new transient profile is created with the same profile id and returned.

Parameters:
pOrder -
Returns:
Throws:
RepositoryException
CommerceException

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 scheduled order Repository

Parameters:
pScheduledOrder - The Scheduled 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 message 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:
pScheduledOrder - 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

createParameterMapForProcessingScheduledOrder

protected java.util.HashMap createParameterMapForProcessingScheduledOrder(RepositoryItem pScheduledOrder,
                                                                          Order pClonedOrder,
                                                                          java.util.Locale pLocale)
Creates the extra parameter map that is passed to processOrder in processScheduledOrder

Parameters:
pScheduledOrder -
pClonedOrder -
pLocale -
Returns:

repriceScheduledOrder

public void repriceScheduledOrder(Order pScheduledOrder,
                                  RepositoryItem pProfile,
                                  java.util.Locale pPricingLocale)
                           throws CommerceException
Throws:
CommerceException
See Also:
repriceScheduledOrder(Order, RepositoryItem, Locale, Map)

repriceScheduledOrder

public void repriceScheduledOrder(Order pScheduledOrder,
                                  RepositoryItem pProfile,
                                  java.util.Locale pPricingLocale,
                                  java.util.Map pExtraParameters)
                           throws CommerceException
Reprices the given scheduled order using the available promotions for the profile.

Parameters:
pScheduledOrder -
pProfile -
pPricingLocale -
pExtraParameters -
Throws:
CommerceException

createParameterMapForCloneOrderPricing

public java.util.Map createParameterMapForCloneOrderPricing(Order pCloneOrder,
                                                            Order pParentOrder,
                                                            RepositoryItem pProfile)
Creates the extra parameter map that is used to an order created by the cloneOrder API. By default, this method creates a parameter map for pricing the parent order.

Parameters:
pCloneOrder - the new clone order
pParentOrder - the order from which the clone was created
pProfile - the order owning profile
Returns:
Map
See Also:
createParameterMapForTemplateOrderPricing(Order, RepositoryItem)

createParameterMapForTemplateOrderPricing

public java.util.Map createParameterMapForTemplateOrderPricing(Order pTemplateOrder,
                                                               RepositoryItem pProfile)
Creates a parameter map for pricing a template order.

Parameters:
pTemplateOrder -
pProfile -
Returns:
See Also:
determinePriceListForOrderPricing(Order, RepositoryItem, String)

determineListPriceListForOrderPricing

public RepositoryItem determineListPriceListForOrderPricing(Order pOrder,
                                                            RepositoryItem pProfile)
Determines the list price list to use for pricing the order.

Parameters:
pOrder -
pProfile -
Returns:
Price list repository item
See Also:
determinePriceListForOrderPricing(Order, RepositoryItem, String)

determineSalePriceListForOrderPricing

public RepositoryItem determineSalePriceListForOrderPricing(Order pOrder,
                                                            RepositoryItem pProfile)
Determines the sale price list to use for pricing the order.

Parameters:
pOrder -
pProfile -
Returns:
Price list repository item
See Also:
determinePriceListForOrderPricing(Order, RepositoryItem, String)

determinePriceListForOrderPricing

protected RepositoryItem determinePriceListForOrderPricing(Order pOrder,
                                                           RepositoryItem pProfile,
                                                           java.lang.String pPriceListPropertyName)
Determines the price list that should be used to pricing the given order.

The price list is determined by extracting the price list from the order's current pricing info or from the assigned profile's price list. The precedence is determined by the configuration of the useOrderPriceListsFirst property.

Parameters:
pOrder -
pProfile -
pPriceListPropertyName - the name of the profile property for storing the price list
Returns:
price list item
See Also:
isUseOrderPriceListsFirst(), getPriceListFromOrder(atg.commerce.order.Order, String)

getPriceListFromSite

protected RepositoryItem getPriceListFromSite(Order pOrder,
                                              RepositoryItem pProfile,
                                              java.lang.String pPricelistPropertyName)
Returns a price list that is appropriate for a profile and order's site.

Parameters:
pOrder - order instance
pProfile - user profile repository item
pPricelistPropertyName - price list property name
Returns:
price list repository item

getPriceListFromOrder

protected RepositoryItem getPriceListFromOrder(Order pOrder,
                                               java.lang.String pPriceListPropertyName)
Returns a price list from the order

Parameters:
pOrder -
pPriceListPropertyName - the configured property name for storing the price list on the profile.
Returns:
See Also:
PricingTools.getListPriceListFromOrder(Order), PricingTools.getSalePriceListFromOrder(Order)

activateSchedule

public void activateSchedule(java.lang.String pScheduledOrderItemId)
                      throws CommerceException
Activates the given scheduled order item.

Parameters:
pScheduledOrderItemId -
Throws:
CommerceException

deactivateSchedule

public void deactivateSchedule(java.lang.String pScheduledOrderItemId)
                        throws CommerceException
Deactivates the given scheduled order item.

Parameters:
pScheduledOrderItemId -
Throws:
CommerceException

cloneOrder

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

Parameters:
pOrderId - the id of the order that will be cloned
Returns:
the cloned order
Throws:
CommerceException - if an error occurs
See Also:
cloneOrderObject(String), repriceCloneOrder(atg.commerce.order.Order, atg.commerce.order.Order, atg.repository.RepositoryItem, java.util.Locale), RepositoryUtils

repriceCloneOrder

public void repriceCloneOrder(Order pCloneOrder,
                              Order pParentOrder,
                              RepositoryItem pProfile,
                              java.util.Locale pPricingLocale)
                       throws CommerceException
Reprices the clone order

Parameters:
pCloneOrder -
pParentOrder -
pProfile -
Throws:
CommerceException

getPricingLocale

public java.util.Locale getPricingLocale(RepositoryItem pProfile)
Returns the locale that should be used to price the given order.

This method will first look on the profile for a locale and if not found return the default locale.

Parameters:
pProfile -
Returns:
Locale

cloneOrderObject

public Order cloneOrderObject(java.lang.String pOrderId)
                       throws CommerceException
This method prepares the clone order from the given order id.

Parameters:
pOrderId -
Returns:
new clone order
Throws:
CommerceException

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

isScheduledOrderTemplate

public boolean isScheduledOrderTemplate(Order pOrder)
Determines if an order is a scheduled order template.

Parameters:
pOrder -
Returns:
true if an order has a scheduled order template.

getScheduledOrderItemsByProfileId

public RepositoryItem[] getScheduledOrderItemsByProfileId(java.lang.String pProfileId)
Returns all scheduled order items for the given profile id

Parameters:
pProfileId -
Returns:
Throws:
RepositoryException

getScheduledOrderItemsByProfileId

public RepositoryItem[] getScheduledOrderItemsByProfileId(java.lang.String pProfileId,
                                                          java.util.Collection<java.lang.String> pSiteIds)
Returns all scheduled order items for the given profile id in the given sites

Parameters:
pProfileId -
pSiteIds -
Returns:
Throws:
RepositoryException

getScheduledOrderItem

public RepositoryItem getScheduledOrderItem(java.lang.String pScheduledOrderItemId)
Returns the schedule repository item

Parameters:
pScheduledOrderItemId -
Returns:
scheduled order RepositoryItem

getScheduledOrderItemsByTemplateId

public RepositoryItem[] getScheduledOrderItemsByTemplateId(java.lang.String pTemplateId)
Returns all scheduled order items for the given order template id

Parameters:
pTemplateId -
Returns:
Throws:
RepositoryException

getLastOrderSubmittedFromTemplate

public Order getLastOrderSubmittedFromTemplate(java.lang.String pTemplateOrderId)
Finds the latest order that was submitted from the given template.

Parameters:
pTemplateOrderId -
Returns:
the last order submitted

getScheduleFromScheduledOrder

public Schedule getScheduleFromScheduledOrder(RepositoryItem pScheduledOrderItem)
                                       throws CommerceException
Parameters:
pScheduledOrderItem -
Returns:
Throws:
CommerceException
See Also:
getScheduleFromScheduledOrder(RepositoryItem, Locale)

getScheduleFromScheduledOrder

public Schedule getScheduleFromScheduledOrder(RepositoryItem pScheduledOrderItem,
                                              java.util.Locale pLocale)
                                       throws CommerceException
Returns the schedule object from the given scheduled order repository item

Parameters:
pScheduledOrderItem -
pLocale -
Returns:
Schedule
Throws:
CommerceException

getScheduleFromScheduleString

public Schedule getScheduleFromScheduleString(java.lang.String pSchedule,
                                              java.util.Locale pLocale)
                                       throws CommerceException
Returns a schedule object based on the schedule string provided.

Parameters:
pSchedule -
pLocale -
Returns:
Throws:
CommerceException

getScheduleClassType

public java.lang.String getScheduleClassType(RepositoryItem pScheduledOrderItem,
                                             java.util.Locale pLocale)
Returns the schedule class type for the given scheduled order item

Parameters:
pScheduledOrderItem -
pLocale -
Returns:

generateQueryForOrdersCreatedByTemplate

public Query generateQueryForOrdersCreatedByTemplate(java.lang.String pTemplateOrderId,
                                                     QueryBuilder pQueryBuilder)
                                              throws RepositoryException
Generates a Query for all orders created by the template.

Parameters:
pQueryBuilder - The querybuilder to use when creating the query
pTemplateOrderId -
Returns:
Query
Throws:
RepositoryException

areAllOccurrencesSelected

public boolean areAllOccurrencesSelected(CalendarSchedule pCalendarSchedule)
Returns true if all occurrences are currently selected in the schedule

Parameters:
pCalendarSchedule -
Returns:

areAnyOccurrencesSelected

public boolean areAnyOccurrencesSelected(CalendarSchedule pCalendarSchedule)
Returns true if only some, but not all occurrences are currently selected in the schedule

Parameters:
pCalendarSchedule -
Returns:

areAnyDaysSelected

public boolean areAnyDaysSelected(CalendarSchedule pCalendarSchedule)
Returns true if some of the days of the week are selected.

Parameters:
pCalendarSchedule -
Returns:
true if some of the days of the week are selected.

areAllDaysSelected

public boolean areAllDaysSelected(CalendarSchedule pCalendarSchedule)
Returns true if all of the days of the week are selected.

Parameters:
pCalendarSchedule -
Returns:
true if all of the days of the week are selected.

areAnyDatesSelected

public boolean areAnyDatesSelected(CalendarSchedule pCalendarSchedule)
Returns true if some dates, but not all are selected in the schedule

Parameters:
pCalendarSchedule -
Returns:

areAllDatesSelected

public boolean areAllDatesSelected(CalendarSchedule pCalendarSchedule)
Returns true if all dates are selected in the schedule

Parameters:
pCalendarSchedule -
Returns:

areAllMonthsSelected

public boolean areAllMonthsSelected(CalendarSchedule pCalendarSchedule)
Returns true if all months are selected in the calendar

Parameters:
pCalendarSchedule -
Returns:

isScheduledForEveryDay

public boolean isScheduledForEveryDay(CalendarSchedule pCalendarSchedule)
Determines if the schedule is setup to run every day. There are two possible cases for a true outcome. If all days and all occurrences are selected, or all dates are selected.

Parameters:
pCalendarSchedule -
Returns:
true if all days are selected

calculateEndTimeForOccurrences

public long calculateEndTimeForOccurrences(Schedule pSchedule,
                                           long pNumberOfOccurrences,
                                           long pStartingFrom)
Calculates the time that would result from executing the given schedule for the given number of occurrences.

Parameters:
pSchedule -
pNumberOfOccurrences -
pStartingFrom -
Returns:

processScheduledOrderErrors

protected void processScheduledOrderErrors(MutableRepositoryItem pScheduledOrderItem,
                                           java.lang.Throwable pThrownException,
                                           PipelineResult pResult)
Processes errors that occurred when processing a scheduled order.

This method will create a new scheduledOrderError item and associate it with the given scheduled order item. It will add the given exception and any errors in the pipeline result object to the list of errors contained in the scheduledOrderError item.

Parameters:
pScheduledOrderItem - the scheduled order item
pThrownException - A reference to the exception that was thrown when processing the scheduled order item. This can be null.
pResult - A reference to the PipelineResult object returned from the submit order process in OrderManager. This can be null.

addErrorToScheduledOrderErrorItem

protected void addErrorToScheduledOrderErrorItem(RepositoryItem pScheduledOrderItem,
                                                 MutableRepositoryItem pScheduledOrderErrorItem,
                                                 java.lang.Object pError)
Creates a new error string from the given error object and adds to the list of errors contained in the given scheduled order error item.

If pError is a Throwable, StackTraceUtils is used to provide the source exception and the localizeMessage value is used. Otherise, toString is called on the pError object.

All error strings are truncated to 254 bytes

Parameters:
pScheduledOrderItem -
pScheduledOrderErrorItem -
pError -
See Also:
StackTraceUtils.getSourceException(Throwable)

clearLastError

protected void clearLastError(MutableRepositoryItem pScheduledOrderItem)
Sets the error item property on the scheduled order item to null.

Parameters:
pScheduledOrderItem - the mutable scheduled order item

shouldProcessOrder

public boolean shouldProcessOrder(java.lang.String pOrderId)
Checks to see if an order should be processed based on its site's state (if any). Only those states that are enabled will be processed. Sites that are disabled will not be. Whether a site is considered "active" or "inactive" is ignored by this method. Orders that have no site property will pass this check (i.e. return true).

Parameters:
pOrderId - the repository id of the order to examine
Returns:
true if this order should be processed, false otherwise. False is also returned if the order id doesn't represent an order in the repository, there's no enabled property of an order's site, or a checked exception occurs while trying to determine an answer