Class FileSystemResultActionBuilder
- java.lang.Object
-
- com.inet.taskplanner.server.api.action.FileSystemResultActionBuilder
-
public class FileSystemResultActionBuilder extends java.lang.ObjectUse this to easily createdefinitionsfor 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
Constructors Constructor Description FileSystemResultActionBuilder(java.io.File destinationFolder)Creates a new FileSystemResultActionBuilder with given destination directory.FileSystemResultActionBuilder(java.lang.String destinationFolder)Creates a new FileSystemResultActionBuilder with given destination directory.FileSystemResultActionBuilder(java.nio.file.Path destinationFolder)Creates a new FileSystemResultActionBuilder with given destination directory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResultActionDefinitioncreate()Finish construction of the FileSystemResultActionand construct a definition object which can be added to atask.FileSystemResultActionBuilderwithDestinationFolder(java.io.File destinationFolder)Use the given destinationFolder as directory where generated file are saved.FileSystemResultActionBuilderwithDestinationFolder(java.lang.String destinationFolder)Use the given destinationFolder as directory where generated file are saved.
Use this if you need a placeholder in your path.FileSystemResultActionBuilderwithDestinationFolder(java.nio.file.Path destinationFolder)Use the given destinationFolder as directory where generated file are saved.FileSystemResultActionBuilderwithFileNameFormat(java.lang.String fileNameFormat)Set the format of the filename that are saved in the destination folder.
-
-
-
Constructor Detail
-
FileSystemResultActionBuilder
public FileSystemResultActionBuilder(@Nonnull java.nio.file.Path destinationFolder)Creates a new FileSystemResultActionBuilder with given destination directory.- Parameters:
destinationFolder- the folder where the results will be saved- Throws:
java.lang.IllegalArgumentException- if the given destinationFolder is null- Since:
- taskplanner 3.0
-
FileSystemResultActionBuilder
public FileSystemResultActionBuilder(@Nonnull java.io.File destinationFolder)Creates a new FileSystemResultActionBuilder with given destination directory.- Parameters:
destinationFolder- the folder where the results will be saved- Throws:
java.lang.IllegalArgumentException- if the given destinationFolder is null or cannot be converted to a validPath- Since:
- taskplanner 3.0
-
FileSystemResultActionBuilder
public FileSystemResultActionBuilder(@Nonnull java.lang.String destinationFolder)Creates a new FileSystemResultActionBuilder with given destination directory.- Parameters:
destinationFolder- the folder where the results will be saved- Throws:
java.lang.IllegalArgumentException- if the given destinationFolder is null- Since:
- taskplanner 3.0
-
-
Method Detail
-
withDestinationFolder
public FileSystemResultActionBuilder withDestinationFolder(@Nonnull java.nio.file.Path destinationFolder)
Use the given destinationFolder as directory where generated file are saved.- Parameters:
destinationFolder- the new destination folder- Returns:
- this builder instance.
- Throws:
java.lang.IllegalArgumentException- if the given destinationFolder is null- Since:
- taskplanner 3.0
-
withDestinationFolder
public FileSystemResultActionBuilder withDestinationFolder(@Nonnull java.io.File destinationFolder)
Use the given destinationFolder as directory where generated file are saved.- Parameters:
destinationFolder- the new destination folder- Returns:
- this builder instance.
- Throws:
java.lang.IllegalArgumentException- if the given destinationFolder is null or cannot be converted to a validPath- Since:
- taskplanner 3.0
-
withDestinationFolder
public FileSystemResultActionBuilder withDestinationFolder(@Nonnull java.lang.String destinationFolder)
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:
java.lang.IllegalArgumentException- if the given destinationFolder is null- Since:
- taskplanner 3.0
-
withFileNameFormat
public FileSystemResultActionBuilder withFileNameFormat(java.lang.String fileNameFormat)
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:
java.lang.IllegalArgumentException- if the given fileNameFormat is null or empty- Since:
- taskplanner 3.0
-
create
public ResultActionDefinition create()
Finish construction of the FileSystemResultActionand 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
-
-