Package com.adobe.granite.comments
Class AbstractComment
java.lang.Object
com.adobe.granite.comments.AbstractComment
- All Implemented Interfaces:
Comment
The
AbstractComment implements Comment and provides the API implementation, at the same time
offering abstract methods with which concrete implementations can control retrieval and storage of resources.-
Method Summary
Modifier and TypeMethodDescriptionfinal ResourceaddAttachment(String name, InputStream inputStream, String mimeType) Attach a file to this comment.final StringReturns the string representing annotation data that is part of this comment and pertains to the target of the associated comment collection.final ResourcegetAttachment(String name) Retrieve an attachment of this comment by its file name.Retrieves a map, an entry of which represents a file-name/attachment pair.final StringReturns the author's identifying name that represents the author of this comment.final CommentCollectionReturns the parentCommentCollectionthis comment is a part of.final CalendarThe time stamp this comment was created.final CalendarReturns the moment in time this collection was last modified.final StringRetrieves the message of this comment.final StringgetPath()Get the path of the resource representing this comment.final ValueMapReturns aValueMapholding all properties of this comment.final voidremove()Removes (deletes) this comment from its collection.final voidremoveAttachment(String name) Removes an attachment from this comment, as identified by its name.
-
Method Details
-
addAttachment
public final Resource addAttachment(String name, InputStream inputStream, String mimeType) throws CommentException Attach a file to this comment.- Specified by:
addAttachmentin interfaceComment- 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.
-
getAnnotationData
Description copied from interface:CommentReturns the string representing annotation data that is part of this comment and pertains to the target of the associated comment collection.- Specified by:
getAnnotationDatain interfaceComment- Returns:
- The string of the annotation data, or
nullif none is present.
-
getAttachment
Retrieve an attachment of this comment by its file name.- Specified by:
getAttachmentin interfaceComment- Parameters:
name- The file name of the attachment.- Returns:
- A
Resourcerepresenting the attachment, ornullif no attachment with the given name exists.
-
getAuthorName
Description copied from interface:CommentReturns 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.- Specified by:
getAuthorNamein interfaceComment- Returns:
- The string representing the author name.
-
getAttachmentMap
Retrieves a map, an entry of which represents a file-name/attachment pair. The map contains all the attachments of the comment.- Specified by:
getAttachmentMapin interfaceComment- Returns:
- A
Maprepresenting the available attachments, or an empty map if no attachments are present.
-
getCreated
The time stamp this comment was created.- Specified by:
getCreatedin interfaceComment- Returns:
- A
Calendarrepresenting creation time.
-
getLastModified
Description copied from interface:CommentReturns the moment in time this collection was last modified.- Specified by:
getLastModifiedin interfaceComment- Returns:
- The calendar representing the last modification.
-
getMessage
Retrieves the message of this comment.- Specified by:
getMessagein interfaceComment- Returns:
- A
Stringrepresenting the message.
-
getCollection
Returns the parentCommentCollectionthis comment is a part of.- Specified by:
getCollectionin interfaceComment- Returns:
- The parent
CommentCollection.
-
getPath
Get the path of the resource representing this comment. -
getProperties
Returns aValueMapholding all properties of this comment.- Specified by:
getPropertiesin interfaceComment- Returns:
- A
ValueMaprepresenting the properties.
-
removeAttachment
Removes an attachment from this comment, as identified by its name.- Specified by:
removeAttachmentin interfaceComment- Parameters:
name- The name of the attachment to remove.- Throws:
CommentException- If an error occurs removing the attachment.
-
remove
public final 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.
-