use of org.apache.commons.io.filefilter.IOFileFilter in project cu-kfs by CU-CommunityApps.
the class BatchFileLookupableHelperServiceImpl method getPathBasedFileFilter.
protected IOFileFilter getPathBasedFileFilter() {
List<File> selectedFiles = getSelectedDirectories(getSelectedPaths());
if (selectedFiles.isEmpty()) {
return null;
}
IOFileFilter fileFilter = null;
for (File selectedFile : selectedFiles) {
IOFileFilter subFilter = new SubDirectoryFileFilter(selectedFile);
if (fileFilter == null) {
fileFilter = subFilter;
} else {
fileFilter = FileFilterUtils.orFileFilter(fileFilter, subFilter);
}
}
return fileFilter;
}
use of org.apache.commons.io.filefilter.IOFileFilter in project cu-kfs by CU-CommunityApps.
the class BatchFileLookupableHelperServiceImpl method getSearchResults.
@Override
public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
List<BatchFile> results = new ArrayList<BatchFile>();
IOFileFilter filter = FileFilterUtils.fileFileFilter();
IOFileFilter pathBasedFilter = getPathBasedFileFilter();
if (pathBasedFilter != null) {
filter = FileFilterUtils.andFileFilter(filter, pathBasedFilter);
}
String fileNamePattern = fieldValues.get("fileName");
IOFileFilter fileNameBasedFilter = getFileNameBasedFilter(fileNamePattern);
if (fileNameBasedFilter != null) {
filter = FileFilterUtils.andFileFilter(filter, fileNameBasedFilter);
}
String lastModifiedDate = fieldValues.get("lastModifiedDate");
IOFileFilter lastModifiedDateBasedFilter = getLastModifiedDateBasedFilter(lastModifiedDate);
if (lastModifiedDateBasedFilter != null) {
filter = FileFilterUtils.andFileFilter(filter, lastModifiedDateBasedFilter);
}
BatchFileFinder finder = new BatchFileFinder(results, filter);
List<File> rootDirectories = BatchFileUtils.retrieveBatchFileLookupRootDirectories();
finder.find(rootDirectories);
return results;
}
Aggregations