atg.commerce.pricing
Class AvailableShippingMethodsDroplet

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

public class AvailableShippingMethodsDroplet
extends DynamoServlet

This Dynamo Servlet Bean is used to display avalable shipping methods for a particular shipping group. The class's service method calls into the ShippingPricingEngine getAvailableMethods method to return the list of shipping method codes. These codes correspond to the shippingMethod property of the order HardgoodShippingGroup class.

The only required input parameter is:

shippingGroup
The ShippingGroup that needs to be shipped

The following parameters are optional:

pricingModels
A collection of shipping pricing models. If this parameter is null then the session-scoped PricingModelHolder is resolved and the collection is fetched. The path to the PricingModelHolder component is configured through the userPricingModelsPath property.
profile
The RepositoryItem which represents the user requesting the shipping methods. If this parameter is null, then the session-scoped Profile is resolved. The path to the Profile component is configured through the profilePath property.
locale
The locale of the user requesting the shipping methods. This parameter may be either a java.util.Locale object or a String which represents a locale. If this parameter is not found then by default the locale is fetched from the request. If this locale cannot be determined then the default locale for this component is utilized.

The following output parameters are defined when the service method is invoked:

availableShippingMethods
A list of shipping method codes which can be used as a shippingMethod value in a HardgoodShippingGroup
output
An oparam which will include the availableShippingMethods parameter

This is an example of using this droplet to provide a select box of available shipping methods which are bound to the shippingMethod property of the first shipping group.

 <droplet bean="/atg/commerce/pricing/AvailableShippingMethods">
 <param name="shippingGroup" value="bean:ShoppingCartModifier.shippingGroup">
 <oparam name="output">
   <select bean="ShoppingCartModifier.shippingGroup.shippingMethod">
   <droplet bean="ForEach">
   <param name="array" value="param:availableShippingMethods">
   <param name="elementName" value="method">
   <oparam name="output">
     <option value="param:method"><valueof param="method"></valueof>
   </oparam>
   </droplet>
   </select>
 </oparam>
 </droplet>

 


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
protected  ComponentName mProfilePath
          the path to the user's profile in the nucleus namespace
protected  ComponentName mUserPricingModelsPath
          the path to the PricingModelHolder in Nucleus which holds the user's pricing models
 
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
AvailableShippingMethodsDroplet()
          Constructs an instanceof AvailableShippingMethodsDroplet
 
Method Summary
 java.util.Locale getDefaultLocale()
          the default locale for which available shipping methods should be retrieved
protected  java.util.Collection getPricingModels(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Get the collection of pricing models to use for determing what shipping methods are availble.
protected  RepositoryItem getProfile(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          get the profile of the user requesting the shipping information
 java.lang.String getProfilePath()
          the path to the user's profile in the nucleus namespace
protected  ShippingGroup getShippingGroup(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Get the shipping group from which we should determine the available shipping methods
 ShippingPricingEngine getShippingPricingEngine()
          the shipping pricing engine to consult for available shipping methods
 boolean getUseRequestLocale()
          flag to determine whether to ask for available shipping methods using the locale in the Request object before falling back on the default locale
protected  java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 java.lang.String getUserPricingModelsPath()
          the path to the PricingModelHolder in Nucleus which holds the user's pricing models
 boolean isUseRequestLocale()
          Test property UseRequestLocale
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Performs the getting of available shipping methods within a Request scope.
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          the default locale for which available shipping methods should be retrieved
 void setProfilePath(java.lang.String pProfilePath)
          the path to the user's profile in the nucleus namespace
 void setShippingPricingEngine(ShippingPricingEngine pShippingPricingEngine)
          the shipping pricing engine to consult for available shipping methods
 void setUseRequestLocale(boolean pUseRequestLocale)
          flag to determine whether to ask for available shipping methods using the locale in the Request object before falling back on the default locale
 void setUserPricingModelsPath(java.lang.String pUserPricingModelsPath)
          the path to the PricingModelHolder in Nucleus which holds the user's pricing models
 
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, 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


mProfilePath

protected ComponentName mProfilePath
the path to the user's profile in the nucleus namespace


mUserPricingModelsPath

protected ComponentName mUserPricingModelsPath
the path to the PricingModelHolder in Nucleus which holds the user's pricing models

Constructor Detail

AvailableShippingMethodsDroplet

public AvailableShippingMethodsDroplet()
Constructs an instanceof AvailableShippingMethodsDroplet

Method Detail

setShippingPricingEngine

public void setShippingPricingEngine(ShippingPricingEngine pShippingPricingEngine)
the shipping pricing engine to consult for available shipping methods

Parameters:
pShippingPricingEngine - new value to set

getShippingPricingEngine

public ShippingPricingEngine getShippingPricingEngine()
the shipping pricing engine to consult for available shipping methods

Returns:
property ShippingPricingEngine

setProfilePath

public void setProfilePath(java.lang.String pProfilePath)
the path to the user's profile in the nucleus namespace

Parameters:
pProfilePath - new value to set

getProfilePath

public java.lang.String getProfilePath()
the path to the user's profile in the nucleus namespace

Returns:
property ProfilePath

setUserPricingModelsPath

public void setUserPricingModelsPath(java.lang.String pUserPricingModelsPath)
the path to the PricingModelHolder in Nucleus which holds the user's pricing models

Parameters:
pUserPricingModelsPath - new value to set

getUserPricingModelsPath

public java.lang.String getUserPricingModelsPath()
the path to the PricingModelHolder in Nucleus which holds the user's pricing models

Returns:
property UserPricingModelsPath

setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
the default locale for which available shipping methods should be retrieved

Parameters:
pDefaultLocale - new value to set

getDefaultLocale

public java.util.Locale getDefaultLocale()
the default locale for which available shipping methods should be retrieved

Returns:
property DefaultLocale

setUseRequestLocale

public void setUseRequestLocale(boolean pUseRequestLocale)
flag to determine whether to ask for available shipping methods using the locale in the Request object before falling back on the default locale

Parameters:
pUseRequestLocale - new value to set

getUseRequestLocale

public boolean getUseRequestLocale()
flag to determine whether to ask for available shipping methods using the locale in the Request object before falling back on the default locale

Returns:
property UseRequestLocale

isUseRequestLocale

public boolean isUseRequestLocale()
Test property UseRequestLocale

Returns:
UseRequestLocale

service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Performs the getting of available shipping methods within a Request scope.

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.

getShippingGroup

protected ShippingGroup getShippingGroup(DynamoHttpServletRequest pRequest,
                                         DynamoHttpServletResponse pResponse)
                                  throws javax.servlet.ServletException,
                                         java.io.IOException
Get the shipping group from which we should determine the available shipping methods

Parameters:
pRequest - the request to be processed
pResponse - the response object for this request
Returns:
the shipping group from which we should determine the available shipping methods
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.

getProfile

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

Parameters:
pRequest - the request to be processed
pResponse - the response object for this request
Returns:
the profile of the user requesting the shipping information
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.

getPricingModels

protected java.util.Collection getPricingModels(DynamoHttpServletRequest pRequest,
                                                DynamoHttpServletResponse pResponse)
                                         throws javax.servlet.ServletException,
                                                java.io.IOException
Get the collection of pricing models to use for determing what shipping methods are availble.

Parameters:
pRequest - the request to be processed
pResponse - the response object for this request
Returns:
the collection of pricing models to use for determing what shipping methods are availble.
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(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.

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.