Package lumis.portal.file.transformation
Class FileTransformationManager
- java.lang.Object
-
- lumis.portal.file.transformation.FileTransformationManager
-
- All Implemented Interfaces:
IFileTransformationManager
,IFileTransformationManagerSPI
public class FileTransformationManager extends java.lang.Object implements IFileTransformationManagerSPI
Manager responsible for file transformations. Implementation ofIFileTransformationManager
- Since:
- 6.1.0
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description FileTransformationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FileTransformation
addFileTransformation(SessionConfig sessionConfig, FileTransformation fileTransformation, ITransaction transaction)
Persist a FileTransformation for a serviceInstance.void
addTransformedFileConfig(TransformedFileConfig fileTransformedConfig, ITransaction transaction)
Persists a transformed file.void
changeFilename(SessionConfig sessionConfig, java.lang.String tranformedFileId, java.lang.String newFilename, ITransaction transaction)
Changes the filename of a tranformed file.IServiceInterfaceUrl
getFileHref(SessionConfig sessionConfig, TransformedFileConfig transformedFileConfig, ITransaction transaction)
Returns the href for linking to the given transformed file in a portal's page.FileTransformation
getFileTransformation(java.lang.String fileTransformationId, ITransaction transaction)
Return a given persisted transformation.java.util.Collection<FileTransformation>
getFileTransformationsByServiceInstanceId(java.lang.String serviceInstanceId, ITransaction transaction)
Returns all transformations for the given service instance.java.util.Collection<IImageScaleTransformationResult>
getImageScaleTransformationResults(FileConfig srcFile)
Returns all image scaling transformations of the given file.IFile
getPortalFile(SessionConfig sessionConfig, TransformedFileConfig transformedFileConfig, ITransaction transaction)
Returns theIFile
related to the givenTransformedFileConfig
.TransformedFileConfig
getTransformedFileConfig(java.lang.String transformedFileId, ITransaction transaction)
Returns the persisted generated file.java.util.Collection<TransformedFileConfig>
getTransformedFileConfigByOriginalId(java.lang.String originalFileId, ITransaction transaction)
Returns all transformed files by the original file.void
moveTransformedFiles(FileConfig fileConfig, IWebRootPortalBaseFolder oldWebRoot)
Moves the transformed public files from the old web root to the current.void
recreateTransformations(SessionConfig sessionConfig, java.lang.String serviceInstanceId, ITransaction transaction)
Recreates all transformations of a given file.void
removeFileTransformation(SessionConfig sessionConfig, FileTransformation fileTransformation, ITransaction transaction)
Removes the specified transformation and its related files.void
removeFileTransformationInternal(SessionConfig sessionConfig, FileTransformation fileTransformation, IWebRootPortalBaseFolder webRoot, ITransaction transaction)
Removes the specified transformation and all related files.void
removeTransformedFileConfig(TransformedFileConfig transformedFileConfig, ITransaction transaction)
Deletes asynchronously the persisted transformed file.void
removeTransformedFileConfig(TransformedFileConfig transformedFileConfig, IWebRootPortalBaseFolder webRootBaseFolder, ITransaction transaction)
Deletes synchronously persisted transformed file.void
transformFile(SessionConfig sessionConfig, java.lang.String fileId, FileTransformation fileTransformation, ITransaction transaction)
Transforms a given file.void
transformFiles(java.util.Collection<FileConfig> files, java.lang.String serviceInstanceId, ITransaction transaction)
Schedule the file transformation for the given files.void
updateFileTransformation(SessionConfig sessionConfig, FileTransformation fileTransformation, ITransaction transaction)
Updates a given transformation.void
updateMetadata(java.lang.String transformedFileConfigId, ITransaction transaction)
Updates metadata information from a given tranformed file
-
-
-
Method Detail
-
addFileTransformation
public FileTransformation addFileTransformation(SessionConfig sessionConfig, FileTransformation fileTransformation, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManager
Persist a FileTransformation for a serviceInstance.- Specified by:
addFileTransformation
in interfaceIFileTransformationManager
- Parameters:
sessionConfig
- the current session configuration.fileTransformation
- the transformation to be added.- Returns:
- the added file transformation.
- Throws:
PortalException
-
getFileTransformationsByServiceInstanceId
public java.util.Collection<FileTransformation> getFileTransformationsByServiceInstanceId(java.lang.String serviceInstanceId, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManager
Returns all transformations for the given service instance.- Specified by:
getFileTransformationsByServiceInstanceId
in interfaceIFileTransformationManager
- Parameters:
serviceInstanceId
- the wished service instance id.- Returns:
- all transformations for the given service instance.
- Throws:
PortalException
-
recreateTransformations
public void recreateTransformations(SessionConfig sessionConfig, java.lang.String serviceInstanceId, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Recreates all transformations of a given file.- Specified by:
recreateTransformations
in interfaceIFileTransformationManagerSPI
- Parameters:
sessionConfig
- the current session configuration.serviceInstanceId
- the desired serviceInstanceId.transaction
- the transaction for persistence access.- Throws:
PortalException
-
transformFiles
public void transformFiles(java.util.Collection<FileConfig> files, java.lang.String serviceInstanceId, ITransaction transaction) throws PortalException
Schedule the file transformation for the given files.- Parameters:
files
- the files.serviceInstanceId
- the service instance identifier.transaction
- the transaction.- Throws:
PortalException
- Since:
- 7.0.1
-
removeFileTransformation
public void removeFileTransformation(SessionConfig sessionConfig, FileTransformation fileTransformation, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManager
Removes the specified transformation and its related files.This method only schedules the removal, that will occur asynchrounsly. But the removal will only occur if the given transaction commits.
- Specified by:
removeFileTransformation
in interfaceIFileTransformationManager
- Parameters:
sessionConfig
- the current session configuration.fileTransformation
- the file transformation responsible for the file creation.transaction
- the transaction for persistence access.- Throws:
PortalException
-
removeFileTransformationInternal
public void removeFileTransformationInternal(SessionConfig sessionConfig, FileTransformation fileTransformation, IWebRootPortalBaseFolder webRoot, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Removes the specified transformation and all related files.- Specified by:
removeFileTransformationInternal
in interfaceIFileTransformationManagerSPI
- Parameters:
sessionConfig
- the current session configuration.fileTransformation
- the file transformation.webRoot
- base folder for the website.transaction
- the transaction for persistence access.- Throws:
PortalException
-
transformFile
public void transformFile(SessionConfig sessionConfig, java.lang.String fileId, FileTransformation fileTransformation, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Transforms a given file.- Specified by:
transformFile
in interfaceIFileTransformationManagerSPI
- Parameters:
sessionConfig
- the current session configuration.fileId
- the file to be transformed.fileTransformation
- the transformation to be user.transaction
- the current transaction- Throws:
PortalException
-
updateFileTransformation
public void updateFileTransformation(SessionConfig sessionConfig, FileTransformation fileTransformation, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManager
Updates a given transformation.- Specified by:
updateFileTransformation
in interfaceIFileTransformationManager
- Parameters:
sessionConfig
- the current session configuration.fileTransformation
- the file transformation to be updatedtransaction
- the current transaction- Throws:
PortalException
-
addTransformedFileConfig
public void addTransformedFileConfig(TransformedFileConfig fileTransformedConfig, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Persists a transformed file.- Specified by:
addTransformedFileConfig
in interfaceIFileTransformationManagerSPI
- Parameters:
fileTransformedConfig
- the transformed file to be persistedtransaction
- the current transaction- Throws:
PortalException
-
getTransformedFileConfig
public TransformedFileConfig getTransformedFileConfig(java.lang.String transformedFileId, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Returns the persisted generated file.- Specified by:
getTransformedFileConfig
in interfaceIFileTransformationManagerSPI
- Parameters:
transformedFileId
- the file id of the generated file.transaction
- the current transaction- Throws:
PortalException
-
getTransformedFileConfigByOriginalId
public java.util.Collection<TransformedFileConfig> getTransformedFileConfigByOriginalId(java.lang.String originalFileId, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Returns all transformed files by the original file.- Specified by:
getTransformedFileConfigByOriginalId
in interfaceIFileTransformationManagerSPI
- Parameters:
originalFileId
- the original file of the transformed config persistedtransaction
- the current transaction- Returns:
- the file transformation persisted
- Throws:
PortalException
-
removeTransformedFileConfig
public void removeTransformedFileConfig(TransformedFileConfig transformedFileConfig, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Deletes asynchronously the persisted transformed file.- Specified by:
removeTransformedFileConfig
in interfaceIFileTransformationManagerSPI
- Parameters:
transformedFileConfig
- the transformed file config to be deleted.transaction
- the current transaction- Throws:
PortalException
-
removeTransformedFileConfig
public void removeTransformedFileConfig(TransformedFileConfig transformedFileConfig, IWebRootPortalBaseFolder webRootBaseFolder, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Deletes synchronously persisted transformed file.- Specified by:
removeTransformedFileConfig
in interfaceIFileTransformationManagerSPI
- Parameters:
transformedFileConfig
- the transformed file config to be deleted.webRootBaseFolder
- base folder for the website.transaction
- in which the deletion should occur.- Throws:
PortalException
-
getFileTransformation
public FileTransformation getFileTransformation(java.lang.String fileTransformationId, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManager
Return a given persisted transformation.- Specified by:
getFileTransformation
in interfaceIFileTransformationManager
- Parameters:
fileTransformationId
- the wished transformation id.transaction
- the transaction for persistence access.- Returns:
- the found transformation
- Throws:
PortalException
-
getPortalFile
public IFile getPortalFile(SessionConfig sessionConfig, TransformedFileConfig transformedFileConfig, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Returns theIFile
related to the givenTransformedFileConfig
.- Specified by:
getPortalFile
in interfaceIFileTransformationManagerSPI
- Parameters:
sessionConfig
- the user's session.transformedFileConfig
- the transformed file config.transaction
- the transaction.- Returns:
- the
IFile
related to the givenTransformedFileConfig
. - Throws:
PortalException
-
getFileHref
public IServiceInterfaceUrl getFileHref(SessionConfig sessionConfig, TransformedFileConfig transformedFileConfig, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Returns the href for linking to the given transformed file in a portal's page.- Specified by:
getFileHref
in interfaceIFileTransformationManagerSPI
- Parameters:
sessionConfig
- user session information.transformedFileConfig
- the transformed file.transaction
- the transaction for persistence access.- Returns:
- the href.
- Throws:
PortalException
-
updateMetadata
public void updateMetadata(java.lang.String transformedFileConfigId, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Updates metadata information from a given tranformed file- Specified by:
updateMetadata
in interfaceIFileTransformationManagerSPI
- Parameters:
transformedFileConfigId
- file that the metadata information will be updatedtransaction
- the transaction for persistence access.- Throws:
PortalException
- if any error updating occurs
-
changeFilename
public void changeFilename(SessionConfig sessionConfig, java.lang.String tranformedFileId, java.lang.String newFilename, ITransaction transaction) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Changes the filename of a tranformed file.- Specified by:
changeFilename
in interfaceIFileTransformationManagerSPI
- Parameters:
sessionConfig
- identifier for the session.tranformedFileId
- the file id.newFilename
- the new filename for the file.transaction
- the transaction for persistence access.- Throws:
PortalException
-
moveTransformedFiles
public void moveTransformedFiles(FileConfig fileConfig, IWebRootPortalBaseFolder oldWebRoot) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Moves the transformed public files from the old web root to the current.- Specified by:
moveTransformedFiles
in interfaceIFileTransformationManagerSPI
- Parameters:
fileConfig
- the file whose transformations are to be moved.oldWebRoot
- the web root folder the file was originally in, ornull
if it was not in any web root.- Throws:
PortalException
-
getImageScaleTransformationResults
public java.util.Collection<IImageScaleTransformationResult> getImageScaleTransformationResults(FileConfig srcFile) throws PortalException
Description copied from interface:IFileTransformationManagerSPI
Returns all image scaling transformations of the given file.- Specified by:
getImageScaleTransformationResults
in interfaceIFileTransformationManagerSPI
- Parameters:
srcFile
- the file- Returns:
- all image scaling transformations of the given file
- Throws:
PortalException
-
-