Class FileSystemResultActionBuilder


  • public class FileSystemResultActionBuilder
    extends java.lang.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 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 valid Path
        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 valid Path
        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 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