Package org.silverpeas.core.comment.dao
Interface CommentDAO
-
- All Known Implementing Classes:
JDBCCommentDAO
public interface CommentDAO
A Data Access Object that provides an access to Comment objects persisted within a data source. The way the data source is accessed and the nature of the data source are wrapped by the implementation of this interface. For each provided methods, if an error occurs a CommentRuntimeException is thrown.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<Comment>
getAllCommentsByForeignKey(String resourceType, ResourceReference resourceRef)
Gets all the comments of the publication identified by the resource type and the specified foreign key.List<CommentedPublicationInfo>
getAllMostCommentedPublications()
Among all available commented publications, gets the most commented ones.Comment
getComment(CommentId commentId)
Gets the comment identified by the specified primary key.Map<ResourceReference,Integer>
getCommentCountIndexedByResource(String resourceType, String instanceId)
Gets the number of comments by resources of resource type and hosted by the specified component instance.int
getCommentsCountByForeignKey(String resourceType, ResourceReference resourceRef)
Gets the number of comments on the publication identified by the resource type and the specified foreign key.List<Comment>
getLastComments(String instanceId, int count)
Gets the last comments posted to the publications in the specified component instance.List<CommentedPublicationInfo>
getMostCommentedPublications(String resourceType)
Among all available commented publications of the specified type, gets the moste commented ones.List<CommentedPublicationInfo>
getMostCommentedPublications(String resourceType, List<ResourceReference> resourceRefs)
Among all the publications identified by the resource type and the specified primary keys, gets the most commented ones.List<SocialInformationComment>
getSocialInformationCommentsListByUserId(List<String> resourceTypes, String userId, Period period)
Get the list of SocialInformationComment added by userId in a periodList<SocialInformationComment>
getSocialInformationCommentsListOfMyContacts(List<String> resourceTypes, List<String> myContactsIds, List<String> instanceIds, Period period)
Gets the list of SocialInformationComment added by myContactsIds in a periodvoid
moveComments(String fromResourceType, ResourceReference fromPK, String toResourceType, ResourceReference toPK)
Moves all the comments from the publication identified by the resource type and the specified foreign key to the publication identified by the second resource type and specified foreign key.void
moveComments(String resourceType, ResourceReference fromPK, ResourceReference toPK)
Moves all the comments from the publication identified by the resource type and the specified foreign key to the publication identified by the second specified foreign key.void
removeAllCommentsByForeignPk(String resourceType, ResourceReference resourceRef)
Deletes all the comments on the publication identified by the resource type and the specified foreign key.void
removeComment(CommentId commentId)
Deletes the comment identified by the specified primary keyComment
saveComment(Comment cmt)
Saves the specified comment into the underlying data source.void
updateComment(Comment cmt)
Updates the comment in the data source identified by the specified one with the values carried by the specified comment.
-
-
-
Method Detail
-
saveComment
Comment saveComment(Comment cmt)
Saves the specified comment into the underlying data source.- Parameters:
cmt
- the comment to save.- Returns:
- the effectively saved comment.
-
removeAllCommentsByForeignPk
void removeAllCommentsByForeignPk(String resourceType, ResourceReference resourceRef)
Deletes all the comments on the publication identified by the resource type and the specified foreign key.- Parameters:
resourceType
- type of the commented publication.resourceRef
- the foreign key refering the publication in the data source
-
removeComment
void removeComment(CommentId commentId)
Deletes the comment identified by the specified primary key- Parameters:
commentId
-
-
getAllCommentsByForeignKey
List<Comment> getAllCommentsByForeignKey(String resourceType, ResourceReference resourceRef)
Gets all the comments of the publication identified by the resource type and the specified foreign key.- Parameters:
resourceType
- type of the commented publication.resourceRef
- the foreign key refering the publication in the data source.- Returns:
- a list with all of the publication comments. If the publication isn't commented, then an empty list is returned.
-
getComment
Comment getComment(CommentId commentId)
Gets the comment identified by the specified primary key. If no comment exist with a such primary key, then a CommentRuntimeException is thrown.- Parameters:
commentId
- the primary key of the comment to get.- Returns:
- the comment.
-
getCommentsCountByForeignKey
int getCommentsCountByForeignKey(String resourceType, ResourceReference resourceRef)
Gets the number of comments on the publication identified by the resource type and the specified foreign key.- Parameters:
resourceType
- type of the commented publication.resourceRef
- the foreign key referring the publication.- Returns:
- the number of the publication comments.
-
getCommentCountIndexedByResource
Map<ResourceReference,Integer> getCommentCountIndexedByResource(String resourceType, String instanceId)
Gets the number of comments by resources of resource type and hosted by the specified component instance.- Parameters:
resourceType
- type of the commented publication.instanceId
- identifier of aimed component instance.- Returns:
- a map containing the number of comments by resources.
-
getMostCommentedPublications
List<CommentedPublicationInfo> getMostCommentedPublications(String resourceType, List<ResourceReference> resourceRefs)
Among all the publications identified by the resource type and the specified primary keys, gets the most commented ones.- Parameters:
resourceType
- type of the commented publication.resourceRefs
- a list of primary keys refering some publications.- Returns:
- a list of information about the most commented publication (publication primary key, number of comments, and so on).
-
getMostCommentedPublications
List<CommentedPublicationInfo> getMostCommentedPublications(String resourceType)
Among all available commented publications of the specified type, gets the moste commented ones.- Parameters:
resourceType
- the type of the publication.- Returns:
- a list of information about the most commented publication sorted in descendent order.
-
getAllMostCommentedPublications
List<CommentedPublicationInfo> getAllMostCommentedPublications()
Among all available commented publications, gets the most commented ones.- Returns:
- a list of information about the most commented publication (publication primary key, number of comments, and so on).
-
moveComments
void moveComments(String resourceType, ResourceReference fromPK, ResourceReference toPK)
Moves all the comments from the publication identified by the resource type and the specified foreign key to the publication identified by the second specified foreign key.- Parameters:
resourceType
- type of source and destination publication.fromPK
- the foreign key refering the source publication.toPK
- the foreign key refering the destination publication.
-
moveComments
void moveComments(String fromResourceType, ResourceReference fromPK, String toResourceType, ResourceReference toPK)
Moves all the comments from the publication identified by the resource type and the specified foreign key to the publication identified by the second resource type and specified foreign key.- Parameters:
fromResourceType
- source type the source publication.fromPK
- the foreign key refering the source publication.toResourceType
- type of the destination publication.toPK
- the foreign key refering the destination publication.
-
updateComment
void updateComment(Comment cmt)
Updates the comment in the data source identified by the specified one with the values carried by the specified comment.- Parameters:
cmt
- the comment to update in the data source.
-
getLastComments
List<Comment> getLastComments(String instanceId, int count)
Gets the last comments posted to the publications in the specified component instance.- Parameters:
instanceId
- the unique identifier of the component instance.count
- the maximum number of comments to fetch. Lesser or equal to 0 means no limit.- Returns:
- a list of the last comments.
-
getSocialInformationCommentsListByUserId
List<SocialInformationComment> getSocialInformationCommentsListByUserId(List<String> resourceTypes, String userId, Period period)
Get the list of SocialInformationComment added by userId in a period- Parameters:
resourceTypes
- the aimed resources types.userId
- the author of comments.period
- the period into which the comment has been created or modified.- Returns:
- List of
SocialInformation
-
getSocialInformationCommentsListOfMyContacts
List<SocialInformationComment> getSocialInformationCommentsListOfMyContacts(List<String> resourceTypes, List<String> myContactsIds, List<String> instanceIds, Period period)
Gets the list of SocialInformationComment added by myContactsIds in a period- Parameters:
resourceTypes
- the aimed resources types.myContactsIds
- the aimed user identifiers of contacts.instanceIds
- the aimed identifiers of component instances.period
- the period into which the comment has been created or modified.- Returns:
- List of
SocialInformation
-
-