public class InventoryDroplet extends DynamoServlet
/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 the default InventoryManager
to use when the servlet is invoked. By default this value is true. This can be overrode
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.
Setting filterOutOfStock will allow results to be filtered to only return results that are in stock.
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:
InventoryManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
mAllowCleanupRequest, mParameters
SERVLET_INFO_KEY
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
InventoryDroplet()
Constructs an instanceof InventoryDroplet
|
Modifier and Type | Method and Description |
---|---|
protected InventoryInfo |
createInventoryInfo(java.lang.String pInventoryId,
java.lang.String pLocationId,
InventoryManager pInventoryManager,
ApplicationLogging pLogging)
Create a new InventoryInfo object
|
protected java.util.Collection<InventoryInfo> |
filterOutOfStockInventoryItems(java.util.Collection<InventoryInfo> pInfos)
Filters out 'out of stock' items from collection
|
protected java.util.Collection<InventoryInfo> |
getBatchInfo(java.util.Collection<java.lang.String> pInventoryIds,
java.util.Collection<java.lang.String> pLocationIds,
InventoryManager pInventoryManager,
boolean pFilterOutOfStock)
Gets multiple inventory info messages in a single call if possible
|
protected java.util.Collection<InventoryInfo> |
getBatchInfo(java.util.Collection<java.lang.String> pInventoryIds,
java.lang.String pLocationId,
InventoryManager pInventoryManager,
boolean pFilterOutOfStock)
Gets multiple inventory info messages in a single call if possible
|
protected java.util.Collection<InventoryInfo> |
getBatchInfo(java.lang.String pInventoryId,
java.util.Collection<java.lang.String> pLocationIds,
InventoryManager pInventoryManager,
boolean pFilterOutOfStock)
Gets multiple inventory info messages in a single call if possible
|
InventoryManager |
getCachingInventoryManager()
Returns property CachingInventoryManager
|
protected InventoryInfo |
getInventoryInfo(java.lang.String pInventoryId,
java.lang.String pLocationId,
InventoryManager pInventoryManager,
boolean pFilterOutOfStock)
Gets an inventory info record for a given id and location.
|
InventoryManager |
getInventoryManager()
Returns property InventoryManager
|
boolean |
isLogMissingInventoryExceptionsAsError()
Return the logMissingInventoryExceptionsAsError property.
|
boolean |
isUseCache()
Returns property UseCache
|
boolean |
isUseLocalizedResourceStrings()
If this is true, then availability status messages are localized.
|
void |
service(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
This method provides the default implementation of service,
by dispatching to conventionally named methods which begin
with "do".
|
void |
setCachingInventoryManager(InventoryManager pCachingInventoryManager)
Sets property CachingInventoryManager
|
void |
setInventoryManager(InventoryManager pInventoryManager)
Sets property InventoryManager
|
void |
setLogMissingInventoryExceptionsAsError(boolean pLogMissingInventoryExceptionsAsError)
Set the logMissingInventoryExceptionsAsError property.
|
void |
setUseCache(boolean pUseCache)
Sets property UseCache
|
void |
setUseLocalizedResourceStrings(boolean pUseLocalizedResourceStrings) |
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, init, service, service, setParameter
destroy, getServletConfig, getServletInfo, setServletInfo
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
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
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public InventoryDroplet()
public void setLogMissingInventoryExceptionsAsError(boolean pLogMissingInventoryExceptionsAsError)
public boolean isLogMissingInventoryExceptionsAsError()
public void setUseCache(boolean pUseCache)
public boolean isUseCache()
public void setCachingInventoryManager(InventoryManager pCachingInventoryManager)
public InventoryManager getCachingInventoryManager()
public void setInventoryManager(InventoryManager pInventoryManager)
public InventoryManager getInventoryManager()
public void setUseLocalizedResourceStrings(boolean pUseLocalizedResourceStrings)
public boolean isUseLocalizedResourceStrings()
public void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
DynamoServlet
service
in class DynamoServlet
pRequest
- the request to be processedpResponse
- the response object for this requestjavax.servlet.ServletException
- an application specific error occurred
processing this requestjava.io.IOException
- an error occurred reading data from the request
or writing data to the response.protected java.util.Collection<InventoryInfo> getBatchInfo(java.util.Collection<java.lang.String> pInventoryIds, java.lang.String pLocationId, InventoryManager pInventoryManager, boolean pFilterOutOfStock) throws InventoryException
pInventoryIds
- The Inventory Ids to retrievepLocationId
- the location of the inventorypInventoryManager
- the managerpFilterOutOfStock
- filter out items in "out of stock" stateInventoryException
protected java.util.Collection<InventoryInfo> getBatchInfo(java.lang.String pInventoryId, java.util.Collection<java.lang.String> pLocationIds, InventoryManager pInventoryManager, boolean pFilterOutOfStock) throws InventoryException
pInventoryId
- The Inventory Id to retrievepLocationIds
- the locations of the inventorypInventoryManager
- the managerpFilterOutOfStock
- filter out items in "out of stock" stateInventoryException
protected java.util.Collection<InventoryInfo> getBatchInfo(java.util.Collection<java.lang.String> pInventoryIds, java.util.Collection<java.lang.String> pLocationIds, InventoryManager pInventoryManager, boolean pFilterOutOfStock) throws InventoryException
pInventoryIds
- The Inventory Ids to retrievepLocationIds
- the locations of the inventorypInventoryManager
- the managerpFilterOutOfStock
- filter out items in "out of stock" stateInventoryException
protected InventoryInfo getInventoryInfo(java.lang.String pInventoryId, java.lang.String pLocationId, InventoryManager pInventoryManager, boolean pFilterOutOfStock) throws InventoryException
pInventoryIds
- The Inventory Ids to retrievepLocationIds
- the locations of the inventorypInventoryManager
- the managerpFilterOutOfStock
- filter out items in "out of stock" stateInventoryException
protected InventoryInfo createInventoryInfo(java.lang.String pInventoryId, java.lang.String pLocationId, InventoryManager pInventoryManager, ApplicationLogging pLogging)
protected java.util.Collection<InventoryInfo> filterOutOfStockInventoryItems(java.util.Collection<InventoryInfo> pInfos)
pInfos
- collection of InventoryInfo objects to be filtered