|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.service.collections.filter.CachedCollectionFilter atg.commerce.collections.filter.PriceAndStateFilter
public class PriceAndStateFilter
This filter demonstrates how someone might implement a filter based on profile attributes.
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.
Field Summary | |
---|---|
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
|
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 | |
---|---|
PriceAndStateFilter()
|
Method Summary | |
---|---|
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. |
Methods inherited from class atg.service.collections.filter.CachedCollectionFilter |
---|
dumpCache, filterCollection, filterCollection, filterCollection, filterCollection, flushCache, generateCacheKey, generateCacheKey, generateContextKey, generateFilteredCollection, generateNewCollectionObject, getCache, getDefaultProfile, isCacheEnabled, setCache, setCacheEnabled, shouldApplyFilter, stringIt |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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 |
---|
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
Constructor Detail |
---|
public PriceAndStateFilter()
Method Detail |
---|
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 profile
CachedCollectionFilter.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 item
FilterException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |