From f95285f28e5437effcb0dc09ad5df9d5a80485d9 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 17 Dec 2019 11:02:22 -0500 Subject: [PATCH] Fixed filtering issues --- .../geolocation/GeolocationTopComponent.java | 7 ++- .../autopsy/geolocation/MapPanel.java | 5 +++ .../datamodel/WaypointBuilder.java | 45 +++++++++++++++---- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java index b1dee1cbb4..8fc00e6764 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -444,7 +444,7 @@ public final class GeolocationTopComponent extends TopComponent { private class WaypointCallBack implements WaypointFilterQueryCallBack { @Override - public void process(List waypoints) { + public void process(final List waypoints) { // Make sure that the waypoints are added to the map panel in // the correct thread. SwingUtilities.invokeLater(new Runnable() { @@ -453,13 +453,16 @@ public final class GeolocationTopComponent extends TopComponent { // If the list is empty, tell the user and do not change // the visible waypoints. if (waypoints == null || waypoints.isEmpty()) { + mapPanel.clearWaypoints(); JOptionPane.showMessageDialog(GeolocationTopComponent.this, Bundle.GeoTopComponent_no_waypoints_returned_Title(), Bundle.GeoTopComponent_no_waypoints_returned_mgs(), JOptionPane.INFORMATION_MESSAGE); - + setWaypointLoading(false); + geoFilterPanel.setEnabled(true); return; } + mapPanel.clearWaypoints(); mapPanel.setWaypoints(MapWaypoint.getWaypoints(waypoints)); setWaypointLoading(false); geoFilterPanel.setEnabled(true); diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java index 7be6ac25a8..1cb18de228 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java @@ -332,6 +332,11 @@ final public class MapPanel extends javax.swing.JPanel { */ void clearWaypoints() { waypointTree = null; + currentlySelectedWaypoint = null; + if (currentPopup != null) { + currentPopup.hide(); + } + mapViewer.repaint(); } /** diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/WaypointBuilder.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/WaypointBuilder.java index 86539412be..6da1beb73b 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/WaypointBuilder.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/WaypointBuilder.java @@ -56,7 +56,8 @@ public final class WaypointBuilder { final static String GEO_ARTIFACT_WITH_DATA_SOURCES_QUERY = "SELECT blackboard_attributes.artifact_id " + "FROM blackboard_attributes, blackboard_artifacts " - + "WHERE blackboard_attributes.attribute_type_id IN(%d, %d) " + + "WHERE blackboard_attributes.artifact_id = blackboard_artifacts.artifact_id " + + "AND blackboard_attributes.attribute_type_id IN(%d, %d) " + "AND data_source_obj_id IN (%s)"; //NON-NLS // Select will return the "most recent" timestamp from all waypoings @@ -469,6 +470,18 @@ public final class WaypointBuilder { * @return SQL SELECT statement */ static private String buildQueryForWaypointsWOTimeStamps(List dataSources) { + +// SELECT_WO_TIMESTAMP +// SELECT DISTINCT artifact_id, artifact_type_id +// FROM blackboard_attributes +// WHERE artifact_id NOT IN (%s) +// AND artifact_id IN (%s) + +// GEO_ARTIFACT_QUERY_ID_ONLY +// SELECT artifact_id +// FROM blackboard_attributes +// WHERE attribute_type_id IN (%d, %d) + return String.format(SELECT_WO_TIMESTAMP, String.format(GEO_ARTIFACT_QUERY_ID_ONLY, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID(), @@ -502,16 +515,26 @@ public final class WaypointBuilder { String mostRecentQuery = ""; if (!showAll && cntDaysFromRecent > 0) { - mostRecentQuery = String.format("AND value_int64 > (%s)", //NON-NLS - String.format(MOST_RECENT_TIME, - cntDaysFromRecent, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID(), - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), - getWaypointListQuery(dataSources) - )); +// MOST_RECENT_TIME +// SELECT MAX(value_int64) - (%d * 86400) +// FROM blackboard_attributes +// WHERE attribute_type_id IN(%d, %d) +// AND artifact_id +// IN ( %s ) +// + mostRecentQuery = String.format("AND value_int64 > (%s)", //NON-NLS + String.format(MOST_RECENT_TIME, + cntDaysFromRecent, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID(), + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID(), + getWaypointListQuery(dataSources) + )); } - // This givens us all artifact_ID that have time stamp +// GEO_ARTIFACT_QUERY +// SELECT artifact_id, artifact_type_id +// FROM blackboard_attributes +// WHERE attribute_type_id IN (%d, %d) String query = String.format(GEO_ARTIFACT_QUERY, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()); @@ -542,6 +565,10 @@ public final class WaypointBuilder { static private String getWaypointListQuery(List dataSources) { if (dataSources == null || dataSources.isEmpty()) { +// GEO_ARTIFACT_QUERY +// SELECT artifact_id, artifact_type_id +// FROM blackboard_attributes +// WHERE attribute_type_id IN (%d, %d) return String.format(GEO_ARTIFACT_QUERY, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START.getTypeID());