atg.service.collections.filter
Class ValidatorFilter
java.lang.Object
atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.service.collections.filter.CachedCollectionFilter
atg.service.collections.filter.ValidatorFilter
- All Implemented Interfaces:
- atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
public class ValidatorFilter
- extends CachedCollectionFilter
This filter uses a collection of validators to filter objects in the collection. Any
object that fails one or more validations will not be included in the result.
- See Also:
CachedCollectionFilter.isCacheEnabled()
,
generateContextKey(java.util.Collection, java.lang.String, atg.repository.RepositoryItem)
,
generateFilteredCollection(java.util.Collection, java.lang.String, atg.repository.RepositoryItem)
,
CachedCollectionFilter
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging |
DEFAULT_LOG_TRACE_STATUS |
Method Summary |
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)
Called by the filterCollection method to generate the filtered collection. |
CollectionObjectValidator[] |
getValidators()
Returns the array of validators that will be executed in succession to
produce the final filtered results. |
void |
setValidators(CollectionObjectValidator[] pValidators)
Sets the array of validators that will be executed in succession to
produce the final filtered results. |
boolean |
shouldApplyFilter(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
This method is called by filterCollection prior to looking up the filtered collection in the
cache or generating a new filtered collection. |
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.GenericService |
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 |
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 |
CLASS_VERSION
public static final java.lang.String CLASS_VERSION
- See Also:
- Constant Field Values
mValidators
protected CollectionObjectValidator[] mValidators
ValidatorFilter
public ValidatorFilter()
setValidators
public void setValidators(CollectionObjectValidator[] pValidators)
- Sets the array of validators that will be executed in succession to
produce the final filtered results.
getValidators
public CollectionObjectValidator[] getValidators()
- Returns the array of validators that will be executed in succession to
produce the final filtered results.
generateContextKey
public java.lang.Object generateContextKey(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
- Generates a context key.
- Overrides:
generateContextKey
in class CachedCollectionFilter
- Returns:
- a null context key.
shouldApplyFilter
public boolean shouldApplyFilter(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
- Description copied from class:
CachedCollectionFilter
- This method is called by filterCollection prior to looking up the filtered collection in the
cache or generating a new filtered collection. Implementations should use this method to
bypass the filter when it doesn't apply to the current execution context.
(e.g. a profile attribute has the wrong value etc.)
- Overrides:
shouldApplyFilter
in class CachedCollectionFilter
- Parameters:
pUnfilteredCollection
- the unfiltered collectionpCollectionIdentifierKey
- the key param as passed to filterCollectionpProfile
- the user profile
- Returns:
- true if there are any validators to execute
- See Also:
atg.serivce.collections.filter.CachedCollectionFilter#shouldApplyFilter
generateFilteredCollection
protected java.util.Collection generateFilteredCollection(java.util.Collection pUnfilteredCollection,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
throws FilterException
- Called by the filterCollection method to generate the filtered collection.
Each object in the collection is tested against all validators. If the object does not pass
any validation it is not included in the filtered results.
Each validator is executed by calling its validateObjects method.
- Overrides:
generateFilteredCollection
in class CachedCollectionFilter
- Parameters:
pUnfilteredCollection
- the unfiltered collectionpCollectionIdentifierKey
- the key the uniquely identifies the unfiltered collection.pProfile
- Repository item
- Returns:
- the filtered collection
- Throws:
FilterException