Class FileRepositoryAdapterImpl

java.lang.Object
com.example.blogs.app.api.file.repository.adapter.FileRepositoryAdapterImpl
All Implemented Interfaces:
FileRepositoryAdapter

@Component public class FileRepositoryAdapterImpl extends Object implements FileRepositoryAdapter
Wraps file repository operations with exception translation for consistent error handling.
  • Constructor Details

    • FileRepositoryAdapterImpl

      public FileRepositoryAdapterImpl()
  • Method Details

    • save

      public FileEntity save(String filePath, String fileName, String extension, String uuid)
      Saves file metadata to the repository with exception translation. Builds a file entity from the provided metadata and persists it.
      Specified by:
      save in interface FileRepositoryAdapter
      Parameters:
      filePath - the storage path of the file
      fileName - the original name of the file
      extension - 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

      public void deleteById(Long fileId)
      Deletes file metadata by its ID with exception translation.
      Specified by:
      deleteById in interface FileRepositoryAdapter
      Parameters:
      fileId - the ID of the file entity to delete
      Throws:
      FailedToDeleteFileByIdException - if the repository operation fails