Package mops.businesslogic.file
Class FileInfoServiceImpl
- java.lang.Object
-
- mops.businesslogic.file.FileInfoServiceImpl
-
- All Implemented Interfaces:
FileInfoService
@Service public class FileInfoServiceImpl extends java.lang.Object implements FileInfoService
Handles meta data for files.
-
-
Constructor Summary
Constructors Constructor Description FileInfoServiceImpl(FileInfoRepository fileInfoRepo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteFileInfo(long fileId)Delete file from database by id.java.util.Set<java.lang.Long>fetchAllFileInfoIds()Fetches all available FileInfo ids.java.util.List<FileInfo>fetchAllFilesInDirectory(long dirId)Lists all files in a specific directory.java.util.Set<java.lang.Long>fetchAllOrphanedFileInfos()Fetches all FileInfos which are in non existing directories.FileInfofetchFileInfo(long fileId)Get a file by id.longgetFileCountInGroup(long groupId)Get the total number of files in a group.longgetStorageUsageInGroup(long groupId)Get the total number of bytes used by that group.longgetTotalFileCount()Get the total number of files in all groups.longgetTotalStorageUsage()Get the total number of bytes used by all groups.FileInfosaveFileInfo(FileInfo fileInfo)Save file to database.
-
-
-
Constructor Detail
-
FileInfoServiceImpl
public FileInfoServiceImpl(FileInfoRepository fileInfoRepo)
-
-
Method Detail
-
fetchAllFilesInDirectory
public java.util.List<FileInfo> fetchAllFilesInDirectory(long dirId) throws MopsException
Lists all files in a specific directory.- Specified by:
fetchAllFilesInDirectoryin interfaceFileInfoService- Parameters:
dirId- directory id- Returns:
- a list of files in that directory
- Throws:
MopsException
-
fetchFileInfo
public FileInfo fetchFileInfo(long fileId) throws MopsException
Get a file by id.- Specified by:
fetchFileInfoin interfaceFileInfoService- Parameters:
fileId- file id- Returns:
- a FileInfo object
- Throws:
MopsException
-
saveFileInfo
public FileInfo saveFileInfo(FileInfo fileInfo) throws MopsException
Save file to database.- Specified by:
saveFileInfoin interfaceFileInfoService- Parameters:
fileInfo- Metadata of a file- Returns:
- the freshly saved FileInfo
- Throws:
MopsException
-
deleteFileInfo
public void deleteFileInfo(long fileId) throws MopsExceptionDelete file from database by id.- Specified by:
deleteFileInfoin interfaceFileInfoService- Parameters:
fileId- file id- Throws:
MopsException
-
getStorageUsageInGroup
public long getStorageUsageInGroup(long groupId) throws MopsExceptionGet the total number of bytes used by that group.- Specified by:
getStorageUsageInGroupin interfaceFileInfoService- Parameters:
groupId- group- Returns:
- bytes used
- Throws:
MopsException
-
getTotalStorageUsage
public long getTotalStorageUsage() throws MopsExceptionGet the total number of bytes used by all groups.- Specified by:
getTotalStorageUsagein interfaceFileInfoService- Returns:
- bytes used
- Throws:
MopsException
-
getFileCountInGroup
public long getFileCountInGroup(long groupId) throws MopsExceptionGet the total number of files in a group.- Specified by:
getFileCountInGroupin interfaceFileInfoService- Parameters:
groupId- group- Returns:
- file count
- Throws:
MopsException
-
getTotalFileCount
public long getTotalFileCount() throws MopsExceptionGet the total number of files in all groups.- Specified by:
getTotalFileCountin interfaceFileInfoService- Returns:
- file count
- Throws:
MopsException
-
fetchAllFileInfoIds
public java.util.Set<java.lang.Long> fetchAllFileInfoIds() throws MopsExceptionFetches all available FileInfo ids.- Specified by:
fetchAllFileInfoIdsin interfaceFileInfoService- Returns:
- all ids
- Throws:
MopsException- on error
-
fetchAllOrphanedFileInfos
public java.util.Set<java.lang.Long> fetchAllOrphanedFileInfos() throws MopsExceptionFetches all FileInfos which are in non existing directories.- Specified by:
fetchAllOrphanedFileInfosin interfaceFileInfoService- Returns:
- all ids
- Throws:
MopsException- on error
-
-