atg.commerce.order.purchase
Class ApplicableShippingGroups

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.order.purchase.ApplicableShippingGroups
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 ApplicableShippingGroups
extends atg.servlet.DynamoServlet

This droplet is used to serve applicable shipping groups and shipping group types for a commerce item or an order.

This droplet should be used in conjunction with ShippingGroupDroplet. The ShippingGroupDroplet is used to initialize the list of available shipping groups in the ShippingGroupMapContainer. If the ShippingGroupMapContainer is not initialized, this droplet will not serve any shipping groups.

Shipping group types are determined based on the fulfiller property in the skus referred to by the CommerceItem.catalogRefId property. If a sku's fulfiller property is not filled in, a shipping group type supported by OrderFulfillmentTools.defaultFulfiller (HardgoodFulfiller by default) is used.

This droplet takes in commerce item or order as optional input parameters.

The parameters to the ApplicableShippingGroups droplet are:

commerceItem
If this optional input parameter is passed in, the applicable shipping group types and shipping groups for this commerce item parameter is served in the output oparam.
order
If this optional input parameter is passed in, the applicable two sets of shipping group types, shipping groups and common shipping group name are served in output oparam. One list contains all the types for all the items in the order (the union of types). The other list contains only the types that are common to the items in the order (the intersection of types).
cisiContainer
This is an optional parameter. Either this parameter needs to be passed in as input parameter or you need to configure the right path in the property file. If you want to configure the property file you need to update commerceItemShippingInfoContainerPath property.
sgMapContainer
This is an optional parameter. Either this parameter needs to be passed in as input parameter or you need to configure the right path in the property file. If you want to configure the property file you need to update shippingGroupMapContainerPath property.
output
This oparam is always rendered.
shippingGroups
This parameter is served for both input parameters such as order and commerceItem. This parameter served as a Map and it contains all applicable shipping groups for an item or an order. Even though the ShippingGroupMapContainer contains the super set of all shipping groups, only valid shipping groups for the commerce item or order are returned.If a shipping group is not valid or not supported by the commerce item or order, that shipping group is not included.
allShippingGroupTypes
This parameter is served for both input parameters such as order and commerceItem. This parameter contains the list of all shipping group types for an item or order. This parameter does not generated from the ShippingGroupMapContainer and this is generated based on the order or commerceItem. See ShippingGroupManager.getShippingGroupTypes(Order) or ShippingGroupManager.getShippingGroupTypes(String, String, CommerceItem) for more information
commonShippingGroupTypes
If the order is passed in this parameter is served. This parameter contains the list is all common shipping group types for each commerce item in the order. This parameter does not generated from the ShippingGroupMapContainer and this is generated based on the order. See ShippingGroupManager.getCommonShippingGroupTypes(Order) for more information
commonShippingGroupName
If the order is passed in, this parameter is served. This parameter contains the common shipping group name. If all commerce items in the order is pointing to the same shipping group name, then this parameter is set with that shipping group name. If all the commerce items are not pointing to the same shipping group name, then this parameter is empty. If all the CommerceItemShippingInfo's in the ShippingGroupMapContainerService is using the same shipping group name, then that is considered as common shipping group name.

See Also:
This droplet initializes ShippingGroupMapContainer

Field Summary
static java.lang.String ALL_SHIPPING_GROUP_TYPES
           
static atg.nucleus.naming.ParameterName CISI_CONTAINER
           
static java.lang.String CLASS_VERSION
           
static atg.nucleus.naming.ParameterName COMMERCE_ITEM
           
static java.lang.String COMMON_SHIPPING_GROUP_NAME
           
static java.lang.String COMMON_SHIPPING_GROUP_TYPES
           
protected  java.lang.String mCommerceItemShippingInfoContainerPath
           
protected  atg.commerce.order.ShippingGroupManager mShippingGroupManager
           
protected  java.lang.String mShippingGroupMapContainerPath
           
static atg.nucleus.naming.ParameterName ORDER
           
static atg.nucleus.naming.ParameterName OUTPUT
           
static atg.nucleus.naming.ParameterName SG_MAP_CONTAINER
           
