5661 address some codacy complaints

This commit is contained in:
William Schaefer 2019-12-09 16:06:57 -05:00
parent 685a3f1b81
commit c16198cd48
19 changed files with 271 additions and 148 deletions

View File

@ -81,13 +81,45 @@ class DataSourceModulesWrapper {
if (hashModuleRun && fileTypeModuleRun && exifModuleRun) { if (hashModuleRun && fileTypeModuleRun && exifModuleRun) {
return; return;
} }
if (!hashModuleRun && moduleInfo.getDisplayName().equals(HashLookupModuleFactory.getModuleName())) { updateHashModuleStatus(moduleInfo);
hashModuleRun = true; updateFileTypeStatus(moduleInfo);
} else if (!fileTypeModuleRun && moduleInfo.getDisplayName().equals(FileTypeIdModuleFactory.getModuleName())) { updateExifStatus(moduleInfo);
fileTypeModuleRun = true; }
} else if (!exifModuleRun && moduleInfo.getDisplayName().equals(ExifParserModuleFactory.getModuleName())) { }
exifModuleRun = true;
} /**
* Update whether the Hash Lookup module was run for this data source.
*
* @param moduleInfo Information regarding a module which was run on this
* data source.
*/
private void updateHashModuleStatus(IngestModuleInfo moduleInfo) {
if (!hashModuleRun && moduleInfo.getDisplayName().equals(HashLookupModuleFactory.getModuleName())) {
hashModuleRun = true;
}
}
/**
* Update whether the File Type ID module was run for this data source.
*
* @param moduleInfo Information regarding a module which was run on this
* data source.
*/
private void updateFileTypeStatus(IngestModuleInfo moduleInfo) {
if (!fileTypeModuleRun && moduleInfo.getDisplayName().equals(FileTypeIdModuleFactory.getModuleName())) {
fileTypeModuleRun = true;
}
}
/**
* Update whether the Exif module was run for this data source.
*
* @param moduleInfo Information regarding a module which was run on this
* data source.
*/
private void updateExifStatus(IngestModuleInfo moduleInfo) {
if (!exifModuleRun && moduleInfo.getDisplayName().equals(ExifParserModuleFactory.getModuleName())) {
exifModuleRun = true;
} }
} }
} }

View File

