Class FileSystemResultActionBuilder

java.lang.Object
com.inet.taskplanner.server.api.action.FileSystemResultActionBuilder

public class FileSystemResultActionBuilder extends Object
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 Details

    • FileSystemResultActionBuilder

      public FileSystemResultActionBuilder(@Nonnull @Nonnull Path destinationFolder)
      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

      public FileSystemResultActionBuilder(@Nonnull @Nonnull File destinationFolder)
      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 valid Path
      Since:
      taskplanner 3.0
    • FileSystemResultActionBuilder

      public FileSystemResultActionBuilder(@Nonnull @Nonnull String destinationFolder)
      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

      public FileSystemResultActionBuilder withDestinationFolder(@Nonnull @Nonnull Path destinationFolder)
      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

      public FileSystemResultActionBuilder withDestinationFolder(@Nonnull @Nonnull File destinationFolder)
      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 valid Path
      Since:
      taskplanner 3.0
    • withDestinationFolder

      public FileSystemResultActionBuilder withDestinationFolder(@Nonnull @Nonnull 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:
      IllegalArgumentException - if the given destinationFolder is null
      Since:
      taskplanner 3.0
    • withFileNameFormat

      public FileSystemResultActionBuilder withFileNameFormat(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:
      IllegalArgumentException - if the given fileNameFormat is null or empty
      Since:
      taskplanner 3.0
    • create

      public ResultActionDefinition create()
      Finish construction of the FileSystem ResultAction and construct a definition object which can be added to a task.
      Returns:
      the new created Definition containing the settings of this builder
      Since:
      taskplanner 3.0