Class AbstractComment

  • All Implemented Interfaces:
    Comment

    @ConsumerType
    public abstract class AbstractComment
    extends java.lang.Object
    implements Comment
    The AbstractComment implements Comment and provides the API implementation, at the same time offering abstract methods with which concrete implementations can control retrieval and storage of resources.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Resource addAttachment​(java.lang.String name, java.io.InputStream inputStream, java.lang.String mimeType)
      Attach a file to this comment.
      java.lang.String getAnnotationData()
      Returns the string representing annotation data that is part of this comment and pertains to the target of the associated comment collection.
      Resource getAttachment​(java.lang.String name)
      Retrieve an attachment of this comment by its file name.
      java.util.Map<java.lang.String,​Resource> getAttachmentMap()
      Retrieves a map, an entry of which represents a file-name/attachment pair.
      java.lang.String getAuthorName()
      Returns the author's identifying name that represents the author of this comment.
      CommentCollection getCollection()
      Returns the parent CommentCollection this comment is a part of.
      java.util.Calendar getCreated()
      The time stamp this comment was created.
      java.util.Calendar getLastModified()
      Returns the moment in time this collection was last modified.
      java.lang.String getMessage()
      Retrieves the message of this comment.
      java.lang.String getPath()
      Get the path of the resource representing this comment.
      ValueMap getProperties()
      Returns a ValueMap holding all properties of this comment.
      void remove()
      Removes (deletes) this comment from its collection.
      void removeAttachment​(java.lang.String name)
      Removes an attachment from this comment, as identified by its name.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • addAttachment

        public final Resource addAttachment​(java.lang.String name,
                                            java.io.InputStream inputStream,
                                            java.lang.String mimeType)
                                     throws CommentException
        Attach a file to this comment.
        Specified by:
        addAttachment in interface Comment
        Parameters:
        name - The name of the file to attach.
        inputStream - The InputStream representing the contents of the file.
        mimeType - The mime-type of this file.
        Returns:
        The Resource representing the attachment just added.
        Throws:
        CommentException - Upon encountering an error during persistence of the attachment.
      • getAnnotationData

        public final java.lang.String getAnnotationData()
        Description copied from interface: Comment
        Returns the string representing annotation data that is part of this comment and pertains to the target of the associated comment collection.
        Specified by:
        getAnnotationData in interface Comment
        Returns:
        The string of the annotation data, or null if none is present.
      • getAttachment

        public final Resource getAttachment​(java.lang.String name)
        Retrieve an attachment of this comment by its file name.
        Specified by:
        getAttachment in interface Comment
        Parameters:
        name - The file name of the attachment.
        Returns:
        A Resource representing the attachment, or null if no attachment with the given name exists.
      • getAuthorName

        public final java.lang.String getAuthorName()
        Description copied from interface: Comment
        Returns the author's identifying name that represents the author of this comment. This may be a user ID, a regular name, depending on the implementation.
        Specified by:
        getAuthorName in interface Comment
        Returns:
        The string representing the author name.
      • getAttachmentMap

        public final java.util.Map<java.lang.String,​Resource> getAttachmentMap()
        Retrieves a map, an entry of which represents a file-name/attachment pair. The map contains all the attachments of the comment.
        Specified by:
        getAttachmentMap in interface Comment
        Returns:
        A Map representing the available attachments, or an empty map if no attachments are present.
      • getCreated

        public final java.util.Calendar getCreated()
        The time stamp this comment was created.
        Specified by:
        getCreated in interface Comment
        Returns:
        A Calendar representing creation time.
      • getLastModified

        public final java.util.Calendar getLastModified()
        Description copied from interface: Comment
        Returns the moment in time this collection was last modified.
        Specified by:
        getLastModified in interface Comment
        Returns:
        The calendar representing the last modification.
      • getMessage

        public final java.lang.String getMessage()
        Retrieves the message of this comment.
        Specified by:
        getMessage in interface Comment
        Returns:
        A String representing the message.
      • getPath

        public final java.lang.String getPath()
        Get the path of the resource representing this comment.
        Specified by:
        getPath in interface Comment
        Returns:
        A string representing the path.
      • removeAttachment

        public final void removeAttachment​(java.lang.String name)
                                    throws CommentException
        Removes an attachment from this comment, as identified by its name.
        Specified by:
        removeAttachment in interface Comment
        Parameters:
        name - The name of the attachment to remove.
        Throws:
        CommentException - If an error occurs removing the attachment.
      • remove

        public final void remove()
        Removes (deletes) this comment from its collection. If the given comment has already been removed, nothing happens. After removal, the given comment object must be considered invalid/stale and must not be used anymore.
        Specified by:
        remove in interface Comment