Package mops.businesslogic.file
Interface FileService
-
- All Known Implementing Classes:
FileServiceImpl
@Service public interface FileServiceHandles communication with the storage service.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DirectorydeleteFile(Account account, long fileId)Deletes a file.voiddeleteFileWithoutMeta(long fileId)INTERNAL USE ONLY.java.util.Set<java.lang.Long>getAllFileIds()Fetches all IDs.FileContainergetFile(Account account, long fileId)Gets a file.FileInfogetFileInfo(Account account, long fileId)Retrieves file meta data.java.util.List<FileListEntry>getFilesOfDirectory(Account account, long dirId)Retrieves file meta data of all files in a directory.DirectoryrenameFile(Account account, long fileId, java.lang.String newName)Renames a file.voidsaveFile(Account account, long dirId, org.springframework.web.multipart.MultipartFile multipartFile, java.util.Set<java.lang.String> tags)Saves a file.
-
-
-
Method Detail
-
saveFile
void saveFile(Account account, long dirId, org.springframework.web.multipart.MultipartFile multipartFile, java.util.Set<java.lang.String> tags) throws MopsException
Saves a file.- Parameters:
account- user credentialsdirId- directory id of the future parent foldermultipartFile- the binary code of the filetags- the file tag- Throws:
MopsException
-
getFile
FileContainer getFile(Account account, long fileId) throws MopsException
Gets a file.- Parameters:
account- user credentialsfileId- file id of needed file- Returns:
- file
- Throws:
MopsException
-
deleteFile
Directory deleteFile(Account account, long fileId) throws MopsException
Deletes a file.- Parameters:
account- user credentialsfileId- file id of file to be deleted- Returns:
- parent directory Id
- Throws:
MopsException
-
getFileInfo
FileInfo getFileInfo(Account account, long fileId) throws MopsException
Retrieves file meta data.- Parameters:
account- the account object.fileId- the file ID- Returns:
- the meta info.
- Throws:
MopsException- on error.
-
getFilesOfDirectory
java.util.List<FileListEntry> getFilesOfDirectory(Account account, long dirId) throws MopsException
Retrieves file meta data of all files in a directory.- Parameters:
account- the account object.dirId- the file ID- Returns:
- the meta info.
- Throws:
MopsException- on error.
-
getAllFileIds
java.util.Set<java.lang.Long> getAllFileIds() throws MopsExceptionFetches all IDs.- Returns:
- all File IDs
- Throws:
MopsException
-
deleteFileWithoutMeta
void deleteFileWithoutMeta(long fileId) throws MopsExceptionINTERNAL USE ONLY. Deletes a file without checking permission. And without removing the corresponding FileInfo.- Parameters:
fileId- the id of the file- Throws:
MopsException- on error
-
renameFile
Directory renameFile(Account account, long fileId, java.lang.String newName) throws MopsException
Renames a file.- Parameters:
account- user credentialsfileId- the file IDnewName- the new filename- Returns:
- the directory of the dir
- Throws:
MopsException- on error
-
-