public class StartEndDateFilter extends CachedCollectionFilter
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION |
protected java.lang.String |
mEndDatePropertyName |
protected java.lang.String |
mStartDatePropertyName |
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 |
---|
StartEndDateFilter() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
generateContextKey(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
Generates a context key.
|
protected java.util.Collection |
generateFilteredCollection(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
Generates a filtered collection based on the start and end date properties.
|
CurrentDate |
getCurrentDate()
get CurrentDate
|
protected java.util.Date |
getDatePropertyFromObject(java.lang.Object pObject,
java.lang.String pDatePropertyName)
This method is called by generateFilteredCollection to extract the
value from a date property using DynamicBeans.getPropertyValue(pObject,pDatePropertyName)
|
java.lang.String |
getEndDatePropertyName()
Returns the property name used to get the end date
|
java.lang.String |
getStartDatePropertyName()
Returns the property name used to get the start date
|
void |
setCurrentDate(CurrentDate pCurrentDate)
set CurrentDate
|
void |
setEndDatePropertyName(java.lang.String pEndDatePropertyName)
Sets the property name used to get the end date
|
void |
setStartDatePropertyName(java.lang.String pStartDatePropertyName)
Sets the property name used to get the start date
|
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, 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 java.lang.String mStartDatePropertyName
protected java.lang.String mEndDatePropertyName
public void setCurrentDate(CurrentDate pCurrentDate)
pCurrentDate
- the CurrentDatepublic CurrentDate getCurrentDate()
public void setStartDatePropertyName(java.lang.String pStartDatePropertyName)
public java.lang.String getStartDatePropertyName()
public void setEndDatePropertyName(java.lang.String pEndDatePropertyName)
public java.lang.String getEndDatePropertyName()
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.Date getDatePropertyFromObject(java.lang.Object pObject, java.lang.String pDatePropertyName)
If the date property does not exist or it is not a type of Date, then null is returned.
Extend this method if the date property is not of type java.util.Date, such as a string, and convert the property value to an appropriate Date object.
protected java.util.Collection generateFilteredCollection(java.util.Collection pUnfilteredCollection, java.lang.String pCollectionIdentifierKey, RepositoryItem pProfile) throws FilterException
All objects in the collection are expected to have a start and end date property.
Objects that have a startDate less than or equal to the current date, and an endDate greater than or equal to the current date are added to the filter collection.
A null startDate or missing startDate property is considered to be always started
A null endDate or missing endDate property is considered to be never ending.
A startDate and/or endDate property that is not of type java.util.Date is considered to be always started or never ending respectively. This behavior can be changed by overriding getDatePropertyFromObject 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
getDatePropertyFromObject(java.lang.Object, java.lang.String)