com.bea.content.manager.servlets.attribute.property
Class ContentPropertyResolver

java.lang.Object
  extended by com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Object>
      extended by com.bea.content.manager.servlets.attribute.property.ContentPropertyResolver
All Implemented Interfaces
AttributeResolver<Object>, ContentResolverConstants, PropertyResolverConstants
Direct Known Subclasses:
MultiValuePropertyResolver, SingleValuePropertyResolver

public abstract class ContentPropertyResolver
extends com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Object>
implements PropertyResolverConstants

This attribute resolver is responsible for retrieving a property from a com.bea.content.Node.


Field Summary
protected static String CURRENT_VERSION_NUMBER_STR
           
 
Fields inherited from class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver
debug, txDebug
 
Fields inherited from interface com.bea.content.manager.servlets.attribute.property.PropertyResolverConstants
ATTR_CONVERSION_TYPE, ATTR_DATE_FORMATTER, ATTR_DEFAULT_VALUE, ATTR_END_INDEX, ATTR_HTTP_SERVLET_REQUEST, ATTR_HTTP_SERVLET_RESPONSE, ATTR_IS_MULTIVALUED, ATTR_IS_NESTED_PROPERTY, ATTR_NODE_VERSION, ATTR_NUMBER_FORMATTER, ATTR_OVERRIDING_PROPERTY, ATTR_PROPERTY_NAME, ATTR_READ_WRITE_BLOCK_SIZE, ATTR_SELECTED_NODE, ATTR_START_INDEX, ATTR_TRANSACTION_TIMEOUT_SECS
 
Constructor Summary
ContentPropertyResolver()
          Default constructor
 
Method Summary
protected  String convert(AttributeContext context, String in)
          Convert a string with the current convertType.
protected  Object doNonBinary(AttributeContext context, Collection<Object> values)
          Returns the "value" of the property for non-binary properties.
protected  String getConversionType(AttributeContext context)
          If resultId is not set, this specifies how to encode the property value when printing it to the JSP.
protected  Format getDateFormatter(AttributeContext context)
          Returns the java.text.Format to use (if specified) for date properties.
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  String getDefaultValue(AttributeContext context)
          Returns the default value to use (if specified).
protected  Integer getEndIndex(AttributeContext context)
          Returns the end index specified by caller.
protected  Boolean getIsMultiValued(AttributeContext context)
          Returns whether or not this provider returns a mutivalued property or not(if specified by caller).
protected  Boolean getIsNestedProperty(AttributeContext context)
           
protected  Property getNodeProperty(AttributeContext context)
          Logic for retrieval of the property.
protected  String getNodeVersion(AttributeContext context)
          Returns the node version to retrieve, specified by caller.
protected  Format getNumberFormatter(AttributeContext context)
          Returns the java.text.Format to use (if specified) for numeric properties.
protected  Property getPrimaryPropertyFromVersion(AttributeContext context, ID nodeId, Version version)
          Responsible for retrieving the binary property from versioned node.
protected  String getPropertyName(AttributeContext context)
          Returns the property name to retrieve, specified by caller.
protected  Collection<Object> getPropertyValues(Property property)
          Responsible for retrieving all values for provided property
protected  Set<String> getRequiredContextAttributes()
          Returns a collection of required AttributeContext keys.
protected  Node getSelectedNode(AttributeContext context)
          Returns the selected node, specified by caller.
protected  Integer getStartIndex(AttributeContext context)
          Returns the start index specified by caller.
protected  Map<String,Class<?>> getValidContextAttributeClasses()
          Used for validation of classes associated with context keys.
 Object resolveAttribute(AttributeContext context)
          Retrieves the "value(s)" from the specified node and property name.
 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  boolean shouldGetPropertyFromNode(AttributeContext context)
          Logic responsible for determining if the property should be retrieved from the node, or from versioned object.
protected  String toString(AttributeContext context, Collection<Object> objects)
           
protected  String toString(AttributeContext context, Object obj, String defaultValue)
          Convert an Object to a string with our current formatting.
protected  Object validateAndProcessProperty(AttributeContext context, Collection<Object> values, boolean getPropertyFromNode, boolean isNestedProperty)
           
protected  void validateAttributeContext(AttributeContext context)
          Overridden to validate conversion type.
 
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
 

Field Detail

CURRENT_VERSION_NUMBER_STR

protected static final String CURRENT_VERSION_NUMBER_STR
See Also
Constants Summary
Constructor Detail

ContentPropertyResolver

public ContentPropertyResolver()
Default constructor

Method Detail

resolveAttribute

public Object resolveAttribute(AttributeContext context)
Retrieves the "value(s)" from the specified node and property name.

