Interface CommentRepositoryAdapter

All Known Implementing Classes:
CommentRepositoryAdapterImpl

public interface CommentRepositoryAdapter
Adapter for comment repository operations with exception handling.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deleteById(Long commentId)
    Deletes a comment by its ID with exception translation.
    boolean
    existsById(Long commentId)
    Checks if a comment exists with the specified ID.
    boolean
    existsByIdAndAuthorId(Long commentId, Long authorId)
    Checks if a comment exists with the specified ID and author ID.
    Retrieves all comments associated with a specific post with exception translation.
    findById(Long commentId)
    Retrieves a comment by its ID with exception translation.
    save(CommentEntity commentEntity)
    Saves a comment entity to the database with exception translation.
  • Method Details

    • findAllByPostId

      List<CommentEntity> findAllByPostId(Long postId)
      Retrieves all comments associated with a specific post with exception translation.
      Parameters:
      postId - the ID of the post
      Returns:
      list of comments for the post
    • save

      CommentEntity save(CommentEntity commentEntity)
      Saves a comment entity to the database with exception translation.
      Parameters:
      commentEntity - the comment entity to save
      Returns:
      the saved comment entity with generated ID
      Throws:
      FailedToCreateCommentException - if the save operation fails
    • existsById

      boolean existsById(Long commentId)
      Checks if a comment exists with the specified ID.
      Parameters:
      commentId - the ID of the comment
      Returns:
      true if a comment with the given ID exists, false otherwise
      Throws:
      FailedToCheckCommentExistenceException - if the check operation fails
    • existsByIdAndAuthorId

      boolean existsByIdAndAuthorId(Long commentId, Long authorId)
      Checks if a comment exists with the specified ID and author ID.
      Parameters:
      commentId - the ID of the comment
      authorId - the ID of the author
      Returns:
      true if a comment with the given ID and author exists, false otherwise
      Throws:
      FailedToCheckCommentExistenceException - if the check operation fails
    • deleteById

      void deleteById(Long commentId)
      Deletes a comment by its ID with exception translation.
      Parameters:
      commentId - the ID of the comment to delete
      Throws:
      FailedToDeleteCommentException - if the delete operation fails
    • findById

      CommentEntity findById(Long commentId)
      Retrieves a comment by its ID with exception translation.
      Parameters:
      commentId - the ID of the comment to retrieve
      Returns:
      the comment entity if found
      Throws:
      CommentNotFoundException - if the comment does not exist
      FailedToFindCommentByIdException - if the retrieval operation fails