Interface CommentService

  • All Known Implementing Classes:
    DefaultCommentService

    public interface CommentService
    User: ehugonnet Date: 21/03/11 Time: 09:54
    • Method Detail

      • createComment

        Comment createComment​(Comment cmt)
        Persists the specified comment and notifies any observers about the comment creation.
        Parameters:
        cmt - the comment to save.
        Returns:
        the created comment with its unique identifier.
      • createAndIndexComment

        Comment createAndIndexComment​(Comment cmt)
        Persists and indexes the specified comment and notifies any observers about the comment creation.
        Parameters:
        cmt - the comment to save and to index.
        Returns:
        the created comment with its unique identifier.
      • deleteComment

        void deleteComment​(CommentId commentId)
        Deletes the comment identified by the specified identifier and notifies any observers about the comment deletion. Any indexes on it are removed. If no such comment exists with the specified identifier, then a CommentRuntimeException is thrown.
        Parameters:
        commentId - the unique identifier of the comment to remove.
      • deleteAllCommentsOnResource

        void deleteAllCommentsOnResource​(String resourceType,
                                         ResourceReference resourceRef)
        Deletes all the comments on the specified resource and notifies any observers about those comments deletion. If no such resource exists with the specified identifier then a CommentRuntimeException is thrown.
        Parameters:
        resourceType - the type of the commented resource.
        resourceRef - a reference to the resource the comments are on.
      • deleteComment

        void deleteComment​(Comment comment)
        Deletes the specified comment and notifies about any observers about his deletion. Any indexes on it are removed. If no such comment exists with the specified identifier, then a CommentRuntimeException is thrown.
        Parameters:
        comment - the comment to remove.
      • moveComments

        void moveComments​(String resourceType,
                          ResourceReference fromResource,
                          ResourceReference toResource)
        Moves the comments on the specified resource to the another specified resource. The resulting operation is that the comments will be on the other resource and all the previous indexes on them are removed. If at least one of the resources doesn't exist then a CommentRuntimeException is thrown.
        Parameters:
        resourceType - the type of the commented resource. Both the source and target resources have to be of the same type.
        fromResource - a reference to the source resource.
        toResource - a reference to the destination resource.
      • moveAndReindexComments

        void moveAndReindexComments​(String resourceType,
                                    ResourceReference fromResource,
                                    ResourceReference toResource)
        Moves the comments on the specified resource to the another specified resource and indexes them again. The resulting operation is that the comments are on the other resource and they are indexed again (or simply indexed if not already) accordingly to the new resource. If at least one of the resources doesn't exist then a CommentRuntimeException is thrown.
        Parameters:
        resourceType - the type of the commented resource. Both the source and target resources have to be of the same type.
        fromResource - a reference to the source resource.
        toResource - a reference to the destination resource.
      • updateComment

        void updateComment​(Comment cmt)
        Updates the specified comment in the business layer. The comment to update is identified by its unique identifier and the update information are carried by the given Comment instance.
        Parameters:
        cmt - the updated comment.
      • updateAndIndexComment

        void updateAndIndexComment​(Comment cmt)
        Updates and indexes the specified comment in the business layer. The comment to update in the business layer is identified by its unique identifier and the update information are carried by the given Comment instance.
        Parameters:
        cmt - the comment to update and to index.
      • getComment

        Comment getComment​(CommentId commentId)
        Gets the comment that identified by the specified identifier. If no such comment exists with the specified identifier, then a CommentRuntimeException is thrown.
        Parameters:
        commentId - the identifier of the comment in the business layer.
        Returns:
        the comment.
      • getAllCommentsOnResource

        List<Comment> getAllCommentsOnResource​(String resourceType,
                                               ResourceReference resourceRef)
        Gets all the comments on the resource identified by the resource type and the specified reference. If no such publication exists with the specified resource reference, then a CommentRuntimeException is thrown.
        Parameters:
        resourceType - the type of the commented resource.
        resourceRef - a reference to the resource.
        Returns:
        a list of the comments on the given resource. The list is empty if the resource isn't commented.
      • getMostCommentedPublicationsInfo

        List<CommentedPublicationInfo> getMostCommentedPublicationsInfo​(String resourceType,
                                                                        List<ResourceReference> refs)
        Gets information about the commented resources among the specified ones. The resource information are returned ordered down to the lesser commented resource.
        Parameters:
        resourceType - the type of the commented resource.
        refs - a collection of reference to the resources to get information and to order by comments count.
        Returns:
        an ordered list of information about the most commented resource. The list is sorted by their comments count in a descendent order.
      • getMostCommentedPublicationsInfo

        List<CommentedPublicationInfo> getMostCommentedPublicationsInfo​(String resourceType)
        Gets information about the most commented resources of the specified type. The resource information are returned ordered down to the lesser commented resource.
        Parameters:
        resourceType - the type of the commented resource.
        Returns:
        an ordered list of information about the most commented resources. The list is sorted by their comments count in a descendent order.
      • getAllMostCommentedPublicationsInfo

        List<CommentedPublicationInfo> getAllMostCommentedPublicationsInfo()
        Gets information about all the commented resources in Silverpeas. The resource information are returned ordered down to the lesser commented resource.
        Returns:
        an ordered list of information about the most commented resources. The list is sorted by their comments count in a descendent order.
      • getLastComments

        List<Comment> getLastComments​(String resourceType,
                                      int count)
      • getCommentsCountOnResource

        int getCommentsCountOnResource​(String resourceType,
                                       ResourceReference resourceRef)
        Gets the count of comments on the resource identifier by the resource type and the specified reference.
        Parameters:
        resourceType - the type of the commented resource.
        resourceRef - a reference on the resource.
        Returns:
        the number of comments on the resource.
      • indexAllCommentsOnPublication

        void indexAllCommentsOnPublication​(String resourceType,
                                           ResourceReference resourceRef)
        Indexes all the comments on the resource identified by the resource type and the specified reference. If no such resource exists with the specified reference, then a CommentRuntimeException is thrown.
        Parameters:
        resourceType - the type of the commented resource.
        resourceRef - a reference on the resource.
      • unindexAllCommentsOnPublication

        void unindexAllCommentsOnPublication​(String resourceType,
                                             ResourceReference resourceRef)
        Removes the indexes on all the comments of the resource identified by the resource type and the specified reference. If no such resource exists with the specified reference, then a CommentRuntimeException is thrown.
        Parameters:
        resourceType - the type of the commented publication.
        resourceRef - a reference on the resource.
      • getSocialInformationCommentsListByUserId

        List<SocialInformationComment> getSocialInformationCommentsListByUserId​(List<String> resourceTypes,
                                                                                String userId,
                                                                                Period period)
        Get the list of SocialInformationComment added by the given user in a specified 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 the specified contacts in the given 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