|
|||||||||
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.search.query.filters.RepositoryItemResultCollectionFilter
public abstract class RepositoryItemResultCollectionFilter
An abstract base class for search result collection filtering with support for repository items associated with the search result. A minimal implementation implements the accept method:
protected boolean accept( Result pResult, RepositoryItem pUserProfile )The following is a sample implementation of this method that retrieves the repository item from a Result object. This assumes that the Result object's url property contains an atgrep:/ url:
protected boolean accept( Result pResult, RepositoryItem pUserProfile ) { RepositoryItem item = null; try { repositoryItem = getRepositoryItem( pResult ); } catch ( NamingException ne ) { if ( isLoggingDebug() ) logDebug( "Error looking up: " + pResult, ne ); throw new FilterException( "Error looking up: " + pResult, ne ); } ... return <true to accept Result object>; }This implementation attempts to retrieve a repository item with an atgrep:/ style URL, associated with the "someKey.$url" entry in the result object's properties map.
protected boolean accept( Result pResult, RepositoryItem pUserProfile ) { RepositoryItem item = null; try { String url = (String) pResult.getProperties().get( "someKey.$url" ); repositoryItem = getRepositoryItem( url ); } catch ( NamingException ne ) { if ( isLoggingDebug() ) logDebug( "Error looking up: " + pResult, ne ); throw new FilterException( "Error looking up: " + pResult, ne ); } ... return <true to accept Result object>; }
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
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 | |
---|---|
RepositoryItemResultCollectionFilter()
|
Method Summary | |
---|---|
protected abstract boolean |
accept(Result pResult,
RepositoryItem pProfile)
Override this method to filter individual result/repository items. |
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 pUnfiltered,
java.lang.String pCollectionIdentifierKey,
RepositoryItem pProfile)
Called by the filterCollection method to generate the filtered collection. |
JNDIInitialContextPool |
getInitialContextPool()
Get the JNDI initial context pool |
protected RepositoryItem |
getRepositoryItem(java.lang.String pRepositoryUrl)
Get a repository item from the Result object. |
void |
setInitialContextPool(JNDIInitialContextPool pInitialContextPool)
Set the JNDI initial context pool. |
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, flushCache, generateCacheKey, generateNewCollectionObject, getCache, getDefaultProfile, isCacheEnabled, setCache, setCacheEnabled, stringIt |
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 |
---|
public static final java.lang.String CLASS_VERSION
Constructor Detail |
---|
public RepositoryItemResultCollectionFilter()
Method Detail |
---|
public void setInitialContextPool(JNDIInitialContextPool pInitialContextPool)
pInitialContextPool
- the JNDI initial context poolpublic JNDIInitialContextPool getInitialContextPool()
public java.lang.Object generateContextKey(java.util.Collection pUnfilteredCollection, java.lang.String pCollectionIdentifierKey, RepositoryItem pProfile)
generateContextKey
in class atg.service.collections.filter.CachedCollectionFilter
pUnfilteredCollection
- the unfiltered collectionpCollectionIdentifierKey
- pProfile
-
protected java.util.Collection generateFilteredCollection(java.util.Collection pUnfiltered, java.lang.String pCollectionIdentifierKey, RepositoryItem pProfile) throws atg.service.collections.filter.FilterException
generateFilteredCollection
in class atg.service.collections.filter.CachedCollectionFilter
pUnfilteredCollection
- the unfiltered collection, a collection ofpCollectionIdentifierKey
- the key that was passed to the
filterCollection
method.
atg.service.collections.filter.FilterException
public boolean shouldApplyFilter(java.util.Collection pUnfilteredCollection, java.lang.String pCollectionIdentifierKey, RepositoryItem pProfile)
shouldApplyFilter
in class atg.service.collections.filter.CachedCollectionFilter
pUnfilteredCollection
- the unfiltered collectionpCollectionIdentifierKey
- the key param as passed to
filterCollectionpProfile
- the user profile
CachedCollectionFilter.filterCollection(java.util.Collection, java.lang.String, atg.repository.RepositoryItem, boolean, boolean)
protected RepositoryItem getRepositoryItem(java.lang.String pRepositoryUrl) throws javax.naming.NamingException
pResult
- the search result object
javax.naming.NamingException
- if repository item cannot be foundprotected abstract boolean accept(Result pResult, RepositoryItem pProfile) throws atg.service.collections.filter.FilterException
pResult
- the search result objectpProfile
- the user profile repository item
atg.service.collections.filter.FilterException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |