com.wewebu.ow.server.field
Class OwSort

java.lang.Object
  extended by com.wewebu.ow.server.field.OwSort
Direct Known Subclasses:
OwStandardCrossMappings.OwCrossSort

public class OwSort
extends Object

Sorts contain a list of sort criteria. Sort is used with OwObjectList.sort(...) and OwNetwork.doSearch(...) Function.
Automatically keeps the size of the list to a specified maximum, when using addCriteria(...).

To be extended with the specific DMS system.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Nested Class Summary
static class OwSort.OwSortCriteria
           Sort criteria tuple containing property and order direction.
 
Field Summary
protected  boolean m_fDefaultAsc
          default sort order for new criteria
protected  int m_iMax
          the maximum number of sort criteria in the sort list default is 1
protected  List m_SortList
          list containing the sort OwSortCriteria NOTE: We actually need a Hash Access to the sort criteria and the sort criteria must be predictable ordered With JDK 1.4 we could use a LinkedHashMap, but with JDK 1.3 we must use a List
 
Constructor Summary
OwSort()
          constructs empty sort criteria list with maxsize = 1 and default sort order asc = true
OwSort(int iMaxSize_p, boolean fAsc_p)
          constructs empty sort criteria list with specified maxsize if the number of sort criteria exceeds the maximum value, the first sort criteria gets removed
 
Method Summary
 void addCriteria(OwSort.OwSortCriteria criteria_p)
          add a sort criteria to the sort
 OwSort.OwSortCriteria getCriteria(String strPropertyName_p)
          get the specified criteria
 Collection getCriteriaCollection()
          get a collection over the criteria.
 boolean getDefaultAsc()
          get default sort order for new criteria
 OwSort.OwSortCriteria getLastCriteria()
          get the last criteria, i.e.
 int getMaxSize()
          get the maximum number of sort criteria in the sort list
 int getPriority(OwSort.OwSortCriteria criteria_p)
          get the priority of the criteria, last criteria has highest priority
 int getSize()
          get the size of the criteria list
 void removeCriteria(String strPropertyName_p)
          remove the specified criteria
 void setCriteria(String strPropertyName_p, boolean fAsc_p)
          toggle existing criteria or add a criteria to the sort list if it does not yet exist if the number of sort criteria exceeds the maximum value, the first sort criteria gets removed
 void setMaxSize(int iMax_p)
          set the maximum number of sort criteria in the sort list.
 void toggleCriteria(String strPropertyName_p)
          toggle existing criteria or add a criteria to the sortlist if it does not yet exist if the number of sort criteria exceeds the maximum value, the first sort criteria gets removed
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_SortList

protected List m_SortList
list containing the sort OwSortCriteria NOTE: We actually need a Hash Access to the sort criteria and the sort criteria must be predictable ordered With JDK 1.4 we could use a LinkedHashMap, but with JDK 1.3 we must use a List


m_iMax

protected int m_iMax
the maximum number of sort criteria in the sort list default is 1


m_fDefaultAsc

protected boolean m_fDefaultAsc
default sort order for new criteria

Constructor Detail

OwSort

public OwSort()
constructs empty sort criteria list with maxsize = 1 and default sort order asc = true


OwSort

public OwSort(int iMaxSize_p,
              boolean fAsc_p)
constructs empty sort criteria list with specified maxsize if the number of sort criteria exceeds the maximum value, the first sort criteria gets removed

Parameters:
iMaxSize_p - the maximum number of sort criteria in the sort list.
fAsc_p - sort order true = ascending, false = descending
Method Detail

getMaxSize

public int getMaxSize()
get the maximum number of sort criteria in the sort list


getDefaultAsc

public boolean getDefaultAsc()
get default sort order for new criteria


setMaxSize

public void setMaxSize(int iMax_p)
set the maximum number of sort criteria in the sort list. if the number of sort criteria exceeds the maximum value, the first sort criteria gets removed

Parameters:
iMax_p - maximum number of sort criteria

getSize

public int getSize()
get the size of the criteria list

Returns:
int size

getCriteriaCollection

public Collection getCriteriaCollection()
get a collection over the criteria. The returned collection has predictable order.

Returns:
Collection of OwSortCriteria Elements

addCriteria

public void addCriteria(OwSort.OwSortCriteria criteria_p)
add a sort criteria to the sort

Parameters:
criteria_p - OwSortCriteria to add

removeCriteria

public void removeCriteria(String strPropertyName_p)
remove the specified criteria

Parameters:
strPropertyName_p - Property name or criteria to remove

getLastCriteria

public OwSort.OwSortCriteria getLastCriteria()
get the last criteria, i.e. the criteria with the highest priority

Returns:
OwSortCriteria if found, null otherwise

getCriteria

public OwSort.OwSortCriteria getCriteria(String strPropertyName_p)
get the specified criteria

Parameters:
strPropertyName_p - Property name to sort for
Returns:
OwSortCriteria if found, null otherwise

toggleCriteria

public void toggleCriteria(String strPropertyName_p)
toggle existing criteria or add a criteria to the sortlist if it does not yet exist if the number of sort criteria exceeds the maximum value, the first sort criteria gets removed

Parameters:
strPropertyName_p - Property name to sort for

getPriority

public int getPriority(OwSort.OwSortCriteria criteria_p)
get the priority of the criteria, last criteria has highest priority

Parameters:
criteria_p -
Returns:
int priority > 0, or 0 if no priority is undefined

setCriteria

public void setCriteria(String strPropertyName_p,
                        boolean fAsc_p)
toggle existing criteria or add a criteria to the sort list if it does not yet exist if the number of sort criteria exceeds the maximum value, the first sort criteria gets removed

Parameters:
strPropertyName_p - Property name to sort for

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.