Interface CockpitCommentService

    • Method Detail

      • getItemComments

        java.util.List<CommentModel> getItemComments​(ItemModel item,
                                                     UserModel user,
                                                     java.util.Collection<ComponentModel> components,
                                                     java.util.Collection<CommentTypeModel> types,
                                                     int offset,
                                                     int count)
        Gets comments.
        Parameters:
        item - the item that has been commented on
        user - the author
        components - the related comment components
        types - the comment type
        offset - the search offset
        count - the maximum number of comments to return
        Returns:
        list of all the comments matching the specified criteria
      • getItemCommentsQuery

        Query getItemCommentsQuery​(ItemModel item,
                                   UserModel user,
                                   java.util.Collection<ComponentModel> components,
                                   java.util.Collection<CommentTypeModel> types)
        Get item comments query.
        Parameters:
        item - the item that has been commented on
        user - the author or the watcher or the user assigned to the comment
        components - the related comment components
        types - the comment type
        Returns:
        query for getting all comments matching the specified criteria
      • getCurrentUserCommentsQuery

        Query getCurrentUserCommentsQuery()
        Get current user comments query.
        Returns:
        query for getting all current user comments
      • createReply

        ReplyModel createReply​(UserModel author,
                               AbstractCommentModel comment,
                               java.lang.String text)
        Creates and returns a new comment reply.
        Parameters:
        author - reply author
        comment - comment to reply to
        text - reply content
        Returns:
        created reply
      • createItemComment

        CommentModel createItemComment​(UserModel author,
                                       ComponentModel component,
                                       CommentTypeModel type,
                                       java.util.Collection<ItemModel> items,
                                       java.lang.String subject,
                                       java.lang.String text)
        Creates and returns a new item comment.
        Parameters:
        author - comment author
        component - comment domain component
        type - comment type
        items - related items
        subject - comment subject
        text - comment content
        Returns:
        created comment
      • getDirectReplies

        java.util.List<ReplyModel> getDirectReplies​(CommentModel comment,
                                                    int offset,
                                                    int count)
        Returns all direct comment replies for the specified comment.
        Parameters:
        comment - the comment
        offset - search offset
        count - max hit count
        Returns:
        all found comments in the specified range
      • getComments

        java.util.List<CommentModel> getComments​(UserModel user,
                                                 java.util.Collection<ComponentModel> components,
                                                 java.util.Collection<CommentTypeModel> types,
                                                 int offset,
                                                 int count)
        Returns all comments in the specified domain components which are of the specified types and where user is a participant.
        Parameters:
        user - comment participant
        components - domain components
        types - comment types
        offset - search offset
        count - max hit count
        Returns:
        all found comments in the specified range
      • getCurrentUserComments

        java.util.List<CommentModel> getCurrentUserComments()
        Returns all comments in the default domain components which are of the default types and where the current user is a participant.
        Returns:
        all found comments in the default range
      • getCurrentUserComments

        java.util.List<CommentModel> getCurrentUserComments​(org.zkoss.zk.ui.Desktop desktop)
        Returns all comments in the default domain components which are of the default types and where the current user is a participant.
        Returns:
        all found comments in the default range
      • getItemsFromCommentAttachments

        java.util.List<ItemModel> getItemsFromCommentAttachments​(AbstractCommentModel abstractComment)
        Returns all attachments of the abstract comment
        Parameters:
        abstractComment - abstract comment to get attachments from
        Returns:
        all items of the comments ItemAttachment
      • isRead

        boolean isRead​(TypedObject commentItem)
        Return if the comment is read by the current user or not
        Returns:
        true, if comment is read, false otherwise
      • setRead

        void setRead​(TypedObject commentItem,
                     boolean read)
        Sets the read status of the specified commentItem for the current user
        Parameters:
        commentItem - the commentItem (comment or reply)
        read - true, if commentItem should be marked as read, false otherwise
      • saveChangedComments

        void saveChangedComments​(java.util.List<CommentModel> comments)
        Saves only modified comments from comments list
        Parameters:
        comments - list of comments