atg.projects.store.droplet
Class AddItemsToOrder

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.nucleus.servlet.ServletService
                  extended by atg.nucleus.servlet.HttpServletService
                      extended by atg.servlet.DynamoServlet
                          extended by atg.projects.store.droplet.AddItemsToOrder
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, atg.servlet.ParameterServlet, java.util.EventListener, javax.servlet.Servlet

public class AddItemsToOrder
extends atg.servlet.DynamoServlet

This droplet is placed on the page that follows login during checkout (currently the shipping page). It is required for the case when a user is recognized by auto-login, but when he/she gets to the login page during checkout, indicates that this is a case of mistaken identity, and wants to check out anonymously. We need to copy the contents of the recognized user's cart to a new cart. In this case, the login during checkout process will save the user's items in a globally-scoped map, and pass the "key" for this map as a query parameter. We also need to set the new user's email address here after the user has been logged out. All this is caused by the fact that we send the "DPSLogout=true" in the query string, which causes the servlet pipeline to log the user out. Finally, we remove the entries from the globally-scoped Map so that it doesn't just keep growing.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string.
static java.lang.String NEW_EMAIL_ADDRESS
          New email address parameter name.
static atg.nucleus.naming.ParameterName ORDER
          Input parameter name order.
static atg.nucleus.naming.ParameterName PROFILE
          Input parameter name profile.
 
Fields inherited from class atg.servlet.DynamoServlet
mAllowCleanupRequest, mParameters
 
Fields inherited from class atg.nucleus.servlet.ServletService
SERVLET_INFO_KEY
 
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
AddItemsToOrder()
           
 
Method Summary
 void copyItemsToOrder(java.util.List pItemsToAdd, atg.commerce.order.Order pOrder, atg.repository.RepositoryItem pProfile, atg.commerce.pricing.PricingModelHolder pUserPricingModels, java.lang.String pCatalogKey, java.util.Locale pLocale)
          This method is used when a user enters the checkout process as a recognized user, but decides to proceed anonymously.
