atg.commerce.inventory
Class LocalizingInventoryDroplet

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.inventory.InventoryDroplet
                              extended by atg.commerce.inventory.LocalizingInventoryDroplet
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 LocalizingInventoryDroplet
extends InventoryDroplet

This Dynamo Servlet Bean is an interface into the Inventory management services. A single global instance is defined with the Nucleus name /atg/commerce/inventory/InventoryLookup. This service is intended to be configured with both a caching and non-caching InventoryManager. Therefore with this one service a developer can easily show both cached and uncached inventory information. The useCache property defines which InventoryManager (caching or non-caching) to use when the servlet is invoked. By default this value is true. This can be overridden by setting the servlet param useCache to true or false.

This servlet requires a single parameter to be set, itemId. This should be the identifier that will be passed through to the InventoryManager services. Typically this would be a SKU id.

InventoryManagers are configured using an LocalizingInventoryManager component, where localized inventory repositories can be also be defined, along with locale maps.

An optional parameter, localeKey, specifies the locale; (if unspecifed, the default is request.RequestLocale.locale). This indicates which InventoryManager (and hence which inventory repository) to use, based on the maps specified on the LocalizingInventoryManager component.

Using this id the servlet uses an InventoryManager to set an inventory information object that includes several properties. It is inside the output oparam. The parameters are as follows:

inventoryInfo
An information object that includes property values for the inventory item with the given id.
inventoryInfo.availabilityStatus
A numeric status code that defines the current inventory state/ The Dynamo inventory system defines the following codes:
  • 1000 constant InventoryManager.AVAILABILITY_STATUS_IN_STOCK -> In Stock
  • 1001 constant InventoryManager.AVAILABILITY_STATUS_OUT_OF_STOCK -> Out of Stock
  • 1002 constant InventoryManager.AVAILABILITY_STATUS_PREORDERABLE -> Preorderable
  • 1003 constant InventoryManager.AVAILABILITY_STATUS_BACKORDERABLE -> Backorderable
inventoryInfo.availabilityStatusMsg
A texual representation that maps to the numeric availabilityStatus code. By default this mapping is as follows:
  • 1000 -> "INSTOCK"
  • 1001 -> "OUTOFSTOCK"
  • 1002 -> "PREORDERABLE"
  • 1003 -> "BACKORDERABLE"
inventoryInfo.availabilityDate
If the product is not in stock, then this indicates a date when the item will be available
inventoryInfo.stockLevel
The total number of units that are currently in stock for the item
inventoryInfo.preorderLevel
The total number of units that are available for preorder
inventoryInfo.backorderLevel
The total number of units that are available for backorder
inventoryInfo.stockThreshold
The threshold for the stock level.
inventoryInfo.preorderThreshold
The threshold for the preorder level.
inventoryInfo.backorderThreshold
The threshold for the backorder level.
error
Any exception that may have occured while looking up the inventory information

See Also:
LocalizingInventoryManager

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
LocalizingInventoryDroplet()
          Constructs an instanceof LocalizingInventoryDroplet
 
Method Summary
 java.lang.String getDefaultLocale()
          the default locale for which inventory should be retrieved
 LocalizingInventoryManager getLocalizingInventoryManager()
          Return the LocalizingInventoryManager property.
 boolean getUseRequestLocale()
          flag to determine whether to ask for inventory using the locale in the Request object before falling back on the default locale
 boolean isUseRequestLocale()
          Test property UseRequestLocale
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Replacement service method.
 void setDefaultLocale(java.lang.String pDefaultLocale)
          the default locale for which inventory should be retrieved
 void setLocalizingInventoryManager(LocalizingInventoryManager pLocalizingInventoryManager)
          Set the LocalizingInventoryManager property.
 void setUseRequestLocale(boolean pUseRequestLocale)
          flag to determine whether to ask for inventory using the locale in the Request object before falling back on the default locale
 
Methods inherited from class atg.commerce.inventory.InventoryDroplet
getCachingInventoryManager, getInventoryManager, isLogMissingInventoryExceptionsAsError, isUseCache, isUseLocalizedResourceStrings, setCachingInventoryManager, setInventoryManager, setLogMissingInventoryExceptionsAsError, setUseCache, setUseLocalizedResourceStrings
 
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

Constructor Detail

LocalizingInventoryDroplet

public LocalizingInventoryDroplet()
Constructs an instanceof LocalizingInventoryDroplet

Method Detail

setLocalizingInventoryManager

public void setLocalizingInventoryManager(LocalizingInventoryManager pLocalizingInventoryManager)
Set the LocalizingInventoryManager property.


getLocalizingInventoryManager

public LocalizingInventoryManager getLocalizingInventoryManager()
Return the LocalizingInventoryManager property.


setDefaultLocale

public void setDefaultLocale(java.lang.String pDefaultLocale)
the default locale for which inventory should be retrieved

Parameters:
pDefaultLocale - new value to set

getDefaultLocale

public java.lang.String getDefaultLocale()
the default locale for which inventory should be retrieved

Returns:
property DefaultLocale

setUseRequestLocale

public void setUseRequestLocale(boolean pUseRequestLocale)
flag to determine whether to ask for inventory 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 inventory 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
Replacement service method. The only deviations from existing 5.1 functionality are: - extract the LOCALE_KEY parameter value - determine whether to use the default locale - pass the locale key to the parameterized getInventoryManager() and getCachingInventoryManager() methods on the LocalizingInventoryManager object.

Looks for the RepositoryItem in the appropriate inventory repository; if found, binds the inventory info as a parameter. Renders the output oparam in either case.

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