Class FileRepositoryAdapterImpl
java.lang.Object
com.example.blogs.app.api.file.repository.adapter.FileRepositoryAdapterImpl
- All Implemented Interfaces:
FileRepositoryAdapter
Wraps file repository operations with exception translation for consistent error handling.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteById(Long fileId) Deletes file metadata by its ID with exception translation.Saves file metadata to the repository with exception translation.
-
Constructor Details
-
FileRepositoryAdapterImpl
public FileRepositoryAdapterImpl()
-
-
Method Details
-
save
Saves file metadata to the repository with exception translation. Builds a file entity from the provided metadata and persists it.- Specified by:
savein interfaceFileRepositoryAdapter- Parameters:
filePath- the storage path of the filefileName- the original name of the fileextension- the file extension including the dot (e.g., ".png")uuid- the unique identifier for the file- Returns:
- the saved file entity with generated ID
- Throws:
FailedToSaveFileException- if the repository operation fails
-
deleteById
Deletes file metadata by its ID with exception translation.- Specified by:
deleteByIdin interfaceFileRepositoryAdapter- Parameters:
fileId- the ID of the file entity to delete- Throws:
FailedToDeleteFileByIdException- if the repository operation fails
-