public class FileManager extends Object implements IFileManager
CONTENT_TYPE_PROVIDER_PROPERTY_NAME
Constructor and Description |
---|
FileManager() |
Modifier and Type | Method and Description |
---|---|
FileConfig |
add(SessionConfig sessionConfig,
FileConfig fileConfig,
ITransaction transaction)
Deprecated.
|
FileConfig |
add(SessionConfig sessionConfig,
String name,
File file,
String contentType,
String serviceInstanceId,
ITransaction transaction)
Persists a file.
|
FileConfig |
add(SessionConfig sessionConfig,
String fileId,
String fileRelativePath,
String name,
File file,
String serviceInstanceId,
ITransaction transaction)
Persists a file.
|
FileConfig |
add(SessionConfig sessionConfig,
String fileId,
String fileRelativePath,
String name,
File file,
String contentType,
String serviceInstanceId,
ITransaction transaction)
Persists a file.
|
void |
changeFilename(SessionConfig sessionConfig,
String fileId,
String newFilename,
ITransaction transaction)
Changes the filename of a file.
|
FileConfig |
findByFullPath(SessionConfig sessionConfig,
String fullPath,
ITransaction transaction)
Finds the FileConfig by the full path.
|
FileConfig |
get(SessionConfig sessionConfig,
String fileId,
ITransaction transaction)
Returns the FileConfig for a file with the given fileId.
|
File |
getFile(SessionConfig sessionConfig,
FileConfig fileConfig,
ITransaction transaction)
Deprecated.
|
Collection<FileConfig> |
getFileConfigsByFilesId(SessionConfig sessionConfig,
String filesId,
ITransaction transaction)
Returns a collection of FileConfig of file entries belonging to the files
with the given id.
|
Collection<FileConfig> |
getFileConfigsByServiceInstanceId(String serviceInstanceId,
ITransaction transaction)
Returns all file configs by a given service instance id.
|
IServiceInterfaceUrl |
getFileHref(SessionConfig sessionConfig,
String fileId,
ITransaction transaction)
Returns the href that is used to access the specified file.
|
FilesConfig |
getFilesConfig(SessionConfig sessionConfig,
String filesId,
ITransaction transaction)
Returns the FilesConfig for a files with the given filesId.
|
FileMimeTypeConfig |
getMimeType(SessionConfig sessionConfig,
String fileMimeType,
ITransaction transaction)
Returns a mime type information.
|
int |
getNumberOfServiceInstanceFiles(SessionConfig sessionConfig,
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 |
moveFile(FileConfig file,
IWebRootPortalBaseFolder oldWebRoot,
IWebRootPortalBaseFolder newWebRoot)
Moves the given
file from one web root to another. |
void |
publicServiceInstanceFiles(SessionConfig sessionConfig,
String serviceInstanceId,
boolean filesArePublic,
ITransaction transaction)
Creates or deletes the public copy of the files of a service instance.
|
void |
removeStoredFile(SessionConfig sessionConfig,
String fileId,
ITransaction transaction)
Removes the specified file.
|
void |
removeStoredFiles(SessionConfig sessionConfig,
String filesId,
ITransaction transaction)
Removes the files associated with the filesId given.
|
void |
setFileContentLocaleId(String fileId,
String contentLocaleId)
Sets the given content locale identifier in the file with the given identifier.
|
void |
updateMetadata(String fileId,
ITransaction transaction)
Updates metadata information from a given file
|
public FileConfig get(SessionConfig sessionConfig, String fileId, ITransaction transaction) throws PortalException
IFileManager
get
in interface IFileManager
sessionConfig
- identifier for the session.fileId
- the id of the file.transaction
- the transaction for persistence access.PortalException
public FileConfig findByFullPath(SessionConfig sessionConfig, String fullPath, ITransaction transaction) throws PortalException
sessionConfig
- identifier for the session.fullPath
- the full path.transaction
- the transaction for persistence access.PortalException
public FilesConfig getFilesConfig(SessionConfig sessionConfig, String filesId, ITransaction transaction) throws PortalException
IFileManager
getFilesConfig
in interface IFileManager
sessionConfig
- identifier for the session.filesId
- the id of the files.transaction
- the transaction for persistence access.PortalException
public Collection<FileConfig> getFileConfigsByFilesId(SessionConfig sessionConfig, String filesId, ITransaction transaction) throws PortalException
IFileManager
getFileConfigsByFilesId
in interface IFileManager
sessionConfig
- identifier for the session.filesId
- id of the files entry.transaction
- the transaction for persistence access.PortalException
public void removeStoredFile(SessionConfig sessionConfig, String fileId, ITransaction transaction) throws PortalException
IFileManager
removeStoredFile
in interface IFileManager
sessionConfig
- identifier for the session.fileId
- the file id.transaction
- the transaction for persistence access.PortalException
public void removeStoredFiles(SessionConfig sessionConfig, String filesId, ITransaction transaction) throws PortalException
IFileManager
removeStoredFiles
in interface IFileManager
sessionConfig
- identifier for the session.filesId
- the filesId.transaction
- the transaction for persistence access.PortalException
public FileConfig add(SessionConfig sessionConfig, String name, File file, String contentType, String serviceInstanceId, ITransaction transaction) throws PortalException
IFileManager
add
in interface IFileManager
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 persistencePortalException
- If any error occursFileUploadDeniedException
- if the file was not added
because it did not comply with portal file upload restrictions configuration.public FileConfig add(SessionConfig sessionConfig, String fileId, String fileRelativePath, String name, File file, String serviceInstanceId, ITransaction transaction) throws PortalException
IFileManager
add
in interface IFileManager
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 persistencePortalException
- If any error occursFileUploadDeniedException
- if the file was not added because it did not comply with portal file upload restrictions
configuration.public FileConfig add(SessionConfig sessionConfig, String fileId, String fileRelativePath, String name, File file, String contentType, String serviceInstanceId, ITransaction transaction) throws PortalException
IFileManager
add
in interface IFileManager
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 persistencePortalException
- If any error occursFileUploadDeniedException
- if the file was not added
because it did not comply with portal file upload restrictions configuration.@Deprecated public FileConfig add(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction) throws PortalException
IFileManager
add
in interface IFileManager
sessionConfig
- identifier for the session.fileConfig
- file config of the file to be added.transaction
- the transaction for persistence access.FileUploadDeniedException
- if the file was not added
because it did not comply with portal file upload restrictions configuration.PortalException
@Deprecated public File getFile(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction) throws PortalException
IFileManager
getFile
in interface IFileManager
sessionConfig
- identifier for the session.fileConfig
- the fileConfig of the asked file.transaction
- the transaction for persistence access.PortalException
public IFile getPortalFile(SessionConfig sessionConfig, FileConfig fileConfig, ITransaction transaction) throws PortalException
IFileManager
getPortalFile
in interface IFileManager
sessionConfig
- identifier for the session.fileConfig
- the fileConfig of the asked file.transaction
- the transaction for persistence access.PortalException
public void changeFilename(SessionConfig sessionConfig, String fileId, String newFilename, ITransaction transaction) throws PortalException
IFileManager
changeFilename
in interface IFileManager
sessionConfig
- identifier for the session.fileId
- the file id.newFilename
- the new filename for the file.transaction
- the transaction for persistence access.PortalException
public IServiceInterfaceUrl getFileHref(SessionConfig sessionConfig, String fileId, ITransaction transaction) throws PortalException
IFileManager
getFileHref
in interface IFileManager
sessionConfig
- identifier for the session.fileId
- the file id.transaction
- the transaction for persistence access.PortalException
public void publicServiceInstanceFiles(SessionConfig sessionConfig, String serviceInstanceId, boolean filesArePublic, ITransaction transaction) throws PortalException
IFileManager
publicServiceInstanceFiles
in interface IFileManager
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.PortalException
public FileMimeTypeConfig getMimeType(SessionConfig sessionConfig, String fileMimeType, ITransaction transaction) throws PortalException
IFileManager
getMimeType
in interface IFileManager
sessionConfig
- the user session information.fileMimeType
- the mime type.transaction
- the transaction for persistence access.PortalException
public void updateMetadata(String fileId, ITransaction transaction) throws PortalException
fileId
- file that the metadata information will be updatedtransaction
- the transaction for persistence access.PortalException
- if any error updating occurspublic int getNumberOfServiceInstanceFiles(SessionConfig sessionConfig, String serviceInstanceId, ITransaction transaction) throws PortalException
IFileManager
getNumberOfServiceInstanceFiles
in interface IFileManager
sessionConfig
- the user session information.serviceInstanceId
- the service instance identifier.transaction
- the transaction for persistence access.PortalException
public Collection<FileConfig> getFileConfigsByServiceInstanceId(String serviceInstanceId, ITransaction transaction) throws PortalException
serviceInstanceId
- the wished service instance idtransaction
- the current transactionPortalException
public void moveFile(FileConfig file, IWebRootPortalBaseFolder oldWebRoot, IWebRootPortalBaseFolder newWebRoot) throws PortalException
file
from one web root to another.
The actual move operation will occur after the current transaction
commits.
This method also moves all transformed files
derived from the given file.
Note: this method does not validates whether the file is public or if it should be in the specified web root. This method is just a low-level movement operation.
file
- the file to be moved.oldWebRoot
- the web root base folder the file will be moved from. May
be null
if the file is not in any web root.newWebRoot
- the web root base folder the file will be moved to. May
be null
if the file will not be in any web root.PortalException
public void setFileContentLocaleId(String fileId, String contentLocaleId) throws PortalException
IFileManager
setFileContentLocaleId
in interface IFileManager
fileId
- the file identifier.contentLocaleId
- the content locale identifier.PortalException
LumisXP 12.0.0.190809 - Copyright © 2006–2019 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.