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 Message

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

All Implemented Interfaces:
  java.io.Serializable

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

This class represents a message. Messages are grouped under a topic and can have sub-messages.

To add and search for message, see the `Messages` collection class available from a `Topic`. Once the message is obtained, its accessor methods may be called to set and get properties. The `update()` method must be called to store any changes to the server.

The following table contains the mappings from Message properties to their corresponding Java methods:

Message Property | Java Methods
`MessageProperty.APPROVAL_STATUS` | `getApprovalStatus()`
`MessageProperty.AUTHOR` | `getAuthor()`
`MessageProperty.BODY` | `getBody()`
`MessageProperty.CONTENT_TYPE` | `getContentType()`
`MessageProperty.CUSTOM_NUM1` | `getCustomNum1()`
`MessageProperty.CUSTOM_NUM2` | `getCustomNum2()`
`MessageProperty.CUSTOM_NUM3` | `getCustomNum3()`
`MessageProperty.CUSTOM_NUM4` | `getCustomNum4()`
`MessageProperty.CUSTOM_STR1` | `getCustomStr1()`
`MessageProperty.CUSTOM_STR2` | `getCustomStr2()`
`MessageProperty.CUSTOM_STR3` | `getCustomStr3()`
`MessageProperty.CUSTOM_STR4` | `getCustomStr4()`
`MessageProperty.DATE_CREATED` | `getDateCreated()`
`MessageProperty.DATE_LAST_MODIFIED` | `getDateLastModified()`
`MessageProperty.FILE_ATTACHMENT_COUNT` | `getFileAttachmentCount()`
`MessageProperty.KEYWORDS` | `getKeywords()`
`MessageProperty.MASK_AUTHOR` | `getMaskAuthor()`
`MessageProperty.MESSAGE_COUNT` | `getMessageCount()`
`MessageProperty.SUBJECT` | `getSubject()`

See Also:
  Serialized Form

Field Summary
`protected int` | `m_iMessageCount`

Constructor Summary
`Message()` Constructor.

Method Summary
`FileAttachment` | `addFileAttachment(java.lang.String sFilename, java.io.InputStream io)` Adds the file attachment to this message.
`void` | `delete()` Deletes the message.
`boolean` | `equals(java.lang.Object obj)` Indicates whether some other object is "equal to" this one.
`ApprovalStatus` | `getApprovalStatus()` Gets the approval status of the message.
`java.lang.String` | `getAuthor()` Gets the name of the author.
`java.lang.String` | `getBody()` Gets the body of the message.
`java.lang.String` | `getContentType()` Gets the content type of the message body.
`long` | `getCustomNum1()` Gets the custom number1 field of the message.
`long` | `getCustomNum2()` Gets the custom number2 field of the message.
`long` | `getCustomNum3()` Gets the custom number3 field of the message.
`long` | `getCustomNum4()` Gets the custom number4 field of the message.
`java.lang.String` | `getCustomStr1()` Gets the custom string1 field of the message.
`java.lang.String` | `getCustomStr2()` Gets the custom string2 field of the message.
`java.lang.String` | `getCustomStr3()` Gets the custom string3 field of the message.
`java.lang.String` | `getCustomStr4()` Gets the custom string4 field of the message.
`java.util.Date` | `getDateCreated()` Gets the date the message was created.
`java.util.Date` | `getDateLastModified()` Gets the date the message was last modified.
`FileAttachment` | `getFileAttachment(long lAttachmentID)` Gets the file attachment by the specified id.
`int` | `getFileAttachmentCount()` Gets the number of files associated with this message.
`java.util.List` | `getFileAttachments()` Gets a list of file attachments for this message.
`long` | `getID()` Gets the unique identifier (id) of the message.
`java.lang.String` | `getKeywords()` Gets the keywords associated with this message.
`boolean` | `getMaskAuthor()` Gets the mask author setting.
`int` | `getMessageCount()` Gets the number of messages associated with the messages under this message.
`Messages` | `getMessages()` Gets the sub-messages of this message.
`Message` | `getParentMessage()` Gets the parent message this message is associated with.
`long` | `getParentMessageID()` Gets the parent message id this message is associated with.
`java.lang.String` | `getSubject()` Gets the subject of the message.
`java.lang.String` | `getSubject(int iLength)` Gets the subject of the message.
`Topic` | `getTopic()` Gets the topic this message is associated with.
`long` | `getTopicID()` Gets the topic id this message is associated with.
`java.lang.String` | `getUnmaskedAuthor()` Gets the name of the author without a mask.
`boolean` | `hasFileAttachment()` Checks if the message has any file attachments.
`boolean` | `hasParentMessage()` Checks if this message has a parent message.
`boolean` | `isAuthor()` Checks if this user is the author of the message.
`void` | `removeFileAttachment(long lAttachmentID)` Removes the file attachment by the specified id.
`void` | `setApprovalStatus(ApprovalStatus status)` Sets the approval status of the message.
`void` | `setBody(java.lang.String sBody)` Sets the body of the message.
`void` | `setContentType(java.lang.String sContentType)` Sets the content type of the message body.
`void` | `setCustomNum1(long lCustomNum1)` Sets the custom number1 field of the message.
`void` | `setCustomNum2(long lCustomNum2)` Sets the custom number2 field of the message.
`void` | `setCustomNum3(long lCustomNum3)` Sets the custom number3 field of the message.
`void` | `setCustomNum4(long lCustomNum4)` Sets the custom number4 field of the message.
`void` | `setCustomStr1(java.lang.String sCustomStr1)` Sets the custom string1 field of the message.
`void` | `setCustomStr2(java.lang.String sCustomStr2)` Sets the custom string2 field of the message.
`void` | `setCustomStr3(java.lang.String sCustomStr3)` Sets the custom string3 field of the message.
`void` | `setCustomStr4(java.lang.String sCustomStr4)` Sets the custom string4 field of the message.
`void` | `setKeywords(java.lang.String sKeywords)` Sets the keywords associated with this message.
`void` | `setKeywords(java.lang.String[] keywords)` Sets the keywords associated with this message.
`void` | `setMaskAuthor(boolean bMaskAuthor)` Sets the mask author setting.
`void` | `setSubject(java.lang.String sSubject)` Sets the subject of the message.
`java.lang.String` | `toString()` Returns a string representation of the object.
`boolean` | `update()` Updates the message (saves the message entry).
`boolean` | `update(boolean bForce)` Updates the message (saves the message entry).

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### m_iMessageCount

    protected int m_iMessageCount

