com.endeca.navigation.analytics
Class OrderBy

java.lang.Object
  extended by com.endeca.navigation.analytics.OrderBy
All Implemented Interfaces:
QueryNode

public class OrderBy
extends Object
implements QueryNode

An OrderBy defines an ordering on a set of records, based on the natural ordering of the specified field. Records can be ordered by any of their property, dimension, or derived values, by ascending or descending sort, in any combination. OrderBy instances are encapsulated in an OrderByList, which in turn is set in the Statement.


Constructor Summary
OrderBy(String _field, boolean isAscending)
          Constructs a new OrderBy that specifies a sort on an Endeca property or dimension indicated by _field in a sort direction specified by isAscending.
 
Method Summary
 String getFieldName()
          Get the name of the sorting property or dimension for this OrderBy.
 boolean isAscending()
          Indicates the sort direction of this OrderBy.
 void setAscending(boolean _isAsc)
          Sets the sort direction of this OrderBy.
 void setFieldName(String f)
          Sets the name of the sorting property or dimension for this OrderBy.
 String toString()
          Returns the string form of this OrderBy.
 String toWire()
          Returns the wire format of this OrderBy.
 void validateSyntax()
          Validates the syntax of this OrderBy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OrderBy

public OrderBy(String _field,
               boolean isAscending)
Constructs a new OrderBy that specifies a sort on an Endeca property or dimension indicated by _field in a sort direction specified by isAscending. For example, this code:
OrderByList o = new OrderByList();
o.add(new OrderBy("Total", false));
specifies an ordering based on the Total property with a descending sort of the records.

Parameters:
_field - the name of the Endeca property or dimension by which the records will be sorted.
isAscending - specifies the sort direction: true for an ascending sort order or false for a descending sort.
Method Detail

getFieldName

public String getFieldName()
Get the name of the sorting property or dimension for this OrderBy.

Returns:
The name of the Endeca property or dimension by which the records are ordered.

setFieldName

public void setFieldName(String f)
Sets the name of the sorting property or dimension for this OrderBy.

Parameters:
f - the name of the Endeca property or dimension by which the records will be ordered.

isAscending

public boolean isAscending()
Indicates the sort direction of this OrderBy.

Returns:
true if this OrderBy specifies an ascending sort or false for a descending sort.

setAscending

public void setAscending(boolean _isAsc)
Sets the sort direction of this OrderBy.

Parameters:
_isAsc - specify true to set an ascending sort or false for a descending sort.

toString

public String toString()
Returns the string form of this OrderBy. For an ascending sort, the format is:
key-sort-name ASC
For a descending sort, the format is:
key-sort-name DESC
where key-sort-name is the Endeca property or dimension by which the records will be sorted.

For example:

YearSales ASC
is returned if the sorting key is a property named YearSales and an ascending sort direction has been set.

Specified by:
toString in interface QueryNode
Overrides:
toString in class Object
Returns:
A string representation of this OrderBy in the specified format.

toWire

public String toWire()
Returns the wire format of this OrderBy. This method is not intended for public use because the wire format is subject to change.

Specified by:
toWire in interface QueryNode
Returns:
A wire format representation of this OrderBy.

validateSyntax

public void validateSyntax()
                    throws SyntaxException
Validates the syntax of this OrderBy. An OrderBy is valid if the key sorting name is non-null and non-empty.

Specified by:
validateSyntax in interface QueryNode
Throws:
SyntaxException - if the syntax requirements are not satisfied.


© 2003, 2012 Oracle and/or its affiliates. All rights reserved.