All Downloads are FREE. Search and download functionalities are using the official Maven repository.

getl.data.opts.FileDatasetRetrieveObjectsSpec.groovy Maven / Gradle / Ivy

Go to download

GETL - based package in Groovy, which automates the work of loading and transforming data

There is a newer version: 4.18.9
Show newest version
package getl.data.opts

import getl.driver.FileDriver
import getl.lang.opts.BaseSpec
import groovy.transform.InheritConstructors
import groovy.transform.stc.ClosureParams
import groovy.transform.stc.SimpleType

/**
 * File dataset retrieve objects options
 * @author Alexsey Konstantinov
 *
 */
@InheritConstructors
class FileDatasetRetrieveObjectsSpec extends BaseSpec {
    /** File location path relative to the connection path */
    String getDirectory() { params.directory as String }
    /** File location path relative to the connection path */
    void setDirectory(String value) { saveParamValue('directory', value) }

    /** Regular file search mask */
    String getMask() { (params.mask as String)?:'.*' }
    /** Regular file search mask */
    void setMask(String value) { saveParamValue('mask', value) }

    /** Mask search type */
    FileDriver.RetrieveObjectType getType() { params.type as FileDriver.RetrieveObjectType?:FileDriver.RetrieveObjectType.FILE}
    /** Mask search type */
    void setType(FileDriver.RetrieveObjectType value) { saveParamValue('type', value) }

    /** File type search by mask */
    static public final FileDriver.RetrieveObjectType fileType = FileDriver.RetrieveObjectType.FILE
    /** Catalog type search by mask */
    static public final FileDriver.RetrieveObjectType directoryType = FileDriver.RetrieveObjectType.DIR

    /** Way to sort the results */
    FileDriver.RetrieveObjectSort getSort() { params.sort as FileDriver.RetrieveObjectSort }
    /** Way to sort the results */
    void setSort(FileDriver.RetrieveObjectSort value) { saveParamValue('sort', value) }

    /** No sorting required */
    static public final FileDriver.RetrieveObjectSort noneSort = FileDriver.RetrieveObjectSort.NONE
    /** Sort by name */
    static public final FileDriver.RetrieveObjectSort nameSort = FileDriver.RetrieveObjectSort.NAME
    /** Sort by create date of file */
    static public final FileDriver.RetrieveObjectSort dateSort = FileDriver.RetrieveObjectSort.DATE
    /** Sort by size of file */
    static public final FileDriver.RetrieveObjectSort sizeSort = FileDriver.RetrieveObjectSort.SIZE

    /** Recursive directory processing */
    Boolean getRecursive() { params.recursive as Boolean }
    /** Recursive directory processing */
    void setRecursive(Boolean value) { saveParamValue('recursive', value) }

    /** Custom file filtering */
    Closure getOnFilter() { params.filter as Closure }
    /** Custom file filtering */
    void setOnFilter(Closure value) { saveParamValue('filter', value) }
    /** Custom file filtering */
    void filter(@ClosureParams(value = SimpleType, options = ['java.io.File'])
                        Closure value) {
        setOnFilter(value)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy