Class AbstractCommentCollection<C extends Comment>

java.lang.Object
com.adobe.granite.comments.AbstractCommentCollection<C>
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 Details

    • 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.
    • getCreated

      public final 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 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 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.
    • getTarget

      public final Resource getTarget()
      Returns the Resource representing the target this comment collection belongs to.
      Specified by:
      getTarget in interface CommentCollection<C extends Comment>
      Returns:
      The resource.
    • 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>