Specified by:
resolveAttribute in interface AttributeResolver<Object>
Specified by:
resolveAttribute in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Object>
Parameters
context - The AttributeContext to use when resolving this attribute.
Returns
The specified property value.

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<Object>
Specified by:
resolveAttribute in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Object>
Parameters
context - The 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<Object>
Specified by:
resolveAttributeToString in class com.bea.content.manager.servlets.attribute.impl.AbstractContentAttributeResolver<Object>
Parameters
context - AttributeContext to retrieve context attributes from.
Returns
the java.lang.String version of the Object returned from resolveAttribute(context)

toString

protected String toString(AttributeContext context,
                          Object obj,
                          String defaultValue)
Convert an Object to a string with our current formatting.

Throws
nested - RuntimeException thrown on conversion failure.
See Also
getDefaultValue(com.bea.content.manager.servlets.attribute.AttributeContext), toString(AttributeContext, java.util.Calendar), toString(AttributeContext, java.lang.Number)

toString

protected String toString(AttributeContext context,
                          Collection<Object> objects)

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<Object>
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<Object>
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<Object>
Returns
Map of attributes and their expected classes.

doNonBinary

protected Object doNonBinary(AttributeContext context,
                             Collection<Object> values)
Returns the "value" of the property for non-binary properties.


getPrimaryPropertyFromVersion

protected Property getPrimaryPropertyFromVersion(AttributeContext context,
                                                 ID nodeId,
                                                 Version version)
                                          throws RepositoryException
Responsible for retrieving the binary property from versioned node.

Throws
RepositoryException

convert

protected String convert(AttributeContext context,
                         String in)
Convert a string with the current convertType.


getDateFormatter

protected Format getDateFormatter(AttributeContext context)
Returns the java.text.Format to use (if specified) for date properties.

Returns
the java.text.Format if specified by caller in context, null otherwise.
See Also
ATTR_DATE_FORMATTER

getNumberFormatter

protected Format getNumberFormatter(AttributeContext context)
Returns the java.text.Format to use (if specified) for numeric properties.

Returns
the java.text.Format if specified by caller in context, null otherwise.
See Also
ATTR_NUMBER_FORMATTER

getDefaultValue

protected String getDefaultValue(AttributeContext context)
Returns the default value to use (if specified).

Returns
the default value if specified by caller in context, null otherwise.
See Also
ATTR_DEFAULT_VALUE

getIsMultiValued

protected Boolean getIsMultiValued(AttributeContext context)
Returns whether or not this provider returns a mutivalued property or not(if specified by caller).

Returns
the isMultivalued if specified by caller in context, null otherwise.
See Also
ATTR_IS_MULTIVALUED

getIsNestedProperty

protected Boolean getIsNestedProperty(AttributeContext context)

getConversionType

protected String getConversionType(AttributeContext context)
If resultId is not set, this specifies how to encode the property value when printing it to the JSP. This should be one of: html, url, or none. html will convert HTML special characters to their entity form; url will convert the text via the java.net.URLEncoder. Default is to do no conversion.

Parameters
context -

getStartIndex

protected Integer getStartIndex(AttributeContext context)
Returns the start index specified by caller.

Returns
the start index specified by caller, null otherwise.
See Also
ATTR_START_INDEX

getEndIndex

protected Integer getEndIndex(AttributeContext context)
Returns the end index specified by caller.

Returns
the end index specified by caller, null otherwise.
See Also
ATTR_END_INDEX

getPropertyName

protected String getPropertyName(AttributeContext context)
Returns the property name to retrieve, specified by caller.

Returns
the property name specified by caller, null otherwise.
See Also
ATTR_END_INDEX

getNodeVersion

protected String getNodeVersion(AttributeContext context)
Returns the node version to retrieve, specified by caller.

Returns
the node version specified by caller, null otherwise.
See Also
ATTR_NODE_VERSION

getSelectedNode

protected Node getSelectedNode(AttributeContext context)
Returns the selected node, specified by caller.

Returns
the selected node specified by caller, null otherwise.
See Also
ATTR_SELECTED_NODE

getNodeProperty

protected Property getNodeProperty(AttributeContext context)
Logic for retrieval of the property.

Parameters
context - AttributeContext

shouldGetPropertyFromNode

protected boolean shouldGetPropertyFromNode(AttributeContext context)
Logic responsible for determining if the property should be retrieved from the node, or from versioned object.


validateAttributeContext

protected void validateAttributeContext(AttributeContext context)
                                 throws IllegalArgumentException
Overridden to validate conversion type.

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

validateAndProcessProperty

protected Object validateAndProcessProperty(AttributeContext context,
                                            Collection<Object> values,
                                            boolean getPropertyFromNode,
                                            boolean isNestedProperty)
                                     throws AuthorizationException,
                                            RepositoryException
Throws
AuthorizationException
RepositoryException

getPropertyValues

protected Collection<Object> getPropertyValues(Property property)
Responsible for retrieving all values for provided property



Copyright © 2011, Oracle. All rights reserved.