Class FileSystemResultActionBuilder
java.lang.Object
com.inet.taskplanner.server.api.action.FileSystemResultActionBuilder
Use this to easily create
definitions for a file-system result action. 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 )
.withFileNameFormat( "[filename] [date] [time]" ).create();
task.addResultAction( definition );
// .. add jobs and triggers ...
TaskPlanner.getInstance().addTask( task, userID );
- Since:
- taskplanner 3.0
-
Constructor Summary
ConstructorsConstructorDescriptionFileSystemResultActionBuilder(@Nonnull File destinationFolder) Creates a new FileSystemResultActionBuilder with the given destination directory.FileSystemResultActionBuilder(@Nonnull String destinationFolder) Creates a new FileSystemResultActionBuilder with the given destination directory.FileSystemResultActionBuilder(@Nonnull Path destinationFolder) Creates a new FileSystemResultActionBuilder with the given destination directory. -
Method Summary
Modifier and TypeMethodDescriptioncreate()Finishes construction of the file-systemResultActionand constructs a definition object that can be added to atask.withDestinationFolder(@Nonnull File destinationFolder) Uses the given destinationFolder as the directory where generated files are saved.withDestinationFolder(@Nonnull String destinationFolder) Uses the given destinationFolder as the directory where generated files are saved.
Use this if you need a placeholder in your path.withDestinationFolder(@Nonnull Path destinationFolder) Uses the given destinationFolder as the directory where generated files are saved.withFileNameFormat(String fileNameFormat) Sets the format of the filenames saved in the destination folder.
-
Constructor Details
-
FileSystemResultActionBuilder
Creates a new FileSystemResultActionBuilder with the 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 the 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 the 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
Uses the given destinationFolder as the directory where generated files 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
Uses the given destinationFolder as the directory where generated files 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
Uses the given destinationFolder as the directory where generated files 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
Sets the format of the filenames 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; file extensions are added automatically- Returns:
- this builder instance.
- Throws:
IllegalArgumentException- if the given fileNameFormat is null or empty- Since:
- taskplanner 3.0
-
create
Finishes construction of the file-systemResultActionand constructs a definition object that can be added to atask.- Returns:
- the newly created definition containing the settings of this builder
- Since:
- taskplanner 3.0
-