Class DefaultJcrCommentPersistenceManager
java.lang.Object
org.onehippo.forge.document.commenting.cms.impl.DefaultJcrCommentPersistenceManager
- All Implemented Interfaces:
Serializable,CommentPersistenceManager
public class DefaultJcrCommentPersistenceManager
extends Object
implements CommentPersistenceManager
CommentPersistenceManager implementation which stores data into JCR repository.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbindCommentNode(Node commentNode, CommentItem commentItem) createCommentItem(CommentingContext commentingContext, CommentItem commentItem) Create comment data item based on givencommentItem.protected QuerycreateLatestCommentItemsReadQuery(CommentingContext commentingContext, String subjectId, long offset, long limit) voiddeleteCommentItem(CommentingContext commentingContext, CommentItem commentItem) Deletes comment data item based on information given bycommentItem.protected StringgetAuthorName(CommentItem commentItem) getCommentBodyText(CommentingContext commentingContext, CommentItem commentItem) Gets comment body text to display in user interface fromcommentItem.getCommentBodyTooltip(CommentingContext commentingContext, CommentItem commentItem) Gets comment body tooltip text to display in user interface fromcommentItem.getCommentHeadText(CommentingContext commentingContext, CommentItem commentItem) Gets comment header text to display in user interface fromcommentItem.getCommentHeadTooltip(CommentingContext commentingContext, CommentItem commentItem) Gets comment header tooltip text to display in user interface fromcommentItem.getCommentItemById(CommentingContext commentingContext, String commentId) Retrieves a comment data item bycommentId.protected StringgetDateFormat(CommentingContext commentingContext) getLatestCommentItemsBySubjectId(CommentingContext commentingContext, String subjectId, long offset, long limit) Retrieves command data bysubjectId,offsetandlimit.protected Sessionprotected voidmapCommentItem(CommentItem commentItem, Node commentNode) voidupdateCommentItem(CommentingContext commentingContext, CommentItem commentItem) Updates comment data item bycommentItem.
-
Field Details
-
DEFAULT_COMMENTS_LOCATION
- See Also:
-
NT_COMMENTS_CONTAINER
- See Also:
-
NT_COMMENT
- See Also:
-
PROP_SUBJECTID
- See Also:
-
PROP_AUTHOR
- See Also:
-
PROP_CREATED
- See Also:
-
PROP_LAST_MODIFIED
- See Also:
-
PROP_CONTENT
- See Also:
-
-
Constructor Details
-
DefaultJcrCommentPersistenceManager
public DefaultJcrCommentPersistenceManager()
-
-
Method Details
-
getCommentItemById
public CommentItem getCommentItemById(CommentingContext commentingContext, String commentId) throws CommentingException Description copied from interface:CommentPersistenceManagerRetrieves a comment data item bycommentId.- Specified by:
getCommentItemByIdin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancecommentId- the identifier of the comment data item- Returns:
CommentIteminstance- Throws:
CommentingException- if any exception occurs while retrieving a comment data item
-
getLatestCommentItemsBySubjectId
public List<CommentItem> getLatestCommentItemsBySubjectId(CommentingContext commentingContext, String subjectId, long offset, long limit) throws CommentingException Description copied from interface:CommentPersistenceManagerRetrieves command data bysubjectId,offsetandlimit.- Specified by:
getLatestCommentItemsBySubjectIdin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancesubjectId- the identifier of the subject data (e.g, document handle UUID).offset- first item index of datalimit- max query item count limit- Returns:
- list of comment data items
- Throws:
CommentingException- if any exception occurs while retrieving comment data
-
createCommentItem
public String createCommentItem(CommentingContext commentingContext, CommentItem commentItem) throws CommentingException Description copied from interface:CommentPersistenceManagerCreate comment data item based on givencommentItem.- Specified by:
createCommentItemin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancecommentItem- comment data item object- Returns:
- the identifier of the newly created comment data item
- Throws:
CommentingException- if any exception occurs while creating a comment data item
-
updateCommentItem
public void updateCommentItem(CommentingContext commentingContext, CommentItem commentItem) throws CommentingException Description copied from interface:CommentPersistenceManagerUpdates comment data item bycommentItem.- Specified by:
updateCommentItemin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancecommentItem- comment data item object- Throws:
CommentingException- if any exception occurs while updating a comment data item
-
deleteCommentItem
public void deleteCommentItem(CommentingContext commentingContext, CommentItem commentItem) throws CommentingException Description copied from interface:CommentPersistenceManagerDeletes comment data item based on information given bycommentItem.- Specified by:
deleteCommentItemin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancecommentItem- comment data item object- Throws:
CommentingException- if any exception occurs while deleting a comment data item
-
getCommentHeadText
public String getCommentHeadText(CommentingContext commentingContext, CommentItem commentItem) throws CommentingException Description copied from interface:CommentPersistenceManagerGets comment header text to display in user interface fromcommentItem.- Specified by:
getCommentHeadTextin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancecommentItem- comment data item object- Returns:
- comment header text to display in user interface
- Throws:
CommentingException- if any exception occurs while creating a comment data item
-
getCommentBodyText
public String getCommentBodyText(CommentingContext commentingContext, CommentItem commentItem) throws CommentingException Description copied from interface:CommentPersistenceManagerGets comment body text to display in user interface fromcommentItem.- Specified by:
getCommentBodyTextin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancecommentItem- comment data item object- Returns:
- comment body text to display in user interface
- Throws:
CommentingException- if any exception occurs while creating a comment data item
-
getCommentHeadTooltip
public String getCommentHeadTooltip(CommentingContext commentingContext, CommentItem commentItem) throws CommentingException Description copied from interface:CommentPersistenceManagerGets comment header tooltip text to display in user interface fromcommentItem. Null if tooltip is not needed to display.- Specified by:
getCommentHeadTooltipin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancecommentItem- comment data item object- Returns:
- comment header tooltip text to display in user interface. Null if tooltip is not needed to display.
- Throws:
CommentingException- if any exception occurs while creating a comment data item
-
getCommentBodyTooltip
public String getCommentBodyTooltip(CommentingContext commentingContext, CommentItem commentItem) throws CommentingException Description copied from interface:CommentPersistenceManagerGets comment body tooltip text to display in user interface fromcommentItem. Null if tooltip is not needed to display.- Specified by:
getCommentBodyTooltipin interfaceCommentPersistenceManager- Parameters:
commentingContext- commenting context instancecommentItem- comment data item object- Returns:
- comment body tooltip text to display in user interface. Null if tooltip is not needed to display.
- Throws:
CommentingException- if any exception occurs while creating a comment data item
-
getSession
-
createLatestCommentItemsReadQuery
protected Query createLatestCommentItemsReadQuery(CommentingContext commentingContext, String subjectId, long offset, long limit) throws RepositoryException - Throws:
RepositoryException
-
mapCommentItem
- Throws:
RepositoryException
-
bindCommentNode
protected void bindCommentNode(Node commentNode, CommentItem commentItem) throws RepositoryException - Throws:
RepositoryException
-
getDateFormat
-
getAuthorName
-