Compoze Software, Inc.

com.compoze.todo
Class ToDos


java.lang.Object

  |

  +--com.compoze.todo.ToDos

All Implemented Interfaces:
com.compoze.common.IPagination, java.io.Serializable

public class ToDos
extends java.lang.Object
implements com.compoze.common.IPagination, java.io.Serializable

This class represents a to do. The to do collection may be used to iterate through to dos. By default, the to do colleciton is sorted by due date in ascending order.

The to do collection may also be used for searching. The following code segment shows how to reduce the to do that are returned in the collection to ones with a particular name and implies sorting:

 ToDoSession s = ToDoSession.getSession(user);
 ToDos	todos = s.getToDos();

 ToDoFilter filter = new ToDoFilter();
 filter.setSummary("Management Report");

 todos.setFilter(filter);
 todos.sort(SortOrder.ASCENDING, ToDoProperty.SUMMARY);

 Iterator	it = todos.todos().iterator();
 while(it.hasNext())
	{
	ToDo   td = (ToDo)it.next();
	...
  }

 

See Also:
Serialized Form

Method Summary
 ToDo add()
          Adds a to do to the collection.
 void clearFilter()
          Clears the to do filter for this collection of to dos.
 void clearSort()
          Clears the sorting for this collection of to dos.
 int getCount()
          Gets the number of to dos in the collection.
 int getCurrentPageNumber()
          Gets the number of the current page.
 ToDoFilter getFilter()
          Gets the to do filter.
 int getNextPageNumber()
          Gets the number of the next page.
 int getPageCount()
          Gets the total number of pages in the object for pagination.
 int getPageSize()
          Gets the number of to dos to appear on a single page.
 int getPreviousPageNumber()
          Gets the number of the previous page.
 int getShowingFrom()
          Gets the from index.
 int getShowingTo()
          Gets the to index.
 SortOrder getSort()
          Gets the sort order.
 ToDoProperty[] getSortProperties()
          Gets the sort properties.
 ToDoProperty getSortProperty()
          Gets the sort property.
 ToDo getToDo(long id)
          Gets a to do with the given id.
 boolean isFirstPage()
          Checks if current page is the first page.
 boolean isLastPage()
          Checks if current page is the last page.
 void setFilter(ToDoFilter filter)
          Sets the to do filter.
 void setPageSize(int iPageSize)
          Sets the number of todos to appear on a single page.
 void sort(SortOrder order, ToDoProperty property)
          Sorts the to dos in the collection.
 void sort(SortOrder order, ToDoProperty[] properties)
          Sorts the to dos in the collection.
 ToDoList todos()
          Gets the list of all to dos the authenticated user has READ access to.
 ToDoList todos(int iPageNumber)
          Gets the sublist of to dos on the specified page number.
 ToDoList todos(int iFromIndex, int iToIndex)
          Gets the sublist of to dos between the specified iFromIndex and iToIndex.
 java.lang.String toString()
          Returns the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

add


public ToDo add()
Adds a to do to the collection.
Returns:
the new to do or null if create fails

setFilter


public void setFilter(ToDoFilter filter)
Sets the to do filter. The filter may be used to restrict the to dos that are returned by the collection. To clear the filter, use clearFilter().
Returns:
the to do filter (may not be null)

getFilter


public ToDoFilter getFilter()
Gets the to do filter. The filter may be used to restrict the to dos that are returned by the collection.
Returns:
the to do filter or null if no filter is set

clearFilter


public void clearFilter()
Clears the to do filter for this collection of to dos.

getPageSize


public int getPageSize()
Gets the number of to dos to appear on a single page.
Specified by:
getPageSize in interface com.compoze.common.IPagination
Returns:
the number of to dos

setPageSize


public void setPageSize(int iPageSize)
Sets the number of todos to appear on a single page.
Specified by:
setPageSize in interface com.compoze.common.IPagination
Parameters:
iPageSize - the number of to dos on a single page (must be greater than zero)

getPageCount