@ -28,7 +28,7 @@ import org.sleuthkit.autopsy.filequery.FileSearchData.FileType;
/** /**
* Class to handle event bus and events for file discovery tool. * Class to handle event bus and events for file discovery tool.
*/ */
final class DiscoveryEvents { final class DiscoveryEventUtils {
private final static EventBus discoveryEventBus = new EventBus(); private final static EventBus discoveryEventBus = new EventBus();
@ -41,7 +41,7 @@ final class DiscoveryEvents {
return discoveryEventBus; return discoveryEventBus;
} }
private DiscoveryEvents() { private DiscoveryEventUtils() {
} }
/** /**

View File

@ -174,6 +174,10 @@
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DiscoveryTopComponent.stepOneLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DiscoveryTopComponent.stepOneLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JButton" name="videosButton"> <Component class="javax.swing.JButton" name="videosButton">
<Properties> <Properties>
@ -218,6 +222,8 @@
</Property> </Property>
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalStrut"/> <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalStrut"/>
</AuxValues> </AuxValues>
</Component> </Component>

View File

@ -127,19 +127,19 @@ public final class DiscoveryTopComponent extends TopComponent {
public void componentOpened() { public void componentOpened() {
super.componentOpened(); super.componentOpened();
WindowManager.getDefault().setTopComponentFloating(this, true); WindowManager.getDefault().setTopComponentFloating(this, true);
DiscoveryEvents.getDiscoveryEventBus().register(this); DiscoveryEventUtils.getDiscoveryEventBus().register(this);
DiscoveryEvents.getDiscoveryEventBus().register(resultsPanel); DiscoveryEventUtils.getDiscoveryEventBus().register(resultsPanel);
DiscoveryEvents.getDiscoveryEventBus().register(groupListPanel); DiscoveryEventUtils.getDiscoveryEventBus().register(groupListPanel);
DiscoveryEvents.getDiscoveryEventBus().register(fileSearchPanel); DiscoveryEventUtils.getDiscoveryEventBus().register(fileSearchPanel);
} }
@Override @Override
protected void componentClosed() { protected void componentClosed() {
fileSearchPanel.cancelSearch(); fileSearchPanel.cancelSearch();
DiscoveryEvents.getDiscoveryEventBus().unregister(this); DiscoveryEventUtils.getDiscoveryEventBus().unregister(this);
DiscoveryEvents.getDiscoveryEventBus().unregister(fileSearchPanel); DiscoveryEventUtils.getDiscoveryEventBus().unregister(fileSearchPanel);
DiscoveryEvents.getDiscoveryEventBus().unregister(groupListPanel); DiscoveryEventUtils.getDiscoveryEventBus().unregister(groupListPanel);
DiscoveryEvents.getDiscoveryEventBus().unregister(resultsPanel); DiscoveryEventUtils.getDiscoveryEventBus().unregister(resultsPanel);
super.componentClosed(); super.componentClosed();
} }
@ -158,9 +158,9 @@ public final class DiscoveryTopComponent extends TopComponent {
javax.swing.JPanel toolBarPanel = new javax.swing.JPanel(); javax.swing.JPanel toolBarPanel = new javax.swing.JPanel();
javax.swing.JToolBar toolBar = new javax.swing.JToolBar(); javax.swing.JToolBar toolBar = new javax.swing.JToolBar();
imagesButton = new javax.swing.JButton(); imagesButton = new javax.swing.JButton();
stepOneLabel = new javax.swing.JLabel(); javax.swing.JLabel stepOneLabel = new javax.swing.JLabel();
videosButton = new javax.swing.JButton(); videosButton = new javax.swing.JButton();
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(62, 0), new java.awt.Dimension(62, 0), new java.awt.Dimension(62, 32767)); javax.swing.Box.Filler filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(62, 0), new java.awt.Dimension(62, 0), new java.awt.Dimension(62, 32767));
setPreferredSize(new java.awt.Dimension(1400, 900)); setPreferredSize(new java.awt.Dimension(1400, 900));
setLayout(new java.awt.BorderLayout()); setLayout(new java.awt.BorderLayout());
@ -282,7 +282,7 @@ public final class DiscoveryTopComponent extends TopComponent {
* @param searchCancelledEvent The SearchCancelledEvent received. * @param searchCancelledEvent The SearchCancelledEvent received.
*/ */
@Subscribe @Subscribe
void handleSearchCancelledEvent(DiscoveryEvents.SearchCancelledEvent searchCancelledEvent) { void handleSearchCancelledEvent(DiscoveryEventUtils.SearchCancelledEvent searchCancelledEvent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
if (fileSearchPanel.getSelectedType() == FileType.VIDEO) { if (fileSearchPanel.getSelectedType() == FileType.VIDEO) {
imagesButton.setEnabled(true); imagesButton.setEnabled(true);
@ -298,7 +298,7 @@ public final class DiscoveryTopComponent extends TopComponent {
* @param searchCompletedEvent The SearchCompletedEvent received. * @param searchCompletedEvent The SearchCompletedEvent received.
*/ */
@Subscribe @Subscribe
void handleSearchCompletedEvent(DiscoveryEvents.SearchCompleteEvent searchCompletedEvent) { void handleSearchCompletedEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompletedEvent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
if (fileSearchPanel.getSelectedType() == FileType.VIDEO) { if (fileSearchPanel.getSelectedType() == FileType.VIDEO) {
imagesButton.setEnabled(true); imagesButton.setEnabled(true);
@ -325,7 +325,7 @@ public final class DiscoveryTopComponent extends TopComponent {
* @param searchStartedEvent The SearchStartedEvent received. * @param searchStartedEvent The SearchStartedEvent received.
*/ */
@Subscribe @Subscribe
void handleSearchStartedEvent(DiscoveryEvents.SearchStartedEvent searchStartedEvent) { void handleSearchStartedEvent(DiscoveryEventUtils.SearchStartedEvent searchStartedEvent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
imagesButton.setEnabled(false); imagesButton.setEnabled(false);
videosButton.setEnabled(false); videosButton.setEnabled(false);
@ -333,11 +333,9 @@ public final class DiscoveryTopComponent extends TopComponent {
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.Box.Filler filler1;
private javax.swing.JButton imagesButton; private javax.swing.JButton imagesButton;
private javax.swing.JSplitPane leftSplitPane; private javax.swing.JSplitPane leftSplitPane;
private javax.swing.JSplitPane rightSplitPane; private javax.swing.JSplitPane rightSplitPane;
private javax.swing.JLabel stepOneLabel;
private javax.swing.JButton videosButton; private javax.swing.JButton videosButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

View File

@ -803,6 +803,16 @@ class FileSearch {
parent = null; parent = null;
} }
} }
setParentPathAndID(parent, file);
}
/**
* Helper method to set the parent path and parent ID.
*
* @param parent The parent content object.
* @param file The ResultFile object.
*/
private void setParentPathAndID(Content parent, ResultFile file) {
if (parent != null) { if (parent != null) {
try { try {
parentPath = parent.getUniquePath(); parentPath = parent.getUniquePath();
@ -1207,29 +1217,41 @@ class FileSearch {
} }
} }
} else { } else {
// Set frequency in batches processResultFilesForCR(files, centralRepoDb);
List<ResultFile> currentFiles = new ArrayList<>();
Set<String> hashesToLookUp = new HashSet<>();
for (ResultFile file : files) {
if (file.getFirstInstance().getKnown() == TskData.FileKnown.KNOWN) {
file.setFrequency(Frequency.KNOWN);
}
if (file.getFrequency() == Frequency.UNKNOWN
&& file.getFirstInstance().getMd5Hash() != null
&& !file.getFirstInstance().getMd5Hash().isEmpty()) {
hashesToLookUp.add(file.getFirstInstance().getMd5Hash());
currentFiles.add(file);
}
if (hashesToLookUp.size() >= BATCH_SIZE) {
computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
hashesToLookUp.clear();
currentFiles.clear();
}
}
computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
} }
} }
/**
* Private helper method for adding Frequency attribute when CR is
* enabled.
*
* @param files The list of ResultFiles to caluclate frequency
* for.
* @param centralRepoDb The central repository currently in use.
*/
private void processResultFilesForCR(List<ResultFile> files,
EamDb centralRepoDb) {
List<ResultFile> currentFiles = new ArrayList<>();
Set<String> hashesToLookUp = new HashSet<>();
for (ResultFile file : files) {
if (file.getFirstInstance().getKnown() == TskData.FileKnown.KNOWN) {
file.setFrequency(Frequency.KNOWN);
}
if (file.getFrequency() == Frequency.UNKNOWN
&& file.getFirstInstance().getMd5Hash() != null
&& !file.getFirstInstance().getMd5Hash().isEmpty()) {
hashesToLookUp.add(file.getFirstInstance().getMd5Hash());
currentFiles.add(file);
}
if (hashesToLookUp.size() >= BATCH_SIZE) {
computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
hashesToLookUp.clear();
currentFiles.clear();
}
}
computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
}
} }
/** /**

View File

@ -29,7 +29,7 @@ import org.sleuthkit.autopsy.coreutils.FileTypeUtils;
/** /**
* Utility enums for FileSearch * Utility enums for FileSearch
*/ */
class FileSearchData { final class FileSearchData {
private final static long BYTES_PER_MB = 1000000; private final static long BYTES_PER_MB = 1000000;
@ -293,7 +293,7 @@ class FileSearchData {
private final String displayName; private final String displayName;
private final Collection<String> mediaTypes; private final Collection<String> mediaTypes;
private FileType(int value, String displayName, Collection<String> mediaTypes) { FileType(int value, String displayName, Collection<String> mediaTypes) {
this.ranking = value; this.ranking = value;
this.displayName = displayName; this.displayName = displayName;
this.mediaTypes = mediaTypes; this.mediaTypes = mediaTypes;

View File

@ -88,42 +88,57 @@ class FileSearchFiltering {
// The file search filter is required, so this should never be empty. // The file search filter is required, so this should never be empty.
throw new FileSearchException("Selected filters do not include a case database query"); throw new FileSearchException("Selected filters do not include a case database query");
} }
try { try {
// Get all matching abstract files return getResultList(filters, combinedQuery, caseDb, centralRepoDb);
List<ResultFile> resultList = new ArrayList<>();
logger.log(Level.INFO, "Running SQL query: {0}", combinedQuery);
List<AbstractFile> sqlResults = caseDb.findAllFilesWhere(combinedQuery);
// If there are no results, return now
if (sqlResults.isEmpty()) {
return resultList;
}
// Wrap each result in a ResultFile
for (AbstractFile abstractFile : sqlResults) {
resultList.add(new ResultFile(abstractFile));
}
// Now run any non-SQL filters.
for (FileFilter filter : filters) {
if (filter.useAlternateFilter()) {
resultList = filter.applyAlternateFilter(resultList, caseDb, centralRepoDb);
}
// There are no matches for the filters run so far, so return
if (resultList.isEmpty()) {
return resultList;
}
}
return resultList;
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
throw new FileSearchException("Error querying case database", ex); // NON-NLS throw new FileSearchException("Error querying case database", ex); // NON-NLS
} }
} }
/**
* Private helper method for runQueries method to get the ResultFile list.
*
* @param filters The filters to run.
* @param combinedQuery The query to get results files for.
* @param caseDb The case database.
* @param crDb The central repo. Can be null as long as no filters
* need it.
*
* @return An ArrayList of ResultFiles returned by the query.
*
* @throws TskCoreException
* @throws FileSearchException
*/
private static List<ResultFile> getResultList(List<FileFilter> filters, String combinedQuery, SleuthkitCase caseDb, EamDb centralRepoDb) throws TskCoreException, FileSearchException {
// Get all matching abstract files
List<ResultFile> resultList = new ArrayList<>();
logger.log(Level.INFO, "Running SQL query: {0}", combinedQuery);
List<AbstractFile> sqlResults = caseDb.findAllFilesWhere(combinedQuery);
// If there are no results, return now
if (sqlResults.isEmpty()) {
return resultList;
}
// Wrap each result in a ResultFile
for (AbstractFile abstractFile : sqlResults) {
resultList.add(new ResultFile(abstractFile));
}
// Now run any non-SQL filters.
for (FileFilter filter : filters) {
if (filter.useAlternateFilter()) {
resultList = filter.applyAlternateFilter(resultList, caseDb, centralRepoDb);
}
// There are no matches for the filters run so far, so return
if (resultList.isEmpty()) {
return resultList;
}
}
return resultList;
}
/** /**
* Base class for the filters. * Base class for the filters.
*/ */
@ -857,11 +872,9 @@ class FileSearchFiltering {
@Override @Override
String getWhereClause() { String getWhereClause() {
String queryStr = "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN " return "(obj_id IN (SELECT obj_id from blackboard_artifacts WHERE artifact_id IN "
+ "(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = " + "(SELECT artifact_id FROM blackboard_attributes WHERE artifact_type_id = "
+ BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID() + ")))"; + BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID() + ")))";
return queryStr;
} }
@NbBundle.Messages({ @NbBundle.Messages({

View File

@ -102,6 +102,10 @@
<Dimension value="[309, 400]"/> <Dimension value="[309, 400]"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents> <SubComponents>
@ -114,6 +118,10 @@
<Dimension value="[280, 540]"/> <Dimension value="[280, 540]"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents> <SubComponents>
@ -368,6 +376,10 @@
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.parentLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.parentLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/> <GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
@ -691,6 +703,10 @@
</Constraints> </Constraints>
</Component> </Component>
<Container class="javax.swing.JPanel" name="fullRadioPanel"> <Container class="javax.swing.JPanel" name="fullRadioPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="9" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> <GridBagConstraints gridX="0" gridY="9" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
@ -732,6 +748,10 @@
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="includeRadioPanel"> <Container class="javax.swing.JPanel" name="includeRadioPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="10" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/> <GridBagConstraints gridX="0" gridY="10" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
@ -763,6 +783,8 @@
</Property> </Property>
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.Glue"/> <AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.Glue"/>
</AuxValues> </AuxValues>
</Component> </Component>
@ -781,6 +803,10 @@
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="parentTextPanel"> <Container class="javax.swing.JPanel" name="parentTextPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="11" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="10" weightX="1.5" weightY="0.0"/> <GridBagConstraints gridX="1" gridY="11" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="10" weightX="1.5" weightY="0.0"/>
@ -837,6 +863,10 @@
<Dimension value="[345, 112]"/> <Dimension value="[345, 112]"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
@ -912,6 +942,10 @@
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.orderGroupsByLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.orderGroupsByLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="orderByLabel"> <Component class="javax.swing.JLabel" name="orderByLabel">
<Properties> <Properties>
@ -919,6 +953,10 @@
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.orderByLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.orderByLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="groupByLabel"> <Component class="javax.swing.JLabel" name="groupByLabel">
<Properties> <Properties>
@ -926,6 +964,10 @@
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.groupByLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.groupByLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JComboBox" name="groupSortingComboBox"> <Component class="javax.swing.JComboBox" name="groupSortingComboBox">
<AuxValues> <AuxValues>
@ -958,6 +1000,10 @@
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.stepTwoLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.stepTwoLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="stepThreeLabel"> <Component class="javax.swing.JLabel" name="stepThreeLabel">
<Properties> <Properties>
@ -965,6 +1011,10 @@
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.stepThreeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.stepThreeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component> </Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -1075,8 +1075,8 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
javax.swing.ButtonGroup parentPathButtonGroup = new javax.swing.ButtonGroup(); javax.swing.ButtonGroup parentPathButtonGroup = new javax.swing.ButtonGroup();
javax.swing.ButtonGroup parentIncludeButtonGroup = new javax.swing.ButtonGroup(); javax.swing.ButtonGroup parentIncludeButtonGroup = new javax.swing.ButtonGroup();
filtersScrollPane = new javax.swing.JScrollPane(); javax.swing.JScrollPane filtersScrollPane = new javax.swing.JScrollPane();
filtersPanel = new javax.swing.JPanel(); javax.swing.JPanel filtersPanel = new javax.swing.JPanel();
sizeCheckbox = new javax.swing.JCheckBox(); sizeCheckbox = new javax.swing.JCheckBox();
dataSourceCheckbox = new javax.swing.JCheckBox(); dataSourceCheckbox = new javax.swing.JCheckBox();
crFrequencyCheckbox = new javax.swing.JCheckBox(); crFrequencyCheckbox = new javax.swing.JCheckBox();
@ -1093,7 +1093,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
crFrequencyList = new javax.swing.JList<>(); crFrequencyList = new javax.swing.JList<>();
keywordScrollPane = new javax.swing.JScrollPane(); keywordScrollPane = new javax.swing.JScrollPane();
keywordList = new javax.swing.JList<>(); keywordList = new javax.swing.JList<>();
parentLabel = new javax.swing.JLabel(); javax.swing.JLabel parentLabel = new javax.swing.JLabel();
parentScrollPane = new javax.swing.JScrollPane(); parentScrollPane = new javax.swing.JScrollPane();
parentList = new javax.swing.JList<>(); parentList = new javax.swing.JList<>();
hashSetCheckbox = new javax.swing.JCheckBox(); hashSetCheckbox = new javax.swing.JCheckBox();
@ -1115,25 +1115,25 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
scoreList = new javax.swing.JList<>(); scoreList = new javax.swing.JList<>();
excludeRadioButton = new javax.swing.JRadioButton(); excludeRadioButton = new javax.swing.JRadioButton();
knownFilesCheckbox = new javax.swing.JCheckBox(); knownFilesCheckbox = new javax.swing.JCheckBox();
fullRadioPanel = new javax.swing.JPanel(); javax.swing.JPanel fullRadioPanel = new javax.swing.JPanel();
fullRadioButton = new javax.swing.JRadioButton(); fullRadioButton = new javax.swing.JRadioButton();
includeRadioPanel = new javax.swing.JPanel(); javax.swing.JPanel includeRadioPanel = new javax.swing.JPanel();
filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)); javax.swing.Box.Filler filler2 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767));
includeRadioButton = new javax.swing.JRadioButton(); includeRadioButton = new javax.swing.JRadioButton();
parentTextPanel = new javax.swing.JPanel(); javax.swing.JPanel parentTextPanel = new javax.swing.JPanel();
parentTextField = new javax.swing.JTextField(); parentTextField = new javax.swing.JTextField();
searchButton = new javax.swing.JButton(); searchButton = new javax.swing.JButton();
sortingPanel = new javax.swing.JPanel(); javax.swing.JPanel sortingPanel = new javax.swing.JPanel();
groupByCombobox = new javax.swing.JComboBox<>(); groupByCombobox = new javax.swing.JComboBox<>();
orderByCombobox = new javax.swing.JComboBox<>(); orderByCombobox = new javax.swing.JComboBox<>();
orderGroupsByLabel = new javax.swing.JLabel(); javax.swing.JLabel orderGroupsByLabel = new javax.swing.JLabel();
orderByLabel = new javax.swing.JLabel(); javax.swing.JLabel orderByLabel = new javax.swing.JLabel();
groupByLabel = new javax.swing.JLabel(); javax.swing.JLabel groupByLabel = new javax.swing.JLabel();
groupSortingComboBox = new javax.swing.JComboBox<>(); groupSortingComboBox = new javax.swing.JComboBox<>();
errorLabel = new javax.swing.JLabel(); errorLabel = new javax.swing.JLabel();
cancelButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton();
stepTwoLabel = new javax.swing.JLabel(); javax.swing.JLabel stepTwoLabel = new javax.swing.JLabel();
stepThreeLabel = new javax.swing.JLabel(); javax.swing.JLabel stepThreeLabel = new javax.swing.JLabel();
setMinimumSize(new java.awt.Dimension(10, 0)); setMinimumSize(new java.awt.Dimension(10, 0));
setPreferredSize(new java.awt.Dimension(321, 400)); setPreferredSize(new java.awt.Dimension(321, 400));
@ -1740,7 +1740,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
// Get the selected filters // Get the selected filters
List<FileSearchFiltering.FileFilter> filters = getFilters(); List<FileSearchFiltering.FileFilter> filters = getFilters();
enableSearch(false); enableSearch(false);
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchStartedEvent(fileType)); DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.SearchStartedEvent(fileType));
// Get the grouping attribute and group sorting method // Get the grouping attribute and group sorting method
FileSearch.AttributeType groupingAttr = getGroupingAttribute(); FileSearch.AttributeType groupingAttr = getGroupingAttribute();
@ -1792,7 +1792,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
* @param searchCancelledEvent The SearchCancelledEvent which was received. * @param searchCancelledEvent The SearchCancelledEvent which was received.
*/ */
@Subscribe @Subscribe
void handleSearchCancelledEvent(DiscoveryEvents.SearchCancelledEvent searchCancelledEvent) { void handleSearchCancelledEvent(DiscoveryEventUtils.SearchCancelledEvent searchCancelledEvent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
enableSearch(true); enableSearch(true);
}); });
@ -1804,7 +1804,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
* @param searchCompleteEvent The SearchCompleteEvent which was received. * @param searchCompleteEvent The SearchCompleteEvent which was received.
*/ */
@Subscribe @Subscribe
void handleSearchCompleteEvent(DiscoveryEvents.SearchCompleteEvent searchCompleteEvent) { void handleSearchCompleteEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompleteEvent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
enableSearch(true); enableSearch(true);
}); });
@ -1903,19 +1903,13 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private javax.swing.JLabel errorLabel; private javax.swing.JLabel errorLabel;
private javax.swing.JRadioButton excludeRadioButton; private javax.swing.JRadioButton excludeRadioButton;
private javax.swing.JCheckBox exifCheckbox; private javax.swing.JCheckBox exifCheckbox;
private javax.swing.Box.Filler filler2;
private javax.swing.JPanel filtersPanel;
private javax.swing.JScrollPane filtersScrollPane;
private javax.swing.JRadioButton fullRadioButton; private javax.swing.JRadioButton fullRadioButton;
private javax.swing.JPanel fullRadioPanel;
private javax.swing.JComboBox<GroupingAttributeType> groupByCombobox; private javax.swing.JComboBox<GroupingAttributeType> groupByCombobox;
private javax.swing.JLabel groupByLabel;
private javax.swing.JComboBox<GroupSortingAlgorithm> groupSortingComboBox; private javax.swing.JComboBox<GroupSortingAlgorithm> groupSortingComboBox;
private javax.swing.JCheckBox hashSetCheckbox; private javax.swing.JCheckBox hashSetCheckbox;
private javax.swing.JList<String> hashSetList; private javax.swing.JList<String> hashSetList;
private javax.swing.JScrollPane hashSetScrollPane; private javax.swing.JScrollPane hashSetScrollPane;
private javax.swing.JRadioButton includeRadioButton; private javax.swing.JRadioButton includeRadioButton;
private javax.swing.JPanel includeRadioPanel;
private javax.swing.JCheckBox interestingItemsCheckbox; private javax.swing.JCheckBox interestingItemsCheckbox;
private javax.swing.JList<String> interestingItemsList; private javax.swing.JList<String> interestingItemsList;
private javax.swing.JScrollPane interestingItemsScrollPane; private javax.swing.JScrollPane interestingItemsScrollPane;
@ -1928,14 +1922,10 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private javax.swing.JList<String> objectsList; private javax.swing.JList<String> objectsList;
private javax.swing.JScrollPane objectsScrollPane; private javax.swing.JScrollPane objectsScrollPane;
private javax.swing.JComboBox<SortingMethod> orderByCombobox; private javax.swing.JComboBox<SortingMethod> orderByCombobox;
private javax.swing.JLabel orderByLabel;
private javax.swing.JLabel orderGroupsByLabel;
private javax.swing.JCheckBox parentCheckbox; private javax.swing.JCheckBox parentCheckbox;
private javax.swing.JLabel parentLabel;
private javax.swing.JList<ParentSearchTerm> parentList; private javax.swing.JList<ParentSearchTerm> parentList;
private javax.swing.JScrollPane parentScrollPane; private javax.swing.JScrollPane parentScrollPane;
private javax.swing.JTextField parentTextField; private javax.swing.JTextField parentTextField;
private javax.swing.JPanel parentTextPanel;
private javax.swing.JCheckBox scoreCheckbox; private javax.swing.JCheckBox scoreCheckbox;
private javax.swing.JList<Score> scoreList; private javax.swing.JList<Score> scoreList;
private javax.swing.JScrollPane scoreScrollPane; private javax.swing.JScrollPane scoreScrollPane;
@ -1943,9 +1933,6 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private javax.swing.JCheckBox sizeCheckbox; private javax.swing.JCheckBox sizeCheckbox;
private javax.swing.JList<FileSize> sizeList; private javax.swing.JList<FileSize> sizeList;
private javax.swing.JScrollPane sizeScrollPane; private javax.swing.JScrollPane sizeScrollPane;
private javax.swing.JPanel sortingPanel;
private javax.swing.JLabel stepThreeLabel;
private javax.swing.JLabel stepTwoLabel;
private javax.swing.JRadioButton substringRadioButton; private javax.swing.JRadioButton substringRadioButton;
private javax.swing.JCheckBox tagsCheckbox; private javax.swing.JCheckBox tagsCheckbox;
private javax.swing.JList<TagName> tagsList; private javax.swing.JList<TagName> tagsList;

View File

@ -34,6 +34,8 @@
<SubComponents> <SubComponents>
<Container class="javax.swing.JScrollPane" name="groupListScrollPane"> <Container class="javax.swing.JScrollPane" name="groupListScrollPane">
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues> </AuxValues>

View File

@ -56,7 +56,7 @@ class GroupListPanel extends javax.swing.JPanel {
* @param searchStartedEvent the SearchStartedEvent which was received * @param searchStartedEvent the SearchStartedEvent which was received
*/ */
@Subscribe @Subscribe
void handleSearchStartedEvent(DiscoveryEvents.SearchStartedEvent searchStartedEvent) { void handleSearchStartedEvent(DiscoveryEventUtils.SearchStartedEvent searchStartedEvent) {
resultType = searchStartedEvent.getType(); resultType = searchStartedEvent.getType();
groupKeyList.setListData(new GroupKey[0]); groupKeyList.setListData(new GroupKey[0]);
} }
@ -70,7 +70,7 @@ class GroupListPanel extends javax.swing.JPanel {
* @param searchCompleteEvent the SearchCompleteEvent which was received * @param searchCompleteEvent the SearchCompleteEvent which was received
*/ */
@Subscribe @Subscribe
void handleSearchCompleteEvent(DiscoveryEvents.SearchCompleteEvent searchCompleteEvent) { void handleSearchCompleteEvent(DiscoveryEventUtils.SearchCompleteEvent searchCompleteEvent) {
groupMap = searchCompleteEvent.getGroupMap(); groupMap = searchCompleteEvent.getGroupMap();
searchfilters = searchCompleteEvent.getFilters(); searchfilters = searchCompleteEvent.getFilters();
groupingAttribute = searchCompleteEvent.getGroupingAttr(); groupingAttribute = searchCompleteEvent.getGroupingAttr();
@ -96,7 +96,7 @@ class GroupListPanel extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
groupListScrollPane = new javax.swing.JScrollPane(); javax.swing.JScrollPane groupListScrollPane = new javax.swing.JScrollPane();
groupKeyList = new javax.swing.JList<>(); groupKeyList = new javax.swing.JList<>();
groupKeyList.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(GroupListPanel.class, "GroupListPanel.groupKeyList.border.title"))); // NOI18N groupKeyList.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(GroupListPanel.class, "GroupListPanel.groupKeyList.border.title"))); // NOI18N
@ -145,20 +145,19 @@ class GroupListPanel extends javax.swing.JPanel {
for (GroupKey groupKey : groupMap.keySet()) { for (GroupKey groupKey : groupMap.keySet()) {
if (selectedGroup.equals(groupKey)) { if (selectedGroup.equals(groupKey)) {
selectedGroupKey = groupKey; selectedGroupKey = groupKey;
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.GroupSelectedEvent( DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.GroupSelectedEvent(
searchfilters, groupingAttribute, groupSort, fileSortMethod, selectedGroupKey, groupMap.get(selectedGroupKey), resultType)); searchfilters, groupingAttribute, groupSort, fileSortMethod, selectedGroupKey, groupMap.get(selectedGroupKey), resultType));
break; break;
} }
} }
} else { } else {
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.NoResultsEvent()); DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.NoResultsEvent());
} }
} }
}//GEN-LAST:event_groupSelected }//GEN-LAST:event_groupSelected
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JList<GroupKey> groupKeyList; private javax.swing.JList<GroupKey> groupKeyList;
private javax.swing.JScrollPane groupListScrollPane;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
/** /**

View File

@ -160,7 +160,7 @@ public class ImageThumbnailPanel extends javax.swing.JPanel implements ListCellR
case INTERESTING_SCORE: case INTERESTING_SCORE:
scoreLabel.setIcon(INTERESTING_SCORE_ICON); scoreLabel.setIcon(INTERESTING_SCORE_ICON);
break; break;
case NO_SCORE: case NO_SCORE: // empty case - this is interpreted as an intentional fall-through
default: default:
scoreLabel.setIcon(null); scoreLabel.setIcon(null);
break; break;
@ -210,6 +210,7 @@ public class ImageThumbnailPanel extends javax.swing.JPanel implements ListCellR
break; break;
default: default:
units = Bundle.ImageThumbnailPanel_bytes_text(); units = Bundle.ImageThumbnailPanel_bytes_text();
break;
} }
return Bundle.ImageThumbnailPanel_sizeLabel_text(size, units); return Bundle.ImageThumbnailPanel_sizeLabel_text(size, units);
} }

View File

@ -80,28 +80,7 @@ public final class OpenFileDiscoveryAction extends CallableSystemAction implemen
if (tc.isOpened() == false) { if (tc.isOpened() == false) {
tc.open(); tc.open();
tc.updateSearchSettings(); tc.updateSearchSettings();
//check if modules run and assemble message displayErrorMessage(tc);
try {
SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
Map<Long, DataSourceModulesWrapper> dataSourceIngestModules = new HashMap<>();
for (DataSource dataSource : skCase.getDataSources()) {
dataSourceIngestModules.put(dataSource.getId(), new DataSourceModulesWrapper(dataSource.getName()));
}
for (IngestJobInfo jobInfo : skCase.getIngestJobs()) {
dataSourceIngestModules.get(jobInfo.getObjectId()).updateModulesRun(jobInfo);
}
String message = "";
for (DataSourceModulesWrapper dsmodulesWrapper : dataSourceIngestModules.values()) {
message += dsmodulesWrapper.getMessage();
}
if (!message.isEmpty()) {
JOptionPane.showMessageDialog(tc, message, Bundle.OpenFileDiscoveryAction_resultsIncomplete_text(), JOptionPane.INFORMATION_MESSAGE);
}
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.WARNING, "Exception while determining which modules have been run for File Discovery", ex);
}
} }
tc.toFront(); tc.toFront();
tc.requestActive(); tc.requestActive();
@ -109,6 +88,36 @@ public final class OpenFileDiscoveryAction extends CallableSystemAction implemen
} }
} }
/**
* Private helper method to display an error message when the results of the
* File Discovery Top component may be incomplete.
*
* @param tc The File Discovery Top component.
*/
private void displayErrorMessage(DiscoveryTopComponent tc) {
//check if modules run and assemble message
try {
SleuthkitCase skCase = Case.getCurrentCaseThrows().getSleuthkitCase();
Map<Long, DataSourceModulesWrapper> dataSourceIngestModules = new HashMap<>();
for (DataSource dataSource : skCase.getDataSources()) {
dataSourceIngestModules.put(dataSource.getId(), new DataSourceModulesWrapper(dataSource.getName()));
}
for (IngestJobInfo jobInfo : skCase.getIngestJobs()) {
dataSourceIngestModules.get(jobInfo.getObjectId()).updateModulesRun(jobInfo);
}
String message = "";
for (DataSourceModulesWrapper dsmodulesWrapper : dataSourceIngestModules.values()) {
message += dsmodulesWrapper.getMessage();
}
if (!message.isEmpty()) {
JOptionPane.showMessageDialog(tc, message, Bundle.OpenFileDiscoveryAction_resultsIncomplete_text(), JOptionPane.INFORMATION_MESSAGE);
}
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.WARNING, "Exception while determining which modules have been run for File Discovery", ex);
}
}
/** /**
* Returns the toolbar component of this action. * Returns the toolbar component of this action.
* *

View File

@ -96,7 +96,7 @@ final class PageWorker extends SwingWorker<Void, Void> {
protected void done() { protected void done() {
if (!isCancelled()) { if (!isCancelled()) {
int currentPage = startingEntry / pageSize; //integer division should round down to get page number correctly int currentPage = startingEntry / pageSize; //integer division should round down to get page number correctly
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.PageRetrievedEvent(resultType, currentPage, results)); DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.PageRetrievedEvent(resultType, currentPage, results));
} }
} }

View File

@ -45,6 +45,10 @@
</Border> </Border>
</Property> </Property>
</Properties> </Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">

View File

@ -190,7 +190,7 @@ public class ResultsPanel extends javax.swing.JPanel {
* @param pageRetrievedEvent The PageRetrievedEvent received. * @param pageRetrievedEvent The PageRetrievedEvent received.
*/ */
@Subscribe @Subscribe
void handlePageRetrievedEvent(DiscoveryEvents.PageRetrievedEvent pageRetrievedEvent) { void handlePageRetrievedEvent(DiscoveryEventUtils.PageRetrievedEvent pageRetrievedEvent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
populateInstancesList(); populateInstancesList();
currentPage = pageRetrievedEvent.getPageNumber(); currentPage = pageRetrievedEvent.getPageNumber();
@ -264,7 +264,7 @@ public class ResultsPanel extends javax.swing.JPanel {
* @param groupSelectedEvent The GroupSelectedEvent received. * @param groupSelectedEvent The GroupSelectedEvent received.
*/ */
@Subscribe @Subscribe
void handleGroupSelectedEvent(DiscoveryEvents.GroupSelectedEvent groupSelectedEvent) { void handleGroupSelectedEvent(DiscoveryEventUtils.GroupSelectedEvent groupSelectedEvent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
searchFilters = groupSelectedEvent.getFilters(); searchFilters = groupSelectedEvent.getFilters();
groupingAttribute = groupSelectedEvent.getGroupingAttr(); groupingAttribute = groupSelectedEvent.getGroupingAttr();
@ -284,7 +284,7 @@ public class ResultsPanel extends javax.swing.JPanel {
* @param noResultsEvent the NoResultsEvent received. * @param noResultsEvent the NoResultsEvent received.
*/ */
@Subscribe @Subscribe
void handleNoResultsEvent(DiscoveryEvents.NoResultsEvent noResultsEvent) { void handleNoResultsEvent(DiscoveryEventUtils.NoResultsEvent noResultsEvent) {
SwingUtilities.invokeLater(() -> { SwingUtilities.invokeLater(() -> {
groupSize = 0; groupSize = 0;
currentPage = 0; currentPage = 0;
@ -349,7 +349,7 @@ public class ResultsPanel extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
pagingPanel = new javax.swing.JPanel(); javax.swing.JPanel pagingPanel = new javax.swing.JPanel();
previousPageButton = new javax.swing.JButton(); previousPageButton = new javax.swing.JButton();
currentPageLabel = new javax.swing.JLabel(); currentPageLabel = new javax.swing.JLabel();
nextPageButton = new javax.swing.JButton(); nextPageButton = new javax.swing.JButton();
@ -611,7 +611,6 @@ public class ResultsPanel extends javax.swing.JPanel {
private javax.swing.JList<AbstractFile> instancesList; private javax.swing.JList<AbstractFile> instancesList;
private javax.swing.JButton nextPageButton; private javax.swing.JButton nextPageButton;
private javax.swing.JComboBox<Integer> pageSizeComboBox; private javax.swing.JComboBox<Integer> pageSizeComboBox;
private javax.swing.JPanel pagingPanel;
private javax.swing.JButton previousPageButton; private javax.swing.JButton previousPageButton;
private javax.swing.JPanel resultsViewerPanel; private javax.swing.JPanel resultsViewerPanel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

View File

@ -39,7 +39,7 @@ class SearchResults {
private final Map<FileSearch.GroupKey, FileGroup> groupMap = new HashMap<>(); private final Map<FileSearch.GroupKey, FileGroup> groupMap = new HashMap<>();
private List<FileGroup> groupList = new ArrayList<>(); private List<FileGroup> groupList = new ArrayList<>();
private final long MAX_OUTPUT_FILES = 2000; // For debug UI - maximum number of lines to print private static final long MAX_OUTPUT_FILES = 2000; // For debug UI - maximum number of lines to print
/** /**
* Create an empty SearchResults object * Create an empty SearchResults object

View File

@ -78,9 +78,9 @@ final class SearchWorker extends SwingWorker<Void, Void> {
@Override @Override
protected void done() { protected void done() {
if (isCancelled()) { if (isCancelled()) {
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchCancelledEvent()); DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.SearchCancelledEvent());
} else { } else {
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchCompleteEvent(results, filters, groupingAttr, groupSortAlgorithm, fileSort)); DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.SearchCompleteEvent(results, filters, groupingAttr, groupSortAlgorithm, fileSort));
} }
} }
} }

View File

@ -193,7 +193,7 @@ final class VideoThumbnailPanel extends javax.swing.JPanel implements ListCellRe
case INTERESTING_SCORE: case INTERESTING_SCORE:
scoreLabel.setIcon(INTERESTING_SCORE_ICON); scoreLabel.setIcon(INTERESTING_SCORE_ICON);
break; break;
case NO_SCORE: case NO_SCORE: // empty case - this is interpreted as an intentional fall-through
default: default:
scoreLabel.setIcon(null); scoreLabel.setIcon(null);
break; break;
@ -242,6 +242,7 @@ final class VideoThumbnailPanel extends javax.swing.JPanel implements ListCellRe
break; break;
default: default:
units = Bundle.VideoThumbnailPanel_bytes_text(); units = Bundle.VideoThumbnailPanel_bytes_text();
break;
} }
return Bundle.VideoThumbnailPanel_sizeLabel_text(size, units); return Bundle.VideoThumbnailPanel_sizeLabel_text(size, units);
} }