public class InventoryFilter extends CachedCollectionFilter
The availability state for each sku is checked against the InventoryManager. If any of a product's skus are considered available, the product is considered available and is added to the filtered results.
The inventory states that mean a sku is available are configurable using the inclludeInventoryStates property. See the InventoryManager for valid states.
The InventoryFilter cache should be disabled if your Inventory Manager is already caching inventory status information.
InventoryManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
protected CatalogServices |
mCatalogServices |
protected CatalogTools |
mCatalogTools |
protected java.lang.Integer[] |
mIncludeInventoryStates
Sets the array of possible inventory states that mean a sku
is considered available.
|
protected InventoryManager |
mInventoryManager |
FILTER_CACHE_COMPONENT, mCache, mCacheEnabled
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 |
---|
InventoryFilter() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
generateContextKey(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
This filter does not produce a context key.
|
protected java.util.Collection |
generateFilteredCollection(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
Generates a filtered collection based on Inventory availabilty.
|
CatalogServices |
getCatalogServices()
Returns the CatalogServices
|
CatalogTools |
getCatalogTools()
Returns the CatalogTools
|
java.lang.Integer[] |
getIncludeInventoryStates()
Returns the array of possible inventory states that mean a sku
is considered available.
|
InventoryManager |
getInventoryManager()
Returns the InventoryMananager
|
void |
setCatalogServices(CatalogServices pCatalogServices)
Sets the CatalogServices
|
void |
setCatalogTools(CatalogTools pCatalogTools)
Sets the CatalogTools
|
void |
setIncludeInventoryStates(java.lang.Integer[] pIncludeInventoryStates) |
void |
setInventoryManager(InventoryManager pInventoryManager)
Sets the InventoryManager
|
boolean |
shouldApplyFilter(java.util.Collection pUnfilteredCollection,
java.lang.String pKey,
RepositoryItem pProfile)
This method is called by filterCollection prior to looking up the filtered collection in the
cache or generating a new filtered collection.
|
dumpCache, filterCollection, filterCollection, filterCollection, filterCollection, flushCache, generateCacheKey, generateCacheKey, generateContextKey, generateFilteredCollection, generateNewCollectionObject, getCache, getDefaultProfile, isCacheEnabled, setCache, setCacheEnabled, shouldApplyFilter, stringIt
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 static final java.lang.String CLASS_VERSION
protected java.lang.Integer[] mIncludeInventoryStates
protected InventoryManager mInventoryManager
protected CatalogTools mCatalogTools
protected CatalogServices mCatalogServices
public void setIncludeInventoryStates(java.lang.Integer[] pIncludeInventoryStates)
public java.lang.Integer[] getIncludeInventoryStates()
See the InventoryManager javadoc for all valid inventory states.
InventoryManager
public void setInventoryManager(InventoryManager pInventoryManager)
public InventoryManager getInventoryManager()
public void setCatalogTools(CatalogTools pCatalogTools)
public CatalogTools getCatalogTools()
public void setCatalogServices(CatalogServices pCatalogServices)
public CatalogServices getCatalogServices()
public boolean shouldApplyFilter(java.util.Collection pUnfilteredCollection, java.lang.String pKey, RepositoryItem pProfile)
CachedCollectionFilter
shouldApplyFilter
in class CachedCollectionFilter
pUnfilteredCollection
- the unfiltered collectionpKey
- the key param as passed to filterCollectionpProfile
- the user profileCachedCollectionFilter.shouldApplyFilter(java.util.Collection, java.lang.String, atg.repository.RepositoryItem)
public java.lang.Object generateContextKey(java.util.Collection pUnfilteredCollection, java.lang.String pCollectionIdentifierKey, RepositoryItem pProfile)
generateContextKey
in class CachedCollectionFilter
protected java.util.Collection generateFilteredCollection(java.util.Collection pUnfilteredCollection, java.lang.String pCollectionIdentifierKey, RepositoryItem pProfile) throws FilterException
A product is included in the filtered collection if it does not contain any skus, or any of its skus is considered available.
The availabilty state of the sku must be one of the preconfigured include states.
If the new filtered collection is the same size as the unfiltered collection, the filtered collection is disgarded and the unfiltered collection is returned.
generateFilteredCollection
in class CachedCollectionFilter
pUnfilteredCollection
- the unfiltered collectionpCollectionIdentifierKey
- the key provided by the caller.pProfile
- Repository itemFilterException