Skip navigation links


com.bea.content.manager.servlets.attribute.search
Class SearchAttributeResolver<V>

java.lang.Object
  extended by com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<V>
      extended by com.bea.content.manager.servlets.attribute.search.SearchAttributeResolver<V>

All Implemented Interfaces
AttributeResolver<V>, ContentResolverConstants, SearchResolverConstants
Direct Known Subclasses:
NodeSearchAttributeResolver, VersionedSearchAttributeResolver

public abstract class SearchAttributeResolver<V>
extends com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<V>
implements SearchResolverConstants

This attribute resolver is responsible for performing content searches using CM api's.

The following describes the behavior of this resolver depending on the context attributes that are configured:


Field Summary

 

Fields inherited from class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver
debug, txDebug

 

Fields inherited from interface com.bea.content.manager.servlets.attribute.search.SearchResolverConstants
ATTR_CONTENT_CONTEXT_PARAMS, ATTR_EXPRESSION_OVERRIDE, ATTR_IN_MEMORY_SORT, ATTR_IS_VERSIONED_SEARCH, ATTR_MAX_RESULTS, ATTR_PROPERTY_PROVIDER, ATTR_SEARCH_PATHS, ATTR_SEARCH_QUERY, ATTR_SORT_BY

 

Constructor Summary
SearchAttributeResolver()
           

 

Method Summary
protected  Map getContextParams(AttributeContext context)
           
protected  Map<String,Object> getDefaultContextValues()
          Returns a map of key/values that contain default values if/when their associated context keys are null or not provided.
protected  Expression getExpression(AttributeContext context)
          Compile search expression
protected  Expression getInitialExpression(AttributeContext context)
           
protected  Integer getMaxResults(AttributeContext context)
           
protected  PropertyProvider getPropertyProvider(AttributeContext context)
           
protected  String getQuery(AttributeContext context)
           
protected  Set<String> getRequiredContextAttributes()
          Returns a collection of required AttributeContext keys.
protected  Search getSearch(AttributeContext context)
           
protected  String[] getSearchPaths(AttributeContext context)
           
static SearchAttributeResolver getSearchResolver(AttributeContext context)
          Retrieve the appropriate resolver, depending on configuration of attribute context.
protected  String getSortBy(AttributeContext context)
           
protected  Expression getSpecifiedExpression(AttributeContext context)
           
protected  Map<String,Class<?>> getValidContextAttributeClasses()
          Used for validation of classes associated with context keys.
protected  Boolean isSortInMemory(AttributeContext context)
           
 void resolveAttribute(AttributeContext context, Writer writer)
          Resolves an object and writes its value to the provided java.io.Writer.
 String resolveAttributeToString(AttributeContext context)
          Returns the string value specified by attributes in AttributeContext
protected  void validateAttributeContext(AttributeContext context)
          Make sure that either ATTR_EXPRESSION_OVERRIDE or ATTR_SEARCH_QUERY is provided.

 

Methods inherited from class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver
checkCallerCanViewNode, getContextAttribute, resolveAttribute, validateAttributeValueFromOptions

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

SearchAttributeResolver

public SearchAttributeResolver()

Method Detail

getSearchResolver

public static SearchAttributeResolver getSearchResolver(AttributeContext context)
Retrieve the appropriate resolver, depending on configuration of attribute context. <p/> If the context attribute ATTR_IS_VERSIONED_SEARCH is configured, an instance of VersionedSearchAttributeResolver is returned. Otherwise, an instance of NodeSearchAttributeResolver is returned.
Parameters
context - The attribute context to interrogate.
Returns
The appropriate search attribute resolver.

resolveAttribute

public void resolveAttribute(AttributeContext context,
                             Writer writer)
Description copied from interface: AttributeResolver
Resolves an object and writes its value to the provided java.io.Writer.

If propertyName is null, the default primary property value will be written to the java.io.Writer.

Specified by:
resolveAttribute in interface AttributeResolver<V>
Specified by:
resolveAttribute in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<V>
Parameters
context - The <AttributeContext> to use when resolving this attribute.
writer - The java.io.Writer to write the property value to.

resolveAttributeToString

public String resolveAttributeToString(AttributeContext context)
Description copied from interface: AttributeResolver
Returns the string value specified by attributes in AttributeContext
Specified by:
resolveAttributeToString in interface AttributeResolver<V>
Specified by:
resolveAttributeToString in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<V>
Parameters
context - AttributeContext to retrieve context attributes from.
Returns
the java.lang.String version of the Object returned from resolveAttribute(context)

getDefaultContextValues

protected Map<String,Object> getDefaultContextValues()
Description copied from class: com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver
Returns a map of key/values that contain default values if/when their associated context keys are null or not provided.

This method must NOT return null. An empty Map is acceptable.

Overrides:
getDefaultContextValues in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<V>
Returns
Map<String,Object> of default values.

getRequiredContextAttributes

protected Set<String> getRequiredContextAttributes()
Description copied from class: com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver
Returns a collection of required AttributeContext keys.

The returned value will be used to ensure that the proper context keys are set up in the AttributeContext.

This method must NOT return null. An empty Set is acceptable.

Overrides:
getRequiredContextAttributes in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<V>
Returns
A set of valid keys to validate against.

getValidContextAttributeClasses

protected Map<String,Class<?>> getValidContextAttributeClasses()
Description copied from class: com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver
Used for validation of classes associated with context keys.

This method must NOT return null. An empty Map is acceptable.

Overrides:
getValidContextAttributeClasses in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<V>
Returns
Map<String,Class> of attributes and their expected classes.

getSpecifiedExpression

protected Expression getSpecifiedExpression(AttributeContext context)

getQuery

protected String getQuery(AttributeContext context)

getPropertyProvider

protected PropertyProvider getPropertyProvider(AttributeContext context)

getMaxResults

protected Integer getMaxResults(AttributeContext context)

getSortBy

protected String getSortBy(AttributeContext context)

getSearchPaths

protected String[] getSearchPaths(AttributeContext context)

getContextParams

protected Map getContextParams(AttributeContext context)

isSortInMemory

protected Boolean isSortInMemory(AttributeContext context)

getExpression

protected Expression getExpression(AttributeContext context)
Compile search expression

getInitialExpression

protected Expression getInitialExpression(AttributeContext context)

getSearch

protected Search getSearch(AttributeContext context)

validateAttributeContext

protected void validateAttributeContext(AttributeContext context)
                                 throws IllegalArgumentException
Make sure that either ATTR_EXPRESSION_OVERRIDE or ATTR_SEARCH_QUERY is provided.
Overrides:
validateAttributeContext in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<V>
Parameters
context - The AttributeContext to validate
Throws
IllegalArgumentException

Skip navigation links


Copyright © 2010, Oracle. All rights reserved.