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;
}
Aggregations