Interface CommentRepositoryAdapter
- All Known Implementing Classes:
CommentRepositoryAdapterImpl
public interface CommentRepositoryAdapter
Adapter for comment repository operations with exception handling.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteById(Long commentId) Deletes a comment by its ID with exception translation.booleanexistsById(Long commentId) Checks if a comment exists with the specified ID.booleanexistsByIdAndAuthorId(Long commentId, Long authorId) Checks if a comment exists with the specified ID and author ID.findAllByPostId(Long postId) Retrieves all comments associated with a specific post with exception translation.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
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
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
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
Checks if a comment exists with the specified ID and author ID.- Parameters:
commentId- the ID of the commentauthorId- 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
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
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 existFailedToFindCommentByIdException- if the retrieval operation fails
-