public class JDBCCommentsDAO extends Object implements CommentsDAO
CommentsDAO to store comments on a JDBC-based database.| Modifier and Type | Field and Description |
|---|---|
protected static Object |
ADD_COMMENT_LOCK |
| Constructor and Description |
|---|
JDBCCommentsDAO(DAOManager daoManager)
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
int |
addComment(ResourceImpl resource,
String userID,
Comment comment)
Method to persist a comment.
|
void |
addComments(ResourceImpl resource,
CommentDO[] commentDOs)
Method to persist comments.
|
void |
copyComments(ResourceImpl sourceResource,
ResourceImpl targetResource)
Method to copy comments.
|
void |
deleteComment(long commentId)
Method to delete a comment.
|
Comment |
getComment(long commentID,
String resourcePath)
Method to get a comment added to a given resource.
|
Comment[] |
getComments(ResourceImpl resource)
Method to get comments added to a given resource.
|
String[] |
getResourcePathsOfComments(Long[] commentIDs,
Connection conn)
Method to get resource paths of comments.
|
ResourceImpl |
getResourceWithMinimumData(String path)
Gets the resource with sufficient data to differentiate it from another resource.
|
void |
moveCommentPaths(ResourceIDImpl source,
ResourceIDImpl target)
Method to move comment paths.
|
void |
moveComments(ResourceIDImpl source,
ResourceIDImpl target)
Method to move comments.
|
void |
removeComments(ResourceImpl resource)
Method to remove all comments added to a resource.
|
void |
removeVersionComments(long regVersion)
Removes all comments added to the given resource for a given version.
|
void |
updateComment(long commentId,
String text)
Method to update a comment.
|
protected static final Object ADD_COMMENT_LOCK
public JDBCCommentsDAO(DAOManager daoManager)
daoManager - instance of the data access object manager.public int addComment(ResourceImpl resource, String userID, Comment comment) throws RegistryException
CommentsDAOaddComment in interface CommentsDAOresource - the resourceuserID - the id of the user who added the comment.comment - the comment to be persisted.RegistryException - if some error occurs while adding a commentpublic void addComments(ResourceImpl resource, CommentDO[] commentDOs) throws RegistryException
CommentsDAOaddComments in interface CommentsDAOresource - the resourcecommentDOs - the comments to be persisted.RegistryException - if some error occurs while adding commentspublic void copyComments(ResourceImpl sourceResource, ResourceImpl targetResource) throws RegistryException
CommentsDAOcopyComments in interface CommentsDAOsourceResource - the source resource.targetResource - the target resource.RegistryException - if some error occurs while copying commentspublic void updateComment(long commentId,
String text)
throws RegistryException
CommentsDAOupdateComment in interface CommentsDAOcommentId - the comment id.text - the comment text.RegistryException - if some error occurs while updating the comment.public void deleteComment(long commentId)
throws RegistryException
CommentsDAOdeleteComment in interface CommentsDAOcommentId - the comment id.RegistryException - if some error occurs while deleting the comment.public void removeComments(ResourceImpl resource) throws RegistryException
CommentsDAOremoveComments in interface CommentsDAOresource - the resource.RegistryException - if some error occurs while removing comments.public Comment getComment(long commentID, String resourcePath) throws RegistryException
CommentsDAOgetComment in interface CommentsDAOcommentID - the identifier of the comment.resourcePath - the resource's path.RegistryException - if an error occurs while getting the comment.public Comment[] getComments(ResourceImpl resource) throws RegistryException
CommentsDAOgetComments in interface CommentsDAOresource - the resource.RegistryException - if an error occurs while getting comments.public String[] getResourcePathsOfComments(Long[] commentIDs, Connection conn) throws RegistryException
commentIDs - the comment id.conn - the connection to use.RegistryException - if an error occurs.public ResourceImpl getResourceWithMinimumData(String path) throws RegistryException
CommentsDAOResourceImpl with the path, name and path identifier
of a resource.getResourceWithMinimumData in interface CommentsDAOpath - the path of the resource.RegistryException - if an error occurs while retrieving resource data.public void moveComments(ResourceIDImpl source, ResourceIDImpl target) throws RegistryException
CommentsDAOmoveComments in interface CommentsDAOsource - the source resource.target - the target resource.RegistryException - if some error occurs while moving commentspublic void moveCommentPaths(ResourceIDImpl source, ResourceIDImpl target) throws RegistryException
CommentsDAOmoveCommentPaths in interface CommentsDAOsource - the source resource.target - the target resource.RegistryException - if some error occurs while moving comment pathspublic void removeVersionComments(long regVersion)
throws RegistryException
CommentsDAOremoveVersionComments in interface CommentsDAOregVersion - the versionRegistryException - if an error occurred while removing tags.Copyright © 2015 WSO2 Inc. All Rights Reserved.