Package com.adobe.granite.comments
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 java.lang.Object implements CommentCollection<C>
TheAbstractCommentCollection
implements aCommentCollection
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 theResource
representing the target this comment collection belongs to.void
remove()
Removes (deletes) this comment collection.
-
-
-
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 interfaceCommentCollection<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 interfaceCommentCollection<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 interfaceCommentCollection<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 interfaceCommentCollection<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 interfaceCommentCollection<C extends Comment>
- Returns:
- A
String
representing the path.
-
getTarget
public final Resource getTarget()
Returns theResource
representing the target this comment collection belongs to.- Specified by:
getTarget
in interfaceCommentCollection<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 interfaceCommentCollection<C extends Comment>
-
-