org.wso2.carbon.registry.core.jdbc.dao
Class JDBCCommentsVersionDAO

java.lang.Object
  extended by org.wso2.carbon.registry.core.jdbc.dao.JDBCCommentsDAO
      extended by org.wso2.carbon.registry.core.jdbc.dao.JDBCCommentsVersionDAO
All Implemented Interfaces:
CommentsDAO

public class JDBCCommentsVersionDAO
extends JDBCCommentsDAO
implements CommentsDAO

An extension of JDBCCommentsVersionDAO implements JDBCCommentsDAO to store comments on a JDBC-based database, when versioning for comments has been enabled.


Field Summary
 
Fields inherited from class org.wso2.carbon.registry.core.jdbc.dao.JDBCCommentsDAO
ADD_COMMENT_LOCK
 
Constructor Summary
JDBCCommentsVersionDAO(DAOManager daoManager)
          Default constructor
 
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.
 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.
 
Methods inherited from class org.wso2.carbon.registry.core.jdbc.dao.JDBCCommentsDAO
deleteComment, getComment, removeComments, updateComment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.wso2.carbon.registry.core.dao.CommentsDAO
deleteComment, getComment, removeComments, updateComment
 

Constructor Detail

JDBCCommentsVersionDAO

public JDBCCommentsVersionDAO(DAOManager daoManager)
Default constructor

Parameters:
daoManager - instance of the data access object manager.
Method Detail

addComment

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

Specified by:
addComment in interface CommentsDAO
Overrides:
addComment in class JDBCCommentsDAO
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

copyComments

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

Specified by:
copyComments in interface CommentsDAO
Overrides:
copyComments in class JDBCCommentsDAO
Parameters:
sourceResource - the source resource.
targetResource - the target resource.
Throws:
RegistryException - if some error occurs while copying comments

addComments

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

Specified by:
addComments in interface CommentsDAO
Overrides:
addComments in class JDBCCommentsDAO
Parameters:
resource - the resource
commentDOs - the comments to be persisted.
Throws:
RegistryException - if some error occurs while adding comments

getComments

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

Specified by:
getComments in interface CommentsDAO
Overrides:
getComments in class JDBCCommentsDAO
Parameters:
resource - the resource.
Returns:
an array of comments.
Throws:
RegistryException - if an error occurs while getting comments.

getResourcePathsOfComments

public String[] getResourcePathsOfComments(Long[] commentIDs,
                                           Connection conn)
                                    throws RegistryException
Method to get resource paths of comments.

Overrides:
getResourcePathsOfComments in class JDBCCommentsDAO
Parameters:
commentIDs - the comment id.
conn - the connection to use.
Returns:
array of resource paths.
Throws:
RegistryException - if an error occurs.

getResourceWithMinimumData

public 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.

Specified by:
getResourceWithMinimumData in interface CommentsDAO
Overrides:
getResourceWithMinimumData in class JDBCCommentsDAO
Parameters:
path - the path of the resource.
Returns:
the resource with minimum data.
Throws:
RegistryException - if an error occurs while retrieving resource data.

moveComments

public void moveComments(ResourceIDImpl source,
                         ResourceIDImpl target)
                  throws RegistryException
Method to move comments. This function is not applicable to versioned resources.

Specified by:
moveComments in interface CommentsDAO
Overrides:
moveComments in class JDBCCommentsDAO
Parameters:
source - the source resource.
target - the target resource.
Throws:
RegistryException - if some error occurs while moving comments

moveCommentPaths

public void moveCommentPaths(ResourceIDImpl source,
                             ResourceIDImpl target)
                      throws RegistryException
Method to move comment paths. This function is not applicable to versioned resources.

Specified by:
moveCommentPaths in interface CommentsDAO
Overrides:
moveCommentPaths in class JDBCCommentsDAO
Parameters:
source - the source resource.
target - the target resource.
Throws:
RegistryException - if some error occurs while moving comment paths


Copyright © 2011 WSO2 Inc. All Rights Reserved.