atg.projects.store.droplet
Class AvailableShippingGroups

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.AvailableShippingGroups
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
Direct Known Subclasses:
AvailableBillingAddresses, InternationalizedAvailableShippingGroups

public class AvailableShippingGroups
extends atg.servlet.DynamoServlet

The droplet sorts shipping addresses so that the default address is first and returns only permitted shipping addresses.

This droplet takes the following parameters

defaultKey
The parameter that defines the map key of the default item that should be placed in the beginning of the array.
sortByKeys
Boolean that specifies whether to sort map entries by keys or not.
map
The parameter that defines the map of items to convert to the sorted array.

Output parameters

output
Rendered for permitted shipping address list, permittedAddresses parameter contains the permitted shipping addresses.
empty
Rendered if there are no shipping addresses or there are no permitted shipping addresses


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static atg.nucleus.naming.ParameterName DEFAULT_ID
          Default id parameter name.
static atg.nucleus.naming.ParameterName DEFAULT_KEY
          Default key parameter name.
static atg.nucleus.naming.ParameterName EMPTY
          Empty parameter name.
static atg.nucleus.naming.ParameterName MAP
          Map parameter name.
static atg.nucleus.naming.ParameterName SORT_BY_KEYS
          Sort by keys parameter name
 
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
AvailableShippingGroups()
           
 
Method Summary
protected  java.lang.String getCountryCode(atg.commerce.order.ShippingGroup pShippingGroup)
          Returns country code for the given item.
 atg.core.i18n.CountryList getCountryList()
           
 CountryRestrictionsService getCountryRestrictionsService()
           
 StoreGiftlistManager getGiftlistManager()
           
 java.util.List getPermittedCountryCodes()
           
 java.util.List getRestrictedCountryCodes()
           
 java.lang.Object[] getSortedAddressList(java.lang.String pDefaultKey, java.lang.String pSortByKeysParameter, java.util.Map pMap)
          This method converts a map of items to a sorted array of map entries with the default item in the beginning of the array.
 java.lang.Object[] getSortedArray(java.util.Map pMap, java.lang.String pDefaultKey, boolean pSortByKeys)
          Converts the map to the array of map entries with the default one in the beginning of the array.
 boolean isRemoveGiftShippingGroups()
           
 void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          See the class documentation above.
 void setCountryList(atg.core.i18n.CountryList pCountryList)
           
 void setCountryRestrictionsService(CountryRestrictionsService pCountryRestrictionsService)
           
 void setGiftlistManager(StoreGiftlistManager pGiftlistManager)
           
 void setPermittedCountryCodes(java.util.List pPermittedCountryCodes)
           
 void setRemoveGiftShippingGroups(boolean pRemoveGiftShippingGroups)
           
 void setRestrictedCountryCodes(java.util.List pRestrictedCountryCodes)
           
 
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 final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

EMPTY

public static final atg.nucleus.naming.ParameterName EMPTY
Empty parameter name.


MAP

public static final atg.nucleus.naming.ParameterName MAP
Map parameter name.


DEFAULT_ID

public static final atg.nucleus.naming.ParameterName DEFAULT_ID
Default id parameter name.


DEFAULT_KEY

public static final atg.nucleus.naming.ParameterName DEFAULT_KEY
Default key parameter name.


SORT_BY_KEYS

public static final atg.nucleus.naming.ParameterName SORT_BY_KEYS
Sort by keys parameter name

Constructor Detail

AvailableShippingGroups

public AvailableShippingGroups()
Method Detail

getCountryRestrictionsService

public CountryRestrictionsService getCountryRestrictionsService()
Returns:
the countryRestrictionsService

setCountryRestrictionsService

public void setCountryRestrictionsService(CountryRestrictionsService pCountryRestrictionsService)
Parameters:
pCountryRestrictionsService - the countryRestrictionsService to set

getCountryList

public atg.core.i18n.CountryList getCountryList()
Returns:
country list.

setCountryList

public void setCountryList(atg.core.i18n.CountryList pCountryList)
Parameters:
pCountryList - - country list.

getPermittedCountryCodes

public java.util.List getPermittedCountryCodes()
Returns:
permitted country list.

setPermittedCountryCodes

public void setPermittedCountryCodes(java.util.List pPermittedCountryCodes)
Parameters:
pPermittedCountryCodes - - permitted country list.

getRestrictedCountryCodes

public java.util.List getRestrictedCountryCodes()
Returns:
restricted country codes.

setRestrictedCountryCodes

public void setRestrictedCountryCodes(java.util.List pRestrictedCountryCodes)
Parameters:
pRestrictedCountryCodes - - restricted country codes.

isRemoveGiftShippingGroups

public boolean isRemoveGiftShippingGroups()
Returns:
Boolean indicating whether or not shipping groups in the input map should be returned in the output list

setRemoveGiftShippingGroups

public void setRemoveGiftShippingGroups(boolean pRemoveGiftShippingGroups)
Parameters:
pRemoveGiftShippingGroups - Set the removeShippingGroups flag

getGiftlistManager

public StoreGiftlistManager getGiftlistManager()
Returns:
The GiftlistManager component

setGiftlistManager

public void setGiftlistManager(StoreGiftlistManager pGiftlistManager)
Parameters:
Set - a new GiftlistManager

service

public void service(atg.servlet.DynamoHttpServletRequest pRequest,
                    atg.servlet.DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
See the class documentation above.

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.

getCountryCode

protected java.lang.String getCountryCode(atg.commerce.order.ShippingGroup pShippingGroup)
Returns country code for the given item. For the AvailableShippingGroups pItem.value is of type HardgoodShippingGroup

Parameters:
map - entry item that contains country
Returns:
country code associated with the pItem

getSortedArray

public java.lang.Object[] getSortedArray(java.util.Map pMap,
                                         java.lang.String pDefaultKey,
                                         boolean pSortByKeys)
Converts the map to the array of map entries with the default one in the beginning of the array. If pSortByKeys boolean is true then map entries are sorted by keys.

Parameters:
pMap - - the map to convert to the sorted array
pDefaultKey - - the map key that corresponds to the default item
pSortByKeys - - boolean that specifies whether to sort items by keys or not
Returns:
Object[] sorted array of items

getSortedAddressList

public java.lang.Object[] getSortedAddressList(java.lang.String pDefaultKey,
                                               java.lang.String pSortByKeysParameter,
                                               java.util.Map pMap)
This method converts a map of items to a sorted array of map entries with the default item in the beginning of the array. The default item is specified through defaultKey parameter that is the map key that corresponds to the default item. The method is used to sort shipping addresses so that the default address is displayed as the first item on the JSP

Parameters:
pDefaultKey - defines the map key of the default item that should be placed in the beginning of the array.
pSortByKeysParameter - is set to true then the returning array will be sorted by keys otherwise an unsorted array will be returned. In the case of a null map, the returning array would be null.
pMap - defines the map of items to convert to the sorted array.
Returns:
Object[] sorted array of addresses