Clearspace API (2.5.18) Core Javadocs

com.jivesoftware.community
Interface Comment

All Superinterfaces:
ImageContentResource, JiveContentObject, JiveObject

public interface Comment
extends JiveContentObject, ImageContentResource

A comment provides a way for users to annotate or give feedback on a JiveContentObject. Administrators control who is allowed to post comments and can also specify whether a moderator has to approve comments before they are visible to other users.

There are two options for navigating through the comments on a JiveContentObject.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.jivesoftware.community.JiveContentObject
JiveContentObject.Field, JiveContentObject.Status
 
Method Summary
 Document getBody()
          Returns the comment body.
 CommentContentResource getCommentContentResource()
          Returns the parent CommentContentResource of the comment.
 Date getCreationDate()
          Returns the date that the comment was created.
 String getEmail()
          Returns the email of the person that authored this comment.
 String getIPAddress()
          Returns the IP address of the person that authored this comment.
 JiveContainer getJiveContainer()
          Returns the container object of the document.
 Date getModificationDate()
          Returns the date that the comment was last modified.
 String getName()
          Returns the name of the person that authored this comment.
 Map<String,String> getProperties()
          Retrieve a map of all the extended properties for the comment.
 String getUnfilteredProperty(String name)
          Returns an extended property of the comment, bypassing any filters.
 String getURL()
          Returns the URL of the person that authored this comment.
 User getUser()
          Returns the user that authored the comment.
 boolean isAnonymous()
          Returns true if the comment was posted anonymously.
 boolean isAuthorized(long permissionType)
          Returns true if the handle on the object has the permission specified.
 boolean isModerated()
          Returns true if the commend is moderated, false otherwise.
 void setBody(Document body)
          Sets the comment body.
 void setCreationDate(Date creationDate)
          Sets the creation date of the comment.
 void setEmail(String email)
          Set the email address of the person who authored this comment.
 void setIPAddress(String ipaddress)
          Set the IP address of the person who authored this comment.
 void setModerated(boolean moderated)
          Sets whether the comment is moderated or not.
 void setModificationDate(Date modificationDate)
          Sets the date the comment was last modified.
 void setName(String name)
          Set the name of the person who authored this comment.
 void setStatus(JiveContentObject.Status status)
          Sets the status of this comment
 void setURL(String url)
          Set the URL / homepage of the person who authored this comment.
 
Methods inherited from interface com.jivesoftware.community.JiveContentObject
getContainerID, getContainerType, getIndexContent, getPlainBody, getPlainSubject, getStatus, getSubject, getUnfilteredSubject
 
Methods inherited from interface com.jivesoftware.community.JiveObject
getID, getObjectType
 
Methods inherited from interface com.jivesoftware.community.ImageContentResource
addImage, createImage, deleteImage, getImage, getImageCount, getImages
 

Method Detail

getCommentContentResource

CommentContentResource getCommentContentResource()
Returns the parent CommentContentResource of the comment.

Returns:
the parent CommentContentResource which contains the comment.

getUser

User getUser()
Returns the user that authored the comment. If the comment was created anonymously, this method will return null.

Specified by:
getUser in interface JiveContentObject
Returns:
the author of the comment, or null if anonymous.

getName

String getName()
Returns the name of the person that authored this comment. If the comment was created anonymously, this method will return null.

Returns:
the name of the author of the comment

setName

void setName(String name)
             throws UnauthorizedException
Set the name of the person who authored this comment.

Parameters:
name - the name of the person who authored this comment.
Throws:
UnauthorizedException - if user is not allowed to edit the comment.

getEmail

String getEmail()
Returns the email of the person that authored this comment. If the comment was created anonymously, this method will return null.

Returns:
the email of the author of the comment

setEmail

void setEmail(String email)
              throws UnauthorizedException
Set the email address of the person who authored this comment.

Parameters:
email - the email address of the person who authored this comment.
Throws:
UnauthorizedException - if user is not allowed to edit the comment.

getURL

String getURL()
Returns the URL of the person that authored this comment. If the comment was created anonymously, this method will return null.

Returns:
the URL of the author of the comment

setURL

void setURL(String url)
            throws UnauthorizedException
Set the URL / homepage of the person who authored this comment.

Parameters:
url - the URL / homepage of the person who authored this comment.
Throws:
UnauthorizedException - if user is not allowed to edit the comment.

getIPAddress

String getIPAddress()
Returns the IP address of the person that authored this comment.

Returns:
the IP address of the author of the comment

setIPAddress

void setIPAddress(String ipaddress)
                  throws UnauthorizedException
Set the IP address of the person who authored this comment.

Parameters:
ipaddress - the IP address of the person who authored this comment.
Throws:
UnauthorizedException - if user is not allowed to edit the comment.

getBody

