Class PriceItemDroplet

  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
                              extended by atg.commerce.pricing.PriceItemDroplet
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, ParameterServlet, java.util.EventListener, javax.servlet.Servlet

public class PriceItemDroplet
extends ItemPricingDroplet

This Dynamo Servlet Bean is used to price a single item. The only required parameter is named item. This can be either a RepositoryItem, which represents the item to be priced, or a CommerceItem which can be directly priced. If the item supplied is a RepositoryItem then a new CommerceItem is created to be priced.

The following parameters are optional:

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.
The locale the the pricing should take place within
The user for whom pricing is performed. If this parameter is null, then the profile is resolved through the property profilePath.
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.
The name to use as the parameter set within the output oparam.
The Long quantity of the input product which should be priced. Used when constructing a CommerceItem out of the supplied information.

With these parameters the supplied or constructed CommerceItem, the user's current promotions, their profile and locale are passed to the PricingTools.priceItem method. This then calls into the ItemPricingEngine. The CommerceItem, which has now been priced, is made available as a parameter in the output oparam. By default the name of this CommerceItem parameter is element, however as described above this can be changed through the elementName input parameter.

For example:
NOTE: the promotions, locale and profile are extracted from the request, since they are not supplied as parameters.

 <droplet bean="/atg/commerce/pricing/PriceItem">
 <param name="item" value="param:sku">
 <param name="product" value="param:product">
 <param name="quantity" value="param:quantity">
 <param name="elementName" value="pricedItem">
 <oparam name="output">
    <valueof param="pricedItem.priceInfo.amount" currency>no price</valueof>

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  Qualifier mPricingQualifierService
Fields inherited from class atg.commerce.pricing.ItemPricingDroplet
mProfilePath, mUserPricingModelsPath
Fields inherited from class atg.servlet.DynamoServlet
mAllowCleanupRequest, mParameters
Fields inherited from class atg.nucleus.servlet.ServletService
Fields inherited from class atg.nucleus.GenericService
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
Constructor Summary
          Constructs an instanceof PriceItemDroplet
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.util.Map getExtraParams(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Intended to be used to build a map of extra parameters for passing in to ItemPricingEngines for their use in pricing the input item.
 Qualifier getPricingQualifierService()
          Returns the qualifier service that is used to price promotions during the pricing operation.
protected  java.lang.Object performPricing(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the CommerceItem which has been priced.
 void setPricingQualifierService(Qualifier pPricingQualifierService)
Methods inherited from class atg.commerce.pricing.ItemPricingDroplet
getCatalogRefId, getDefaultLocale, getOrderTools, getPricingModels, getPricingTools, getProduct, getProductId, getProfile, getProfilePath, getUserLocale, getUserPricingModelsPath, isUseRequestLocale, service, setDefaultLocale, setOrderTools, setPricingTools, setProfilePath, setUseRequestLocale, setUserPricingModelsPath
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


public static java.lang.String CLASS_VERSION
Class version string


protected Qualifier mPricingQualifierService
Constructor Detail


public PriceItemDroplet()
Constructs an instanceof PriceItemDroplet

Method Detail


public Qualifier getPricingQualifierService()
Returns the qualifier service that is used to price promotions during the pricing operation.



public void setPricingQualifierService(Qualifier pPricingQualifierService)


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.

createCommerceItem in class ItemPricingDroplet


protected java.lang.Object performPricing(DynamoHttpServletRequest pRequest,
                                          DynamoHttpServletResponse pResponse)
                                   throws javax.servlet.ServletException,
Returns the CommerceItem which has been priced. This method gathers the user's promotions, locale and profile and calls into the PricingTools to price the item.

Specified by:
performPricing in class ItemPricingDroplet


protected java.util.Map getExtraParams(DynamoHttpServletRequest pRequest,
                                       DynamoHttpServletResponse pResponse)
                                throws javax.servlet.ServletException
Intended to be used to build a map of extra parameters for passing in to ItemPricingEngines for their use in pricing the input item.

By default, this method will create a parameter map containing the configured qualifier service to be used in the pricing operation. Otherwise, it returns null. Note: override this method if you've created a new implementation of ItemPricingEngine which uses the 'ExtraParameters' param that's passed in to its pricing methods.

pRequest - the request object which holds the extra pararameters map in its parameters table
pResponse - the response object
the Map in pRequest's "extra parameters" parameter, if any
javax.servlet.ServletException - if there was a problem getting the request parameter value