Class LocalDatabaseFileService
- java.lang.Object
-
- fr.paris.lutece.portal.service.file.implementation.LocalDatabaseFileService
-
- All Implemented Interfaces:
IFileStoreServiceProvider,java.io.Serializable
public class LocalDatabaseFileService extends java.lang.Object implements IFileStoreServiceProvider
DatabaseBlobStoreService.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LocalDatabaseFileService(IFileDownloadUrlService _fileDownloadUrlService, IFileRBACService _fileRBACService)init
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckAccessRights(java.util.Map<java.lang.String,java.lang.String> fileData, fr.paris.lutece.api.user.User user)check if current user can access the filevoidcheckLinkValidity(java.util.Map<java.lang.String,java.lang.String> fileData)check if link is validvoiddelete(java.lang.String strKey)Delete a blobIFileDownloadUrlServicegetDownloadUrlService()Get the downloadServiceFilegetFile(java.lang.String strKey)Get a fileFilegetFile(java.lang.String strKey, boolean withPhysicalFile)get file from databasejava.lang.StringgetFileDownloadUrlBO(java.lang.String strKey)Gets the file download url for Back Office admin Lutece usersjava.lang.StringgetFileDownloadUrlBO(java.lang.String strKey, java.util.Map<java.lang.String,java.lang.String> additionnalData)Gets the file download url for Back Office admin Lutece usersjava.lang.StringgetFileDownloadUrlFO(java.lang.String strKey)Gets the file download url for Front Office Lutece usersjava.lang.StringgetFileDownloadUrlFO(java.lang.String strKey, java.util.Map<java.lang.String,java.lang.String> additionnalData)Gets the file download url for Front Office Lutece usersFilegetFileFromRequestBO(javax.servlet.http.HttpServletRequest request)get requested file from BOFilegetFileFromRequestFO(javax.servlet.http.HttpServletRequest request)get requested file from FOFilegetFileMetaData(java.lang.String strKey)Get a file object only filled with the meta data (name, size ...) without the physical file contentIFileRBACServicegetFileRBACService()get the FileRBACServicejava.io.InputStreamgetInputStream(java.lang.String strKey)Gets a blob asInputStreamjava.lang.StringgetName()get the service namebooleanisDefault()get the defaultvoidsetDefault(boolean bDefault)voidsetDownloadUrlService(IFileDownloadUrlService downloadUrlService)Sets the downloadServicevoidsetFileRBACService(IFileRBACService fileRBACService)set the FileRBACServicevoidsetName(java.lang.String strName)java.lang.StringstoreBytes(byte[] blob)Store a blob from a bytes arrayjava.lang.StringstoreFile(File file)Stores a file Lutece Filejava.lang.StringstoreFileItem(org.apache.commons.fileupload.FileItem fileItem)Stores a org.apache.commons.fileupload.FileItemjava.lang.StringstoreInputStream(java.io.InputStream inputStream)Stores an input stream-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface fr.paris.lutece.portal.service.file.IFileStoreServiceProvider
healthCheck
-
-
-
-
Constructor Detail
-
LocalDatabaseFileService
public LocalDatabaseFileService(IFileDownloadUrlService _fileDownloadUrlService, IFileRBACService _fileRBACService)
init- Parameters:
_fileDownloadUrlService-_fileRBACService-
-
-
Method Detail
-
getFileRBACService
public IFileRBACService getFileRBACService()
get the FileRBACService- Returns:
- the FileRBACService
-
setFileRBACService
public void setFileRBACService(IFileRBACService fileRBACService)
set the FileRBACService- Parameters:
fileRBACService-
-
getDownloadUrlService
public IFileDownloadUrlService getDownloadUrlService()
Get the downloadService- Returns:
- the downloadService
-
setDownloadUrlService
public void setDownloadUrlService(IFileDownloadUrlService downloadUrlService)
Sets the downloadService- Parameters:
downloadUrlService- downloadService
-
getName
public java.lang.String getName()
get the service name- Specified by:
getNamein interfaceIFileStoreServiceProvider- Returns:
- the service name
-
delete
public void delete(java.lang.String strKey)
Delete a blob- Specified by:
deletein interfaceIFileStoreServiceProvider- Parameters:
strKey- The key of the blob
-
getFile
public File getFile(java.lang.String strKey)
Get a file- Specified by:
getFilein interfaceIFileStoreServiceProvider- Parameters:
strKey- The key of the file- Returns:
- The file
-
getFileMetaData
public File getFileMetaData(java.lang.String strKey)
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
public File getFile(java.lang.String strKey, boolean withPhysicalFile)
get file from database- Parameters:
strKey-withPhysicalFile-- Returns:
- the file with the physical file content if withPhysicalFile is true, null otherwise
-
storeBytes
public java.lang.String storeBytes(byte[] blob)
Store a blob from a bytes array- Specified by:
storeBytesin interfaceIFileStoreServiceProvider- Parameters:
blob- The blob- Returns:
- The key of the blob
-
storeInputStream
public java.lang.String storeInputStream(java.io.InputStream inputStream)
Stores an input stream- Specified by:
storeInputStreamin interfaceIFileStoreServiceProvider- Parameters:
inputStream- the input stream- Returns:
- The key of the blob
-
storeFileItem
public java.lang.String storeFileItem(org.apache.commons.fileupload.FileItem fileItem)
Stores a org.apache.commons.fileupload.FileItem- Specified by:
storeFileItemin interfaceIFileStoreServiceProvider- Parameters:
fileItem- the fileItem- Returns:
- The key of the blob
-
storeFile
public java.lang.String storeFile(File file)
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
public void setName(java.lang.String strName)
-
isDefault
public boolean isDefault()
get the default- Specified by:
isDefaultin interfaceIFileStoreServiceProvider- Returns:
- true if default
-
getInputStream
public java.io.InputStream getInputStream(java.lang.String strKey)
Gets a blob asInputStream- Specified by:
getInputStreamin interfaceIFileStoreServiceProvider- Parameters:
strKey- the key- Returns:
- the
InputStream
-
getFileDownloadUrlFO
public java.lang.String getFileDownloadUrlFO(java.lang.String strKey)
Gets the file download url for Front Office Lutece users- Specified by:
getFileDownloadUrlFOin interfaceIFileStoreServiceProvider- Parameters:
strKey- the- Returns:
- the download link
-
getFileDownloadUrlFO
public java.lang.String getFileDownloadUrlFO(java.lang.String strKey, java.util.Map<java.lang.String,java.lang.String> additionnalData)Gets the file download url for Front Office Lutece users- Specified by:
getFileDownloadUrlFOin interfaceIFileStoreServiceProvider- Parameters:
strKey- the- Returns:
- the download link
-
getFileDownloadUrlBO
public java.lang.String getFileDownloadUrlBO(java.lang.String strKey)
Gets the file download url for Back Office admin Lutece users- Specified by:
getFileDownloadUrlBOin interfaceIFileStoreServiceProvider- Parameters:
strKey- the- Returns:
- the download link
-
getFileDownloadUrlBO
public java.lang.String getFileDownloadUrlBO(java.lang.String strKey, java.util.Map<java.lang.String,java.lang.String> additionnalData)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(java.util.Map<java.lang.String,java.lang.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
public void checkLinkValidity(java.util.Map<java.lang.String,java.lang.String> fileData) throws ExpiredLinkExceptioncheck 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
-
-