Package lumis.portal.file
Interface IFileManager
-
- All Known Implementing Classes:
FileManager
@StableMinor(version="16.1", sinceVersion="4.0") public interface IFileManager
Manages file information.File validations may be configured defining property bags. The properties are applied to service instances. The properties are:
Property Description lumis.portal.file.validation.height Define the maximum height limit for the file in pixels. This validation will be applied just over files that have this information with metadata. lumis.portal.file.validation.width Define the maximum width limit for the file in pixels. This validation will be applied just over files that have this information with metadata. lumis.portal.file.validation.size Define the maximum size limit for the file in bytes. This validation will be applied over all files that the File Manager tries to persist. lumis.portal.file.validation.className Define a list of custom class validators that will be used by the File Manager when his will try to persist each file. More information check IFileValidator
.- Since:
- 4.0.0
- Version:
- $Revision: 26156 $ $Date: 2024-01-13 10:26:46 -0300 (Sat, 13 Jan 2024) $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTENT_TYPE_PROVIDER_PROPERTY_NAME
IContentTypeProvider
property bag name.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description FileConfig
add(SessionConfig sessionConfig, java.lang.String name, java.io.File file, java.lang.String contentType, java.lang.String serviceInstanceId, ITransaction transaction)
Persists a file.FileConfig
add(SessionConfig sessionConfig, java.lang.String fileId, java.lang.String fileRelativePath, java.lang.String name, java.io.File file, java.lang.String contentType, java.lang.String serviceInstanceId, ITransaction transaction)
Persists a file.FileConfig
add(SessionConfig sessionConfig, java.lang.String fileId, java.lang.String fileRelativePath, java.lang.String name, java.io.File file, java.lang.String serviceInstanceId, ITransaction transaction)
Persists a file.FileConfig
add(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction)
Deprecated.Since 6.0.0 replaced byadd(SessionConfig, String, File, String, String, ITransaction)
.void
changeFilename(SessionConfig sessionConfig, java.lang.String fileId, java.lang.String newFilename, ITransaction transaction)
Changes the filename of a file.FileConfig
get(SessionConfig sessionConfig, java.lang.String fileId, ITransaction transaction)
Returns the FileConfig for a file with the given fileId.java.io.File
getFile(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction)
Deprecated.since 8.0.0 replaced bygetPortalFile(SessionConfig, FileConfig, ITransaction)
.java.util.Collection<FileConfig>
getFileConfigsByFilesId(SessionConfig sessionConfig, java.lang.String filesId, ITransaction transaction)
Returns a collection of FileConfig of file entries belonging to the files with the given id.IServiceInterfaceUrl
getFileHref(SessionConfig sessionConfig, java.lang.String fileId, ITransaction transaction)
Returns the href that is used to access the specified file.FilesConfig
getFilesConfig(SessionConfig sessionConfig, java.lang.String filesId, ITransaction transaction)
Returns the FilesConfig for a files with the given filesId.FileMimeTypeConfig
getMimeType(SessionConfig sessionConfig, java.lang.String fileMimeType, ITransaction transaction)
Returns a mime type information.int
getNumberOfServiceInstanceFiles(SessionConfig sessionConfig, java.lang.String serviceInstanceId, ITransaction transaction)
Returns the number of files for a service instance.IFile
getPortalFile(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction)
Returns the File object for accessing the corresponding file in the portal filesystem.void
publicServiceInstanceFiles(SessionConfig sessionConfig, java.lang.String serviceInstanceId, boolean filesArePublic, ITransaction transaction)
Creates or deletes the public copy of the files of a service instance.void
removeStoredFile(SessionConfig sessionConfig, java.lang.String fileId, ITransaction transaction)
Removes the specified file.void
removeStoredFiles(SessionConfig sessionConfig, java.lang.String filesId, ITransaction transaction)
Removes the files associated with the filesId given.void
setFileContentLocaleId(java.lang.String fileId, java.lang.String contentLocaleId)
Sets the given content locale identifier in the file with the given identifier.
-
-
-
Field Detail
-
CONTENT_TYPE_PROVIDER_PROPERTY_NAME
static final java.lang.String CONTENT_TYPE_PROVIDER_PROPERTY_NAME
IContentTypeProvider
property bag name. This property bag is used to declare aIContentTypeProvider
class name that will be used to decide a file's content type.- Since:
- 8.2.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
get
FileConfig get(SessionConfig sessionConfig, java.lang.String fileId, ITransaction transaction) throws PortalException
Returns the FileConfig for a file with the given fileId.- Parameters:
sessionConfig
- identifier for the session.fileId
- the id of the file.transaction
- the transaction for persistence access.- Returns:
- the FileConfig for the file, or null if it is not found.
- Throws:
PortalException
-
getFilesConfig
FilesConfig getFilesConfig(SessionConfig sessionConfig, java.lang.String filesId, ITransaction transaction) throws PortalException
Returns the FilesConfig for a files with the given filesId.- Parameters:
sessionConfig
- identifier for the session.filesId
- the id of the files.transaction
- the transaction for persistence access.- Returns:
- the FilesConfig for the files, or null if it is not found.
- Throws:
PortalException
-
getFileConfigsByFilesId
java.util.Collection<FileConfig> getFileConfigsByFilesId(SessionConfig sessionConfig, java.lang.String filesId, ITransaction transaction) throws PortalException
Returns a collection of FileConfig of file entries belonging to the files with the given id.- Parameters:
sessionConfig
- identifier for the session.filesId
- id of the files entry.transaction
- the transaction for persistence access.- Returns:
- the collection contaning the FileConfig instances, or an empty collection if none is found.
- Throws:
PortalException
-
getFile
@Deprecated java.io.File getFile(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction) throws PortalException
Deprecated.since 8.0.0 replaced bygetPortalFile(SessionConfig, FileConfig, ITransaction)
. When not using the LumisPortal's default file systems, this method may raise an exception.Returns the File object for accessing the corresponding file in the filesystem.- Parameters:
sessionConfig
- identifier for the session.fileConfig
- the fileConfig of the asked file.transaction
- the transaction for persistence access.- Returns:
- the File object for accessing the corresponding file in the filesystem.
- Throws:
PortalException
-
getPortalFile
IFile getPortalFile(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction) throws PortalException
Returns the File object for accessing the corresponding file in the portal filesystem.- Parameters:
sessionConfig
- identifier for the session.fileConfig
- the fileConfig of the asked file.transaction
- the transaction for persistence access.- Returns:
- the File object for accessing the corresponding file in the portal filesystem.
- Throws:
PortalException
-
add
FileConfig add(SessionConfig sessionConfig, java.lang.String name, java.io.File file, java.lang.String contentType, java.lang.String serviceInstanceId, ITransaction transaction) throws PortalException
Persists a file.- Parameters:
sessionConfig
- The session information.name
- The name of the file.file
- The file to be added.contentType
- The contentType of the file.serviceInstanceId
- The ID of the service instance used to add this file.transaction
- The transaction used for the persistence- Returns:
- an instance of FileConfig holding the information of the file.
- Throws:
PortalException
- If any error occursFileUploadDeniedException
- if the file was not added because it did not comply with portal file upload restrictions configuration.- Since:
- 6.0.0
-
add
FileConfig add(SessionConfig sessionConfig, java.lang.String fileId, java.lang.String fileRelativePath, java.lang.String name, java.io.File file, java.lang.String contentType, java.lang.String serviceInstanceId, ITransaction transaction) throws PortalException
Persists a file.- Parameters:
sessionConfig
- The session information.fileId
- Identifier of the filefileRelativePath
- path of the file starting at the files directoryname
- The name of the file.file
- The file to be added.contentType
- The contentType of the file.serviceInstanceId
- The ID of the service instance used to add this file.transaction
- The transaction used for the persistence- Returns:
- an instance of FileConfig holding the information of the file.
- Throws:
PortalException
- If any error occursFileUploadDeniedException
- if the file was not added because it did not comply with portal file upload restrictions configuration.- Since:
- 8.0.0
-
add
FileConfig add(SessionConfig sessionConfig, java.lang.String fileId, java.lang.String fileRelativePath, java.lang.String name, java.io.File file, java.lang.String serviceInstanceId, ITransaction transaction) throws PortalException
Persists a file. Calculates the file's content type automatically.- Parameters:
sessionConfig
- The session information.fileId
- Identifier of the filefileRelativePath
- path of the file starting at the files directoryname
- The name of the file.file
- The file to be added.serviceInstanceId
- The ID of the service instance used to add this file.transaction
- The transaction used for the persistence- Returns:
- an instance of FileConfig holding the information of the file.
- Throws:
PortalException
- If any error occursFileUploadDeniedException
- if the file was not added because it did not comply with portal file upload restrictions configuration.- Since:
- 8.2.0
-
add
@Deprecated FileConfig add(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction) throws PortalException
Deprecated.Since 6.0.0 replaced byadd(SessionConfig, String, File, String, String, ITransaction)
.Adds a file. The file must be available until the transaction is committed.- Parameters:
sessionConfig
- identifier for the session.fileConfig
- file config of the file to be added.transaction
- the transaction for persistence access.- Returns:
- the FileConfig for the file added.
- Throws:
FileUploadDeniedException
- if the file was not added because it did not comply with portal file upload restrictions configuration.PortalException
-
removeStoredFile
void removeStoredFile(SessionConfig sessionConfig, java.lang.String fileId, ITransaction transaction) throws PortalException
Removes the specified file. The file entry from database is removed and the corresponding file in the filesystem is deleted.- Parameters:
sessionConfig
- identifier for the session.fileId
- the file id.transaction
- the transaction for persistence access.- Throws:
PortalException
-
removeStoredFiles
void removeStoredFiles(SessionConfig sessionConfig, java.lang.String filesId, ITransaction transaction) throws PortalException
Removes the files associated with the filesId given.- Parameters:
sessionConfig
- identifier for the session.filesId
- the filesId.transaction
- the transaction for persistence access.- Throws:
PortalException
-
changeFilename
void changeFilename(SessionConfig sessionConfig, java.lang.String fileId, java.lang.String newFilename, ITransaction transaction) throws PortalException
Changes the filename of a file.- Parameters:
sessionConfig
- identifier for the session.fileId
- the file id.newFilename
- the new filename for the file.transaction
- the transaction for persistence access.- Throws:
PortalException
-
getFileHref
IServiceInterfaceUrl getFileHref(SessionConfig sessionConfig, java.lang.String fileId, ITransaction transaction) throws PortalException
Returns the href that is used to access the specified file.- Parameters:
sessionConfig
- identifier for the session.fileId
- the file id.transaction
- the transaction for persistence access.- Throws:
PortalException
-
publicServiceInstanceFiles
void publicServiceInstanceFiles(SessionConfig sessionConfig, java.lang.String serviceInstanceId, boolean filesArePublic, ITransaction transaction) throws PortalException
Creates or deletes the public copy of the files of a service instance.- Parameters:
sessionConfig
- the user session information.serviceInstanceId
- the service instance id.filesArePublic
- if true the files are copied to the public area, if false the files are deleted from the public area.transaction
- the transaction for persistence access.- Throws:
PortalException
-
getMimeType
FileMimeTypeConfig getMimeType(SessionConfig sessionConfig, java.lang.String fileMimeType, ITransaction transaction) throws PortalException
Returns a mime type information.- Parameters:
sessionConfig
- the user session information.fileMimeType
- the mime type.transaction
- the transaction for persistence access.- Returns:
- the mime type information.
- Throws:
PortalException
- Since:
- 4.0.8
-
getNumberOfServiceInstanceFiles
int getNumberOfServiceInstanceFiles(SessionConfig sessionConfig, java.lang.String serviceInstanceId, ITransaction transaction) throws PortalException
Returns the number of files for a service instance.- Parameters:
sessionConfig
- the user session information.serviceInstanceId
- the service instance identifier.transaction
- the transaction for persistence access.- Returns:
- the number of files for the specified service instance.
- Throws:
PortalException
- Since:
- 4.2.0
-
setFileContentLocaleId
void setFileContentLocaleId(java.lang.String fileId, java.lang.String contentLocaleId) throws PortalException
Sets the given content locale identifier in the file with the given identifier. If no file config is found with the given file identifier, nothing will be performed.- Parameters:
fileId
- the file identifier.contentLocaleId
- the content locale identifier.- Throws:
PortalException
- Since:
- 10.1.0
-
-