blackboard.data.discussionboard
Class Message

java.lang.Object
  extended by blackboard.data.BbObject
      extended by blackboard.data.discussionboard.Message
All Implemented Interfaces:
IBbObject, Identifiable, java.lang.Cloneable

public class Message
extends BbObject

The LwMessage class provides a "light weight" view of a discussion board forum message within the Bb Course Management System.

Since:
Bb 5.5
Version:
$Revision: #1 $ $Date: 2007/06/27 $
See Also:
Message

Nested Class Summary
static class Message.MessageLifecycle
          Enumeration for reflecting user forum role A normal user will have a null value in the role A blocked user will be a READER A moderator will be a MODERATOR We can add additional roles in this later
 
Field Summary
static DataType DATA_TYPE
           
static BbLocale.Name POSTED_NAME_FORMAT
           
static java.lang.String RESOURCE_BUNDLE
          Resource bundle for this data object
static int SUBJECT_MAX_LENGTH
           
 
Fields inherited from class blackboard.data.BbObject
_bbAttributes
 
Constructor Summary
Message()
          Creates an instance of Message with default property values.
 
Method Summary
 void appendResponse(Message msg)
          Appends the given Message to the current list of responses currently defined for this Message.
 MessageAttachment getAttachment()
          Returns the attachment for this Message.
 FormattedText getBody()
          Returns the body of this Message
 java.lang.Integer getBodyLength()
          Returns the body length of this Message.
 DataType getDataType()
          Returns the DataType identifier for this object.
 java.util.Calendar getEditDate()
          Returns the edit date for this Message.
 Id getForumId()
          Returns the forum Id to which this Message was posted.
 int getHitCount()
          Returns a count of the number of times this Message has been accessed (viewed).
 boolean getIsCalculatedName()
          Sets the flag indicating that getPostedName returns a real-time name calculated from the User's first and last name, instead of Anonymous or a stored postedName (e.g., if the user was deleted or unavailable on the system).
 boolean getIsFromCartridge()
          Returns whether this Message came from a course cartridge.
 boolean getIsThreadLocked()
          Returns whether this Message has been locked from further responses being made to it.
 Message.MessageLifecycle getLifecycle()
          Returns the lifecycle for this Message.
 java.lang.String getLinkRefId()
          Returns the link reference id for this Message.
 MessageStatus getMessageStatus()
          Returns the status for this Message.
 MessageLabel getMsgLabel()
          Returns the label for this Message.
 Id getParentId()
          Returns the parent Id associated with this Message .
 java.lang.String getPersistentPostedName()
          Returns the name of the poster of this Message
 java.lang.Boolean getPostAsAnonymous()
          Returns whether this Message is posted as anonymous.
 java.util.Calendar getPostDate()
          Returns the post date for this Message.
 java.lang.String getPostedName()
          Returns the localized name of the poster of this Message
 BbList getResponses()
          Returns the list of responses for this Message.
 java.lang.String getSubject()
          Returns the subject associated with this Message
 java.util.List<Tag> getTags()
          Gets the tags associated to this message.
 java.util.List<java.lang.String> getTagsAsString()
          Gets a string-representation of all of the tags associated with this message
 java.lang.String getUserFamilyName()
          Returns
 java.lang.String getUserGivenName()
           
 Id getUserId()
          Returns the user Id associated with this Message.
 void setAttachment(MessageAttachment attachment)
          Sets the attachment for this Message.
 void setBody(FormattedText body)
          Sets the body of this Message
 void setEditDate(java.util.Calendar cEditDate)
          Sets the edit date for this Message.
 void setForumId(Id iForumId)
          Sets the forum Id value for this Message
 void setHitCount(int nHitCount)
          Sets the number of times this Message has been accessed.
 void setIsCalculatedName(boolean isCalculatedName)
          Sets the flag indicating that getPostedName returns a real-time name calculated from the User's first and last name, instead of Anonymous or a stored postedName (e.g., if the user was deleted or unavailable on the system).
 void setIsFromCartridge(boolean bIsFromCartridge)
          Sets whether this Message came from a course cartridge.
 void setIsThreadLocked(boolean bIsThreadLocked)
          Sets whether this Message should be locked from an further responses.
 void setLifecycle(Message.MessageLifecycle lifecycle)
          Sets the lifecycle for this Message.
 void setLinkRefId(java.lang.String linkref)
          Sets the link reference id for this Message.
 void setMessageStatus(MessageStatus ms)
          Sets the status for this Message.
 void setMsgLabel(MessageLabel label)
          Sets the label for this Message.
 void setParentId(Id iParentId)
          Sets the parent Id value for this Message.
 void setPostAsAnonymous(java.lang.Boolean b)
          Sets whether this Message is posted as anonymous.
 void setPostDate(java.util.Calendar cPostDate)
          Sets the post date for this Message.
 void setPostedName(java.lang.String strPostedName)
          Sets the name of the poster of this Message
 void setResponses(BbList msgs)
          Sets the list of responses for this Message.
 void setSubject(java.lang.String strSubject)
          Sets the subject associated with this Message
 void setTags(java.util.List<Tag> tags)
          Sets the tags associated to this message.
 void setUser(User user)
          Sets the user that is the author of this message (for use in getPostedName() calculations)
 void setUserId(Id iUserId)
          Sets the user Id value for this Message
 void validate()
          Validates the contents of this BbObject.
 
