mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
4791 use name of first image in multi-image data sources
This commit is contained in:
parent
ba0010f626
commit
90c75d635e
@ -1,16 +1,16 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
*
|
||||
* Copyright 2018 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -30,10 +30,10 @@ import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Encapsulates logic required to create a mapping of data sources in the
|
||||
* Encapsulates logic required to create a mapping of data sources in the
|
||||
* current case to their data source IDs.
|
||||
*
|
||||
* Intended to be used within the context of a SwingWorker or other background
|
||||
*
|
||||
* Intended to be used within the context of a SwingWorker or other background
|
||||
* thread.
|
||||
*/
|
||||
public class DataSourceLoader {
|
||||
@ -46,8 +46,7 @@ public class DataSourceLoader {
|
||||
//try block releases resources - exceptions are handled in done()
|
||||
try (
|
||||
SleuthkitCase.CaseDbQuery query = tskDb.executeQuery(SELECT_DATA_SOURCES_LOGICAL);
|
||||
ResultSet resultSet = query.getResultSet()
|
||||
) {
|
||||
ResultSet resultSet = query.getResultSet()) {
|
||||
while (resultSet.next()) {
|
||||
Long objectId = resultSet.getLong(1);
|
||||
String dataSourceName = resultSet.getString(2);
|
||||
@ -56,7 +55,7 @@ public class DataSourceLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadImageSources(SleuthkitCase tskDb, Map<Long, String> dataSouceMap) throws SQLException, TskCoreException {
|
||||
private void loadImageSources(SleuthkitCase tskDb, Map<Long, String> dataSourceMap) throws SQLException, TskCoreException {
|
||||
//try block releases resources - exceptions are handled in done()
|
||||
try (
|
||||
SleuthkitCase.CaseDbQuery query = tskDb.executeQuery(SELECT_DATA_SOURCES_IMAGE);
|
||||
@ -64,21 +63,24 @@ public class DataSourceLoader {
|
||||
|
||||
while (resultSet.next()) {
|
||||
Long objectId = resultSet.getLong(1);
|
||||
String dataSourceName = resultSet.getString(2);
|
||||
File image = new File(dataSourceName);
|
||||
String dataSourceNameTrimmed = image.getName();
|
||||
dataSouceMap.put(objectId, dataSourceNameTrimmed);
|
||||
if (!dataSourceMap.containsKey(objectId)) {
|
||||
String dataSourceName = resultSet.getString(2);
|
||||
File image = new File(dataSourceName);
|
||||
String dataSourceNameTrimmed = image.getName();
|
||||
dataSourceMap.put(objectId, dataSourceNameTrimmed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a map of data source Ids to their string names for the current case.
|
||||
*
|
||||
*
|
||||
* @return Map of Long (id) to String (name)
|
||||
*
|
||||
* @throws NoCurrentCaseException
|
||||
* @throws TskCoreException
|
||||
* @throws SQLException
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Long, String> getDataSourceMap() throws NoCurrentCaseException, TskCoreException, SQLException {
|
||||
Map<Long, String> dataSouceMap = new HashMap<>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user