static java.lang.String SHIPPING_GROUPS
           
 
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
ApplicableShippingGroups()
           
 
Method Summary
 java.util.Map<java.lang.String,atg.commerce.order.ShippingGroup> findApplicableShippingGroups(java.util.Collection<java.lang.String> pShippingGroupTypes, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
          The ShippingGroupMapContainer contains all shipping group type shipping groups.
 java.lang.String findCommonApplicableShippingGroupName(java.util.Collection<java.lang.String> pShippingGroupTypes, atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer, atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer)
          This method finds whether all the commerce items in the order are pointing to the same applicable shipping group name and returns the common applicable shipping group name.
protected  atg.commerce.order.CommerceItem getCommerceItem(atg.servlet.DynamoHttpServletRequest pRequest)
          This method gets the CommerceItem from the request.
protected  atg.commerce.order.purchase.CommerceItemShippingInfoContainer getCommerceItemShippingInfoContainer(atg.servlet.DynamoHttpServletRequest pRequest)
          This method gets the CommerceItemShippingInfoContainer from the request.
 java.lang.String getCommerceItemShippingInfoContainerPath()
          Returns the commerceItemShippingInfoContainerPath
protected  atg.commerce.order.Order getOrder(atg.servlet.DynamoHttpServletRequest pRequest)
          This method gets the Order from the request.
 atg.commerce.order.ShippingGroupManager getShippingGroupManager()
          Returns the shippingGroupManager
protected  atg.commerce.order.purchase.ShippingGroupMapContainer getShippingGroupMapContainer(atg.servlet.DynamoHttpServletRequest pRequest)
          This method gets the ShippingGroupMapContainer from the request.
 java.lang.String getShippingGroupMapContainerPath()
          Returns the shippingGroupMapContainerPath
protected  boolean isValidShippingGroup(atg.commerce.order.ShippingGroup pShippingGroup)
          This method uses ShippingGroupPropertyContainer.arePropertiesEmpty() to check for the shipping group's emptiness or validity.
 void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          This method serves the output oparam.
 void setCommerceItemShippingInfoContainerPath(java.lang.String pCommerceItemShippingInfoContainerPath)
          Sets the commerceItemShippingInfoContainerPath
 void setShippingGroupManager(atg.commerce.order.ShippingGroupManager pShippingGroupManager)
          Sets the shippingGroupManager
 void setShippingGroupMapContainerPath(java.lang.String pShippingGroupMapContainerPath)
          Sets the shippingGroupMapContainerPath
 
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

ORDER

public static final atg.nucleus.naming.ParameterName ORDER

COMMERCE_ITEM

public static final atg.nucleus.naming.ParameterName COMMERCE_ITEM

CISI_CONTAINER

public static final atg.nucleus.naming.ParameterName CISI_CONTAINER

SG_MAP_CONTAINER

public static final atg.nucleus.naming.ParameterName SG_MAP_CONTAINER

OUTPUT

public static final atg.nucleus.naming.ParameterName OUTPUT

COMMON_SHIPPING_GROUP_NAME

public static final java.lang.String COMMON_SHIPPING_GROUP_NAME
See Also:
Constant Field Values

COMMON_SHIPPING_GROUP_TYPES

public static final java.lang.String COMMON_SHIPPING_GROUP_TYPES
See Also:
Constant Field Values

SHIPPING_GROUPS

public static final java.lang.String SHIPPING_GROUPS
See Also:
Constant Field Values

ALL_SHIPPING_GROUP_TYPES

public static final java.lang.String ALL_SHIPPING_GROUP_TYPES
See Also:
Constant Field Values

mShippingGroupManager

protected atg.commerce.order.ShippingGroupManager mShippingGroupManager

mCommerceItemShippingInfoContainerPath

protected java.lang.String mCommerceItemShippingInfoContainerPath

mShippingGroupMapContainerPath

protected java.lang.String mShippingGroupMapContainerPath
Constructor Detail

ApplicableShippingGroups

public ApplicableShippingGroups()
Method Detail

getShippingGroupManager

public atg.commerce.order.ShippingGroupManager getShippingGroupManager()
Returns the shippingGroupManager

Returns:
the shippingGroupManager

setShippingGroupManager

public void setShippingGroupManager(atg.commerce.order.ShippingGroupManager pShippingGroupManager)
Sets the shippingGroupManager

Parameters:
pShippingGroupManager - the shippingGroupManager to set

getCommerceItemShippingInfoContainerPath

public java.lang.String getCommerceItemShippingInfoContainerPath()
Returns the commerceItemShippingInfoContainerPath

Returns:
the commerceItemShippingInfoContainerPath

setCommerceItemShippingInfoContainerPath

public void setCommerceItemShippingInfoContainerPath(java.lang.String pCommerceItemShippingInfoContainerPath)
Sets the commerceItemShippingInfoContainerPath

Parameters:
pCommerceItemShippingInfoContainerPath - the commerceItemShippingInfoContainerPath to set

getShippingGroupMapContainerPath

public java.lang.String getShippingGroupMapContainerPath()
Returns the shippingGroupMapContainerPath

Returns:
the shippingGroupMapContainerPath

setShippingGroupMapContainerPath

public void setShippingGroupMapContainerPath(java.lang.String pShippingGroupMapContainerPath)
Sets the shippingGroupMapContainerPath

Parameters:
pShippingGroupMapContainerPath - the shippingGroupMapContainerPath to set

service

public void service(atg.servlet.DynamoHttpServletRequest pRequest,
                    atg.servlet.DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
This method serves the output oparam.

Overrides:
service in class atg.servlet.DynamoServlet
Parameters:
pRequest -
pResponse -
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
ShippingGroupManager.getShippingGroupTypes(String, String, CommerceItem), ShippingGroupManager.getShippingGroupTypes(Order), ShippingGroupManager.getCommonShippingGroupTypes(Order)

findApplicableShippingGroups

public java.util.Map<java.lang.String,atg.commerce.order.ShippingGroup> findApplicableShippingGroups(java.util.Collection<java.lang.String> pShippingGroupTypes,
                                                                                                     atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer)
The ShippingGroupMapContainer contains all shipping group type shipping groups. This container is initialized by ShippingGroupDroplet. This method filters only desired shipping groups. This method walks through all the shipping groups in the ShippingGroupMapContainer and eliminates undesired shipping group types and invalid shipping groups.

Parameters:
pShippingGroupTypes - A list of desired shipping group types.
pShippingGroupMapContainer - The container which contains all the shipping groups
Returns:
Map

isValidShippingGroup

protected boolean isValidShippingGroup(atg.commerce.order.ShippingGroup pShippingGroup)
This method uses ShippingGroupPropertyContainer.arePropertiesEmpty() to check for the shipping group's emptiness or validity. If the shipping group has any information, then the shipping group is valid. otherwise the shipping group is invalid. If the pShippingGroup does not implement ShippingGroupPropertyContainer interface, you need to over ride this method to support custom shipping groups. If the pShippingGroup does not implement ShippingGroupPropertyContainer interface, then this method logs the error and considers as invalid shipping group.

Parameters:
pShippingGroup - The shipping group needs to be validated.
Returns:
if the shipping group is valid returns true, false otherwise.

findCommonApplicableShippingGroupName

public java.lang.String findCommonApplicableShippingGroupName(java.util.Collection<java.lang.String> pShippingGroupTypes,
                                                              atg.commerce.order.purchase.ShippingGroupMapContainer pShippingGroupMapContainer,
                                                              atg.commerce.order.purchase.CommerceItemShippingInfoContainer pCommerceItemShippingInfoContainer)
This method finds whether all the commerce items in the order are pointing to the same applicable shipping group name and returns the common applicable shipping group name. The following is the criteria to select a common applicable shipping group name: First all the commerce items should be shipped to same shipping group. If all the commerce items are shipped to the same shipping group, then that shipping group should be valid and it should should be one of the order's commonly supported shipping group type.

Parameters:
pShippingGroupTypes - A list of order's common shipping group types. All the commerce items could be shipped to any of the shipping group type.
pShippingGroupMapContainer - The container which contains shipping groups
pCommerceItemShippingInfoContainer - The container which contains CommerceItemShippingInfo.
Returns:
The common applicable shipping group name

getOrder

protected atg.commerce.order.Order getOrder(atg.servlet.DynamoHttpServletRequest pRequest)
This method gets the Order from the request.

Returns:
an Order value

getCommerceItem

protected atg.commerce.order.CommerceItem getCommerceItem(atg.servlet.DynamoHttpServletRequest pRequest)
This method gets the CommerceItem from the request.

Returns:
an CommerceItem value

getCommerceItemShippingInfoContainer

protected atg.commerce.order.purchase.CommerceItemShippingInfoContainer getCommerceItemShippingInfoContainer(atg.servlet.DynamoHttpServletRequest pRequest)
This method gets the CommerceItemShippingInfoContainer from the request.

Returns:
an CommerceItemShippingInfoContainer value

getShippingGroupMapContainer

protected atg.commerce.order.purchase.ShippingGroupMapContainer getShippingGroupMapContainer(atg.servlet.DynamoHttpServletRequest pRequest)
This method gets the ShippingGroupMapContainer from the request.

Returns:
an ShippingGroupMapContainer value