Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.compoze.discussion
Class Topics

    java.lang.Object
      |
      +--com.compoze.discussion.Topics

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

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

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

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

     Forum	f = ...;

     DiscussionSession s = DiscussionSession.getSession(user);
     Topics	topics = f.getTopics();

     TopicFilter filter = new TopicFilter();
     filter.setSubject("compile");

     topics.setFilter(filter);
     topics.sort(SortOrder.ASCENDING, TopicProperty.SUBJECT);

     Iterator	it = topics.topics().iterator();
     while(it.hasNext())
    	{
    	Topic	t = (Topic) it.next();
    	...
      }

See Also:
  Serialized Form

Method Summary
`Topic` | `add(java.lang.String sSubject)` Adds a topic to the topics collection.
`Topic` | `add(java.lang.String sSubject, java.lang.String sDescription, java.lang.String sKeywords, java.util.Date expirationDate)` Adds a topic to the topics collection.
`Topic` | `add(java.lang.String sSubject, java.lang.String sContentType, java.lang.String sDescription, java.lang.String sKeywords, java.util.Date expirationDate)` Adds a topic to the topics collection.
`void` | `clearFilter()` Clears the topic filter for this collection of topics.
`void` | `clearSort()` Clears the topic sorting for this collection of topics.
`int` | `getCount()` Gets the number of topics in the collection.
`int` | `getCurrentPageNumber()` Gets the number of the current page.
`TopicFilter` | `getFilter()` Gets the topic 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 topics 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.
`boolean` | `isFirstPage()` Checks if current page is the first page.
`boolean` | `isLastPage()` Checks if current page is the last page.
`void` | `setFilter(TopicFilter filter)` Sets the topic filter.
`void` | `setPageSize(int iPageSize)` Sets the number of topics to appear on a single page.
`void` | `sort(SortOrder order, TopicProperty property)` Sorts the topics in the collection.
`java.util.List` | `topics()` Gets the list of all topics the authenticated user has `READ` access to.
`java.util.List` | `topics(int iPageNumber)` Gets the sublist of topics on the specified page number.
`java.util.List` | `topics(int iFromIndex, int iToIndex)` Gets a list of topics 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 Topic add(java.lang.String sSubject)
              throws java.security.AccessControlException,
                     ForumExpirationException,
                     ForumTopicMaximumException

  Adds a topic to the topics collection.
  Parameters:
    `sSubject` - the subject of the topic
  Returns:
    the new topic or `null` if the create fails
  See Also:
    `the user does not have permissions to add topics to this topics collection`, `the forum has expired and is not accepting new topics`, `the forum topic maximum has been reached and is not accepting new topics`, `DiscussionPermission.ADD_TOPIC`

### add

    public Topic add(java.lang.String sSubject,
                     java.lang.String sDescription,
                     java.lang.String sKeywords,
                     java.util.Date expirationDate)
              throws java.security.AccessControlException,
                     ForumExpirationException,
                     ForumTopicMaximumException

  Adds a topic to the topics collection. The content type of the description is `text/plain` (i.e. plain text).
  Parameters:
    `sSubject` - the subject of the topic
    `sDescription` - the description of the topic
    `sKeywords` - the keywords of the topic
    `expirationDate` - the expiration date (`null` for no expiration)
  Returns:
    the new topic or `null` if the create fails
  See Also:
    `the user does not have permissions to add topics to this topics collection`, `the forum has expired and is not accepting new topics`, `the forum topic maximum has been reached and is not accepting new topics`, `DiscussionPermission.ADD_TOPIC`

### add

    public Topic add(java.lang.String sSubject,
                     java.lang.String sContentType,
                     java.lang.String sDescription,
                     java.lang.String sKeywords,
                     java.util.Date expirationDate)
              throws java.security.AccessControlException,
                     ForumExpirationException,
                     ForumTopicMaximumException

  Adds a topic to the topics collection.
  Parameters:
    `sSubject` - the subject of the topic
    `sContentType` - the content type of the description
    `sDescription` - the description of the topic
    `sKeywords` - the keywords of the topic
    `expirationDate` - the expiration date (`null` for no expiration)
  Returns:
    the new topic or `null` if the create fails
  See Also:
    `the user does not have permissions to add topics to this topics collection`, `the forum has expired and is not accepting new topics`, `the forum topic maximum has been reached and is not accepting new topics`, `DiscussionPermission.ADD_TOPIC`

### setFilter

    public void setFilter(TopicFilter filter)

  Sets the topic filter. The filter may be used to restrict the topics that are returned by the collection. To clear the filter, use `clearFilter()`.
  Returns:
    the topic filter (may not be `null`)

### getFilter

    public TopicFilter getFilter()

  Gets the topic filter. The filter may be used to restrict the topics that are returned by the collection.
  Returns:
    the topic filter or `null` if no filter is set
  See Also:
    `topics()`

### clearFilter

    public void clearFilter()

  Clears the topic filter for this collection of topics.

### getPageSize

    public int getPageSize()

  Gets the number of topics to appear on a single page.
  Specified by:
    `getPageSize` in interface `com.compoze.common.IPagination`
  Returns:
    the number of topics or 0 for all topics

### setPageSize

    public void setPageSize(int iPageSize)

  Sets the number of topics to appear on a single page.
  Specified by:
    `setPageSize` in interface `com.compoze.common.IPagination`
  Parameters:
    `iPageSize` - the number of topics on a single page or 0 for all topics

### 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 `topics() methods, the from index is returned.`
  Specified by:
    `getShowingFrom` in interface `com.compoze.common.IPagination`
  Returns:
    the from index or -1 if all topics were returned
  See Also:
    `topics()`, `topics(int)`, `topics(int, int)`

### getShowingTo

    public int getShowingTo()

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

### topics

    public java.util.List topics(int iPageNumber)

  Gets the sublist of topics on the specified page number. The number of topics 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 `Topic` objects
  See Also:
    `getPageCount()`

### topics

    public java.util.List topics()

  Gets the list of all topics the authenticated user has `READ` access to.
  Returns:
    the un-modifiable list of `Topic` objects

### topics

    public java.util.List topics(int iFromIndex,
                                 int iToIndex)

  Gets a list of topics between the specified `iFromIndex` and `iToIndex`.
  Parameters:
    `iFromIndex` - the from index endpoint (inclusive) of the topic collection
    `iToIndex` - the to index highpoint (exclusive) of the topic collection
  Returns:
    the un-modifiable list of `Topic` objects

### getCount

    public int getCount()

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

### sort

    public void sort(SortOrder order,
                     TopicProperty property)

  Sorts the topics in the collection.
  Parameters:
    `sortOrder` - the sort order
    `property` - the property to sort by

### clearSort

    public void clearSort()

  Clears the topic sorting for this collection of topics.

### getSort

    public SortOrder getSort()

  Gets the sort order.
  Returns:
    the sort order or `null` if not sorting is imposed

### 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

Overview | Package | Class | Tree | Deprecated | Index | Help
| Compoze Software, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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