Fixed filtering issues

This commit is contained in:
Kelly Kelly 2019-12-17 11:02:22 -05:00
parent 6843b95cdd
commit f95285f28e
3 changed files with 46 additions and 11 deletions

View File

@ -444,7 +444,7 @@ public final class GeolocationTopComponent extends TopComponent {
private class WaypointCallBack implements WaypointFilterQueryCallBack { private class WaypointCallBack implements WaypointFilterQueryCallBack {
@Override @Override
public void process(List<Waypoint> waypoints) { public void process(final List<Waypoint> waypoints) {
// Make sure that the waypoints are added to the map panel in // Make sure that the waypoints are added to the map panel in
// the correct thread. // the correct thread.
SwingUtilities.invokeLater(new Runnable() { 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 // If the list is empty, tell the user and do not change
// the visible waypoints. // the visible waypoints.
if (waypoints == null || waypoints.isEmpty()) { if (waypoints == null || waypoints.isEmpty()) {
mapPanel.clearWaypoints();
JOptionPane.showMessageDialog(GeolocationTopComponent.this, JOptionPane.showMessageDialog(GeolocationTopComponent.this,
Bundle.GeoTopComponent_no_waypoints_returned_Title(), Bundle.GeoTopComponent_no_waypoints_returned_Title(),
Bundle.GeoTopComponent_no_waypoints_returned_mgs(), Bundle.GeoTopComponent_no_waypoints_returned_mgs(),
JOptionPane.INFORMATION_MESSAGE); JOptionPane.INFORMATION_MESSAGE);
setWaypointLoading(false);
geoFilterPanel.setEnabled(true);
return; return;
} }
mapPanel.clearWaypoints();
mapPanel.setWaypoints(MapWaypoint.getWaypoints(waypoints)); mapPanel.setWaypoints(MapWaypoint.getWaypoints(waypoints));
setWaypointLoading(false); setWaypointLoading(false);
geoFilterPanel.setEnabled(true); geoFilterPanel.setEnabled(true);

View File

@ -332,6 +332,11 @@ final public class MapPanel extends javax.swing.JPanel {
*/ */
void clearWaypoints() { void clearWaypoints() {
waypointTree = null; waypointTree = null;
currentlySelectedWaypoint = null;
if (currentPopup != null) {
currentPopup.hide();
}
mapViewer.repaint();
} }
/** /**

View File

@ -56,7 +56,8 @@ public final class WaypointBuilder {
final static String GEO_ARTIFACT_WITH_DATA_SOURCES_QUERY final static String GEO_ARTIFACT_WITH_DATA_SOURCES_QUERY
= "SELECT blackboard_attributes.artifact_id " = "SELECT blackboard_attributes.artifact_id "
+ "FROM blackboard_attributes, blackboard_artifacts " + "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 + "AND data_source_obj_id IN (%s)"; //NON-NLS
// Select will return the "most recent" timestamp from all waypoings // Select will return the "most recent" timestamp from all waypoings
@ -469,6 +470,18 @@ public final class WaypointBuilder {
* @return SQL SELECT statement * @return SQL SELECT statement
*/ */
static private String buildQueryForWaypointsWOTimeStamps(List<DataSource> dataSources) { static private String buildQueryForWaypointsWOTimeStamps(List<DataSource> 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, return String.format(SELECT_WO_TIMESTAMP,
String.format(GEO_ARTIFACT_QUERY_ID_ONLY, String.format(GEO_ARTIFACT_QUERY_ID_ONLY,
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID(),
@ -502,6 +515,13 @@ public final class WaypointBuilder {
String mostRecentQuery = ""; String mostRecentQuery = "";
if (!showAll && cntDaysFromRecent > 0) { if (!showAll && cntDaysFromRecent > 0) {
// 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 mostRecentQuery = String.format("AND value_int64 > (%s)", //NON-NLS
String.format(MOST_RECENT_TIME, String.format(MOST_RECENT_TIME,
cntDaysFromRecent, cntDaysFromRecent,
@ -511,7 +531,10 @@ public final class WaypointBuilder {
)); ));
} }
// 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, String query = String.format(GEO_ARTIFACT_QUERY,
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID(),
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()); BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID());
@ -542,6 +565,10 @@ public final class WaypointBuilder {
static private String getWaypointListQuery(List<DataSource> dataSources) { static private String getWaypointListQuery(List<DataSource> dataSources) {
if (dataSources == null || dataSources.isEmpty()) { 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, return String.format(GEO_ARTIFACT_QUERY,
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE.getTypeID(), BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE.getTypeID(),
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START.getTypeID()); BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START.getTypeID());