Package de.xima.fc.bl.fdv.file
Class ProvidingFileHandlerImpl
- java.lang.Object
-
- de.xima.fc.bl.fdv.file.ProvidingFileHandlerImpl
-
- All Implemented Interfaces:
IProvidingFileHandler
public class ProvidingFileHandlerImpl extends Object implements IProvidingFileHandler
Helper utility class for all workflow actions implementingIProviding
. Contains methods such as attaching files to the form record or saving files to the file system.- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Constructor Description ProvidingFileHandlerImpl(IWorkflowProcessingContext wfpc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttachment(File file)
Attaches the given file to the current form record of the workflow processing context.void
attachFilesFromActionToFormRecord(long actionId)
For a given action, attaches the files produced by that action to the current form record.void
attachFilesFromCurrentActionToFormRecord(Aktion action)
For a workflow action that provides files, takes the files it produces and attaches those files to the current form record.File
getExportDirectory(String exportDirectory, boolean useProcessId)
Returns the export directory for aIProviding
.void
saveFilesFromActionToFileSystem(long actionId, File outputDir)
For a given action, saves the files produced by that action to the file system.void
saveFileToFileSystem(File srcFile, File outputDir)
Saves the given file to the file system, ie.
-
-
-
Constructor Detail
-
ProvidingFileHandlerImpl
public ProvidingFileHandlerImpl(IWorkflowProcessingContext wfpc)
-
-
Method Detail
-
addAttachment
public void addAttachment(File file) throws IOException
Description copied from interface:IProvidingFileHandler
Attaches the given file to the current form record of the workflow processing context. The file is attached with theUserMgmtUtils.SYSTEM
user.- Specified by:
addAttachment
in interfaceIProvidingFileHandler
- Parameters:
file
- File to be attached to the form record. Must not be a directory.- Throws:
IOException
- When the file data could not be read.
-
attachFilesFromActionToFormRecord
public void attachFilesFromActionToFormRecord(long actionId) throws IOException
Description copied from interface:IProvidingFileHandler
For a given action, attaches the files produced by that action to the current form record.- Specified by:
attachFilesFromActionToFormRecord
in interfaceIProvidingFileHandler
- Parameters:
actionId
-Aktion.getId()
of the action whose files are to be attached.- Throws:
IOException
-
attachFilesFromCurrentActionToFormRecord
public void attachFilesFromCurrentActionToFormRecord(Aktion action) throws IOException
Description copied from interface:IProvidingFileHandler
For a workflow action that provides files, takes the files it produces and attaches those files to the current form record.- Specified by:
attachFilesFromCurrentActionToFormRecord
in interfaceIProvidingFileHandler
- Parameters:
action
- The current action whose files are to be attached.- Throws:
IOException
-
getExportDirectory
public File getExportDirectory(String exportDirectory, boolean useProcessId) throws IOException
Description copied from interface:IProvidingFileHandler
Returns the export directory for aIProviding
. When enabled, creates a sub directory with the name of the current process ID.- Specified by:
getExportDirectory
in interfaceIProvidingFileHandler
- Parameters:
exportDirectory
- Base export directory.useProcessId
- Whether a sub directory with the process ID is created.- Returns:
- The export directory.
null
if the given export directory is blank. - Throws:
IOException
- When the directory could not be created.
-
saveFilesFromActionToFileSystem
public void saveFilesFromActionToFileSystem(long actionId, File outputDir) throws IOException
Description copied from interface:IProvidingFileHandler
For a given action, saves the files produced by that action to the file system.- Specified by:
saveFilesFromActionToFileSystem
in interfaceIProvidingFileHandler
- Parameters:
actionId
-Aktion.getId()
of the action whose files are to be saved.outputDir
- The directory to which the files are saved.- Throws:
IOException
-
saveFileToFileSystem
public void saveFileToFileSystem(File srcFile, File outputDir) throws IOException
Description copied from interface:IProvidingFileHandler
Saves the given file to the file system, ie. copies it to the given directory.- Specified by:
saveFileToFileSystem
in interfaceIProvidingFileHandler
- Parameters:
srcFile
- File to be saved to the file system.outputDir
- Directory to which the file is saved.- Throws:
IOException
- When the file cannot be copied.
-
-