org.infoglue.cms.util.sorters
Class SortElement

java.lang.Object
  extended by org.infoglue.cms.util.sorters.SortElement
All Implemented Interfaces:
java.lang.Comparable

public class SortElement
extends java.lang.Object
implements java.lang.Comparable

A SortElement object is created for each content/content version to be sorted. If the SortElement is constructed using a content and the content version is needed, the content version to use is decided by fetching the language used by the TemplateController.

Strictly speaking we never sort on a content or a content version, we are sorting on a content and the content version indicated by the language used by the TemplateController at the same time.


Method Summary
 void addContentProperty(java.lang.String name, boolean ascending)
          Use the specified content property 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 addContentVersionProperty(java.lang.String name, boolean ascending)
          Use the specified content version property in the sort.
 int compareTo(java.lang.Object o)
          Compares two SortStruct objects by comparing their SortComparable:s.
 ContentVersionVO getContentVersionVO()
          Returns the content version value object.
 ContentVO getContentVO()
          Returns the content value object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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,
                                       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.

getContentVersionVO

public ContentVersionVO getContentVersionVO()
Returns the content version value object. This is a convenience method as we don't if the element was constructed using a content or a content version.

Returns:
the content version value object.

getContentVO

public ContentVO getContentVO()
Returns the content value object. This is a convenience method as we don't if the element was constructed using a content or a content version.

Returns:
the content value object.

compareTo

public final int compareTo(java.lang.Object o)
Compares two SortStruct objects by comparing their SortComparable:s.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the object to ne compared.
Returns:
a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.


Copyright © 2005 InfoGlue.org All Rights Reserved.