mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
merge cleanup
# Conflicts: # Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonFilesMetaDataBuilder.java
This commit is contained in:
parent
a3038ac395
commit
4f89d62ef3
@ -32,14 +32,14 @@ final class AllDataSources extends CommonFilesMetaDataBuilder {
|
|||||||
* Implements the algorithm for getting common files across all data sources.
|
* Implements the algorithm for getting common files across all data sources.
|
||||||
* @param dataSourceIdMap a map of obj_id to datasource name
|
* @param dataSourceIdMap a map of obj_id to datasource name
|
||||||
*/
|
*/
|
||||||
public AllDataSources(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
AllDataSources(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
||||||
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String buildSqlSelectStatement() {
|
protected String buildSqlSelectStatement() {
|
||||||
Object[] args = new String[] {CommonFilesMetaDataBuilder.SELECT_PREFIX, determineMimeTypeFilter()};
|
Object[] args = new String[] {SELECT_PREFIX, determineMimeTypeFilter()};
|
||||||
return String.format(WHERE_CLAUSE, args);
|
return String.format(WHERE_CLAUSE, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ package org.sleuthkit.autopsy.commonfilesearch;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -115,7 +115,7 @@ abstract class CommonFilesMetaDataBuilder {
|
|||||||
* <li>If you do not use this string, you must use at least the columns selected below, in that order.</li>
|
* <li>If you do not use this string, you must use at least the columns selected below, in that order.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
protected static String SELECT_PREFIX = "SELECT obj_id, md5, data_source_obj_id from tsk_files where";
|
static final String SELECT_PREFIX = "SELECT obj_id, md5, data_source_obj_id from tsk_files where";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should build a SQL SELECT statement to be passed to
|
* Should build a SQL SELECT statement to be passed to
|
||||||
@ -168,7 +168,7 @@ abstract class CommonFilesMetaDataBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String determineMimeTypeFilter() {
|
String determineMimeTypeFilter() {
|
||||||
StringBuilder mimeTypeFilter = new StringBuilder();
|
|
||||||
Set<String> mimeTypesToFilterOn = new HashSet<>();
|
Set<String> mimeTypesToFilterOn = new HashSet<>();
|
||||||
String mimeTypeString = "";
|
String mimeTypeString = "";
|
||||||
if(filterByMedia) {
|
if(filterByMedia) {
|
||||||
@ -177,12 +177,15 @@ abstract class CommonFilesMetaDataBuilder {
|
|||||||
if(filterByDoc) {
|
if(filterByDoc) {
|
||||||
mimeTypesToFilterOn.addAll(TEXT_FILES_MIME_TYPES);
|
mimeTypesToFilterOn.addAll(TEXT_FILES_MIME_TYPES);
|
||||||
}
|
}
|
||||||
|
StringBuilder mimeTypeFilter = new StringBuilder(mimeTypesToFilterOn.size());
|
||||||
if(mimeTypesToFilterOn.size() > 0) {
|
if(mimeTypesToFilterOn.size() > 0) {
|
||||||
for (String mimeType : mimeTypesToFilterOn) {
|
for (String mimeType : mimeTypesToFilterOn) {
|
||||||
mimeTypeFilter.append("\"" + mimeType + "\",");
|
mimeTypeFilter.append("\"").append(mimeType).append("\",");
|
||||||
}
|
}
|
||||||
mimeTypeString = mimeTypeFilter.toString().substring(0, mimeTypeFilter.length() - 1);
|
mimeTypeString = mimeTypeFilter.toString().substring(0, mimeTypeFilter.length() - 1);
|
||||||
}
|
}
|
||||||
return String.format(filterByMimeTypesWhereClause, new Object[]{mimeTypeString});
|
return String.format(filterByMimeTypesWhereClause, new Object[]{mimeTypeString});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.commonfilesearch;
|
package org.sleuthkit.autopsy.commonfilesearch;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides logic for selecting common files from a single data source.
|
* Provides logic for selecting common files from a single data source.
|
||||||
@ -37,14 +35,14 @@ final class SingleDataSource extends CommonFilesMetaDataBuilder {
|
|||||||
* @param dataSourceId data source id for which common files must appear at least once
|
* @param dataSourceId data source id for which common files must appear at least once
|
||||||
* @param dataSourceIdMap map of obj_id to data source name
|
* @param dataSourceIdMap map of obj_id to data source name
|
||||||
*/
|
*/
|
||||||
public SingleDataSource(Long dataSourceId, Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
SingleDataSource(Long dataSourceId, Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
||||||
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
||||||
this.selectedDataSourceId = dataSourceId;
|
this.selectedDataSourceId = dataSourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String buildSqlSelectStatement() {
|
protected String buildSqlSelectStatement() {
|
||||||
Object[] args = new String[]{CommonFilesMetaDataBuilder.SELECT_PREFIX, Long.toString(this.selectedDataSourceId), determineMimeTypeFilter()};
|
Object[] args = new String[]{SELECT_PREFIX, Long.toString(this.selectedDataSourceId), determineMimeTypeFilter()};
|
||||||
return String.format(SingleDataSource.WHERE_CLAUSE, args);
|
return String.format(SingleDataSource.WHERE_CLAUSE, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user