Class JDBCCommentRequester
- java.lang.Object
-
- org.silverpeas.core.comment.dao.jdbc.JDBCCommentRequester
-
@Technical @Bean public class JDBCCommentRequester extends Object
A specific JDBC requester dedicated on the comments persisted in the underlying data source.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JDBCCommentRequester()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
deleteAllComments(Connection con, String resourceType, ResourceReference resourceReference)
void
deleteComment(Connection con, CommentId id)
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, ResourceReference resourceRef)
Comment
getComment(Connection con, CommentId commentId)
Gets the comment identified by the specified identifier.int
getCommentsCount(Connection con, String resourceType, ResourceReference resourceRef)
List<Comment>
getLastComments(Connection con, String instanceId, int count)
List<CommentedPublicationInfo>
getMostCommentedAllPublications(Connection con, String resType)
List<CommentedPublicationInfo>
getMostCommentedPublications(Connection con, List<ResourceReference> pubRefs)
List<SocialInformationComment>
getSocialInformationComments(Connection con, List<String> resourceTypes, List<String> userAuthorIds, List<String> instanceIds, Period period)
void
moveComments(Connection con, String fromResourceType, ResourceReference fromResource, String toResourceType, ResourceReference toResource)
Moves all the comments from the resource they commented to another resource as they comment this new resource instead of the previous one.Comment
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.
-
-
-
Method Detail
-
saveComment
public Comment saveComment(Connection con, Comment cmt) throws SQLException
Saves the specified comment with the specified connection onto a data source. Once saved, the comment passed as argument isn't updated with the persistence information and hence the returned comment instance should be used for further handling.- Parameters:
con
- the connection to a data source.cmt
- the comment to save.- Returns:
- the comment that is saved into the data source with its unique identifier.
- Throws:
SQLException
- if an error occurs while saving the comment.
-
deleteComment
public void deleteComment(Connection con, CommentId id) 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.id
- 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, ResourceReference fromResource, String toResourceType, ResourceReference toResource) throws SQLException
Moves all the comments from the resource they commented to another resource as they comment this new resource instead of the previous one.- Parameters:
con
- the connection to the data source.fromResourceType
- the source type of the commented resourcefromResource
- the source unique identifier of the comment in the data source.toResourceType
- the destination type of the commented resourcetoResource
- 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, CommentId commentId) throws SQLException
Gets the comment identified by the specified identifier.- Parameters:
con
- the connection to use for getting the comment.commentId
- 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<ResourceReference> pubRefs) throws SQLException
- Throws:
SQLException
-
getCommentsCount
public int getCommentsCount(Connection con, String resourceType, ResourceReference resourceRef) throws SQLException
- Throws:
SQLException
-
getAllComments
public List<Comment> getAllComments(Connection con, String resourceType, ResourceReference resourceRef) throws SQLException
- Throws:
SQLException
-
deleteAllComments
public int deleteAllComments(Connection con, String resourceType, ResourceReference resourceReference) 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
-
-