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 Messages

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

All Implemented Interfaces:
  java.io.Serializable

public class Messages
extends java.lang.Object
implements java.io.Serializable

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

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

     DiscussionSession s = DiscussionSession.getSession(user);
     Messages	msgs = s.getMessages();

     MessageFilter filter = new MessageFilter();
     filter.setSubject("java");

     msgs.setFilter(filter);
     msgs.sort(SortOrder.ASCENDING, MessageProperty.SUBJECT);

     Iterator	it = msgs.messages().iterator();
     while(it.hasNext())
    	{
    	Message		m = (Message) it.next();
    	...
      }

See Also:
  Serialized Form

Method Summary
`Message` | `add(java.lang.String sSubject)` Adds a message to the messages collection.
`Message` | `add(java.lang.String sSubject, java.lang.String sBody, java.lang.String sKeywords)` Adds a message to the messages collection.
`Message` | `add(java.lang.String sSubject, java.lang.String sBody, java.lang.String sContentType, java.lang.String sKeywords)` Adds a message to the messages collection.
`void` | `clearFilter()` Clears the message filter for this collection of messages.
`void` | `clearSort()` Clears the message sorting for this collection of messages.
`int` | `getCount()` Gets the number of messages in the collection.
`int` | `getCurrentPageNumber()` Gets the number of the current page.
`MessageFilter` | `getFilter()` Gets the message 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 messages 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.
`java.util.List` | `messages()` Gets the list of all messages the authenticated user has `READ` access to.
`java.util.List` | `messages(int iPageNumber)` Gets the sublist of messages on the specified page number.
`java.util.List` | `messages(int iFromIndex, int iToIndex)` Gets a list of messages between the specified `iFromIndex` and `iToIndex`.
`void` | `setFilter(MessageFilter filter)` Sets the message filter.
`void` | `setPageSize(int iPageSize)` Sets the number of messages to appear on a single page.
`void` | `sort(SortOrder order, MessageProperty property)` Sorts the messages 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 Message add(java.lang.String sSubject)
                throws TopicExpirationException

  Adds a message to the messages collection.
  Parameters:
    `sSubject` - the subject of the message
  Returns:
    the new message or `null if the create fails`
  See Also:
    `the forum has expired and is not accepting new topics`

### add

    public Message add(java.lang.String sSubject,
                       java.lang.String sBody,
                       java.lang.String sKeywords)
                throws TopicExpirationException

  Adds a message to the messages collection.
  Parameters:
    `sSubject` - the subject of the message
    `sBody` - the body of the message (defaults to `text/plain` content type)
    `sKeywords` - the keywords of the message
  Returns:
    the new message or `null` if the create fails
  See Also:
    `the forum has expired and is not accepting new topics`

### add

    public Message add(java.lang.String sSubject,
                       java.lang.String sBody,
                       java.lang.String sContentType,
                       java.lang.String sKeywords)
                throws TopicExpirationException

  Adds a message to the messages collection.
  Parameters:
    `sSubject` - the subject of the message
    `sBody` - the body of the message
    `sContentType` - the content type
    `sKeywords` - the keywords of the message
  Returns:
    the new message or `null` if the create fails
  See Also:
    `the forum has expired and is not accepting new topics`

### setFilter

    public void setFilter(MessageFilter filter)

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

### getFilter

    public MessageFilter getFilter()

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

### clearFilter

    public void clearFilter()

  Clears the message filter for this collection of messages.

### getPageSize

    public int getPageSize()

  Gets the number of messages to appear on a single page.
  Returns:
    the number of messages or 0 for all messages

### setPageSize

    public void setPageSize(int iPageSize)

  Sets the number of messages to appear on a single page.
  Parameters:
    `iPageSize` - the number of messages on a single page or 0 for all messages

### getPageCount

    public int getPageCount()

  Gets the total number of pages in the object for pagination.
  Returns:
    the total number of pages (0 for none)

### getCurrentPageNumber

    public int getCurrentPageNumber()

  Gets the number of the current page.
  Returns:
    the current page number

### getNextPageNumber

    public int getNextPageNumber()

  Gets the number of the next page.
  Returns:
    the next page number

### getPreviousPageNumber

    public int getPreviousPageNumber()

  Gets the number of the previous page.
  Returns:
    the previous page

### isFirstPage

    public boolean isFirstPage()

  Checks if current page is the first page.
  Returns:
    `true` if this is the first page; `false` otherwise

### isLastPage

    public boolean isLastPage()

  Checks if current page is the last page.
  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 `messages() methods, the from index is returned.`
  Returns:
    the from index or -1 if all messages were returned
  See Also:
    `messages()`, `messages(int)`, `messages(int, int)`

### getShowingTo

    public int getShowingTo()

  Gets the to index. Based on the last call to any of the `messages() methods, the to index is returned.`
  Returns:
    the from index or -1 if all messages were returned
  See Also:
    `messages()`, `messages(int)`, `messages(int, int)`

### messages

    public java.util.List messages(int iPageNumber)

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

### messages

    public java.util.List messages()

  Gets the list of all messages the authenticated user has `READ` access to.
  Returns:
    the un-modifiable list of `Message` object

### messages

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

  Gets a list of messages between the specified `iFromIndex` and `iToIndex`.
  Parameters:
    `iFromIndex` - the from index endpoint (inclusive) of the message collection
    `iToIndex` - the to index highpoint (exclusive) of the message collection
  Returns:
    the un-modifiable list of `Message` object

### getCount

    public int getCount()

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

### sort

    public void sort(SortOrder order,
                     MessageProperty property)

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

### clearSort

    public void clearSort()

  Clears the message sorting for this collection of messages.

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