Methods inherited from class blackboard.data.BbObject
clone, getBbAttributes, getCreatedDate, getId, getModifiedDate, persist, setCreatedDate, setId, setModifiedDate, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA_TYPE

public static final DataType DATA_TYPE

RESOURCE_BUNDLE

public static final java.lang.String RESOURCE_BUNDLE
Resource bundle for this data object

See Also:
Constant Field Values

POSTED_NAME_FORMAT

public static final BbLocale.Name POSTED_NAME_FORMAT

SUBJECT_MAX_LENGTH

public static final int SUBJECT_MAX_LENGTH
See Also:
Constant Field Values
Constructor Detail

Message

public Message()
Creates an instance of Message with default property values.

Method Detail

getUserId

public Id getUserId()
Returns the user Id associated with this Message. This value is the id of the user who posted/owns the message.

Returns:
user Id value for this message

setUserId

public void setUserId(Id iUserId)
Sets the user Id value for this Message

Parameters:
iUserId - the user Id value to use for this message

getUserFamilyName

public java.lang.String getUserFamilyName()
Returns

Returns:
Since:
7.3

getUserGivenName

public java.lang.String getUserGivenName()

setUser

public void setUser(User user)
Sets the user that is the author of this message (for use in getPostedName() calculations)

Parameters:
user - the User that is the author of this message

getForumId

public Id getForumId()
Returns the forum Id to which this Message was posted.

Returns:
forum Id value for this message

setForumId

public void setForumId(Id iForumId)
Sets the forum Id value for this Message

Parameters:
iForumId - the forum Id value to use for this message

getParentId

public Id getParentId()
Returns the parent Id associated with this Message . This value represents the message to which this message was posted (in response to). If the parent id value is null or an unset id, then this message is a top-level thread within its forum.

Returns:
parent Id value for this message

setParentId

public void setParentId(Id iParentId)
Sets the parent Id value for this Message. This action set this message as a response to the message to which the given id maps.

Parameters:
iParentId - the parent Id value to use for this message

getIsFromCartridge

public boolean getIsFromCartridge()
Returns whether this Message came from a course cartridge.

Returns:
true if this message came from a cartridge, false otherwise

setIsFromCartridge

public void setIsFromCartridge(boolean bIsFromCartridge)
Sets whether this Message came from a course cartridge.

Parameters:
bIsFromCartridge - true if this message came from a cartridge, false otherwise

getIsThreadLocked

public boolean getIsThreadLocked()
Returns whether this Message has been locked from further responses being made to it.

Returns:
true if this message has been locked to prevent further responses, false otherwise

setIsThreadLocked

public void setIsThreadLocked(boolean bIsThreadLocked)
Sets whether this Message should be locked from an further responses.

Parameters:
bIsThreadLocked - true if this message is locked and all responses should be prevented, false otherwise

getHitCount

public int getHitCount()
Returns a count of the number of times this Message has been accessed (viewed).

Returns:
an int representing the number of time this message has been accessed

setHitCount

public void setHitCount(int nHitCount)
Sets the number of times this Message has been accessed.

Parameters:
nHitCount - an int representing the number of time this message has been accessed

getPostedName

public java.lang.String getPostedName()
Returns the localized name of the poster of this Message

Returns:
the localized name of the poster of this message as a String

getPersistentPostedName

public java.lang.String getPersistentPostedName()
Returns the name of the poster of this Message

Returns:
the name of the poster of this message as a String

setPostedName

public void setPostedName(java.lang.String strPostedName)
Sets the name of the poster of this Message

Parameters:
strPostedName - a String containing the name name of the poster of this message

getSubject

public java.lang.String getSubject()
Returns the subject associated with this Message

Returns:
the subject value of this message as a String

setSubject

public void setSubject(java.lang.String strSubject)
Sets the subject associated with this Message

Parameters:
strSubject - a String containing the subject for this message

getBody

public FormattedText getBody()
Returns the body of this Message

Returns:
a {FormattedText} representing the body of this message

setBody

public void setBody(FormattedText body)
Sets the body of this Message

Parameters:
body - a FormattedText containing the body of this message

getBodyLength

public java.lang.Integer getBodyLength()
Returns the body length of this Message.

Returns:
an Integer representing the body length of this message

getPostAsAnonymous

public java.lang.Boolean getPostAsAnonymous()
Returns whether this Message is posted as anonymous.

Returns:
true if this message is posted as anonymous, false otherwise

setPostAsAnonymous

public void setPostAsAnonymous(java.lang.Boolean b)
Sets whether this Message is posted as anonymous.

