Oracle Content Management SDK

oracle.ifs.search
Class SearchSortSpecification

java.lang.Object
  |
  +--oracle.ifs.search.SearchSortSpecification
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public final class SearchSortSpecification
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A SearchSortSpecification represents the order-by-clause of the Select statement. Attribute names can be qualified by the SearchClass. Also provides a way to specify ASCENDING or DESCEDING order based on the attribute.

 // Usage Examples.
 //
 // Following code shows a SearchSortSpecification which represents
 // ORDER by DOCUMENT.NAME, FOLDER.NAME 
 //
 // Array of classes involved in the order by clause
 // Remember to use aliases if they are specified.
 String [] sortClasses = new String[] {"DOCUMENT", "FOLDER"}
 //
 // Array of Attribute Names to match class names.
 String [] attNames = new String[] {"NAME", "NAME"}
 //
 // Order of Sort for each sort element
 boolean [] orders = new boolean[] {true, false}
 //
 // Create the SortSpecification
 SearchSortSpecification someSortSpec = new SearchSortSpecification(sortClasses, attNames, orders);

 // To do case insensitive sorting, use the constructor  or add method
 // variant that takes a sqlfunction as parameter and pass nls_upper
 // as the name of the sql function that needs to be used.

 someSortSpec.add(Document.CLASS_NAME, "NAME", true, "nls_upper");

 // To sort based on Context scores, look for example in javadoc of
 // ContextQualification. 
 

See Also:
Serialized Form

Field Summary
static boolean ASCENDING
           
static boolean DESCENDING
           
 
Constructor Summary
SearchSortSpecification()
          Constructs a SearchSortSpecification, calls this(null).
SearchSortSpecification(java.lang.String defaultClass)
          Constructs a SearchSortSpecification.
SearchSortSpecification(java.lang.String[] classes, java.lang.String[] attributes, boolean[] orders)
          Constructs a SearchSortSpecification.
SearchSortSpecification(java.lang.String[] classes, java.lang.String[] attributes, boolean[] orders, java.lang.String[] functions)
          Constructs a SearchSortSpecification.
 
Method Summary
 void add(java.lang.String[] sortAttributes, boolean[] sortOrders)
          Adds the unqualified attributes to the sort list.
 void add(java.lang.String[] sortClasses, java.lang.String[] sortAttributes, boolean[] sortOrders)
          Add Attributes to sort list.
 void add(java.lang.String[] sortClasses, java.lang.String[] sortAttributes, boolean[] sortOrders, java.lang.String[] sortFunctions)
          Add Attributes to sort list.
 void add(java.lang.String sortAttribute, boolean sortOrder)
          Adds the unqualified attribute to the end of the sort list.
 void add(java.lang.String sortClass, java.lang.String sortAttribute, boolean sortOrder)
          Add an attribute to the end of the sort list.
 void add(java.lang.String sortClass, java.lang.String sortAttribute, boolean sortOrder, java.lang.String sqlFunction)
          Add an attribute to the end of the sort list.
 java.lang.Object clone()
          Returns a clone of this SearchClassSpecification.
 java.lang.String[] getAttributeNames()
          Gets the list of Sort Attribute names.
 java.lang.String[] getClassnames()
          Returns the Class names of the sort Attributes.
 boolean[] getOrders()
          Returns the sort Orders of the Sort Attributes.
 java.lang.String[] getSqlFunctions()
          Gets the list of sql function names.
 

Field Detail


ASCENDING

public static boolean ASCENDING

DESCENDING

public static boolean DESCENDING
Constructor Detail

SearchSortSpecification

public SearchSortSpecification(java.lang.String defaultClass)
Constructs a SearchSortSpecification. The sort list is set to an empty list. User can specify the default Class for the attributes.
Parameters:
defaultClass - default Class for sort Attributes

SearchSortSpecification

public SearchSortSpecification()
Constructs a SearchSortSpecification, calls this(null).

SearchSortSpecification

public SearchSortSpecification(java.lang.String[] classes,
                               java.lang.String[] attributes,
                               boolean[] orders)
                        throws IfsException
Constructs a SearchSortSpecification. Initializes Sort list with specified attributes. Call the constructor that takes classes, attributes, orders and functions as parameters. Passes null for the functions parameter.
Parameters:
classes - Classes for the sort Attributes
attributes - Sort Attributes
orders - Sort Order for each attribute, true implies ascending, false implies descending.
Throws:
IfsException - if adding sort Attributes fails.

SearchSortSpecification

public SearchSortSpecification(java.lang.String[] classes,
                               java.lang.String[] attributes,
                               boolean[] orders,
                               java.lang.String[] functions)
                        throws IfsException