protected  java.lang.String getCatalogKey(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Get a string that will be used to identify the catalog to use when obtaining a catalogRef and productRef for the creation of a commerce item.
 atg.commerce.order.OrderManager getOrderManager()
           
 atg.repository.RepositoryItem getProfile()
          Return the Profile property.
 atg.commerce.order.purchase.PurchaseProcessHelper getPurchaseProcessHelper()
          Returns property purchaseProcessHelper.
 StorePropertyManager getStorePropertyManager()
           
 UserItems getUserItems()
           
 java.util.Locale getUserLocale(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 atg.commerce.pricing.PricingModelHolder getUserPricingModels()
          Returns property UserPricingModels.
 void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
           Adds items to the user's cart after being logged out during the checkout process.
 void setOrderManager(atg.commerce.order.OrderManager pOrderManager)
          Sets property OrderManager.
 void setProfile(atg.repository.RepositoryItem pProfile)
          Set the Profile property.
 void setPurchaseProcessHelper(atg.commerce.order.purchase.PurchaseProcessHelper pPurchaseProcessHelper)
          Sets property purchaseProcessHelper.
 void setStorePropertyManager(StorePropertyManager pStorePropertyManager)
           
 void setUserItems(UserItems pUserItems)
           
 void setUserPricingModels(atg.commerce.pricing.PricingModelHolder pUserPricingModels)
          Sets property UserPricingModels.
 
Methods inherited from class atg.servlet.DynamoServlet
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter
 
Methods inherited from class atg.nucleus.servlet.ServletService
destroy, getServletConfig, getServletInfo, init, setServletInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
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, reResolveThis, 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.


ORDER

public static final atg.nucleus.naming.ParameterName ORDER
Input parameter name order.


PROFILE

public static final atg.nucleus.naming.ParameterName PROFILE
Input parameter name profile.


NEW_EMAIL_ADDRESS

public static final java.lang.String NEW_EMAIL_ADDRESS
New email address parameter name.

See Also:
Constant Field Values
Constructor Detail

AddItemsToOrder

public AddItemsToOrder()
Method Detail

setPurchaseProcessHelper

public void setPurchaseProcessHelper(atg.commerce.order.purchase.PurchaseProcessHelper pPurchaseProcessHelper)
Sets property purchaseProcessHelper.

Parameters:
pPurchaseProcessHelper - a PurchaseProcessHelper value

getPurchaseProcessHelper

public atg.commerce.order.purchase.PurchaseProcessHelper getPurchaseProcessHelper()
Returns property purchaseProcessHelper.

Returns:
a PurchaseProcessHelper value

getUserItems

public UserItems getUserItems()
Returns:
user items.

setUserItems

public void setUserItems(UserItems pUserItems)
Parameters:
pUserItems - - user items.

setOrderManager

public void setOrderManager(atg.commerce.order.OrderManager pOrderManager)
Sets property OrderManager.

Parameters:
pOrderManager - - order manager

getOrderManager

public atg.commerce.order.OrderManager getOrderManager()
Returns:
property OrderManager.

getStorePropertyManager

public StorePropertyManager getStorePropertyManager()
Returns:
the mStorePropertyManager.

setStorePropertyManager

public void setStorePropertyManager(StorePropertyManager pStorePropertyManager)
Parameters:
pStorePropertyManager - - the mStorePropertyManager to set.

getUserLocale

public java.util.Locale getUserLocale(atg.servlet.DynamoHttpServletRequest pRequest,
                                      atg.servlet.DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Returns the locale associated with the request. The method first searches for a request paramater named locale. This value can be either a java.util.Locale object or a String which represents the locale. Next if the useRequestLocale property is true, then the locale of the request will be returned. Finally, if the locale cannot be determined, the the defaultLocale property is used.

Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Returns:
a Locale value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

getCatalogKey

protected java.lang.String getCatalogKey(atg.servlet.DynamoHttpServletRequest pRequest,
                                         atg.servlet.DynamoHttpServletResponse pResponse)
                                  throws javax.servlet.ServletException,
                                         java.io.IOException
Get a string that will be used to identify the catalog to use when obtaining a catalogRef and productRef for the creation of a commerce item. CatalogTools will maintain a mapping of key to catalog, currently this mapping will be maintained by the users locale.

Parameters:
pRequest - servlet request object
pResponse - servlet response object
Returns:
the catalog key
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs
See Also:
CatalogTools

setUserPricingModels

public void setUserPricingModels(atg.commerce.pricing.PricingModelHolder pUserPricingModels)
Sets property UserPricingModels.

Parameters:
pUserPricingModels - a PricingModelHolder value

getUserPricingModels

public atg.commerce.pricing.PricingModelHolder getUserPricingModels()
Returns property UserPricingModels.

Returns:
a PricingModelHolder value

setProfile

public void setProfile(atg.repository.RepositoryItem pProfile)
Set the Profile property.

Parameters:
pProfile - a RepositoryItem value

getProfile

public atg.repository.RepositoryItem getProfile()
Return the Profile property.

Returns:
a RepositoryItem value

service

public void service(atg.servlet.DynamoHttpServletRequest pRequest,
                    atg.servlet.DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException

Adds items to the user's cart after being logged out during the checkout process.

Overrides:
service in class atg.servlet.DynamoServlet
Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

copyItemsToOrder

public void copyItemsToOrder(java.util.List pItemsToAdd,
                             atg.commerce.order.Order pOrder,
                             atg.repository.RepositoryItem pProfile,
                             atg.commerce.pricing.PricingModelHolder pUserPricingModels,
                             java.lang.String pCatalogKey,
                             java.util.Locale pLocale)
This method is used when a user enters the checkout process as a recognized user, but decides to proceed anonymously. In this case, the user gets a brand new cart (required b/c otherwise the user might see address/cc info from persisted cart which apparently is not his/hers). The items from the old cart are copied into the new cart with this method.

Parameters:
pItemsToAdd - The list of AddCommerceItemInfo objects to add
pOrder - the customer order
pProfile - - profile
pUserPricingModels - - user pricing models
pCatalogKey - - catalog key
pLocale - - locale
See Also:
AddCommerceItemInfo