atg.commerce.collections.filter
Class InventoryFilter

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.service.collections.filter.CachedCollectionFilter
              extended by atg.commerce.collections.filter.InventoryFilter
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class InventoryFilter
extends atg.service.collections.filter.CachedCollectionFilter

This filter will filter products in the collection based on their inventory availability.

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.

See Also:
InventoryManager

Field Summary
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
           
 
Fields inherited from class atg.service.collections.filter.CachedCollectionFilter
FILTER_CACHE_COMPONENT, mCache, mCacheEnabled
 
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
InventoryFilter()
           
 
Method Summary
 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)
           
 
Methods inherited from class atg.service.collections.filter.CachedCollectionFilter
dumpCache, filterCollection, filterCollection, flushCache, generateCacheKey, generateNewCollectionObject, getCache, getDefaultProfile, isCacheEnabled, setCache, setCacheEnabled, stringIt
 
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 final java.lang.String CLASS_VERSION
See Also:
Constant Field Values

mIncludeInventoryStates

protected java.lang.Integer[] mIncludeInventoryStates
Sets the array of possible inventory states that mean a sku is considered available.


mInventoryManager

protected InventoryManager mInventoryManager

mCatalogTools

protected CatalogTools mCatalogTools

mCatalogServices

protected CatalogServices mCatalogServices
Constructor Detail

InventoryFilter

public InventoryFilter()
Method Detail

setIncludeInventoryStates

public void setIncludeInventoryStates(java.lang.Integer[] pIncludeInventoryStates)

getIncludeInventoryStates

public java.lang.Integer[] getIncludeInventoryStates()
Returns the array of possible inventory states that mean a sku is considered available.

See the InventoryManager javadoc for all valid inventory states.

See Also:
InventoryManager

setInventoryManager

public void setInventoryManager(InventoryManager pInventoryManager)
Sets the InventoryManager


getInventoryManager

public InventoryManager getInventoryManager()
Returns the InventoryMananager


setCatalogTools

public void setCatalogTools(CatalogTools pCatalogTools)
Sets the CatalogTools


getCatalogTools

public CatalogTools getCatalogTools()
Returns the CatalogTools


setCatalogServices

public void setCatalogServices(CatalogServices pCatalogServices)
Sets the CatalogServices


getCatalogServices

public CatalogServices getCatalogServices()
Returns the CatalogServices


shouldApplyFilter

public boolean shouldApplyFilter(java.util.Collection pUnfilteredCollection,
                                 java.lang.String pKey,
                                 RepositoryItem pProfile)
Specified by:
shouldApplyFilter in class atg.service.collections.filter.CachedCollectionFilter
Returns:
true by default
See Also:
CachedCollectionFilter.shouldApplyFilter(java.util.Collection, java.lang.String, atg.repository.RepositoryItem)

generateContextKey

public java.lang.Object generateContextKey(java.util.Collection pUnfilteredCollection,
                                           java.lang.String pCollectionIdentifierKey,
                                           RepositoryItem pProfile)
This filter does not produce a context key.

Specified by:
generateContextKey in class atg.service.collections.filter.CachedCollectionFilter
Returns:
null. This implementation of the InventoryFilter does not use a context key.

generateFilteredCollection

protected java.util.Collection generateFilteredCollection(java.util.Collection pUnfilteredCollection,
                                                          java.lang.String pCollectionIdentifierKey,
                                                          RepositoryItem pProfile)
                                                   throws atg.service.collections.filter.FilterException
Generates a filtered collection based on Inventory availabilty.

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.

Specified by:
generateFilteredCollection in class atg.service.collections.filter.CachedCollectionFilter
Parameters:
pUnfilteredCollection - the unfiltered collection
pCollectionIdentifierKey - the key provided by the caller.
Returns:
the filtered collection
Throws:
atg.service.collections.filter.FilterException