Class CommentEntity
- java.lang.Object
-
- org.silverpeas.core.webapi.comment.CommentEntity
-
- All Implemented Interfaces:
Serializable
,WebEntity
public class CommentEntity extends Object implements WebEntity
The comment entity is a comment object that is exposed in the web as an entity (web entity). As such, it publishes only some of its attributes It represents a comment in Silverpeas plus some additional information such as the URI for accessing it.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CommentEntity()
protected
CommentEntity(Comment comment)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
static CommentEntity
fromComment(Comment comment)
Creates a new comment entity from the specified comment.static List<CommentEntity>
fromComments(List<Comment> comments)
Creates several new comment entities from the specified list of comments.static List<CommentEntity>
fromComments(Comment... comments)
Creates several new comment entities from the specified comments.UserProfileEntity
getAuthor()
Gets the user that has written this comment.String
getComponentId()
Gets the identifier of the Silverpeas component instance to which the commented content belongs.String
getCreationDate()
Gets the date at which the comment was created.String
getCurrentUserLanguage()
Gets the current user language.String
getId()
Gets the unique identifier of the comment.String
getModificationDate()
Gets the date at which the comment was lastly updated.String
getResourceId()
Gets the identifier of the resource that is commented by this.String
getResourceType()
Gets the type of the resource that is commented by this.String
getText()
Gets the text of the comment.String
getTextForHtml()
Gets the text encoded for HTLML of the comment.URI
getURI()
Gets the URI of this comment entity.int
hashCode()
boolean
isIndexed()
Is this comment indexed?CommentEntity
newText(String aText)
Changes the text of this comment by the specified one.Comment
toComment()
Gets the comment business objet this entity represent.CommentEntity
withCurrentUserLanguage(String currentUserLanguage)
Sets a currentUserLanguage to this entity.CommentEntity
withURI(URI uri)
Sets a URI to this entity.
-
-
-
Constructor Detail
-
CommentEntity
protected CommentEntity(Comment comment)
-
CommentEntity
protected CommentEntity()
-
-
Method Detail
-
fromComment
public static CommentEntity fromComment(Comment comment)
Creates a new comment entity from the specified comment.- Parameters:
comment
- the comment to entitify.- Returns:
- the entity representing the specified comment.
-
fromComments
public static List<CommentEntity> fromComments(Comment... comments)
Creates several new comment entities from the specified comments.- Parameters:
comments
- the comments to entitify.- Returns:
- a list of entities representing each of then one of the specified comments.
-
fromComments
public static List<CommentEntity> fromComments(List<Comment> comments)
Creates several new comment entities from the specified list of comments.- Parameters:
comments
- the list of comments to entitify.- Returns:
- a list of entities representing each of then one of the specified comments.
-
toComment
public Comment toComment()
Gets the comment business objet this entity represent.- Returns:
- a comment instance.
-
withURI
public CommentEntity withURI(URI uri)
Sets a URI to this entity. With this URI, it can then be accessed through the Web.- Parameters:
uri
- the web entity URI.- Returns:
- itself.
-
getURI
public URI getURI()
Gets the URI of this comment entity.
-
getId
public String getId()
Gets the unique identifier of the comment.- Returns:
- the comment identifier.
-
getComponentId
public String getComponentId()
Gets the identifier of the Silverpeas component instance to which the commented content belongs.- Returns:
- the silverpeas component instance identifier.
-
getResourceType
public String getResourceType()
Gets the type of the resource that is commented by this.- Returns:
- the commented resource type.
-
getResourceId
public String getResourceId()
Gets the identifier of the resource that is commented by this.- Returns:
- the commented resource identifier.
-
getAuthor
public UserProfileEntity getAuthor()
Gets the user that has written this comment.- Returns:
- the author of the comment.
-
getText
public String getText()
Gets the text of the comment.- Returns:
- the text of the comment.
-
getTextForHtml
public String getTextForHtml()
Gets the text encoded for HTLML of the comment.- Returns:
- the text encoded for HTML of the comment.
-
getCurrentUserLanguage
public String getCurrentUserLanguage()
Gets the current user language.- Returns:
- the language of the current user.
-
withCurrentUserLanguage
public CommentEntity withCurrentUserLanguage(String currentUserLanguage)
Sets a currentUserLanguage to this entity.- Parameters:
currentUserLanguage
- the language of the current user.- Returns:
- itself.
-
getCreationDate
public String getCreationDate()
Gets the date at which the comment was created.- Returns:
- the creation date of the comment.
-
getModificationDate
public String getModificationDate()
Gets the date at which the comment was lastly updated.- Returns:
- the modification date of the comment.
-
isIndexed
public boolean isIndexed()
Is this comment indexed? By default, the comment isn't indexed by the system.- Returns:
- true if the comment is indexed, false otherwise.
-
newText
public CommentEntity newText(String aText)
Changes the text of this comment by the specified one.- Parameters:
aText
- the new text.- Returns:
- itself.
-
-