diff --git a/CoreLibs/nbproject/project.xml b/CoreLibs/nbproject/project.xml index b2aa57c54e..38da548a38 100644 --- a/CoreLibs/nbproject/project.xml +++ b/CoreLibs/nbproject/project.xml @@ -230,6 +230,7 @@ org.apache.commons.codec.digest org.apache.commons.codec.language org.apache.commons.codec.net + org.apache.commons.collections4 org.apache.commons.csv org.apache.commons.io org.apache.commons.io.comparator diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java index 236afcd170..add5980574 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ImageGalleryController.java @@ -161,7 +161,7 @@ public final class ImageGalleryController { return thumbnailSize.getReadOnlyProperty(); } - private GroupViewState getViewState() { + public GroupViewState getViewState() { return historyManager.getCurrentState(); } @@ -956,8 +956,6 @@ public final class ImageGalleryController { @NbBundle.Messages({"PrePopulateDataSourceFiles.committingDb.status=committing image/video database"}) static private class PrePopulateDataSourceFiles extends BulkTransferTask { - private static final Logger LOGGER = Logger.getLogger(PrePopulateDataSourceFiles.class.getName()); - /** * * @param dataSourceId Data source object ID diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java index f568fbd105..be2d9417c3 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java @@ -52,7 +52,7 @@ public class CategorizeGroupAction extends CategorizeAction { public CategorizeGroupAction(DhsImageCategory newCat, ImageGalleryController controller) { super(controller, newCat, null); setEventHandler(actionEvent -> { - ObservableList fileIDs = controller.viewState().get().getGroup().getFileIDs(); + ObservableList fileIDs = controller.getViewState().getGroup().getFileIDs(); if (ImageGalleryPreferences.isGroupCategorizationWarningDisabled()) { //if they have preveiously disabled the warning, just go ahead and apply categories. diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/NextUnseenGroup.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/NextUnseenGroup.java index d2b983b693..ae5655c258 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/NextUnseenGroup.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/NextUnseenGroup.java @@ -64,8 +64,7 @@ public class NextUnseenGroup extends Action { setEventHandler(event -> { //on fx-thread //if there is a group assigned to the view, mark it as seen - Optional.ofNullable(controller.viewState()) - .map(ObservableValue::getValue) + Optional.ofNullable(controller.getViewState()) .map(GroupViewState::getGroup) .ifPresent(group -> { groupManager.setGroupSeen(group, true) diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/OpenAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/OpenAction.java index 418b62f30d..cfd56a0874 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/OpenAction.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/OpenAction.java @@ -21,16 +21,11 @@ package org.sleuthkit.autopsy.imagegallery.actions; import java.awt.Component; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.io.IOException; -import java.net.URL; import java.util.logging.Level; import javafx.application.Platform; import javafx.scene.control.Alert; import javafx.scene.control.ButtonType; -import javafx.scene.control.Dialog; -import javafx.scene.image.Image; import javafx.stage.Modality; -import javafx.stage.Stage; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JMenuItem; @@ -49,7 +44,6 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.core.Installer; import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule; import org.sleuthkit.autopsy.imagegallery.ImageGalleryTopComponent; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/TagGroupAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/TagGroupAction.java index afd6a7dcfc..a9229c0315 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/TagGroupAction.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/TagGroupAction.java @@ -30,7 +30,7 @@ public class TagGroupAction extends AddTagAction { public TagGroupAction(final TagName tagName, ImageGalleryController controller) { super(controller, tagName, null); setEventHandler(actionEvent -> - new AddTagAction(controller, tagName, ImmutableSet.copyOf(controller.viewState().get().getGroup().getFileIDs())). + new AddTagAction(controller, tagName, ImmutableSet.copyOf(controller.getViewState().getGroup().getFileIDs())). handle(actionEvent) ); } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java index 7f84fbdfb7..a0430bd45c 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java @@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.imagegallery.datamodel; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; -import org.sleuthkit.autopsy.datamodel.DhsImageCategory; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -51,6 +50,7 @@ import javax.swing.SortOrder; import org.apache.commons.lang3.StringUtils; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.datamodel.DhsImageCategory; import org.sleuthkit.autopsy.imagegallery.FileTypeUtils; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; import org.sleuthkit.autopsy.imagegallery.ImageGalleryModule; @@ -61,11 +61,11 @@ import static org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy. import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.CaseDbAccessManager.CaseDbAccessQueryCallback; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.ContentTag; -import org.sleuthkit.datamodel.SleuthkitCase; -import org.sleuthkit.datamodel.CaseDbAccessManager.CaseDbAccessQueryCallback; import org.sleuthkit.datamodel.DataSource; +import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase.CaseDbTransaction; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; @@ -83,7 +83,7 @@ import org.sqlite.SQLiteJDBCLoader; */ public final class DrawableDB { - private static final org.sleuthkit.autopsy.coreutils.Logger logger = Logger.getLogger(DrawableDB.class.getName()); + private static final Logger logger = Logger.getLogger(DrawableDB.class.getName()); //column name constants////////////////////// private static final String ANALYZED = "analyzed"; //NON-NLS diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupKey.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupKey.java index 9c5140f4d2..8b9cb845d1 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupKey.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupKey.java @@ -98,10 +98,7 @@ public class GroupKey> implements Comparable if (!Objects.equals(this.attr, other.attr)) { return false; } - if (!Objects.equals(this.dataSource, other.dataSource)) { - return false; - } - return true; + return Objects.equals(this.dataSource, other.dataSource); } @Override diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java index 7e246ae091..4143c09b42 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java @@ -21,14 +21,12 @@ package org.sleuthkit.autopsy.imagegallery.datamodel.grouping; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.google.common.eventbus.Subscribe; -import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -42,9 +40,6 @@ import static java.util.Objects.isNull; import static java.util.Objects.nonNull; import java.util.Set; import java.util.TreeSet; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.logging.Level; import java.util.regex.Pattern; @@ -67,6 +62,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.concurrent.GuardedBy; import javax.swing.SortOrder; +import static org.apache.commons.collections4.CollectionUtils.isNotEmpty; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.concurrent.BasicThreadFactory; @@ -508,7 +504,7 @@ public class GroupManager { //only re-query the db if the data source or group by attribute changed or it is forced if (dataSource != getDataSource() || groupBy != getGroupBy() - || force == true) { + || force) { setDataSource(dataSource); setGroupBy(groupBy); @@ -784,7 +780,7 @@ public class GroupManager { groupProgress.finish(); groupProgress = null; } - if (unSeenGroups.isEmpty() == false) { + if (isNotEmpty(unSeenGroups)) { controller.advance(GroupViewState.tile(unSeenGroups.get(0)), true); } } diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java index f7831e9c95..bcdc0ef416 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java @@ -31,7 +31,6 @@ import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.concurrent.Executors; -import java.util.function.Consumer; import java.util.logging.Level; import javafx.application.Platform; import javafx.beans.InvalidationListener; @@ -59,7 +58,6 @@ import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; import javafx.scene.text.Text; import javafx.stage.Modality; -import javafx.util.Duration; import javafx.util.StringConverter; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; import org.controlsfx.control.Notifications; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/navpanel/GroupTree.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/navpanel/GroupTree.java index 31b8a57871..d8320dfe6e 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/navpanel/GroupTree.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/navpanel/GroupTree.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2016 Basis Technology Corp. + * Copyright 2016-18 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.function.Function; -import javafx.application.Platform; import javafx.beans.binding.Bindings; import javafx.beans.binding.BooleanBinding; import javafx.collections.ListChangeListener; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/navpanel/NavPanel.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/navpanel/NavPanel.java index 037d3c3344..e3be8953ab 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/navpanel/NavPanel.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/navpanel/NavPanel.java @@ -95,7 +95,7 @@ abstract class NavPanel extends Tab { //keep selection in sync with controller controller.viewState().addListener(observable -> { Platform.runLater(() -> { - Optional.ofNullable(controller.viewState().get()) + Optional.ofNullable(controller.getViewState()) .map(GroupViewState::getGroup) .ifPresent(this::setFocusedGroup); });