com.bea.content.paging
Interface IPropertyTypeSorter

All Superinterfaces
Comparator, com.bea.content.paging.internal.ITypeSupport, Serializable

public interface IPropertyTypeSorter
extends Comparator, com.bea.content.paging.internal.ITypeSupport, Serializable

Interface which allows custom property type sorting, for specified Java property container types. The property types can be used when sorting both 'standard properties' and 'extended properties' (added by a PropertyProvider).

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

NOTE: custom property type sorters 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 add support for sorting (or override existing support for sorting) a non-Comparable 'property type', such as com.bea.content.ObjectClass. This support will automatically extend to allow sorting on all the JavaBean properties of the specified property type. For example, ObjectClass getObjectClass(), and any other methods returning ObjectClass.

Basically, this specifies a custom Comparator implementation defining Comparator.compare( T o1, T o2 ) where T is a property value of one of the supported property types, NOT an object value, for one or more Java property container types (such as Node, VirtualNode, etc).

In this context, 'property types' refers to the return value of JavaBean methods on the Java class, not to a CM Node ObjectClass type.

For example, the com.bea.content.Node type has an ObjectClass getObjectClass() method, but the ObjectClass type is not Comparable. One could add support for sorting the ObjectClass type, and select support for any JavaBean properties of property type ObjectClass on the 'property container' types com.bea.content.Node, and com.bea.content.virtual.version.Version. In this case, the Comparator method would be Comparator.compare( ObjectClass o1, ObjectClass o2 )


Field Summary
static ContextKey PROPERTY_TYPE_SORTER_KEY
          CONTEXT KEYS (optional) specifies an ordered List used for sorting.
 
Method Summary
 Set<Class> getPropertyTypes(ContentContext context, Class<?> propertyContainerTypeClass)
          For the specified property container Java type, which property types does this sorter support?
 void setState(ContentContext context, Locale locale)
          called BEFORE the comparator.compare() method is invoked
 
Methods inherited from interface java.util.Comparator
compare, equals
 
Methods inherited from interface com.bea.content.paging.internal.ITypeSupport
getSupportedTypes
 

Field Detail

PROPERTY_TYPE_SORTER_KEY

static final ContextKey PROPERTY_TYPE_SORTER_KEY
CONTEXT KEYS (optional) specifies an ordered List used for sorting. The IPropertyTypeSorter interface is used to add or override support for custom property sorting of a property type, which overrides the default property sorting approach (if any).

For example, one could add sorting capabilities for all properties of type 'ObjectClass', regardless of the property name.

A set of IPropertyTypeSorter(s) is provided by default; this key lets you add additional IPropertyTypeSorter obbjects.

Multiple IPropertyTypeSorter(s) can apply for a given type, such as Node.

Method Detail

getPropertyTypes

Set<Class> getPropertyTypes(ContentContext context,
                            Class<?> propertyContainerTypeClass)
                            throws RepositoryException
For the specified property container Java type, which property types does this sorter support?

A property type sorter can support multiple property types, such as com.bea.content.ObjectClass and java.util.Calendar.

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,
              Locale locale)
              throws RepositoryException
called BEFORE the comparator.compare() method is invoked

Throws
RepositoryException


Copyright © 2011, Oracle. All rights reserved.