TODOs and cleanup.

This commit is contained in:
Andrew Ziehl 2018-04-03 07:31:09 -07:00 committed by Brian Sweeney
parent 7fda8e9f2e
commit 02faf93f1c
2 changed files with 7 additions and 5 deletions

View File

@ -42,6 +42,7 @@ class CommonFilesMetaDataBuilder {
private final Long selectedDataSourceId; private final Long selectedDataSourceId;
private final Map<Long, String> dataSourceIdToNameMap; private final Map<Long, String> dataSourceIdToNameMap;
//TODO subclass this class to specify where clause and/or additional algorithms.
private final String singleDataSourceWhereClause = "md5 in (select md5 from tsk_files where data_source_obj_id=%s and (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) AND data_source_obj_id=%s order by md5"; private final String singleDataSourceWhereClause = "md5 in (select md5 from tsk_files where data_source_obj_id=%s and (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) AND data_source_obj_id=%s order by md5";
private final String allDataSourcesWhereClause = "md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) order by md5"; private final String allDataSourcesWhereClause = "md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) order by md5";
@ -68,7 +69,7 @@ class CommonFilesMetaDataBuilder {
Map<String, Set<String>> md5ToDataSourcesStringMap = new HashMap<>(); Map<String, Set<String>> md5ToDataSourcesStringMap = new HashMap<>();
try { try {
List<AbstractFile> files = FindCommonFiles(); List<AbstractFile> files = findCommonFiles();
Map<String, List<AbstractFile>> parentNodes = new HashMap<>(); Map<String, List<AbstractFile>> parentNodes = new HashMap<>();
@ -90,9 +91,9 @@ class CommonFilesMetaDataBuilder {
if (parentNodes.containsKey(currentMd5)) { if (parentNodes.containsKey(currentMd5)) {
parentNodes.get(currentMd5).add(file); parentNodes.get(currentMd5).add(file);
Set<String> currenDataSources = md5ToDataSourcesStringMap.get(currentMd5); Set<String> currentDataSources = md5ToDataSourcesStringMap.get(currentMd5);
addDataSource(currenDataSources, file, dataSourceIdToNameMap); addDataSource(currentDataSources, file, dataSourceIdToNameMap);
md5ToDataSourcesStringMap.put(currentMd5, currenDataSources); md5ToDataSourcesStringMap.put(currentMd5, currentDataSources);
} else { } else {
List<AbstractFile> children = new ArrayList<>(); List<AbstractFile> children = new ArrayList<>();
@ -106,7 +107,7 @@ class CommonFilesMetaDataBuilder {
} }
} }
private List<AbstractFile> FindCommonFiles() throws TskCoreException, NoCurrentCaseException { private List<AbstractFile> findCommonFiles() throws TskCoreException, NoCurrentCaseException {
SleuthkitCase sleuthkitCase; SleuthkitCase sleuthkitCase;
sleuthkitCase = Case.getOpenCase().getSleuthkitCase(); sleuthkitCase = Case.getOpenCase().getSleuthkitCase();
String whereClause = allDataSourcesWhereClause; String whereClause = allDataSourcesWhereClause;

View File

@ -103,6 +103,7 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
return dataSourceMap.size() >= 2; return dataSourceMap.size() >= 2;
} }
//Make this a SwingWorker
private void buildDataSourceMap(Map<Long, String> dataSourceMap) throws TskCoreException, NoCurrentCaseException, SQLException { private void buildDataSourceMap(Map<Long, String> dataSourceMap) throws TskCoreException, NoCurrentCaseException, SQLException {
Case currentCase = Case.getOpenCase(); Case currentCase = Case.getOpenCase();
SleuthkitCase tskDb = currentCase.getSleuthkitCase(); SleuthkitCase tskDb = currentCase.getSleuthkitCase();