Search in sources :

Example 31 with IOFileFilter

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;
}
Also used : IOFileFilter(org.apache.commons.io.filefilter.IOFileFilter) BatchFile(org.kuali.kfs.sys.batch.BatchFile) File(java.io.File)

Example 32 with IOFileFilter

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;
}
Also used : BatchFile(org.kuali.kfs.sys.batch.BatchFile) ArrayList(java.util.ArrayList) IOFileFilter(org.apache.commons.io.filefilter.IOFileFilter) BatchFile(org.kuali.kfs.sys.batch.BatchFile) File(java.io.File)

Aggregations

IOFileFilter (org.apache.commons.io.filefilter.IOFileFilter)32 File (java.io.File)23 ArrayList (java.util.ArrayList)8 IOException (java.io.IOException)6 SuffixFileFilter (org.apache.commons.io.filefilter.SuffixFileFilter)4 WildcardFileFilter (org.apache.commons.io.filefilter.WildcardFileFilter)4 Test (org.junit.Test)4 BatchFile (org.kuali.kfs.sys.batch.BatchFile)4 URL (java.net.URL)3 PatchFile (com.taobao.android.outputs.PatchFile)2 TpatchFile (com.taobao.android.outputs.TpatchFile)2 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 ZipFile (java.util.zip.ZipFile)2 AndFileFilter (org.apache.commons.io.filefilter.AndFileFilter)2 DirectoryFileFilter (org.apache.commons.io.filefilter.DirectoryFileFilter)2 NotFileFilter (org.apache.commons.io.filefilter.NotFileFilter)2 FileAlterationMonitor (org.apache.commons.io.monitor.FileAlterationMonitor)2 FileAlterationObserver (org.apache.commons.io.monitor.FileAlterationObserver)2 Ignite (org.apache.ignite.Ignite)2