Class AbstractCommentCollection<C extends Comment>

  • All Implemented Interfaces:
    CommentCollection<C>

    @ConsumerType
    public abstract class AbstractCommentCollection<C extends Comment>
    extends java.lang.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 Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      C addComment​(java.lang.String message, java.lang.String author, java.lang.String annotationData)
      Create a new comment and add it to the collection.
      java.util.List<C> getCommentList()
      Returns all comments of this collection.
      java.util.Calendar getCreated()
      Returns the moment in time this collection was created.
      java.util.Calendar getLastModified()
      Returns the moment in time this collection was last modified.
      java.lang.String getPath()
      Returns the path of the resource representing this collection.
      Resource getTarget()
      Returns the Resource representing the target this comment collection belongs to.
      void remove()
      Removes (deletes) this comment collection.
      • Methods inherited from class java.lang.Object

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

      • addComment

        public final C addComment​(java.lang.String message,
                                  java.lang.String author,
                                  java.lang.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 java.util.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.
      • getCreated

        public final java.util.Calendar getCreated()
        Description copied from interface: CommentCollection
        Returns the moment in time this collection was created.
        Specified by:
        getCreated in interface CommentCollection<C extends Comment>
        Returns:
        The calendar representing the creation date/time.
      • getLastModified

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

        public final java.lang.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>