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

java.lang.Object
  extended by org.wso2.carbon.registry.core.jdbc.dao.CommentsDAO
      extended by org.wso2.carbon.registry.core.jdbc.dao.CommentsVersionDAO

public class CommentsVersionDAO
extends CommentsDAO

Data Access Object for Comments when auto-versioning for comments has been enabled.


Constructor Summary
CommentsVersionDAO()
           
 
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.CommentsDAO
deleteComment, getComment, removeComments, updateComment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommentsVersionDAO

public CommentsVersionDAO()
Method Detail

addComment

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

Overrides:
addComment in class CommentsDAO
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.

Overrides:
copyComments in class CommentsDAO
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.

Overrides:
addComments in class CommentsDAO
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.

Overrides:
getComments in class CommentsDAO
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 CommentsDAO
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.

Overrides:
getResourceWithMinimumData in class CommentsDAO
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.

Overrides:
moveComments in class CommentsDAO
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.

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


Copyright © 2010. All Rights Reserved.