Class AbstractCommentCollection<C extends Comment>

  • All Implemented Interfaces:
    CommentCollection<C>

    @ConsumerType
    public abstract class AbstractCommentCollection<C extends Comment>
    extends Object
    implements CommentCollection<C>
    The AbstractCommentCollection implements a CommentCollection and provides basic implementation of the API, providing abstract methods so that concrete implementations can control storage and retrieval of resources.
    • Method Detail

      • addComment

        public final C addComment​(String message,
                                  String author,
                                  String annotationData)
                           throws CommentException
        Create a new comment and add it to the collection. The comment will be created with the given message, optional author user ID string and optional annotation data.
        Specified by:
        addComment in interface CommentCollection<C extends Comment>
        Parameters:
        message - The message of the comment.
        author - The optional user ID to set as the author of the new comment. If none is provided, the session user is considered the author.
        annotationData - The optional annotation data. Annotation data may be used to store SVG data when commenting on an image that is annotated with such data.
        Returns:
        The comment just created.
        Throws:
        CommentException - Upon encountering an error during comment creation.
      • getCommentList

        public final List<C> getCommentList()
        Returns all comments of this collection.
        Specified by:
        getCommentList in interface CommentCollection<C extends Comment>
        Returns:
        A List of comments of this collection, or an empty list if no comments are present.
      • getPath

        public final String getPath()
        Returns the path of the resource representing this collection.
        Specified by:
        getPath in interface CommentCollection<C extends Comment>
        Returns:
        A String representing the path.
      • remove

        public final void remove()
        Removes (deletes) this comment collection. After calling this method, the collection must be considered invalid/stale and must not be used anymore.
        Specified by:
        remove in interface CommentCollection<C extends Comment>