Class FileSystemResultActionBuilder
java.lang.Object
com.inet.taskplanner.server.api.action.FileSystemResultActionBuilder
Use this to easily create
definitions
for a FileSystem ResultAction. This action saves
the results in a directory on the filesystem.
Example usage:
TaskDefinition task = new TaskDefinition( "mytask" ); //Save generated files for efficiency reports on drive K Path directory = Paths.get( "K:/weeklyreports/efficiency" ); ResultActionDefinition definition = new FileSystemResultActionBuilder( directory ).withDateAppending( true ).create(); task.addResultAction( definition ); // .. add jobs and triggers ... TaskPlanner.getInstance().addTask( task );
- Since:
- taskplanner 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionFileSystemResultActionBuilder
(File destinationFolder) Creates a new FileSystemResultActionBuilder with given destination directory.FileSystemResultActionBuilder
(String destinationFolder) Creates a new FileSystemResultActionBuilder with given destination directory.FileSystemResultActionBuilder
(Path destinationFolder) Creates a new FileSystemResultActionBuilder with given destination directory. -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Finish construction of the FileSystemResultAction
and construct a definition object which can be added to atask
.withDestinationFolder
(File destinationFolder) Use the given destinationFolder as directory where generated file are saved.withDestinationFolder
(String destinationFolder) Use the given destinationFolder as directory where generated file are saved.
Use this if you need a placeholder in your path.withDestinationFolder
(Path destinationFolder) Use the given destinationFolder as directory where generated file are saved.withFileNameFormat
(String fileNameFormat) Set the format of the filename that are saved in the destination folder.
-
Constructor Details
-
FileSystemResultActionBuilder
Creates a new FileSystemResultActionBuilder with given destination directory.- Parameters:
destinationFolder
- the folder where the results will be saved- Throws:
IllegalArgumentException
- if the given destinationFolder is null- Since:
- taskplanner 3.0
-
FileSystemResultActionBuilder
Creates a new FileSystemResultActionBuilder with given destination directory.- Parameters:
destinationFolder
- the folder where the results will be saved- Throws:
IllegalArgumentException
- if the given destinationFolder is null or cannot be converted to a validPath
- Since:
- taskplanner 3.0
-
FileSystemResultActionBuilder
Creates a new FileSystemResultActionBuilder with given destination directory.- Parameters:
destinationFolder
- the folder where the results will be saved- Throws:
IllegalArgumentException
- if the given destinationFolder is null- Since:
- taskplanner 3.0
-
-
Method Details
-
withDestinationFolder
Use the given destinationFolder as directory where generated file are saved.- Parameters:
destinationFolder
- the new destination folder- Returns:
- this builder instance.
- Throws:
IllegalArgumentException
- if the given destinationFolder is null- Since:
- taskplanner 3.0
-
withDestinationFolder
Use the given destinationFolder as directory where generated file are saved.- Parameters:
destinationFolder
- the new destination folder- Returns:
- this builder instance.
- Throws:
IllegalArgumentException
- if the given destinationFolder is null or cannot be converted to a validPath
- Since:
- taskplanner 3.0
-
withDestinationFolder
Use the given destinationFolder as directory where generated file are saved.
Use this if you need a placeholder in your path.- Parameters:
destinationFolder
- the new destination folder- Returns:
- this builder instance.
- Throws:
IllegalArgumentException
- if the given destinationFolder is null- Since:
- taskplanner 3.0
-
withFileNameFormat
Set the format of the filename that are saved in the destination folder. It additionally allows the placeholders [filename], [date] and [time]
This may be useful if a time-based task runs repeatedly and the results must be preserved and not overwritten.- Parameters:
fileNameFormat
- The format of the file name. Extensions of files are added automatically.- Returns:
- this builder instance.
- Throws:
IllegalArgumentException
- if the given fileNameFormat is null or empty- Since:
- taskplanner 3.0
-
create
Finish construction of the FileSystemResultAction
and construct a definition object which can be added to atask
.- Returns:
- the new created Definition containing the settings of this builder
- Since:
- taskplanner 3.0
-