Package com.adobe.granite.comments
Interface Comment
-
- All Known Implementing Classes:
AbstractComment
@ConsumerType public interface Comment
A
Commentrepresents an annotation created by a user (author) on a specific target (e.g. a page, asset or any node for that matter). The comments are contained within aCommentCollection(seegetCollection(). The comment collection is specific to a target (seeCommentCollection.getTarget().In its simplest form, a comment simply provides a comment text or "message" (see
getMessage()and access to various meta data, such as creation date, who created it, etc.Comments support attachments, i.e. files that are stored as part of a comment, e.g. a preview image if the comment is used to annotate an image.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResourceaddAttachment(java.lang.String name, java.io.InputStream inputStream, java.lang.String mimeType)Attach a file to this comment.java.lang.StringgetAnnotationData()Returns the string representing annotation data that is part of this comment and pertains to the target of the associated comment collection.ResourcegetAttachment(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.StringgetAuthorName()Returns the author's identifying name that represents the author of this comment.CommentCollectiongetCollection()Returns the parentCommentCollectionthis comment is a part of.java.util.CalendargetCreated()The time stamp this comment was created.java.util.CalendargetLastModified()Returns the moment in time this collection was last modified.java.lang.StringgetMessage()Retrieves the message of this comment.java.lang.StringgetPath()Get the path of the resource representing this comment.ValueMapgetProperties()Returns aValueMapholding all properties of this comment.voidremove()Removes (deletes) this comment from its collection.voidremoveAttachment(java.lang.String name)Removes an attachment from this comment, as identified by its name.
-
-
-
Method Detail
-
addAttachment
Resource addAttachment(java.lang.String name, java.io.InputStream inputStream, java.lang.String mimeType)
Attach a file to this comment.- Parameters:
name- The name of the file to attach.inputStream- TheInputStreamrepresenting the contents of the file.mimeType- The mime-type of this file.- Returns:
- The
Resourcerepresenting the attachment just added. - Throws:
CommentException- Upon encountering an error during persistence of the attachment.java.lang.IllegalArgumentException- if name or inputStream or mimeType is null or empty.
-
getAnnotationData
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.- Returns:
- The string of the annotation data, or
nullif none is present.
-
getAttachment
Resource getAttachment(java.lang.String name)
Retrieve an attachment of this comment by its file name.- Parameters:
name- The file name of the attachment.- Returns:
- A
Resourcerepresenting the attachment, ornullif no attachment with the given name exists.
-
getAuthorName
java.lang.String getAuthorName()
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.- Returns:
- The string representing the author name.
-
getAttachmentMap
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.- Returns:
- A
Maprepresenting the available attachments, or an empty map if no attachments are present.
-
getCreated
java.util.Calendar getCreated()
The time stamp this comment was created.- Returns:
- A
Calendarrepresenting creation time.
-
getLastModified
java.util.Calendar getLastModified()
Returns the moment in time this collection was last modified.- Returns:
- The calendar representing the last modification.
-
getMessage
java.lang.String getMessage()
Retrieves the message of this comment.- Returns:
- A
Stringrepresenting the message.
-
getCollection
CommentCollection getCollection()
Returns the parentCommentCollectionthis comment is a part of.- Returns:
- The parent
CommentCollection.
-
getPath
java.lang.String getPath()
Get the path of the resource representing this comment.- Returns:
- A string representing the path.
-
getProperties
ValueMap getProperties()
Returns aValueMapholding all properties of this comment.- Returns:
- A
ValueMaprepresenting the properties.
-
removeAttachment
void removeAttachment(java.lang.String name)
Removes an attachment from this comment, as identified by its name.- Parameters:
name- The name of the attachment to remove.- Throws:
CommentException- If an error occurs removing the attachment.
-
remove
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.- Throws:
CommentException- Upon encountering an error while removing.
-
-