Document getBody()
Returns the comment body. If filters are active, the body returned will be a filtered one. Because filters often provide security functionality such as stripping out HTML and Javascript, this method is the preferred way to get the body of a comment.

Specified by:
getBody in interface JiveContentObject
Returns:
the body of the comment.

setBody

void setBody(Document body)
             throws UnauthorizedException
Sets the comment body.

Parameters:
body - the body of the comment.
Throws:
UnauthorizedException - if user is not allowed to edit the comment.

isAnonymous

boolean isAnonymous()
Returns true if the comment was posted anonymously. This is a convenience method for: comment.getUser() != null.

Returns:
true if the comment was posted anonymously.

getCreationDate

Date getCreationDate()
Returns the date that the comment was created.

Specified by:
getCreationDate in interface JiveContentObject
Returns:
the date the comment was created.

setCreationDate

void setCreationDate(Date creationDate)
                     throws UnauthorizedException
Sets the creation date of the comment. In most cases, the creation date will default to when the comment was entered into the system. However, the creation date needs to be set manually when importing data. In other words, skin authors should ignore this method since it only intended for system maintenance.

Parameters:
creationDate - the date the comment was created.
Throws:
UnauthorizedException - if user does not have Permissions.COMMUNITY_ADMIN or Permissions.SYSTEM_ADMIN permissions.

getModificationDate

Date getModificationDate()
Returns the date that the comment was last modified.

Specified by:
getModificationDate in interface JiveContentObject
Returns:
the date that the comment was last modified.

setModificationDate

void setModificationDate(Date modificationDate)
                         throws UnauthorizedException
Sets the date the comment was last modified. In most cases, last modified will default to when the comment was last changed. However, the last modified date needs to be set manually when importing data. In other words, skin authors should ignore this method since it only intended for system maintenance.

Parameters:
modificationDate - the date the comment was last modified.
Throws:
UnauthorizedException - if user does not have Permissions.COMMUNITY_ADMIN or Permissions.SYSTEM_ADMIN permissions.

isModerated

boolean isModerated()
Returns true if the commend is moderated, false otherwise. New comments are not moderated by default.

If the moderation value is less than the community's minimum, then the comment will not be displayed by default.

Returns:
true if the commend is moderated, false otherwise.

setModerated

void setModerated(boolean moderated)
                  throws UnauthorizedException
Sets whether the comment is moderated or not. If the comment is set to be moderated then a number of things will happen:

When calling this method results in a comment become unmoderated, then the actions listed above will all be executed. Any change in moderation also results in the modified date of the comment being updated.

Only administrators and moderators can call this method.

The authToken of the user must be passed into this method as a parameter for moderation auditing purposes.

Parameters:
moderated - true if the comment is to be moderated, false otherwise.
Throws:
UnauthorizedException - if does not have Permissions.COMMUNITY_ADMIN, Permissions.SYSTEM_ADMIN or Permissions.MODERATOR permissions.
See Also:
WatchManager

isAuthorized

boolean isAuthorized(long permissionType)
Returns true if the handle on the object has the permission specified. For example, if a community administrator has a handle on this object, then calling isAuthorized(Permissions.COMMUNITY_ADMIN) would return true.

A list of possible permissions can be found in the Permissions and the Permissions classes. Certain methods of this class are restricted to certain permissions as specified in the method comments.

Parameters:
permissionType - a permission type from the Permissions or the Permissions class.
Returns:
true if the handle on the object has the specified permission.
See Also:
Permissions, Permissions

getProperties

Map<String,String> getProperties()
Retrieve a map of all the extended properties for the comment. Each comment can have an arbitrary number of extended properties. This allows for enhanced functionality that is not part of the base interface. The map is alterable if the user is authorized to modify the document. Null keys and values are not allowed.

Values returned from the map are filtered through the filter system. To retrieve unfiltered property values use the getUnfilteredProperty(String) method.

Returns:
a map of comment extended properties.

getUnfilteredProperty

String getUnfilteredProperty(String name)
Returns an extended property of the comment, bypassing any filters. Each comment can have an arbitrary number of extended properties. This allows for enhanced functionality that is not part of the base interface.

Because properties are not filtered before being returned, this method should be used with caution. In particular, you should avoid showing unfiltered data in an environment where embedded HTML might be interpreted.

Parameters:
name - the name of the property to get.
Returns:
the value of the property.

getJiveContainer

JiveContainer getJiveContainer()
Returns the container object of the document.

Returns:
the container object of the document.

setStatus

void setStatus(JiveContentObject.Status status)
               throws UnauthorizedException
Sets the status of this comment

Parameters:
status - the status of the comment.
Throws:
UnauthorizedException - if the caller does not have ADMIN, MODERATE_MESSAGES or MODERATOR permissions.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.