Class 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 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 convert into a web entity.
        Returns:
        the entity representing the specified comment.
      • 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.
        Specified by:
        getURI in interface WebEntity
        Returns:
        the URI with which this entity can be access through the Web.
      • 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.
      • 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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object