atg.commerce.pricing
Class ItemPricingDroplet

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.commerce.pricing.ItemPricingDroplet
All Implemented Interfaces:
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, ParameterServlet, java.util.EventListener, javax.servlet.Servlet
Direct Known Subclasses:
PriceEachItemDroplet, PriceItemDroplet

public abstract class ItemPricingDroplet
extends DynamoServlet

An abstract class which is used as the foundation for pricing items and displaying the results to the user. People who extend this class must override the performPricing method to return the CommerceItem(s) that have been priced. These items are then bound into the output oparam with the default name element. One can change this parameter name by setting the elementName parameter.

This droplet can handle the following optional input parameters:

pricingModels
A collection of pricing models that should be used to price the items. If this value if not supplied then by default a collection of pricing models are used from the user's PricingModelHolder component. This component is resolved through the userPricingModelsPath property.
locale
The locale the the pricing should take place within
profile
The user for whom pricing is performed. If this parameter is null, then the profile is resolved through the property profilePath.
product
The object which represents the product definition of the item to price. Typically the items which are priced are skus. In that case this is the product which encompasses all the skus.
elementName
The name to use as the parameter set within the output oparam.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  ComponentName mProfilePath
           
protected  ComponentName mUserPricingModelsPath
           
 
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
ItemPricingDroplet()
          Constructs an instanceof ItemPricingDroplet
 
Method Summary
protected  CommerceItem createCommerceItem(java.lang.String pCatalogRefId, java.lang.Object pCatalogRef, java.lang.String pProductId, java.lang.Object pProductRef, long pQuantity)
          With the given parameters create a new CommerceItem that will be used for pricing
protected  java.lang.String getCatalogRefId(java.lang.Object pCatalogRef)
          Return the id of the supplied catalogRef (aka sku) object
 java.util.Locale getDefaultLocale()
          Returns property DefaultLocale.
 OrderTools getOrderTools()
          Returns property OrderTools
protected  java.util.Collection getPricingModels(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Return the collection of pricing models to use for pricing.
 PricingTools getPricingTools()
          Returns property PricingTools
protected  java.lang.Object getProduct(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Return the product which encompasses the items to be priced.
protected  java.lang.String getProductId(java.lang.Object pProduct)
          Return the product id of the supplied product object
protected  RepositoryItem getProfile(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Return the profile of the user requesting the price information
 java.lang.String getProfilePath()
          Returns property ProfilePath
protected  java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 java.lang.String getUserPricingModelsPath()
          Returns property UserPricingModelsPath
 boolean isUseRequestLocale()
          Returns property UseRequestLocale
protected abstract  java.lang.Object performPricing(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Return the object (CommerceItem or List of CommerceItems) that has been priced
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Fetch the objects returned from performPricing and bind them to the set element name and render the output oparam.
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          Sets property DefaultLocale
 void setOrderTools(OrderTools pOrderTools)
          Sets property OrderTools
 void setPricingTools(PricingTools pPricingTools)
          Sets property PricingTools
 void setProfilePath(java.lang.String pProfilePath)
          Sets property ProfilePath
 void setUseRequestLocale(boolean pUseRequestLocale)
          Sets property UseRequestLocale
 void setUserPricingModelsPath(java.lang.String pUserPricingModelsPath)
          Sets property UserPricingModelsPath
 
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, 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
Class version string


mProfilePath

protected ComponentName mProfilePath

mUserPricingModelsPath

protected ComponentName mUserPricingModelsPath
Constructor Detail

ItemPricingDroplet

public ItemPricingDroplet()
Constructs an instanceof ItemPricingDroplet

Method Detail

setPricingTools

public void setPricingTools(PricingTools pPricingTools)
Sets property PricingTools


getPricingTools

public PricingTools getPricingTools()
Returns property PricingTools


setOrderTools

public void setOrderTools(OrderTools pOrderTools)
Sets property OrderTools


getOrderTools

public OrderTools getOrderTools()
Returns property OrderTools


setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale


getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns property DefaultLocale. If the property value is null, then JVM's default locale is returned.


setUseRequestLocale

public void setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale


isUseRequestLocale

public boolean isUseRequestLocale()
Returns property UseRequestLocale


setProfilePath

public void setProfilePath(java.lang.String pProfilePath)
Sets property ProfilePath


getProfilePath

public java.lang.String getProfilePath()
Returns property ProfilePath


setUserPricingModelsPath

public void setUserPricingModelsPath(java.lang.String pUserPricingModelsPath)
Sets property UserPricingModelsPath


getUserPricingModelsPath

public java.lang.String getUserPricingModelsPath()
Returns property UserPricingModelsPath


service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Fetch the objects returned from performPricing and bind them to the set element name and render the output oparam.

Overrides:
service in class DynamoServlet
Parameters:
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - an application specific error occurred processing this request
java.io.IOException - an error occurred reading data from the request or writing data to the response.

performPricing

protected abstract java.lang.Object performPricing(DynamoHttpServletRequest pRequest,
                                                   DynamoHttpServletResponse pResponse)
                                            throws javax.servlet.ServletException,
                                                   java.io.IOException
Return the object (CommerceItem or List of CommerceItems) that has been priced

Throws:
javax.servlet.ServletException
java.io.IOException

getPricingModels

protected java.util.Collection getPricingModels(DynamoHttpServletRequest pRequest,
                                                DynamoHttpServletResponse pResponse)
                                         throws javax.servlet.ServletException,
                                                java.io.IOException
Return the collection of pricing models to use for pricing.

Throws:
javax.servlet.ServletException
java.io.IOException

getProfile

protected RepositoryItem getProfile(DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Return the profile of the user requesting the price information

Throws:
javax.servlet.ServletException
java.io.IOException

getProduct

protected java.lang.Object getProduct(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Return the product which encompasses the items to be priced.

Throws:
javax.servlet.ServletException
java.io.IOException

getProductId

protected java.lang.String getProductId(java.lang.Object pProduct)
Return the product id of the supplied product object


getCatalogRefId

protected java.lang.String getCatalogRefId(java.lang.Object pCatalogRef)
Return the id of the supplied catalogRef (aka sku) object


getUserLocale

protected java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest,
                                         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.

Throws:
javax.servlet.ServletException
java.io.IOException

createCommerceItem

protected CommerceItem createCommerceItem(java.lang.String pCatalogRefId,
                                          java.lang.Object pCatalogRef,
                                          java.lang.String pProductId,
                                          java.lang.Object pProductRef,
                                          long pQuantity)
                                   throws CommerceException
With the given parameters create a new CommerceItem that will be used for pricing

Throws:
CommerceException