Constructs a SearchSortSpecification. Initializes Sort list with specified attributes. Calls add(classes, attributes, orders, functions)
Parameters:
classes - Classes for the sort Attributes
attributes - Sort Attributes
orders - Sort Order for each attribute, true implies ascending, false implies descending.
functions - Sql function that is to be wrapped around each function
Throws:
IfsException - if adding sort Attributes fails.
Method Detail

add

public void add(java.lang.String[] sortClasses,
                java.lang.String[] sortAttributes,
                boolean[] sortOrders,
                java.lang.String[] sortFunctions)
         throws IfsException
Add Attributes to sort list. Attributes are added to the end of the existing list. Calls add on each attribute in the list.
Parameters:
sortClasses - list of classes, each entry specifies the class of the corresponding entry in the attribute list.
sortAttributes - list of sort Attributes
sortOrders - order of sorting attribute, true implies ascending, false implies descending. If this null, then ascending is assumed for all attributes.
sortFunctions - sql functions that need to be wrapped around the attributes
Throws:
IfsException - if operation fails

add

public void add(java.lang.String[] sortClasses,
                java.lang.String[] sortAttributes,
                boolean[] sortOrders)
         throws IfsException
Add Attributes to sort list. Attributes are added to the end of the existing list. Calls add on each attribute in the list.
Parameters:
sortClasses - list of classes, each entry specifies the class of the corresponding entry in the attribute list.
sortAttributes - list of sort Attributes
sortOrders - order of sorting attribute, true implies ascending, false implies descending. If this null, then ascending is assumed for all attributes.
Throws:
IfsException - if operation fails

add

public void add(java.lang.String[] sortAttributes,
                boolean[] sortOrders)
         throws IfsException
Adds the unqualified attributes to the sort list. The default Class is assumed for these attributes. Calls add(null, sortAttributes, sortOrders)
Parameters:
sortAttributes - list of sort Attributes
sortOrders - order of sorting attribute
Throws:
IfsException - if operation fails
See Also:
add(String[], String[], boolean[])

add

public void add(java.lang.String sortClass,
                java.lang.String sortAttribute,
                boolean sortOrder,
                java.lang.String sqlFunction)
         throws IfsException
Add an attribute to the end of the sort list.
Parameters:
sortClass - Class of attribute, defaultClass is used if this is null.
sortAttribute - sort Attribute
sortOrder - order of sorting, true implies ascending, false implies descending
sqlFunction - any sql function call that needs to be wrapped around the attribute; Use "nls_upper" function to sort case insensitively.
Throws:
IfsException - is the operation fails

add

public void add(java.lang.String sortClass,
                java.lang.String sortAttribute,
                boolean sortOrder)
         throws IfsException
Add an attribute to the end of the sort list.
Parameters:
sortClass - Class of attribute, defaultClass is used if this is null.
sortAttribute - sort Attribute
sortOrder - order of sorting, true implies ascending, false implies descending
Throws:
IfsException - is the operation fails

add

public void add(java.lang.String sortAttribute,
                boolean sortOrder)
         throws IfsException
Adds the unqualified attribute to the end of the sort list.
Parameters:
sortAttribute - sort Attribute
sortOrder - order of sorting, true implies ascending, false implies descending
Throws:
IfsException - if the operation fails

getClassnames

public java.lang.String[] getClassnames()
                                 throws IfsException
Returns the Class names of the sort Attributes. The entries correspond to the entries in the array returned by getAttributeNames.
Returns:
String array representing classes of Sort Attributes.
Throws:
IfsException - if the operation fails

getAttributeNames

public java.lang.String[] getAttributeNames()
                                     throws IfsException
Gets the list of Sort Attribute names.
Returns:
list of Sort Attribute names.
Throws:
IfsException - if the operation fails

getSqlFunctions

public java.lang.String[] getSqlFunctions()
                                   throws IfsException
Gets the list of sql function names.
Returns:
list of sql function names.
Throws:
IfsException - if the operation fails

getOrders

public boolean[] getOrders()
                    throws IfsException
Returns the sort Orders of the Sort Attributes. The entries correspond to the entries in the array returned by getAttributeNames.
Returns:
boolean array representing sort order of Sort Attributes.
Throws:
IfsException - if the operation fails

clone

public java.lang.Object clone()
Returns a clone of this SearchClassSpecification.
Overrides:
clone in class java.lang.Object
Returns:
Return a clone of this SearchClassSpecification.

Oracle Content Management SDK

(c) 2002 Copyright Oracle Corporation. All rights reserved.