Class LocalDatabaseFileService
java.lang.Object
fr.paris.lutece.portal.service.file.implementation.LocalDatabaseFileService
- All Implemented Interfaces:
IFileStoreServiceProvider,Serializable
DatabaseBlobStoreService.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLocalDatabaseFileService(IFileDownloadUrlService _fileDownloadUrlService, IFileRBACService _fileRBACService) init -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckAccessRights(Map<String, String> fileData, fr.paris.lutece.api.user.User user) check if current user can access the filevoidcheckLinkValidity(Map<String, String> fileData) check if link is validvoidDelete a blobGet the downloadServiceGet a fileget file from databasegetFileDownloadUrlBO(String strKey) Gets the file download url for Back Office admin Lutece usersgetFileDownloadUrlBO(String strKey, Map<String, String> additionnalData) Gets the file download url for Back Office admin Lutece usersgetFileDownloadUrlFO(String strKey) Gets the file download url for Front Office Lutece usersgetFileDownloadUrlFO(String strKey, Map<String, String> additionnalData) Gets the file download url for Front Office Lutece usersgetFileFromRequestBO(javax.servlet.http.HttpServletRequest request) get requested file from BOgetFileFromRequestFO(javax.servlet.http.HttpServletRequest request) get requested file from FOgetFileMetaData(String strKey) Get a file object only filled with the meta data (name, size ...) without the physical file contentget the FileRBACServicegetInputStream(String strKey) Gets a blob asInputStreamgetName()get the service namebooleanget the defaultvoidsetDefault(boolean bDefault) voidsetDownloadUrlService(IFileDownloadUrlService downloadUrlService) Sets the downloadServicevoidsetFileRBACService(IFileRBACService fileRBACService) set the FileRBACServicevoidstoreBytes(byte[] blob) Store a blob from a bytes arrayStores a file Lutece FilestoreFileItem(org.apache.commons.fileupload.FileItem fileItem) Stores a org.apache.commons.fileupload.FileItemstoreInputStream(InputStream inputStream) Stores an input streamMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
healthCheck
-
Constructor Details
-
LocalDatabaseFileService
public LocalDatabaseFileService(IFileDownloadUrlService _fileDownloadUrlService, IFileRBACService _fileRBACService) init- Parameters:
_fileDownloadUrlService-_fileRBACService-
-
-
Method Details
-
getFileRBACService
get the FileRBACService- Returns:
- the FileRBACService
-
setFileRBACService
set the FileRBACService- Parameters:
fileRBACService-
-
getDownloadUrlService
Get the downloadService- Returns:
- the downloadService
-
setDownloadUrlService
Sets the downloadService- Parameters:
downloadUrlService- downloadService
-
getName
get the service name- Specified by:
getNamein interfaceIFileStoreServiceProvider- Returns:
- the service name
-
delete
Delete a blob- Specified by:
deletein interfaceIFileStoreServiceProvider- Parameters:
strKey- The key of the blob
-
getFile
Get a file- Specified by:
getFilein interfaceIFileStoreServiceProvider- Parameters:
strKey- The key of the file- Returns:
- The file
-
getFileMetaData
Get a file object only filled with the meta data (name, size ...) without the physical file content- Specified by:
getFileMetaDatain interfaceIFileStoreServiceProvider- Parameters:
strKey- The key of the file- Returns:
- The file
-
getFile
get file from database- Parameters:
strKey-withPhysicalFile-- Returns:
- the file with the physical file content if withPhysicalFile is true, null otherwise
-
storeBytes
Store a blob from a bytes array- Specified by:
storeBytesin interfaceIFileStoreServiceProvider- Parameters:
blob- The blob- Returns:
- The key of the blob
-
storeInputStream
Stores an input stream- Specified by:
storeInputStreamin interfaceIFileStoreServiceProvider- Parameters:
inputStream- the input stream- Returns:
- The key of the blob
-
storeFileItem
Stores a org.apache.commons.fileupload.FileItem- Specified by:
storeFileItemin interfaceIFileStoreServiceProvider- Parameters:
fileItem- the fileItem- Returns:
- The key of the blob
-
storeFile
Stores a file Lutece File- Specified by:
storeFilein interfaceIFileStoreServiceProvider- Parameters:
file- the file- Returns:
- The key of the stored file
-
setDefault
public void setDefault(boolean bDefault) -
setName
-
isDefault
public boolean isDefault()get the default- Specified by:
isDefaultin interfaceIFileStoreServiceProvider- Returns:
- true if default
-
getInputStream
Gets a blob asInputStream- Specified by:
getInputStreamin interfaceIFileStoreServiceProvider- Parameters:
strKey- the key- Returns:
- the
InputStream
-
getFileDownloadUrlFO
Gets the file download url for Front Office Lutece users- Specified by:
getFileDownloadUrlFOin interfaceIFileStoreServiceProvider- Parameters:
strKey- the- Returns:
- the download link
-
getFileDownloadUrlFO
Gets the file download url for Front Office Lutece users- Specified by:
getFileDownloadUrlFOin interfaceIFileStoreServiceProvider- Parameters:
strKey- the- Returns:
- the download link
-
getFileDownloadUrlBO
Gets the file download url for Back Office admin Lutece users- Specified by:
getFileDownloadUrlBOin interfaceIFileStoreServiceProvider- Parameters:
strKey- the- Returns:
- the download link
-
getFileDownloadUrlBO
Gets the file download url for Back Office admin Lutece users- Specified by:
getFileDownloadUrlBOin interfaceIFileStoreServiceProvider- Parameters:
strKey- the- Returns:
- the download link
-
checkAccessRights
public void checkAccessRights(Map<String, String> fileData, fr.paris.lutece.api.user.User user) throws AccessDeniedException, UserNotSignedExceptioncheck if current user can access the file- Specified by:
checkAccessRightsin interfaceIFileStoreServiceProvideruser- the current user- Throws:
AccessDeniedExceptionUserNotSignedException
-
checkLinkValidity
check if link is valid- Specified by:
checkLinkValidityin interfaceIFileStoreServiceProvider- Throws:
ExpiredLinkException
-
getFileFromRequestBO
public File getFileFromRequestBO(javax.servlet.http.HttpServletRequest request) throws AccessDeniedException, ExpiredLinkException, UserNotSignedException get requested file from BO- Specified by:
getFileFromRequestBOin interfaceIFileStoreServiceProvider- Returns:
- the file
- Throws:
AccessDeniedExceptionExpiredLinkExceptionUserNotSignedException
-
getFileFromRequestFO
public File getFileFromRequestFO(javax.servlet.http.HttpServletRequest request) throws AccessDeniedException, ExpiredLinkException, UserNotSignedException get requested file from FO- Specified by:
getFileFromRequestFOin interfaceIFileStoreServiceProvider- Returns:
- the file
- Throws:
AccessDeniedExceptionExpiredLinkExceptionUserNotSignedException
-