Constructor Detail

### Message

    public Message()

  Constructor.

Method Detail

### getID

    public long getID()

  Gets the unique identifier (id) of the message. This is non-zero number that uniquely identifies the message.
  Returns:
    the id of the message

### getTopicID

    public long getTopicID()

  Gets the topic id this message is associated with.
  Returns:
    the topic id

### getTopic

    public Topic getTopic()

  Gets the topic this message is associated with.
  Returns:
    the topic or `null` if an error occurs

### hasParentMessage

    public boolean hasParentMessage()

  Checks if this message has a parent message.
  Returns:
    `true` if this message has a parent; `false` otherwise
  See Also:
    `getParentMessage()`

### getParentMessageID

    public long getParentMessageID()

  Gets the parent message id this message is associated with.
  Returns:
    the parent message id or 0 if top level message
  See Also:
    `getParentMessage()`

### getParentMessage

    public Message getParentMessage()

  Gets the parent message this message is associated with.
  Returns:
    the parent message or `null` if top level message

### getAuthor

    public java.lang.String getAuthor()

  Gets the name of the author. The author is the name of the user who originally created this forum. If the mask author setting is `true`, the author name will be masked as '*' characters.
  Returns:
    the author name
  See Also:
    `getMaskAuthor()`

### getUnmaskedAuthor

    public java.lang.String getUnmaskedAuthor()
                                       throws java.security.AccessControlException

  Gets the name of the author without a mask. This method returns the author name without a mask if the mask author flag is set. This method will thrown an exception if the caller is not a moderator.
  Returns:
    the unmasked author name
  Throws:
    `java.security.AccessControlException` - occurs if the caller does not have `MODERATOR` permission
  See Also:
    `getMaskAuthor()`

### getMaskAuthor

    public boolean getMaskAuthor()

  Gets the mask author setting.
  Returns:
    `true` to mask the author; `false` otherwise

### setMaskAuthor

    public void setMaskAuthor(boolean bMaskAuthor)
                       throws java.security.AccessControlException

  Sets the mask author setting.
  Parameters:
    `bMaskAuthor` - `true` to mask the author; `false` otherwise
  Throws:
    `java.security.AccessControlException` - occurs if an attempt is made to set the mask author by a user without `MODERATOR` or `EDIT` permission

### isAuthor

    public boolean isAuthor()

  Checks if this user is the author of the message.
  Returns:
    `true` if this user is the message; `false` otherwise

