Class JDBCCommentDAO

    • Constructor Detail

      • JDBCCommentDAO

        public JDBCCommentDAO()
    • Method Detail

      • saveComment

        public Comment saveComment​(Comment cmt)
        Description copied from interface: CommentDAO
        Saves the specified comment into the underlying data source.
        Specified by:
        saveComment in interface CommentDAO
        Parameters:
        cmt - the comment to save.
        Returns:
        the effectively saved comment.
      • removeComment

        public void removeComment​(CommentId commentId)
        Description copied from interface: CommentDAO
        Deletes the comment identified by the specified primary key
        Specified by:
        removeComment in interface CommentDAO
      • updateComment

        public void updateComment​(Comment cmt)
        Description copied from interface: CommentDAO
        Updates the comment in the data source identified by the specified one with the values carried by the specified comment.
        Specified by:
        updateComment in interface CommentDAO
        Parameters:
        cmt - the comment to update in the data source.
      • getComment

        public Comment getComment​(CommentId commentId)
        Description copied from interface: CommentDAO
        Gets the comment identified by the specified primary key. If no comment exist with a such primary key, then a CommentRuntimeException is thrown.
        Specified by:
        getComment in interface CommentDAO
        Parameters:
        commentId - the primary key of the comment to get.
        Returns:
        the comment.
      • getAllMostCommentedPublications

        public List<CommentedPublicationInfo> getAllMostCommentedPublications()
        Description copied from interface: CommentDAO
        Among all available commented publications, gets the most commented ones.
        Specified by:
        getAllMostCommentedPublications in interface CommentDAO
        Returns:
        a list of information about the most commented publication (publication primary key, number of comments, and so on).
      • getMostCommentedPublications

        public List<CommentedPublicationInfo> getMostCommentedPublications​(String resourceType,
                                                                           List<ResourceReference> resourceRefs)
        Description copied from interface: CommentDAO
        Among all the publications identified by the resource type and the specified primary keys, gets the most commented ones.
        Specified by:
        getMostCommentedPublications in interface CommentDAO
        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).
      • getCommentsCountByForeignKey

        public int getCommentsCountByForeignKey​(String resourceType,
                                                ResourceReference resourceRef)
        Description copied from interface: CommentDAO
        Gets the number of comments on the publication identified by the resource type and the specified foreign key.
        Specified by:
        getCommentsCountByForeignKey in interface CommentDAO
        Parameters:
        resourceType - type of the commented publication.
        resourceRef - the foreign key refering the publication.
        Returns:
        the number of the publication comments.
      • getAllCommentsByForeignKey

        public List<Comment> getAllCommentsByForeignKey​(String resourceType,
                                                        ResourceReference resourceRef)
        Description copied from interface: CommentDAO
        Gets all the comments of the publication identified by the resource type and the specified foreign key.
        Specified by:
        getAllCommentsByForeignKey in interface CommentDAO
        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.
      • removeAllCommentsByForeignPk

        public void removeAllCommentsByForeignPk​(String resourceType,
                                                 ResourceReference resourceRef)
        Description copied from interface: CommentDAO
        Deletes all the comments on the publication identified by the resource type and the specified foreign key.
        Specified by:
        removeAllCommentsByForeignPk in interface CommentDAO
        Parameters:
        resourceType - type of the commented publication.
        resourceRef - the foreign key refering the publication in the data source
      • moveComments

        public void moveComments​(String resourceType,
                                 ResourceReference fromPK,
                                 ResourceReference toPK)
        Description copied from interface: CommentDAO
        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.
        Specified by:
        moveComments in interface CommentDAO
        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

        public void moveComments​(String fromResourceType,
                                 ResourceReference fromPK,
                                 String toResourceType,
                                 ResourceReference toPK)
        Description copied from interface: CommentDAO
        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.
        Specified by:
        moveComments in interface CommentDAO
        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.
      • getMostCommentedPublications

        public List<CommentedPublicationInfo> getMostCommentedPublications​(String resourceType)
        Description copied from interface: CommentDAO
        Among all available commented publications of the specified type, gets the moste commented ones.
        Specified by:
        getMostCommentedPublications in interface CommentDAO
        Parameters:
        resourceType - the type of the publication.
        Returns:
        a list of information about the most commented publication sorted in descendent order.
      • getLastComments

        public List<Comment> getLastComments​(String instanceId,
                                             int count)
        Description copied from interface: CommentDAO
        Gets the last comments posted to the publications in the specified component instance.
        Specified by:
        getLastComments in interface CommentDAO
        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.