Search in sources :

Example 1 with OrFileFilter

use of org.apache.commons.io.filefilter.OrFileFilter in project symmetric-ds by JumpMind.

the class FileTrigger method createIOFileFilter.

public IOFileFilter createIOFileFilter() {
    String[] includes = StringUtils.isNotBlank(includesFiles) ? includesFiles.split(",") : new String[] { "*" };
    String[] excludes = StringUtils.isNotBlank(excludesFiles) ? excludesFiles.split(",") : null;
    IOFileFilter filter = new WildcardFileFilter(includes);
    if (excludes != null && excludes.length > 0) {
        List<IOFileFilter> fileFilters = new ArrayList<IOFileFilter>();
        fileFilters.add(filter);
        fileFilters.add(new NotFileFilter(new WildcardFileFilter(excludes)));
        filter = new AndFileFilter(fileFilters);
    }
    if (!recurse) {
        List<IOFileFilter> fileFilters = new ArrayList<IOFileFilter>();
        fileFilters.add(filter);
        fileFilters.add(new NotFileFilter(FileFilterUtils.directoryFileFilter()));
        filter = new AndFileFilter(fileFilters);
    } else {
        List<IOFileFilter> fileFilters = new ArrayList<IOFileFilter>();
        fileFilters.add(filter);
        fileFilters.add(FileFilterUtils.directoryFileFilter());
        filter = new OrFileFilter(fileFilters);
    }
    return filter;
}
Also used : AndFileFilter(org.apache.commons.io.filefilter.AndFileFilter) OrFileFilter(org.apache.commons.io.filefilter.OrFileFilter) ArrayList(java.util.ArrayList) IOFileFilter(org.apache.commons.io.filefilter.IOFileFilter) NotFileFilter(org.apache.commons.io.filefilter.NotFileFilter) WildcardFileFilter(org.apache.commons.io.filefilter.WildcardFileFilter)

Aggregations

ArrayList (java.util.ArrayList)1 AndFileFilter (org.apache.commons.io.filefilter.AndFileFilter)1 IOFileFilter (org.apache.commons.io.filefilter.IOFileFilter)1 NotFileFilter (org.apache.commons.io.filefilter.NotFileFilter)1 OrFileFilter (org.apache.commons.io.filefilter.OrFileFilter)1 WildcardFileFilter (org.apache.commons.io.filefilter.WildcardFileFilter)1