org.infoglue.cms.util.sorters
Class ContentSort

java.lang.Object
  extended by org.infoglue.cms.util.sorters.ContentSort

public class ContentSort
extends java.lang.Object

Utility class for sorting content/content version objects. Any number of properties and/or attributes of the content/content versions can be used in the sort.


Constructor Summary
ContentSort(TemplateController controller, java.util.Collection elements)
          Constructs a sorter for the specified elements.
 
Method Summary
 void addContentProperty(java.lang.String name, boolean ascending)
          Use the specified content property in the sort.
 void addContentVersionAttribute(java.lang.String name, boolean ascending, boolean caseSensitive)
          Use the specified content version attribute in the sort.
 void addContentVersionAttribute(java.lang.String name, java.lang.Class clazz, boolean ascending, boolean caseSensitive)
          Use the specified content version attribute in the sort.
 void addContentVersionAttribute(java.lang.String name, java.lang.String className, boolean ascending, boolean caseSensitive)
          Use the specified content version attribute in the sort.
 void addContentVersionProperty(java.lang.String name, boolean ascending)
          Use the specified content version property in the sort.
 java.util.List getContentResult()
          Returns a list of sorted ContentVO objects.
 java.util.List getContentResult(java.lang.String comparatorClass)
          Returns a list of sorted ContentVO objects.
 java.util.List getContentVersionResult()
          Returns a list of sorted ContentVersionVO objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentSort

public ContentSort(TemplateController controller,
                   java.util.Collection elements)
Constructs a sorter for the specified elements.

Parameters:
controller - the controller to use when interacting with the model.
elements - the list of objects to sort.
Method Detail

addContentProperty

public void addContentProperty(java.lang.String name,
                               boolean ascending)
Use the specified content property in the sort.

Parameters:
ascending - indicates the sort order to use when sorting on the specified property.

addContentVersionProperty

public void addContentVersionProperty(java.lang.String name,
                                      boolean ascending)
Use the specified content version property in the sort.

Parameters:
ascending - indicates the sort order to use when sorting on the specified property.

addContentVersionAttribute

public void addContentVersionAttribute(java.lang.String name,
                                       boolean ascending,
                                       boolean caseSensitive)
Use the specified content version attribute in the sort. The type (Comparable) used when sorting on the attribute will be String.

Parameters:
ascending - indicates the sort order to use when sorting on the specified attribute.

addContentVersionAttribute

public void addContentVersionAttribute(java.lang.String name,
                                       java.lang.String className,
                                       boolean ascending,
                                       boolean caseSensitive)
Use the specified content version attribute in the sort. The type (Comparable) used when sorting on the attribute will be the specified class.

Parameters:
className - indicates the name of the Comparable to use when sorting on the attribute.
ascending - indicates the sort order to use when sorting on the specified attribute.

addContentVersionAttribute

public void addContentVersionAttribute(java.lang.String name,
                                       java.lang.Class clazz,
                                       boolean ascending,
                                       boolean caseSensitive)
Use the specified content version attribute in the sort. The type (Comparable) used when sorting on the attribute will be the specified class.

Parameters:
clazz - indicates the Comparable to use when sorting on the attribute.
ascending - indicates the sort order to use when sorting on the specified attribute.

getContentResult

public java.util.List getContentResult()
Returns a list of sorted ContentVO objects.

Returns:
the sorted list.

getContentResult

public java.util.List getContentResult(java.lang.String comparatorClass)
Returns a list of sorted ContentVO objects.

Parameters:
sorts - the list using the comparatorClass specified. The comparator must implement the interface org.infoglue.cms.util.sorters.TemplateControllerAwareComparator
Returns:
the sorted list.

getContentVersionResult

public java.util.List getContentVersionResult()
Returns a list of sorted ContentVersionVO objects.

Returns:
the sorted list.


Copyright © 2005 InfoGlue.org All Rights Reserved.