public class PriceAndStateFilter extends CachedCollectionFilter
The objective of this filter is to create a filtered collection of products for users with a registered home state of X, that includes only the products with a price less than or equal to Y. X and Y are configurable values of the filter.
This filter assumes that a standard catalog configuration is being used which has the list price maintained as a property of the sku item. A product qualifies for the filtered collection if any of its skus pass the price test, or if the product does not have a sku.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
protected CatalogServices |
mCatalogServices |
protected CatalogTools |
mCatalogTools |
protected java.lang.String |
mListPricePropertyName |
protected java.lang.Double |
mPrice |
protected java.lang.String |
mState |
protected java.lang.String |
mStatePropertyName |
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 |
---|
PriceAndStateFilter() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
generateContextKey(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
Generates a context key for this filter.
|
protected java.util.Collection |
generateFilteredCollection(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
Generates a filtered collection based on the registered home state of the user and
the price of each product in the collection.
|
CatalogServices |
getCatalogServices()
Returns the CatalogServices
|
CatalogTools |
getCatalogTools()
Returns the CatalogTools
|
java.lang.String |
getListPricePropertyName()
Returns the property name used to store the list price on the sku
|
java.lang.Double |
getPrice()
Returns the threshold price
|
java.lang.String |
getState()
Returns the home state that applies to this filter
|
java.lang.String |
getStatePropertyName()
Returns the property name used to get the user's home state
|
void |
setCatalogServices(CatalogServices pCatalogServices)
Sets the CatalogServices
|
void |
setCatalogTools(CatalogTools pCatalogTools)
Sets the CatalogTools
|
void |
setListPricePropertyName(java.lang.String pListPricePropertyName)
Sets the property name used to store the list price on the sku
|
void |
setPrice(java.lang.Double pPrice)
Sets the threshold price
|
void |
setState(java.lang.String pState)
Sets the home state that applies to this filter
|
void |
setStatePropertyName(java.lang.String pStatePropertyName)
Sets the property name used to get the user's home state
|
boolean |
shouldApplyFilter(java.util.Collection pUnfilteredCollection,
java.lang.String pKey,
RepositoryItem pProfile)
If the filter is executed for a user that is not registered in the same
home state as the filter's configured home state, then this method
will return false.
|
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, toString
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 CatalogServices mCatalogServices
protected java.lang.String mListPricePropertyName
protected java.lang.String mStatePropertyName
protected java.lang.String mState
protected java.lang.Double mPrice
protected CatalogTools mCatalogTools
public void setCatalogServices(CatalogServices pCatalogServices)
public CatalogServices getCatalogServices()
public void setListPricePropertyName(java.lang.String pListPricePropertyName)
public java.lang.String getListPricePropertyName()
public void setStatePropertyName(java.lang.String pStatePropertyName)
public java.lang.String getStatePropertyName()
public void setState(java.lang.String pState)
public java.lang.String getState()
public void setPrice(java.lang.Double pPrice)
public java.lang.Double getPrice()
public void setCatalogTools(CatalogTools pCatalogTools)
public CatalogTools getCatalogTools()
public java.lang.Object generateContextKey(java.util.Collection pUnfilteredCollection, java.lang.String pCollectionIdentifierKey, RepositoryItem pProfile)
generateContextKey
in class CachedCollectionFilter
pUnfilteredCollection
- the collection to be filteredpCollectionIdentifierKey
- the key that uniquely identifies the unfiltered collection.public boolean shouldApplyFilter(java.util.Collection pUnfilteredCollection, java.lang.String pKey, RepositoryItem pProfile)
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)
protected java.util.Collection generateFilteredCollection(java.util.Collection pUnfilteredCollection, java.lang.String pCollectionIdentifierKey, RepositoryItem pProfile) throws FilterException
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 the uniquely identifies the unfiltered collection.pProfile
- Repository itemFilterException