public int getPageCount()
Gets the total number of pages in the object for pagination.
Specified by:
getPageCount in interface com.compoze.common.IPagination
Returns:
the total number of pages (0 for none)

getShowingFrom


public int getShowingFrom()
Gets the from index. Based on the last call to any of the todos() methods, the from index is returned.
Specified by:
getShowingFrom in interface com.compoze.common.IPagination
Returns:
the from index or -1 if all to dos were returned
See Also:
todos(), todos(int), todos(int, int)

getShowingTo


public int getShowingTo()
Gets the to index. Based on the last call to any of the todos() methods, the to index is returned.
Specified by:
getShowingTo in interface com.compoze.common.IPagination
Returns:
the from index or -1 if all to dos were returned
See Also:
todos(), todos(int), todos(int, int)

getCurrentPageNumber


public int getCurrentPageNumber()
Gets the number of the current page.
Specified by:
getCurrentPageNumber in interface com.compoze.common.IPagination
Returns:
the current page number

getNextPageNumber


public int getNextPageNumber()
Gets the number of the next page.
Specified by:
getNextPageNumber in interface com.compoze.common.IPagination
Returns:
the next page number

getPreviousPageNumber


public int getPreviousPageNumber()
Gets the number of the previous page.
Specified by:
getPreviousPageNumber in interface com.compoze.common.IPagination
Returns:
the previous page

isFirstPage


public boolean isFirstPage()
Checks if current page is the first page.
Specified by:
isFirstPage in interface com.compoze.common.IPagination
Returns:
true if this is the first page; false otherwise

isLastPage


public boolean isLastPage()
Checks if current page is the last page.
Specified by:
isLastPage in interface com.compoze.common.IPagination
Returns:
true if this is the last page; false otherwise

todos


public ToDoList todos(int iPageNumber)
Gets the sublist of to dos on the specified page number. The number of to dos returned will be equaled to the page size (see getPageSize().
Parameters:
iPageNumber - the page number (must be greater than zero and less than the total page count)
Returns:
the list of ToDo objects
See Also:
getPageCount()

todos


public ToDoList todos()
Gets the list of all to dos the authenticated user has READ access to.
Returns:
the list of ToDo objects

todos


public ToDoList todos(int iFromIndex,
                      int iToIndex)
Gets the sublist of to dos between the specified iFromIndex and iToIndex.
Parameters:
iFromIndex - the from index endpoint (inclusive) of the list
iToIndex - the to index highpoint (exclusive) of the list
Returns:
the list of ToDo objects

getCount


public int getCount()
Gets the number of to dos in the collection. The filter for this collection is applied if one exists; therefore, the number represents the number of to dos satisfying the filter, not the total number of to dos.
Returns:
the number of to dos or -1 if a count is not available

getToDo


public ToDo getToDo(long id)
             throws java.security.AccessControlException
Gets a to do with the given id.
Parameters:
id - the to do id
Returns:
the to do or null if not found

sort


public void sort(SortOrder order,
                 ToDoProperty property)
Sorts the to dos in the collection.
Parameters:
sortOrder - the sort order
property - the property to sort by (may not be null)

sort


public void sort(SortOrder order,
                 ToDoProperty[] properties)
Sorts the to dos in the collection. The first index in the property array is the primary sorting property, the second index is the secondary and so forth.
Parameters:
sortOrder - the sort order
props - the properties to sort by

clearSort


public void clearSort()
Clears the sorting for this collection of to dos.

getSort


public SortOrder getSort()
Gets the sort order.
Returns:
the sort order or null if not sorting is imposed

getSortProperty


public ToDoProperty getSortProperty()
Gets the sort property.
Returns:
the property to sort by or null if no property set
See Also:
getSortProperties()

getSortProperties


public ToDoProperty[] getSortProperties()
Gets the sort properties.
Returns:
the properties to sort by or null if no property set

toString


public java.lang.String toString()
Returns the string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
the string representation of this object

Compoze Software, Inc.

Copyright ©1999-2001 Compoze Software, Inc. All rights reserved.