Parameters:
b - true if this message is posted as anonymous, false otherwise

getResponses

public BbList getResponses()
Returns the list of responses for this Message.

Returns:
a BbList with the responses made to this message

setResponses

public void setResponses(BbList msgs)
Sets the list of responses for this Message.

When message responses are added to a message in this manner, no enforcement of the relationship between a message and its responses is performed. It is therefore the responsibility of the caller to have properly enforced these constraints. If enforcement of the elements of the relationship is desired, use appendResponse(Message) instead.

Parameters:
msgs - a BbList containing the set of responses to use for this message

appendResponse

public void appendResponse(Message msg)
Appends the given Message to the current list of responses currently defined for this Message.

This method enforces all constraints in the relationship of a message with its response. First, the parent/child relationship between a message and a response is enforced by calling setParentId(Id), passing in the local id value, on the provided Message prior to adding it to the list of responses. This response will belong to the same forum as the message it is being added to, so the forum id constraint is also enforced by calling (setForumId(Id) providing the same forum id contained locally.

Parameters:
msg - the Message to append to the current list of responses

getAttachment

public MessageAttachment getAttachment()
Returns the attachment for this Message.

Returns:
the MessageAttachment object that represents the file attachment made to this Message.

setAttachment

public void setAttachment(MessageAttachment attachment)
Sets the attachment for this Message.

Parameters:
attachment - the MessageAttachment object that is the file attachment to use for this Message

getMsgLabel

public MessageLabel getMsgLabel()
Returns the label for this Message.

Returns:
the MessageLabel object to this Message.

setMsgLabel

public void setMsgLabel(MessageLabel label)
Sets the label for this Message.

Parameters:
label - the MessageLabel object for this Message

getPostDate

public java.util.Calendar getPostDate()
Returns the post date for this Message.

Returns:
the post date of this Message

setPostDate

public void setPostDate(java.util.Calendar cPostDate)
Sets the post date for this Message.

Parameters:
cPostDate - the post date of this Message

getEditDate

public java.util.Calendar getEditDate()
Returns the edit date for this Message.

Returns:
the edit date of this Message

setEditDate

public void setEditDate(java.util.Calendar cEditDate)
Sets the edit date for this Message.

Parameters:
cEditDate - the edit date of this Message

getDataType

public DataType getDataType()
Returns the DataType identifier for this object. Can be used to uniquely identify the "type" of this data object.

Specified by:
getDataType in interface IBbObject
Specified by:
getDataType in interface Identifiable
Specified by:
getDataType in class BbObject
Returns:
the DataType for this object

getLifecycle

public Message.MessageLifecycle getLifecycle()
Returns the lifecycle for this Message.

Returns:
the Message.MessageLifecycle object to this Message.

setLifecycle

public void setLifecycle(Message.MessageLifecycle lifecycle)
Sets the lifecycle for this Message.

Parameters:
lifecycle - the Message.MessageLifecycle object for this Message

getMessageStatus

public MessageStatus getMessageStatus()
Returns the status for this Message.

Returns:
the MessageStatus object to this Message.

setMessageStatus

public void setMessageStatus(MessageStatus ms)
Sets the status for this Message.

Parameters:
ms - the MessageStatus object for this Message

getLinkRefId

public java.lang.String getLinkRefId()
Returns the link reference id for this Message.

Returns:
the link reference id to this Message.

setLinkRefId

public void setLinkRefId(java.lang.String linkref)
Sets the link reference id for this Message.

Parameters:
linkref - a String containing the link reference id to this Message.

getTags

public java.util.List<Tag> getTags()
Gets the tags associated to this message. Heavy attribute, not loaded by default

Since:
Bb 7.3

getTagsAsString

public java.util.List<java.lang.String> getTagsAsString()
Gets a string-representation of all of the tags associated with this message

Returns:
list of strings representing tag values
Since:
Bb 7.3

setTags

public void setTags(java.util.List<Tag> tags)
Sets the tags associated to this message. Heavy attribute, not loaded by default

Since:
Bb 7.3

getIsCalculatedName

public boolean getIsCalculatedName()
Sets the flag indicating that getPostedName returns a real-time name calculated from the User's first and last name, instead of Anonymous or a stored postedName (e.g., if the user was deleted or unavailable on the system).

Returns:
the isCalculatedName

setIsCalculatedName

public void setIsCalculatedName(boolean isCalculatedName)
Sets the flag indicating that getPostedName returns a real-time name calculated from the User's first and last name, instead of Anonymous or a stored postedName (e.g., if the user was deleted or unavailable on the system).

Parameters:
isCalculatedName - the isCalculatedName to set

validate

public void validate()
              throws ValidationException
Validates the contents of this BbObject. Internal consistency checks are also performed.

Specified by:
validate in interface IBbObject
Overrides:
validate in class BbObject
Throws:
ValidationException - if validation of this object fails


Copyright © 2003 Blackboard, Inc. All Rights Reserved.