com.silverpeas.comment.dao.jdbc
Class JDBCCommentRequester

java.lang.Object
  extended by com.silverpeas.comment.dao.jdbc.JDBCCommentRequester

public class JDBCCommentRequester
extends Object

A specific JDBC requester dedicated on the comments persisted in the underlying data source.


Constructor Summary
JDBCCommentRequester()
          Constructs a new JDBCCommentRequester instance.
 
Method Summary
 int deleteAllComments(Connection con, String resourceType, ForeignPK foreignPK)
           
 void deleteComment(Connection con, CommentPK pk)
          Deletes the comment identified by the specified primary key from the data source onto which the given connection is opened.
 List<Comment> getAllComments(Connection con, String resourceType, WAPrimaryKey foreign_pk)
           
 Comment getComment(Connection con, CommentPK pk)
          Gets the comment identified by the specified identifier.
 int getCommentsCount(Connection con, String resourceType, WAPrimaryKey foreign_pk)
           
 List<Comment> getLastComments(Connection con, String instanceId, int count)
           
 List<CommentedPublicationInfo> getMostCommentedAllPublications(Connection con, String resType)
           
 List<CommentedPublicationInfo> getMostCommentedPublications(Connection con, List<? extends WAPrimaryKey> pks)
           
 List<SocialInformationComment> getSocialInformationComments(Connection con, List<String> resourceTypes, List<String> userAuthorIds, List<String> instanceIds, Period period)
           
 void moveComments(Connection con, String fromResourceType, ForeignPK fromPK, String toResourceType, ForeignPK toPK)
          Moves comments.
 CommentPK saveComment(Connection con, Comment cmt)
          Saves the specified comment with the specified connection onto a data source.
 void updateComment(Connection con, Comment cmt)
          Updates the comment representation in the data source by the specified one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCCommentRequester

public JDBCCommentRequester()
Constructs a new JDBCCommentRequester instance.

Method Detail

saveComment

public CommentPK saveComment(Connection con,
                             Comment cmt)
                      throws SQLException
Saves the specified comment with the specified connection onto a data source.

Parameters:
con - the connection to a data source.
cmt - the comment to save.
Returns:
the unique identifier of comment in the data source (id est the primary key).
Throws:
SQLException - if an error occurs while saving the comment.

deleteComment

public void deleteComment(Connection con,
                          CommentPK pk)
                   throws SQLException
Deletes the comment identified by the specified primary key from the data source onto which the given connection is opened.

Parameters:
con - the connection to the data source.
pk - the unique identifier of the comment in the data source.
Throws:
SQLException - if an error occurs while removing the comment from the data source.

updateComment

public void updateComment(Connection con,
                          Comment cmt)
                   throws SQLException
Updates the comment representation in the data source by the specified one.

Parameters:
con - the connection to the data source.
cmt - the updated comment.
Throws:
SQLException - if an error occurs while updating the comment in the data source.

moveComments

public void moveComments(Connection con,
                         String fromResourceType,
                         ForeignPK fromPK,
                         String toResourceType,
                         ForeignPK toPK)
                  throws SQLException
Moves comments. (Requires more explanation!)

Parameters:
con - the connection to the data source.
fromResourceType - the source type of the commented resource
fromPK - the source unique identifier of the comment in the data source.
toResourceType - the destination type of the commented resource
toPK - the destination unique identifier of another comment in the data source.
Throws:
SQLException - if an error occurs during the operation.

getComment

public Comment getComment(Connection con,
                          CommentPK pk)
                   throws SQLException
Gets the comment identified by the specified identifier.

Parameters:
con - the connection to use for getting the comment.
pk - the identifier of the comment in the data source.
Returns:
the comment or null if no such comment is found.
Throws:
SQLException - if an error occurs during the comment fetching.

getMostCommentedAllPublications

public List<CommentedPublicationInfo> getMostCommentedAllPublications(Connection con,
                                                                      String resType)
                                                               throws SQLException
Throws:
SQLException

getMostCommentedPublications

public List<CommentedPublicationInfo> getMostCommentedPublications(Connection con,
                                                                   List<? extends WAPrimaryKey> pks)
                                                            throws SQLException
Throws:
SQLException

getCommentsCount

public int getCommentsCount(Connection con,
                            String resourceType,
                            WAPrimaryKey foreign_pk)
                     throws SQLException
Throws:
SQLException

getAllComments

public List<Comment> getAllComments(Connection con,
                                    String resourceType,
                                    WAPrimaryKey foreign_pk)
                             throws SQLException
Throws:
SQLException

deleteAllComments

public int deleteAllComments(Connection con,
                             String resourceType,
                             ForeignPK foreignPK)
                      throws SQLException
Throws:
SQLException

getLastComments

public List<Comment> getLastComments(Connection con,
                                     String instanceId,
                                     int count)
                              throws SQLException
Throws:
SQLException

getSocialInformationComments

public List<SocialInformationComment> getSocialInformationComments(Connection con,
                                                                   List<String> resourceTypes,
                                                                   List<String> userAuthorIds,
                                                                   List<String> instanceIds,
                                                                   Period period)
                                                            throws SQLException
Throws:
SQLException


Copyright © 2016 Silverpeas. All Rights Reserved.