org.wso2.carbon.registry.core.dao
Interface CommentsDAO

All Known Implementing Classes:
JDBCCommentsDAO, JDBCCommentsVersionDAO

public interface CommentsDAO

Data Access Object for Comments


Method Summary
 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.
 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.
 

Method Detail

addComment

int addComment(ResourceImpl resource,
               String userID,
               Comment comment)
               throws RegistryException
Method to persist a comment.

Parameters:
resource - the resource
userID - the id of the user who added the comment.
comment - the comment to be persisted.
Returns:
the comment id of the newly added comment.
Throws:
RegistryException - if some error occurs while adding a comment

addComments

void addComments(ResourceImpl resource,
                 CommentDO[] commentDOs)
                 throws RegistryException
Method to persist comments.

Parameters:
resource - the resource
commentDOs - the comments to be persisted.
Throws:
RegistryException - if some error occurs while adding comments

copyComments

void copyComments(ResourceImpl sourceResource,
                  ResourceImpl targetResource)
                  throws RegistryException
Method to copy comments.

Parameters:
sourceResource - the source resource.
targetResource - the target resource.
Throws:
RegistryException - if some error occurs while copying comments

updateComment

void updateComment(long commentId,
                   String text)
                   throws RegistryException
Method to update a comment.

Parameters:
commentId - the comment id.
text - the comment text.
Throws:
RegistryException - if some error occurs while updating the comment.

deleteComment

void deleteComment(long commentId)
                   throws RegistryException
Method to delete a comment.

Parameters:
commentId - the comment id.
Throws:
RegistryException - if some error occurs while deleting the comment.

removeComments

void removeComments(ResourceImpl resource)
                    throws RegistryException
Method to remove all comments added to a resource.

Parameters:
resource - the resource.
Throws:
RegistryException - if some error occurs while removing comments.

getComment

Comment getComment(long commentID,
                   String resourcePath)
                   throws RegistryException
Method to get a comment added to a given resource.

Parameters:
resourcePath - the resource's path.
commentID - the identifier of the comment.
Returns:
the comment.
Throws:
RegistryException - if an error occurs while getting the comment.

getComments

Comment[] getComments(ResourceImpl resource)
                      throws RegistryException
Method to get comments added to a given resource.

Parameters:
resource - the resource.
Returns:
an array of comments.
Throws:
RegistryException - if an error occurs while getting comments.

getResourceWithMinimumData

ResourceImpl getResourceWithMinimumData(String path)
                                        throws RegistryException
Gets the resource with sufficient data to differentiate it from another resource. This would populate a ResourceImpl with the path, name and path identifier of a resource.

Parameters:
path - the path of the resource.
Returns:
the resource with minimum data.
Throws:
RegistryException - if an error occurs while retrieving resource data.

moveComments

void moveComments(ResourceIDImpl source,
                  ResourceIDImpl target)
                  throws RegistryException
Method to move comments.

Parameters:
source - the source resource.
target - the target resource.
Throws:
RegistryException - if some error occurs while moving comments

moveCommentPaths

void moveCommentPaths(ResourceIDImpl source,
                      ResourceIDImpl target)
                      throws RegistryException
Method to move comment paths. This function will move the paths from one path id to another regardless of the resource name.

Parameters:
source - the source resource.
target - the target resource.
Throws:
RegistryException - if some error occurs while moving comment paths

removeVersionComments

void removeVersionComments(long regVersion)
                           throws RegistryException
Removes all comments added to the given resource for a given version. This applies only to versioned resources.

Parameters:
regVersion - the version
Throws:
RegistryException - if an error occurred while removing tags.


Copyright © 2014 WSO2 Inc. All Rights Reserved.