add date range filter

This commit is contained in:
2017-03-17 11:17:57 +01:00
parent 8cc42916a4
commit 3456177291
11 changed files with 140 additions and 34 deletions

View File

@@ -8,13 +8,15 @@ import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.List;
import java.util.function.BiPredicate;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class FileUtils {
private static final Logger LOGGER = Logger.getLogger(FileUtils.class.getCanonicalName());
private static final Logger LOGGER = LoggerFactory.getLogger(FileUtils.class);
private static final class RecursiveDeleter extends SimpleFileVisitor<Path> {
@@ -22,7 +24,7 @@ public class FileUtils {
public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
Files.delete(file);
LOGGER.info("deleted: " + file.toFile().getAbsolutePath());
LOGGER.trace("deleted: {}", file);
return FileVisitResult.CONTINUE;
}
@@ -31,7 +33,7 @@ public class FileUtils {
public FileVisitResult postVisitDirectory(final Path dir, final IOException exc) throws IOException {
Files.delete(dir);
LOGGER.info("deleted: " + dir.toFile().getAbsolutePath());
LOGGER.trace("deleted: {}", dir);
return FileVisitResult.CONTINUE;
}
@@ -44,14 +46,13 @@ public class FileUtils {
while (attempt <= maxAttempts) {
try {
LOGGER.info(
"deleting '" + path.toFile().getAbsolutePath() + "' attempt " + attempt + " of " + maxAttempts);
LOGGER.debug("deleting '{}' attempt {} of {}", path.toFile().getAbsolutePath(), attempt, maxAttempts);
Files.walkFileTree(path, new RecursiveDeleter());
break;
} catch (final IOException e) {
final String msg = "failed to delete '" + path.toFile().getAbsolutePath() + "' on attempt " + attempt
+ " of " + maxAttempts;
LOGGER.log(Level.WARNING, msg, e);
LOGGER.warn(msg, e);
}
attempt++;
}

View File

@@ -182,8 +182,9 @@ public class PerformanceDb implements AutoCloseable, CollectionUtils {
return db.proposeTagForQuery(query, caretIndex);
}
public List<String> getFields(final String query) {
final List<Field> fields = db.getAvailableFieldsForQuery(query);
public List<String> getFields() {
final List<Field> fields = db.getAvailableFields();
return map(fields, Field::getName);
}