### getApprovalStatus

    public ApprovalStatus getApprovalStatus()

  Gets the approval status of the message.
  Returns:
    the approval status

### setApprovalStatus

    public void setApprovalStatus(ApprovalStatus status)
                           throws java.security.AccessControlException

  Sets the approval status of the message.
  Parameters:
    `status` - the approval status (may not be `null`)
  Throws:
    `java.security.AccessControlException` - occurs if an attempt is made to set the approval status by a user without `MODERATOR` permission

### getSubject

    public java.lang.String getSubject()

  Gets the subject of the message.
  Returns:
    the subject of the message or `null` if no subject is set

### getSubject

    public java.lang.String getSubject(int iLength)

  Gets the subject of the message. The subject is truncated after the specified number of characters and "..." is appended to it.
  Parameters:
    `iLength` - the maximum length of the result (string plus "...")
  Returns:
    the truncated subject of the message

### setSubject

    public void setSubject(java.lang.String sSubject)

  Sets the subject of the message.
  Parameters:
    `sSubject` - the subject of the message or `null` for no subject

### getDateCreated

    public java.util.Date getDateCreated()

  Gets the date the message was created.
  Returns:
    the date created

### getContentType

    public java.lang.String getContentType()

  Gets the content type of the message body. The content type can be used to determine how to display the message body. For example, `text/plain` can be displayed as plain text.
  Returns:
    the MIME content type of the body
  See Also:
    `getBody()`

### setContentType

    public void setContentType(java.lang.String sContentType)

  Sets the content type of the message body.
  Parameters:
    `sContentType` - the MIME content type of the body (may not be `null` or empty)
  See Also:
    `getBody()`

### getBody

    public java.lang.String getBody()

  Gets the body of the message.
  Returns:
    the body of the message or `null` for no body

### setBody

    public void setBody(java.lang.String sBody)

  Sets the body of the message.
  Parameters:
    `sBody` - the body of the message or `null` for no body

### getMessageCount

    public int getMessageCount()

  Gets the number of messages associated with the messages under this message. The number of messages includes all messages directly under and the sub-messages of those messages.
  Returns:
    the number of messages (0 for none)

### getKeywords

    public java.lang.String getKeywords()

  Gets the keywords associated with this message.
  Returns:
    the keywords associated with this message or `null` for none
  See Also:
    `setKeywords(String)`

### setKeywords

    public void setKeywords(java.lang.String[] keywords)

  Sets the keywords associated with this message. Keywords represent meta-data to describe the message which are not part of the message subject. When searching for messages by keywords, this field is checked.

  The specified array of keywords are converted into a space delimited `String` of keywords. Existing keywords (if any) are over-written by the specified keywords.

  Parameters:
    `keywords` - an array of keywords to associate with this message (may not be `null`)
  See Also:
    `setKeywords(String)`

### setKeywords

    public void setKeywords(java.lang.String sKeywords)

  Sets the keywords associated with this message. Keywords represent meta-data to describe the message which are not part of the message subject. When searching for messages by keywords, this field is checked.

  Existing keywords (if any) are over-written by the specified keywords.

  Parameters:
    `sKeywords` - the keywords to associate with this message or `null` for none

### getDateLastModified

    public java.util.Date getDateLastModified()

  Gets the date the message was last modified.
  Returns:
    the date last modified

### getCustomNum1

    public long getCustomNum1()

  Gets the custom number1 field of the message.
  Returns:
    the custom number1 field of the message or `null` if the custom number1 field is not set

### setCustomNum1

    public void setCustomNum1(long lCustomNum1)

  Sets the custom number1 field of the message.
  Parameters:
    `lCustomNum1` - the custom number1 field of the message

### getCustomNum2

    public long getCustomNum2()

  Gets the custom number2 field of the message.
  Returns:
    the custom number2 field of the message or `null` if the custom number2 field is not set

### setCustomNum2

    public void setCustomNum2(long lCustomNum2)

  Sets the custom number2 field of the message.
  Parameters:
    `lCustomNum2` - the custom number2 field of the message

### getCustomNum3

    public long getCustomNum3()

  Gets the custom number3 field of the message.
  Returns:
    the custom number3 field of the message or `null` if the custom number3 field is not set

### setCustomNum3

    public void setCustomNum3(long lCustomNum3)

  Sets the custom number3 field of the message.
  Parameters:
    `lCustomNum3` - the custom number3 field of the message

### getCustomNum4

    public long getCustomNum4()

  Gets the custom number4 field of the message.
  Returns:
    the custom number4 field of the message or `null` if the custom number4 field is not set

