Compoze Software, Inc.

com.compoze.discussion
Class Forums

java.lang.Object
  |
  +--com.compoze.discussion.Forums
All Implemented Interfaces:
com.compoze.common.IPagination, java.io.Serializable

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

This class represents a collection of forums. The forums collection may be used to iterate through all of the forums.

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

 DiscussionSession s = DiscussionSession.getSession(user);
 Forums	forums = s.getForums();

 ForumFilter filter = new ForumFilter();
 filter.setName("java");

 forums.setFilter(filter);
 forums.sort(SortOrder.ASCENDING, ForumProperty.NAME);

 Iterator	it = forums.forums().iterator();
 while(it.hasNext())
	{
	Forum	f = (Forum) it.next();
	...
  }

 

See Also:
Serialized Form

Method Summary
 Forum add(java.lang.String sName)
          Adds a forum to the collection.
 void clearFilter()
          Clears the forum filter for this collection of forums.
 void clearSort()
          Clears the forum sorting for this collection of forums.
 java.util.List forums()
          Gets the list of all forums the authenticated user has READ access to.
 java.util.List forums(int iPageNumber)
          Gets the sublist of forums on the specified page number.
 java.util.List forums(int iFromIndex, int iToIndex)
          Gets the sublist of forums between the specified iFromIndex and iToIndex.
 int getCount()
          Gets the number of forums in the collection.
 int getCurrentPageNumber()
          Gets the number of the current page.
 ForumFilter getFilter()
          Gets the forum filter.
 Forum getForum(long id)
          Gets a forum with the given forum id.
 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 forums 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.
 ForumProperty getSortProperty()
          Gets the sort property.
 boolean isFirstPage()
          Checks if current page is the first page.
 boolean isLastPage()
          Checks if current page is the last page.
 void setFilter(ForumFilter filter)
          Sets the forum filter.
 void setPageSize(int iPageSize)
          Sets the number of forums to appear on a single page.
 void sort(SortOrder order, ForumProperty property)
          Sorts the forums in the collection.
 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 Forum add(java.lang.String sName)
Adds a forum to the collection.
Parameters:
sName - the name of the forum
Returns:
the new forum or null if create fails

setFilter

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

getFilter

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

clearFilter

public void clearFilter()
Clears the forum filter for this collection of forums.

getPageSize

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

setPageSize

public void setPageSize(int iPageSize)
Sets the number of forums to appear on a single page.
Specified by:
setPageSize in interface com.compoze.common.IPagination
Parameters:
iPageSize - the number of forums on a single page or 0 for all forums

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)

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

getShowingFrom

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

getShowingTo

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

forums

public java.util.List forums(int iPageNumber)
Gets the sublist of forums on the specified page number. The number of forums 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 un-modifiable list of Forum objects
See Also:
getPageCount()

forums

public java.util.List forums()
Gets the list of all forums the authenticated user has READ access to.
Returns:
the un-modifiable list of Forum objects

forums

public java.util.List forums(int iFromIndex,
                             int iToIndex)
Gets the sublist of forums between the specified iFromIndex and iToIndex.
Parameters:
iFromIndex - the from index endpoint (inclusive) of the forum list
iToIndex - the to index highpoint (exclusive) of the forum list
Returns:
the un-modifiable list of Forum objects

getCount

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

getForum

public Forum getForum(long id)
               throws java.security.AccessControlException
Gets a forum with the given forum id.
Parameters:
id - the forum id
Returns:
the forum or null if not found

sort

public void sort(SortOrder order,
                 ForumProperty property)
Sorts the forums in the collection.
Parameters:
sortOrder - the sort order
property - the property to sort by

clearSort

public void clearSort()
Clears the forum sorting for this collection of forums.

getSort

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

getSortProperty

public ForumProperty getSortProperty()
Gets the sort property.
Returns:
the property 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-2003 Compoze Software, Inc. All rights reserved.