com.bea.content.manager.servlets.attribute.node
Class NodeAttributeResolver

java.lang.Object
  extended by com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Node>
      extended by com.bea.content.manager.servlets.attribute.node.NodeAttributeResolver
All Implemented Interfaces
AttributeResolver<Node>, ContentResolverConstants, NodeResolverConstants

public class NodeAttributeResolver
extends com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Node>
implements NodeResolverConstants

This attribute resolver is responsible for retrieve a node using the CM apis.


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.node.NodeResolverConstants
ATTR_NODE_ID, ATTR_NODE_PATH
 
Constructor Summary
NodeAttributeResolver()
           
 
Method Summary
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  ID getNodeID(AttributeContext context)
           
protected  String getNodePath(AttributeContext context)
           
protected  Set<String> getRequiredContextAttributes()
          Returns a collection of required AttributeContext keys.
protected  Map<String,Class<?>> getValidContextAttributeClasses()
          Used for validation of classes associated with context keys.
 Node resolveAttribute(AttributeContext context)
          Resolves a node based on the provided attribute context.
 void resolveAttribute(AttributeContext context, Writer writer)
          This method is not supported by this implementation of attribute resolver.
 String resolveAttributeToString(AttributeContext context)
          Returns the string representation of the node.
protected  void validateAttributeContext(AttributeContext context)
          Validates the AttributeContext based on required attributes and context attribute values.
 
Methods inherited from class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver
checkCallerCanViewNode, getContextAttribute, validateAttributeValueFromOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeAttributeResolver

public NodeAttributeResolver()
Method Detail

resolveAttribute

public Node resolveAttribute(AttributeContext context)
Resolves a node based on the provided attribute context.

The following context attributes are required for this attribute resolver: Either:

  • NodeResolverConstants.ATTR_NODE_PATH
  • -or-
  • NodeResolverConstants.ATTR_NODE_ID
  • If both attributes are provided, a retrieval by ID will be done.

    Specified by:
    resolveAttribute in interface AttributeResolver<Node>
    Specified by:
    resolveAttribute in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Node>
    Parameters
    context - The AttributeContext to use when resolving this attribute.
    Returns
    The specified property value.
    Throws
    java.lang.RuntimeException - wrapped with the original exception.

    resolveAttribute

    public void resolveAttribute(AttributeContext context,
                                 Writer writer)
    This method is not supported by this implementation of attribute resolver.

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

    resolveAttributeToString

    public String resolveAttributeToString(AttributeContext context)
    Returns the string representation of the node.

    Specified by:
    resolveAttributeToString in interface AttributeResolver<Node>
    Specified by:
    resolveAttributeToString in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Node>
    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<Node>
    Returns
    Map 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<Node>
    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<Node>
    Returns
    Map of attributes and their expected classes.

    validateAttributeContext

    protected void validateAttributeContext(AttributeContext context)
                                     throws IllegalArgumentException
    Description copied from class: com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver
    Validates the AttributeContext based on required attributes and context attribute values.

    This method makes sure that: 1. All attributes are present that are required (@see getRequiredContextAttributes()) This validation will not throw *IF* there are default values specified (@see getDefaultContextValues()). 2. Makes sure that the values set for each context attribute are of the correct type. (@see getValidContextAttributeClasses()) This validation is done to avoid ClassCastExceptions.

    This method can be overridden as more custom validation algorithms are required.

    Overrides:
    validateAttributeContext in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Node>
    Parameters
    context - The AttributeContext to validate
    Throws
    IllegalArgumentException

    getNodePath

    protected String getNodePath(AttributeContext context)

    getNodeID

    protected ID getNodeID(AttributeContext context)


    Copyright © 2011, Oracle. All rights reserved.