### setCustomNum4

    public void setCustomNum4(long lCustomNum4)

  Sets the custom number4 field of the message.
  Parameters:
    `lCustomNum4` - the custom number4 field of the message

### getCustomStr1

    public java.lang.String getCustomStr1()

  Gets the custom string1 field of the message.
  Returns:
    the custom string1 field of the message or `null` if the custom string1 field is not set

### setCustomStr1

    public void setCustomStr1(java.lang.String sCustomStr1)

  Sets the custom string1 field of the message.
  Parameters:
    `sCustomStr1` - the custom string1 field of the message

### getCustomStr2

    public java.lang.String getCustomStr2()

  Gets the custom string2 field of the message.
  Returns:
    the custom string2 field of the message or `null` if the custom string2 field is not set

### setCustomStr2

    public void setCustomStr2(java.lang.String sCustomStr2)

  Sets the custom string2 field of the message.
  Parameters:
    `sCustomStr2` - the custom string2 field of the message

### getCustomStr3

    public java.lang.String getCustomStr3()

  Gets the custom string3 field of the message.
  Returns:
    the custom string3 field of the message or `null` if the custom string3 field is not set

### setCustomStr3

    public void setCustomStr3(java.lang.String sCustomStr3)

  Sets the custom string3 field of the message.
  Parameters:
    `sCustomStr3` - the custom string3 field of the message

### getCustomStr4

    public java.lang.String getCustomStr4()

  Gets the custom string4 field of the message.
  Returns:
    the custom string4 field of the message or `null` if the custom string4 field is not set

### setCustomStr4

    public void setCustomStr4(java.lang.String sCustomStr4)

  Sets the custom string4 field of the message.
  Parameters:
    `sCustomStr4` - the custom string4 field of the message

### getMessages

    public Messages getMessages()

  Gets the sub-messages of this message.
  Returns:
    the sub-messages of this folder (or `null` if there are no sub-messages)

### update

    public boolean update()
                   throws java.security.AccessControlException

  Updates the message (saves the message entry). This method must be called to commit changes to the message.
  Returns:
    `true` if the update is successful; `false` otherwise
  Throws:
    `java.security.AccessControlException` - occurs if the user does not have permission to edit the message

### update

    public boolean update(boolean bForce)
                   throws java.security.AccessControlException

  Updates the message (saves the message entry). This method must be called to commit changes to the message.
  Parameters:
    `bForce` - `true` to force the update; `false` otherwise (currently ignored)
  Returns:
    `true` if the update is successful; `false` otherwise
  Throws:
    `java.security.AccessControlException` - occurs if the user does not have permission to edit the message

### delete

    public void delete()
                throws java.security.AccessControlException

  Deletes the message.
  Throws:
    `java.security.AccessControlException` - occurs if the user does not have permission to delete the message

### equals

    public boolean equals(java.lang.Object obj)

  Indicates whether some other object is "equal to" this one. The message id is used to determine equality.
  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the object to compare for eqaulity
  Returns:
    `true` if the objects are equals; `false`otherwise

### hasFileAttachment

    public boolean hasFileAttachment()

  Checks if the message has any file attachments.
  Returns:
    `true` if the message has file attachments; `false` otherwise

### getFileAttachmentCount

    public int getFileAttachmentCount()

  Gets the number of files associated with this message.
  Returns:
    the number of files

### removeFileAttachment

    public void removeFileAttachment(long lAttachmentID)

  Removes the file attachment by the specified id.
  Returns:
    lAttachmentID the file attachment id

### getFileAttachment

    public FileAttachment getFileAttachment(long lAttachmentID)

  Gets the file attachment by the specified id.
  Returns:
    lAttachmentID the file attachment id

### getFileAttachments

    public java.util.List getFileAttachments()

  Gets a list of file attachments for this message.
  Returns:
    an unmodifiable list of `FileAttachment` objects

### addFileAttachment

    public FileAttachment addFileAttachment(java.lang.String sFilename,
                                            java.io.InputStream io)
                                     throws java.io.IOException

  Adds the file attachment to this message. The input stream will be fully read and closed. The attachment is added and commited to the message. A call to `update()` is not required.
  Parameters:
    `sFilename` - the file attachment name (may not be `null`)
    `io` - the input stream to the file attachment data
  Returns:
    the newly added file attachment

### toString

    public java.lang.String toString()

  Returns a string representation of the object.
  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the string representation of the 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.