com.bea.content.paging
Interface IPropertyProvider

All Superinterfaces
com.bea.content.paging.internal.ITypeSupport

public interface IPropertyProvider
extends com.bea.content.paging.internal.ITypeSupport

Interface to expose one or more 'extended' properties, for specified Java property container types. These extended properties can then be used when sorting and filtering.

An overview of custom sorting and filtering is provided in the package documentation at com.bea.content.paging

NOTE: custom property providers are designed for small datasets (narrow queries returning a hundred or less objects). They may not scale well for large datasets.

Use this interface when you want to sort and filter on new dimensions for a given Java property container type.

You could also use this interface if you want to expose custom ObjectClass type-specific properties, as sortable and filterable properties.

Basically, the implementation lists which 'extended' properties it exposes, and defines how to produce a property value (such as the String 'objectClassName' property), given an object of one or more property container type (such as com.bea.content.Node).

For example, suppose you want to sort com.bea.content.Node objects on objectClassName, but there is no String getObjectClassName() method available which provides this property. You could write an IPropertyProvider which exposed an 'objectClassName' property, and compute the property value by calling aNode.getType().getName(). After doing this, and registering the PropertyProvider, you could then sort Nodes on this property.

Extended properties, as well as all standard properties, can be used when searching (if the property type is Comparable or has a custom sorting support), and filtering (if the property type implements IFilter or has custom filtering support).

During retrieval, three methods are called.

  1. First, the setState( ContentContext, Object obj ) method is invoked to configure the appropriate property provider state.
  2. Second, the appropriate property accessor method is invoked via reflection. For example, getObjectClassName() {...}. This method should fetch the appropriate state stored in the first step, and then return the appropriate property value.
  3. Third, the reset() method is invoked to notify the implementation that the state can be released.

NOTE: the impementation class should define its public property accessor methods with no arguments such as public String getObjectClassName( ) {...} The type extension system will invoke these methods via reflection.


Field Summary
static ContextKey PROPERTY_PROVIDER_KEY
          CONTEXT KEYS (optional) specifies an ordered List used for exposing properties for sorting and filtering.
 
Method Summary
 Map<String,PropertyDescriptor> getExtendedProperties(ContentContext context, Class propertyContainerTypeClass)
          For the specified property container Java type, which 'extended' properties does this provider supply, and what method can be invoked to supply each extended property?
 void reset()
          called AFTER the retrieval method is invoked, to notify the implementation class so it can release its state.
 void setState(ContentContext context, Object obj)
          called BEFORE the retrieval method is invoked, to configure the provider state.
 
Methods inherited from interface com.bea.content.paging.internal.ITypeSupport
getSupportedTypes
 

Field Detail

PROPERTY_PROVIDER_KEY

static final ContextKey PROPERTY_PROVIDER_KEY
CONTEXT KEYS (optional) specifies an ordered List used for exposing properties for sorting and filtering. The IPropertyProvider interface exposes 'extended properties' which can be computed on demand and used for sorting and filtering. Multiple IPropertyProvider(s) can apply for a given supported type, such as Node.

Method Detail

getExtendedProperties

Map<String,PropertyDescriptor> getExtendedProperties(ContentContext context,
                                                     Class propertyContainerTypeClass)
                                                     throws RepositoryException
For the specified property container Java type, which 'extended' properties does this provider supply, and what method can be invoked to supply each extended property?

A property provider can support multiple properties, such as String getObjectClassName() and int getSomeExternalSystemIndex().

The property container type class may be any of those returned by ITypeSupport.getSupportedTypes( ContentContext ).

Must return a Set, though the Set can be empty. NULL is not a valid return value.

Throws
RepositoryException

setState

void setState(ContentContext context,
              Object obj)
              throws RepositoryException
called BEFORE the retrieval method is invoked, to configure the provider state. The implementation should store this state (for example, in an instance variable.)

Throws
RepositoryException

reset

void reset()
           throws RepositoryException
called AFTER the retrieval method is invoked, to notify the implementation class so it can release its state.

Throws
RepositoryException


Copyright © 2011, Oracle. All rights reserved.