atg.projects.store.pricing
Class PriceShippingMethodDroplet

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.pricing.PriceShippingMethodDroplet
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 PriceShippingMethodDroplet
extends atg.servlet.DynamoServlet

This Dynamo Servlet Bean is used to determine shipping costs for the shipping group with specified shipping method. The class's service method calls into the ShippingPricingEngine priceShippingGroup method to get the ShippingPriceInfo for the specified shipping group and the shipping method. The determined shipping cost is put into the output parameter.

The following parameters are required:

shippingGroup
The ShippingGroup to price
shippingMethod
The Shipping method to price with

The following output parameter is defined when the service method is invoked:

shippingPrice
A double value that corresponds to the shipping cost of the specified shipping group with specified shipping method.
output
An oparam that is serviced if the shipping cost is determined.

This is an example of using this droplet to provide a price for the shipping with the specified shipping method.

 <dsp:droplet name="/atg/store/pricing/PriceShippingMethod"">
   <dsp:param name="shippingGroup" param="shippingGroup"/">
   <dsp:param name="shippingMethod" param="shippingMethod"/">
   <dsp:oparam name="output"">
     <dsp:getvalueof var="shippingPrice" param="shippingPrice" /">
     <fmt:formatNumber value="${shippingPrice}" type="currency" /">
   </dsp:oparam">
 </dsp:droplet">

 


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
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
PriceShippingMethodDroplet()
           
 
Method Summary
 java.util.Locale getDefaultLocale()
          the default locale for which shipping method should be priced
 atg.commerce.order.Order getOrder()
          Return the Order property.
 atg.userprofiling.Profile getProfile()
          Return the Profile property.
protected  atg.commerce.order.ShippingGroup getShippingGroup(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Get the shipping group from that we should price with the specified shipping method.
 atg.commerce.pricing.ShippingPricingEngine getShippingPricingEngine()
          the shipping pricing engine to price shipping methods
protected  java.util.Locale getUserLocale(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 atg.commerce.pricing.PricingModelHolder getUserPricingModels()
          Return the UserPricingModels property.
 void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Performs the pricing of specified shipping method.
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          the default locale for which shipping method should be priced
 void setOrder(atg.commerce.order.Order pOrder)
          Set the Order property.
 void setProfile(atg.userprofiling.Profile pProfile)
          Set the Profile property.
 void setShippingPricingEngine(atg.commerce.pricing.ShippingPricingEngine pShippingPricingEngine)
          the shipping pricing engine to price shipping methods
 void setUserPricingModels(atg.commerce.pricing.PricingModelHolder pUserPricingModels)
          Set the UserPricingModels property.
 
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

Constructor Detail

PriceShippingMethodDroplet

public PriceShippingMethodDroplet()
Method Detail

setShippingPricingEngine

public void setShippingPricingEngine(atg.commerce.pricing.ShippingPricingEngine pShippingPricingEngine)
the shipping pricing engine to price shipping methods

Parameters:
pShippingPricingEngine - new value to set

getShippingPricingEngine

public atg.commerce.pricing.ShippingPricingEngine getShippingPricingEngine()
the shipping pricing engine to price shipping methods

Returns:
property ShippingPricingEngine

setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
the default locale for which shipping method should be priced

Parameters:
pDefaultLocale - new value to set

getDefaultLocale

public java.util.Locale getDefaultLocale()
the default locale for which shipping method should be priced

Returns:
property DefaultLocale

setOrder

public void setOrder(atg.commerce.order.Order pOrder)
Set the Order property.

Parameters:
pOrder - an Order value

getOrder

public atg.commerce.order.Order getOrder()
Return the Order property.

Returns:
an Order value

setProfile

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

Parameters:
pProfile - a Profile value

getProfile

public atg.userprofiling.Profile getProfile()
Return the Profile property.

Returns:
a Profile value

setUserPricingModels

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

Parameters:
pUserPricingModels - a PricingModelHolder value

getUserPricingModels

public atg.commerce.pricing.PricingModelHolder getUserPricingModels()
Return the UserPricingModels property.

Returns:
a PricingModelHolder value

service

public void service(atg.servlet.DynamoHttpServletRequest pRequest,
                    atg.servlet.DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Performs the pricing of specified shipping method. Sets the shipping method the specified shipping group to the one that is passed to the droplet. Then calls shipping pricing engine to perform pricing of shipping group. And finally returns back the original shipping method of the shipping group. The determined price is stored into the output parameter.

Overrides:
service in class atg.servlet.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.

getShippingGroup

protected atg.commerce.order.ShippingGroup getShippingGroup(atg.servlet.DynamoHttpServletRequest pRequest,
                                                            atg.servlet.DynamoHttpServletResponse pResponse)
                                                     throws javax.servlet.ServletException,
                                                            java.io.IOException
Get the shipping group from that we should price with the specified shipping method.

Parameters:
pRequest - the request to be processed
pResponse - the response object for this request
Returns:
the shipping group from that we should price with the specified shipping method.
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.

getUserLocale

protected 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 the locale of the request. If the locale cannot be determined, the the defaultLocale property is used.

Parameters:
pRequest - the request to be processed
pResponse - the response object for this request
Returns:
the locale to be associated with this user
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.