mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #3951 from dgrove727/3995_OtherOccurrencesNoResultsFound
3995 other occurrences no results found
This commit is contained in:
commit
25b232c5c8
@ -80,7 +80,7 @@
|
|||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="otherCasesPanel" pref="483" max="32767" attributes="0"/>
|
<Component id="otherCasesPanel" pref="59" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
@ -106,7 +106,7 @@
|
|||||||
<EmptySpace min="0" pref="483" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="483" max="32767" attributes="0"/>
|
||||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Component id="tableContainerPanel" pref="483" max="32767" attributes="0"/>
|
<Component id="tableContainerPanel" pref="59" max="32767" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -133,23 +133,18 @@
|
|||||||
<Component id="earliestCaseLabel" min="-2" max="-2" attributes="0"/>
|
<Component id="earliestCaseLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="earliestCaseDate" min="-2" max="-2" attributes="0"/>
|
<Component id="earliestCaseDate" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
<Component id="tableStatusPanelLabel" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<Component id="tableScrollPane" pref="176" max="32767" attributes="0"/>
|
<Component id="tableScrollPane" pref="27" max="32767" attributes="0"/>
|
||||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Component id="earliestCaseLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="earliestCaseLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="earliestCaseDate" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="earliestCaseDate" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="tableStatusPanelLabel" min="-2" pref="16" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||||
<Component id="tableStatusPanel" min="-2" max="-2" attributes="0"/>
|
<Component id="tableStatusPanel" min="-2" max="-2" attributes="0"/>
|
||||||
@ -230,13 +225,6 @@
|
|||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
</Container>
|
</Container>
|
||||||
<Component class="javax.swing.JLabel" name="tableStatusPanelLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="33" green="0" red="ff" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package org.sleuthkit.autopsy.centralrepository.contentviewer;
|
package org.sleuthkit.autopsy.centralrepository.contentviewer;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.FontMetrics;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
@ -85,7 +86,10 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
|
|
||||||
private static final long serialVersionUID = -1L;
|
private static final long serialVersionUID = -1L;
|
||||||
|
|
||||||
private final static Logger logger = Logger.getLogger(DataContentViewerOtherCases.class.getName());
|
private static final Logger logger = Logger.getLogger(DataContentViewerOtherCases.class.getName());
|
||||||
|
|
||||||
|
private static final int DEFAULT_MIN_CELL_WIDTH = 15;
|
||||||
|
private static final int CELL_TEXT_WIDTH_PADDING = 5;
|
||||||
|
|
||||||
private final DataContentViewerOtherCasesTableModel tableModel;
|
private final DataContentViewerOtherCasesTableModel tableModel;
|
||||||
private final Collection<CorrelationAttribute> correlationAttributes;
|
private final Collection<CorrelationAttribute> correlationAttributes;
|
||||||
@ -125,7 +129,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
showCommonalityDetails();
|
showCommonalityDetails();
|
||||||
} else if (jmi.equals(addCommentMenuItem)) {
|
} else if (jmi.equals(addCommentMenuItem)) {
|
||||||
try {
|
try {
|
||||||
OtherOccurrenceNodeData selectedNode = (OtherOccurrenceNodeData) tableModel.getRow(otherCasesTable.getSelectedRow());
|
OtherOccurrenceNodeInstanceData selectedNode = (OtherOccurrenceNodeInstanceData) tableModel.getRow(otherCasesTable.getSelectedRow());
|
||||||
AddEditCentralRepoCommentAction action = new AddEditCentralRepoCommentAction(selectedNode.createCorrelationAttribute());
|
AddEditCentralRepoCommentAction action = new AddEditCentralRepoCommentAction(selectedNode.createCorrelationAttribute());
|
||||||
action.actionPerformed(null);
|
action.actionPerformed(null);
|
||||||
String currentComment = action.getComment();
|
String currentComment = action.getComment();
|
||||||
@ -149,7 +153,6 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
// Set background of every nth row as light grey.
|
// Set background of every nth row as light grey.
|
||||||
TableCellRenderer renderer = new DataContentViewerOtherCasesTableCellRenderer();
|
TableCellRenderer renderer = new DataContentViewerOtherCasesTableCellRenderer();
|
||||||
otherCasesTable.setDefaultRenderer(Object.class, renderer);
|
otherCasesTable.setDefaultRenderer(Object.class, renderer);
|
||||||
tableStatusPanelLabel.setVisible(false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +210,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
if (-1 != selectedRowViewIdx) {
|
if (-1 != selectedRowViewIdx) {
|
||||||
EamDb dbManager = EamDb.getInstance();
|
EamDb dbManager = EamDb.getInstance();
|
||||||
int selectedRowModelIdx = otherCasesTable.convertRowIndexToModel(selectedRowViewIdx);
|
int selectedRowModelIdx = otherCasesTable.convertRowIndexToModel(selectedRowViewIdx);
|
||||||
OtherOccurrenceNodeData nodeData = (OtherOccurrenceNodeData) tableModel.getRow(selectedRowModelIdx);
|
OtherOccurrenceNodeInstanceData nodeData = (OtherOccurrenceNodeInstanceData) tableModel.getRow(selectedRowModelIdx);
|
||||||
CorrelationCase eamCasePartial = nodeData.getCorrelationAttributeInstance().getCorrelationCase();
|
CorrelationCase eamCasePartial = nodeData.getCorrelationAttributeInstance().getCorrelationCase();
|
||||||
if (eamCasePartial == null) {
|
if (eamCasePartial == null) {
|
||||||
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
|
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
|
||||||
@ -462,12 +465,12 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
|
|
||||||
@Messages({"DataContentViewerOtherCases.earliestCaseNotAvailable= Not Enabled."})
|
@Messages({"DataContentViewerOtherCases.earliestCaseNotAvailable= Not Enabled."})
|
||||||
/**
|
/**
|
||||||
* Gets the list of Eam Cases and determines the earliest case creation date.
|
* Gets the list of Eam Cases and determines the earliest case creation
|
||||||
* Sets the label to display the earliest date string to the user.
|
* date. Sets the label to display the earliest date string to the user.
|
||||||
*/
|
*/
|
||||||
private void setEarliestCaseDate() {
|
private void setEarliestCaseDate() {
|
||||||
String dateStringDisplay = Bundle.DataContentViewerOtherCases_earliestCaseNotAvailable();
|
String dateStringDisplay = Bundle.DataContentViewerOtherCases_earliestCaseNotAvailable();
|
||||||
|
|
||||||
if (EamDb.isEnabled()) {
|
if (EamDb.isEnabled()) {
|
||||||
LocalDateTime earliestDate = LocalDateTime.now(DateTimeZone.UTC);
|
LocalDateTime earliestDate = LocalDateTime.now(DateTimeZone.UTC);
|
||||||
DateFormat datetimeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);
|
DateFormat datetimeFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);
|
||||||
@ -475,15 +478,15 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
EamDb dbManager = EamDb.getInstance();
|
EamDb dbManager = EamDb.getInstance();
|
||||||
List<CorrelationCase> cases = dbManager.getCases();
|
List<CorrelationCase> cases = dbManager.getCases();
|
||||||
for (CorrelationCase aCase : cases) {
|
for (CorrelationCase aCase : cases) {
|
||||||
LocalDateTime caseDate = LocalDateTime.fromDateFields(datetimeFormat.parse(aCase.getCreationDate()));
|
LocalDateTime caseDate = LocalDateTime.fromDateFields(datetimeFormat.parse(aCase.getCreationDate()));
|
||||||
|
|
||||||
if (caseDate.isBefore(earliestDate)) {
|
if (caseDate.isBefore(earliestDate)) {
|
||||||
earliestDate = caseDate;
|
earliestDate = caseDate;
|
||||||
dateStringDisplay = aCase.getCreationDate();
|
dateStringDisplay = aCase.getCreationDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (EamDbException ex) {
|
} catch (EamDbException ex) {
|
||||||
logger.log(Level.SEVERE, "Error getting list of cases from database.", ex); // NON-NLS
|
logger.log(Level.SEVERE, "Error getting list of cases from database.", ex); // NON-NLS
|
||||||
} catch (ParseException ex) {
|
} catch (ParseException ex) {
|
||||||
@ -495,10 +498,10 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Query the central repo database (if enabled) and the case database to find all
|
* Query the central repo database (if enabled) and the case database to
|
||||||
* artifact instances correlated to the given central repository artifact. If the
|
* find all artifact instances correlated to the given central repository
|
||||||
* central repo is not enabled, this will only return files from the current case
|
* artifact. If the central repo is not enabled, this will only return files
|
||||||
* with matching MD5 hashes.
|
* from the current case with matching MD5 hashes.
|
||||||
*
|
*
|
||||||
* @param corAttr CorrelationAttribute to query for
|
* @param corAttr CorrelationAttribute to query for
|
||||||
* @param dataSourceName Data source to filter results
|
* @param dataSourceName Data source to filter results
|
||||||
@ -506,19 +509,19 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
*
|
*
|
||||||
* @return A collection of correlated artifact instances
|
* @return A collection of correlated artifact instances
|
||||||
*/
|
*/
|
||||||
private Map<UniquePathKey,OtherOccurrenceNodeData> getCorrelatedInstances(CorrelationAttribute corAttr, String dataSourceName, String deviceId) {
|
private Map<UniquePathKey, OtherOccurrenceNodeInstanceData> getCorrelatedInstances(CorrelationAttribute corAttr, String dataSourceName, String deviceId) {
|
||||||
// @@@ Check exception
|
// @@@ Check exception
|
||||||
try {
|
try {
|
||||||
final Case openCase = Case.getCurrentCase();
|
final Case openCase = Case.getCurrentCase();
|
||||||
String caseUUID = openCase.getName();
|
String caseUUID = openCase.getName();
|
||||||
|
|
||||||
HashMap<UniquePathKey,OtherOccurrenceNodeData> nodeDataMap = new HashMap<>();
|
HashMap<UniquePathKey, OtherOccurrenceNodeInstanceData> nodeDataMap = new HashMap<>();
|
||||||
|
|
||||||
if (EamDb.isEnabled()) {
|
if (EamDb.isEnabled()) {
|
||||||
List<CorrelationAttributeInstance> instances = EamDb.getInstance().getArtifactInstancesByTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue());
|
List<CorrelationAttributeInstance> instances = EamDb.getInstance().getArtifactInstancesByTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue());
|
||||||
|
|
||||||
for (CorrelationAttributeInstance artifactInstance:instances) {
|
for (CorrelationAttributeInstance artifactInstance : instances) {
|
||||||
|
|
||||||
// Only add the attribute if it isn't the object the user selected.
|
// Only add the attribute if it isn't the object the user selected.
|
||||||
// We consider it to be a different object if at least one of the following is true:
|
// We consider it to be a different object if at least one of the following is true:
|
||||||
// - the case UUID is different
|
// - the case UUID is different
|
||||||
@ -530,14 +533,14 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
|| !artifactInstance.getCorrelationDataSource().getDeviceID().equals(deviceId)
|
|| !artifactInstance.getCorrelationDataSource().getDeviceID().equals(deviceId)
|
||||||
|| !artifactInstance.getFilePath().equalsIgnoreCase(file.getParentPath() + file.getName())) {
|
|| !artifactInstance.getFilePath().equalsIgnoreCase(file.getParentPath() + file.getName())) {
|
||||||
|
|
||||||
OtherOccurrenceNodeData newNode = new OtherOccurrenceNodeData(artifactInstance, corAttr.getCorrelationType(), corAttr.getCorrelationValue());
|
OtherOccurrenceNodeInstanceData newNode = new OtherOccurrenceNodeInstanceData(artifactInstance, corAttr.getCorrelationType(), corAttr.getCorrelationValue());
|
||||||
UniquePathKey uniquePathKey = new UniquePathKey(newNode);
|
UniquePathKey uniquePathKey = new UniquePathKey(newNode);
|
||||||
nodeDataMap.put(uniquePathKey, newNode);
|
nodeDataMap.put(uniquePathKey, newNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (corAttr.getCorrelationType().getDisplayName().equals("Files")) {
|
if (corAttr.getCorrelationType().getDisplayName().equals("Files")) {
|
||||||
List<AbstractFile> caseDbFiles = getCaseDbMatches(corAttr, openCase);
|
List<AbstractFile> caseDbFiles = getCaseDbMatches(corAttr, openCase);
|
||||||
|
|
||||||
for (AbstractFile caseDbFile : caseDbFiles) {
|
for (AbstractFile caseDbFile : caseDbFiles) {
|
||||||
@ -560,13 +563,17 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all other abstract files in the current case with the same MD5 as the selected node.
|
* Get all other abstract files in the current case with the same MD5 as the
|
||||||
|
* selected node.
|
||||||
|
*
|
||||||
* @param corAttr The CorrelationAttribute containing the MD5 to search for
|
* @param corAttr The CorrelationAttribute containing the MD5 to search for
|
||||||
* @param openCase The current case
|
* @param openCase The current case
|
||||||
|
*
|
||||||
* @return List of matching AbstractFile objects
|
* @return List of matching AbstractFile objects
|
||||||
|
*
|
||||||
* @throws NoCurrentCaseException
|
* @throws NoCurrentCaseException
|
||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
private List<AbstractFile> getCaseDbMatches(CorrelationAttribute corAttr, Case openCase) throws NoCurrentCaseException, TskCoreException, EamDbException {
|
private List<AbstractFile> getCaseDbMatches(CorrelationAttribute corAttr, Case openCase) throws NoCurrentCaseException, TskCoreException, EamDbException {
|
||||||
String md5 = corAttr.getCorrelationValue();
|
String md5 = corAttr.getCorrelationValue();
|
||||||
@ -586,18 +593,18 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the file to the nodeDataMap map if it does not already exist
|
* Adds the file to the nodeDataMap map if it does not already exist
|
||||||
*
|
*
|
||||||
* @param autopsyCase
|
* @param autopsyCase
|
||||||
* @param nodeDataMap
|
* @param nodeDataMap
|
||||||
* @param newFile
|
* @param newFile
|
||||||
*
|
*
|
||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
private void addOrUpdateNodeData(final Case autopsyCase, Map<UniquePathKey,OtherOccurrenceNodeData> nodeDataMap, AbstractFile newFile) throws TskCoreException, EamDbException {
|
private void addOrUpdateNodeData(final Case autopsyCase, Map<UniquePathKey, OtherOccurrenceNodeInstanceData> nodeDataMap, AbstractFile newFile) throws TskCoreException, EamDbException {
|
||||||
|
|
||||||
OtherOccurrenceNodeData newNode = new OtherOccurrenceNodeData(newFile, autopsyCase);
|
OtherOccurrenceNodeInstanceData newNode = new OtherOccurrenceNodeInstanceData(newFile, autopsyCase);
|
||||||
|
|
||||||
// If the caseDB object has a notable tag associated with it, update
|
// If the caseDB object has a notable tag associated with it, update
|
||||||
// the known status to BAD
|
// the known status to BAD
|
||||||
if (newNode.getKnown() != TskData.FileKnown.BAD) {
|
if (newNode.getKnown() != TskData.FileKnown.BAD) {
|
||||||
@ -613,13 +620,13 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
|
|
||||||
// Make a key to see if the file is already in the map
|
// Make a key to see if the file is already in the map
|
||||||
UniquePathKey uniquePathKey = new UniquePathKey(newNode);
|
UniquePathKey uniquePathKey = new UniquePathKey(newNode);
|
||||||
|
|
||||||
// If this node is already in the list, the only thing we need to do is
|
// If this node is already in the list, the only thing we need to do is
|
||||||
// update the known status to BAD if the caseDB version had known status BAD.
|
// update the known status to BAD if the caseDB version had known status BAD.
|
||||||
// Otherwise this is a new node so add the new node to the map.
|
// Otherwise this is a new node so add the new node to the map.
|
||||||
if (nodeDataMap.containsKey(uniquePathKey)) {
|
if (nodeDataMap.containsKey(uniquePathKey)) {
|
||||||
if (newNode.getKnown() == TskData.FileKnown.BAD) {
|
if (newNode.getKnown() == TskData.FileKnown.BAD) {
|
||||||
OtherOccurrenceNodeData prevInstance = nodeDataMap.get(uniquePathKey);
|
OtherOccurrenceNodeInstanceData prevInstance = nodeDataMap.get(uniquePathKey);
|
||||||
prevInstance.updateKnown(newNode.getKnown());
|
prevInstance.updateKnown(newNode.getKnown());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -642,7 +649,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
} else {
|
} else {
|
||||||
return this.file != null
|
return this.file != null
|
||||||
&& this.file.getSize() > 0
|
&& this.file.getSize() > 0
|
||||||
&& ((this.file.getMd5Hash() != null) && ( ! this.file.getMd5Hash().isEmpty()));
|
&& ((this.file.getMd5Hash() != null) && (!this.file.getMd5Hash().isEmpty()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -665,8 +672,10 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
*
|
*
|
||||||
* @param node The node being viewed.
|
* @param node The node being viewed.
|
||||||
*/
|
*/
|
||||||
@Messages({"DataContentViewerOtherCases.table.isempty=There are no associated artifacts or files from other occurrences to display.",
|
@Messages({
|
||||||
"DataContentViewerOtherCases.table.noArtifacts=Correlation cannot be performed on the selected file."})
|
"DataContentViewerOtherCases.table.noArtifacts=Item has no attributes with which to search.",
|
||||||
|
"DataContentViewerOtherCases.table.noResultsFound=No results found."
|
||||||
|
})
|
||||||
private void populateTable(Node node) {
|
private void populateTable(Node node) {
|
||||||
String dataSourceName = "";
|
String dataSourceName = "";
|
||||||
String deviceId = "";
|
String deviceId = "";
|
||||||
@ -684,7 +693,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
// get the attributes we can correlate on
|
// get the attributes we can correlate on
|
||||||
correlationAttributes.addAll(getCorrelationAttributesFromNode(node));
|
correlationAttributes.addAll(getCorrelationAttributesFromNode(node));
|
||||||
for (CorrelationAttribute corAttr : correlationAttributes) {
|
for (CorrelationAttribute corAttr : correlationAttributes) {
|
||||||
Map<UniquePathKey,OtherOccurrenceNodeData> correlatedNodeDataMap = new HashMap<>(0);
|
Map<UniquePathKey, OtherOccurrenceNodeInstanceData> correlatedNodeDataMap = new HashMap<>(0);
|
||||||
|
|
||||||
// get correlation and reference set instances from DB
|
// get correlation and reference set instances from DB
|
||||||
correlatedNodeDataMap.putAll(getCorrelatedInstances(corAttr, dataSourceName, deviceId));
|
correlatedNodeDataMap.putAll(getCorrelatedInstances(corAttr, dataSourceName, deviceId));
|
||||||
@ -696,36 +705,45 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (correlationAttributes.isEmpty()) {
|
if (correlationAttributes.isEmpty()) {
|
||||||
// @@@ BC: We should have a more descriptive message than this. Mention that the file didn't have a MD5, etc.
|
tableModel.addNodeData(new OtherOccurrenceNodeMessageData(Bundle.DataContentViewerOtherCases_table_noArtifacts()));
|
||||||
displayMessageOnTableStatusPanel(Bundle.DataContentViewerOtherCases_table_noArtifacts());
|
setColumnWidthToText(0, Bundle.DataContentViewerOtherCases_table_noArtifacts());
|
||||||
} else if (0 == tableModel.getRowCount()) {
|
} else if (0 == tableModel.getRowCount()) {
|
||||||
displayMessageOnTableStatusPanel(Bundle.DataContentViewerOtherCases_table_isempty());
|
tableModel.addNodeData(new OtherOccurrenceNodeMessageData(Bundle.DataContentViewerOtherCases_table_noResultsFound()));
|
||||||
|
setColumnWidthToText(0, Bundle.DataContentViewerOtherCases_table_noResultsFound());
|
||||||
} else {
|
} else {
|
||||||
clearMessageOnTableStatusPanel();
|
|
||||||
setColumnWidths();
|
setColumnWidths();
|
||||||
}
|
}
|
||||||
setEarliestCaseDate();
|
setEarliestCaseDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust a given column for the text provided.
|
||||||
|
*
|
||||||
|
* @param columnIndex The index of the column to adjust.
|
||||||
|
* @param text The text whose length will be used to adjust the
|
||||||
|
* column width.
|
||||||
|
*/
|
||||||
|
private void setColumnWidthToText(int columnIndex, String text) {
|
||||||
|
TableColumn column = otherCasesTable.getColumnModel().getColumn(columnIndex);
|
||||||
|
FontMetrics fontMetrics = otherCasesTable.getFontMetrics(otherCasesTable.getFont());
|
||||||
|
int stringWidth = fontMetrics.stringWidth(text);
|
||||||
|
column.setMinWidth(stringWidth + CELL_TEXT_WIDTH_PADDING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adjust column widths to their preferred values.
|
||||||
|
*/
|
||||||
private void setColumnWidths() {
|
private void setColumnWidths() {
|
||||||
for (int idx = 0; idx < tableModel.getColumnCount(); idx++) {
|
for (int idx = 0; idx < tableModel.getColumnCount(); idx++) {
|
||||||
TableColumn column = otherCasesTable.getColumnModel().getColumn(idx);
|
TableColumn column = otherCasesTable.getColumnModel().getColumn(idx);
|
||||||
int colWidth = tableModel.getColumnPreferredWidth(idx);
|
column.setMinWidth(DEFAULT_MIN_CELL_WIDTH);
|
||||||
if (0 < colWidth) {
|
int columnWidth = tableModel.getColumnPreferredWidth(idx);
|
||||||
column.setPreferredWidth(colWidth);
|
if (columnWidth > 0) {
|
||||||
|
column.setPreferredWidth(columnWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayMessageOnTableStatusPanel(String message) {
|
|
||||||
tableStatusPanelLabel.setText(message);
|
|
||||||
tableStatusPanelLabel.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearMessageOnTableStatusPanel() {
|
|
||||||
tableStatusPanelLabel.setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called from within the constructor to initialize the form.
|
* This method is called from within the constructor to initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
@ -749,7 +767,6 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
earliestCaseLabel = new javax.swing.JLabel();
|
earliestCaseLabel = new javax.swing.JLabel();
|
||||||
earliestCaseDate = new javax.swing.JLabel();
|
earliestCaseDate = new javax.swing.JLabel();
|
||||||
tableStatusPanel = new javax.swing.JPanel();
|
tableStatusPanel = new javax.swing.JPanel();
|
||||||
tableStatusPanelLabel = new javax.swing.JLabel();
|
|
||||||
|
|
||||||
rightClickPopupMenu.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
|
rightClickPopupMenu.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
|
||||||
public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
|
public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
|
||||||
@ -811,8 +828,6 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
.addGap(0, 16, Short.MAX_VALUE)
|
.addGap(0, 16, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
tableStatusPanelLabel.setForeground(new java.awt.Color(255, 0, 51));
|
|
||||||
|
|
||||||
javax.swing.GroupLayout tableContainerPanelLayout = new javax.swing.GroupLayout(tableContainerPanel);
|
javax.swing.GroupLayout tableContainerPanelLayout = new javax.swing.GroupLayout(tableContainerPanel);
|
||||||
tableContainerPanel.setLayout(tableContainerPanelLayout);
|
tableContainerPanel.setLayout(tableContainerPanelLayout);
|
||||||
tableContainerPanelLayout.setHorizontalGroup(
|
tableContainerPanelLayout.setHorizontalGroup(
|
||||||
@ -825,20 +840,16 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
.addComponent(earliestCaseLabel)
|
.addComponent(earliestCaseLabel)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(earliestCaseDate)
|
.addComponent(earliestCaseDate)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
.addComponent(tableStatusPanelLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
);
|
||||||
tableContainerPanelLayout.setVerticalGroup(
|
tableContainerPanelLayout.setVerticalGroup(
|
||||||
tableContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
tableContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tableContainerPanelLayout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, tableContainerPanelLayout.createSequentialGroup()
|
||||||
.addComponent(tableScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
|
.addComponent(tableScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
|
||||||
.addGap(0, 0, 0)
|
.addGap(2, 2, 2)
|
||||||
.addGroup(tableContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
.addGroup(tableContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addGroup(tableContainerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addComponent(earliestCaseLabel)
|
||||||
.addComponent(earliestCaseLabel)
|
.addComponent(earliestCaseDate))
|
||||||
.addComponent(earliestCaseDate))
|
|
||||||
.addComponent(tableStatusPanelLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(0, 0, 0)
|
.addGap(0, 0, 0)
|
||||||
.addComponent(tableStatusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(tableStatusPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(0, 0, 0))
|
.addGap(0, 0, 0))
|
||||||
@ -857,7 +868,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
.addGap(0, 483, Short.MAX_VALUE)
|
.addGap(0, 483, Short.MAX_VALUE)
|
||||||
.addGroup(otherCasesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(otherCasesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(otherCasesPanelLayout.createSequentialGroup()
|
.addGroup(otherCasesPanelLayout.createSequentialGroup()
|
||||||
.addComponent(tableContainerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE)
|
.addComponent(tableContainerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE)
|
||||||
.addGap(0, 0, 0)))
|
.addGap(0, 0, 0)))
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -869,7 +880,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(otherCasesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE)
|
.addComponent(otherCasesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
@ -879,8 +890,9 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
if (EamDbUtil.useCentralRepo() && otherCasesTable.getSelectedRowCount() == 1) {
|
if (EamDbUtil.useCentralRepo() && otherCasesTable.getSelectedRowCount() == 1) {
|
||||||
int rowIndex = otherCasesTable.getSelectedRow();
|
int rowIndex = otherCasesTable.getSelectedRow();
|
||||||
OtherOccurrenceNodeData selectedNode = (OtherOccurrenceNodeData) tableModel.getRow(rowIndex);
|
OtherOccurrenceNodeData selectedNode = (OtherOccurrenceNodeData) tableModel.getRow(rowIndex);
|
||||||
if (selectedNode.isCentralRepoNode()) {
|
if (selectedNode instanceof OtherOccurrenceNodeInstanceData) {
|
||||||
enableCentralRepoActions = true;
|
OtherOccurrenceNodeInstanceData instanceData = (OtherOccurrenceNodeInstanceData) selectedNode;
|
||||||
|
enableCentralRepoActions = instanceData.isCentralRepoNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -904,7 +916,6 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
private javax.swing.JPanel tableContainerPanel;
|
private javax.swing.JPanel tableContainerPanel;
|
||||||
private javax.swing.JScrollPane tableScrollPane;
|
private javax.swing.JScrollPane tableScrollPane;
|
||||||
private javax.swing.JPanel tableStatusPanel;
|
private javax.swing.JPanel tableStatusPanel;
|
||||||
private javax.swing.JLabel tableStatusPanelLabel;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -917,7 +928,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
private final String filePath;
|
private final String filePath;
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
UniquePathKey(OtherOccurrenceNodeData nodeData) {
|
UniquePathKey(OtherOccurrenceNodeInstanceData nodeData) {
|
||||||
super();
|
super();
|
||||||
dataSourceID = nodeData.getDeviceID();
|
dataSourceID = nodeData.getDeviceID();
|
||||||
if (nodeData.getFilePath() != null) {
|
if (nodeData.getFilePath() != null) {
|
||||||
@ -931,9 +942,9 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
|
|||||||
@Override
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
if (other instanceof UniquePathKey) {
|
if (other instanceof UniquePathKey) {
|
||||||
UniquePathKey otherKey = (UniquePathKey)(other);
|
UniquePathKey otherKey = (UniquePathKey) (other);
|
||||||
return ( Objects.equals(otherKey.dataSourceID, this.dataSourceID)
|
return (Objects.equals(otherKey.dataSourceID, this.dataSourceID)
|
||||||
&& Objects.equals(otherKey.filePath, this.filePath)
|
&& Objects.equals(otherKey.filePath, this.filePath)
|
||||||
&& Objects.equals(otherKey.type, this.type));
|
&& Objects.equals(otherKey.type, this.type));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Central Repository
|
* Central Repository
|
||||||
*
|
*
|
||||||
* Copyright 2015-2017 Basis Technology Corp.
|
* Copyright 2015-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -22,8 +22,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
|
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for cells in data content viewer table
|
* Model for cells in data content viewer table
|
||||||
@ -34,8 +32,8 @@ public class DataContentViewerOtherCasesTableModel extends AbstractTableModel {
|
|||||||
"DataContentViewerOtherCasesTableModel.device=Device",
|
"DataContentViewerOtherCasesTableModel.device=Device",
|
||||||
"DataContentViewerOtherCasesTableModel.dataSource=Data Source",
|
"DataContentViewerOtherCasesTableModel.dataSource=Data Source",
|
||||||
"DataContentViewerOtherCasesTableModel.path=Path",
|
"DataContentViewerOtherCasesTableModel.path=Path",
|
||||||
"DataContentViewerOtherCasesTableModel.type=Correlation Type",
|
"DataContentViewerOtherCasesTableModel.attribute=Matched Attribute",
|
||||||
"DataContentViewerOtherCasesTableModel.value=Correlation Value",
|
"DataContentViewerOtherCasesTableModel.value=Attribute Value",
|
||||||
"DataContentViewerOtherCasesTableModel.known=Known",
|
"DataContentViewerOtherCasesTableModel.known=Known",
|
||||||
"DataContentViewerOtherCasesTableModel.comment=Comment",
|
"DataContentViewerOtherCasesTableModel.comment=Comment",
|
||||||
"DataContentViewerOtherCasesTableModel.noData=No Data.",})
|
"DataContentViewerOtherCasesTableModel.noData=No Data.",})
|
||||||
@ -44,7 +42,7 @@ public class DataContentViewerOtherCasesTableModel extends AbstractTableModel {
|
|||||||
// If order is changed, update the CellRenderer to ensure correct row coloring.
|
// If order is changed, update the CellRenderer to ensure correct row coloring.
|
||||||
CASE_NAME(Bundle.DataContentViewerOtherCasesTableModel_case(), 100),
|
CASE_NAME(Bundle.DataContentViewerOtherCasesTableModel_case(), 100),
|
||||||
DATA_SOURCE(Bundle.DataContentViewerOtherCasesTableModel_dataSource(), 100),
|
DATA_SOURCE(Bundle.DataContentViewerOtherCasesTableModel_dataSource(), 100),
|
||||||
TYPE(Bundle.DataContentViewerOtherCasesTableModel_type(), 100),
|
ATTRIBUTE(Bundle.DataContentViewerOtherCasesTableModel_attribute(), 125),
|
||||||
VALUE(Bundle.DataContentViewerOtherCasesTableModel_value(), 200),
|
VALUE(Bundle.DataContentViewerOtherCasesTableModel_value(), 200),
|
||||||
KNOWN(Bundle.DataContentViewerOtherCasesTableModel_known(), 50),
|
KNOWN(Bundle.DataContentViewerOtherCasesTableModel_known(), 50),
|
||||||
FILE_PATH(Bundle.DataContentViewerOtherCasesTableModel_path(), 450),
|
FILE_PATH(Bundle.DataContentViewerOtherCasesTableModel_path(), 450),
|
||||||
@ -109,26 +107,41 @@ public class DataContentViewerOtherCasesTableModel extends AbstractTableModel {
|
|||||||
return Bundle.DataContentViewerOtherCasesTableModel_noData();
|
return Bundle.DataContentViewerOtherCasesTableModel_noData();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapValueById(rowIdx, TableColumns.values()[colIdx]);
|
OtherOccurrenceNodeData nodeData = nodeDataList.get(rowIdx);
|
||||||
}
|
TableColumns columnId = TableColumns.values()[colIdx];
|
||||||
|
if (nodeData instanceof OtherOccurrenceNodeMessageData) {
|
||||||
Object getRow(int rowIdx) {
|
return mapNodeMessageData((OtherOccurrenceNodeMessageData) nodeData, columnId);
|
||||||
return nodeDataList.get(rowIdx);
|
}
|
||||||
|
return mapNodeInstanceData((OtherOccurrenceNodeInstanceData) nodeData, columnId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map a rowIdx and colId to the value in that cell.
|
* Map a column ID to the value in that cell for node message data.
|
||||||
*
|
*
|
||||||
* @param rowIdx Index of row to search
|
* @param nodeData The node message data.
|
||||||
* @param colId ID of column to search
|
* @param columnId The ID of the cell column.
|
||||||
*
|
*
|
||||||
* @return value in the cell
|
* @return The value in the cell.
|
||||||
*/
|
*/
|
||||||
private Object mapValueById(int rowIdx, TableColumns colId) {
|
private Object mapNodeMessageData(OtherOccurrenceNodeMessageData nodeData, TableColumns columnId) {
|
||||||
OtherOccurrenceNodeData nodeData = nodeDataList.get(rowIdx);
|
if (columnId == TableColumns.CASE_NAME) {
|
||||||
|
return nodeData.getDisplayMessage();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map a column ID to the value in that cell for node instance data.
|
||||||
|
*
|
||||||
|
* @param nodeData The node instance data.
|
||||||
|
* @param columnId The ID of the cell column.
|
||||||
|
*
|
||||||
|
* @return The value in the cell.
|
||||||
|
*/
|
||||||
|
private Object mapNodeInstanceData(OtherOccurrenceNodeInstanceData nodeData, TableColumns columnId) {
|
||||||
String value = Bundle.DataContentViewerOtherCasesTableModel_noData();
|
String value = Bundle.DataContentViewerOtherCasesTableModel_noData();
|
||||||
|
|
||||||
switch (colId) {
|
switch (columnId) {
|
||||||
case CASE_NAME:
|
case CASE_NAME:
|
||||||
if (null != nodeData.getCaseName()) {
|
if (null != nodeData.getCaseName()) {
|
||||||
value = nodeData.getCaseName();
|
value = nodeData.getCaseName();
|
||||||
@ -147,7 +160,7 @@ public class DataContentViewerOtherCasesTableModel extends AbstractTableModel {
|
|||||||
case FILE_PATH:
|
case FILE_PATH:
|
||||||
value = nodeData.getFilePath();
|
value = nodeData.getFilePath();
|
||||||
break;
|
break;
|
||||||
case TYPE:
|
case ATTRIBUTE:
|
||||||
value = nodeData.getType();
|
value = nodeData.getType();
|
||||||
break;
|
break;
|
||||||
case VALUE:
|
case VALUE:
|
||||||
@ -159,10 +172,16 @@ public class DataContentViewerOtherCasesTableModel extends AbstractTableModel {
|
|||||||
case COMMENT:
|
case COMMENT:
|
||||||
value = nodeData.getComment();
|
value = nodeData.getComment();
|
||||||
break;
|
break;
|
||||||
|
default: // This shouldn't occur! Use default "No data" value.
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Object getRow(int rowIdx) {
|
||||||
|
return nodeDataList.get(rowIdx);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<String> getColumnClass(int colIdx) {
|
public Class<String> getColumnClass(int colIdx) {
|
||||||
return String.class;
|
return String.class;
|
||||||
@ -178,6 +197,9 @@ public class DataContentViewerOtherCasesTableModel extends AbstractTableModel {
|
|||||||
fireTableDataChanged();
|
fireTableDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the node data table.
|
||||||
|
*/
|
||||||
void clearTable() {
|
void clearTable() {
|
||||||
nodeDataList.clear();
|
nodeDataList.clear();
|
||||||
fireTableDataChanged();
|
fireTableDataChanged();
|
||||||
|
213
Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeData.java
Normal file → Executable file
213
Core/src/org/sleuthkit/autopsy/centralrepository/contentviewer/OtherOccurrenceNodeData.java
Normal file → Executable file
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Central Repository
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2018 Basis Technology Corp.
|
* Copyright 2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
@ -18,216 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.centralrepository.contentviewer;
|
package org.sleuthkit.autopsy.centralrepository.contentviewer;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
|
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
|
||||||
import org.sleuthkit.datamodel.DataSource;
|
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
|
||||||
import org.sleuthkit.datamodel.TskData;
|
|
||||||
import org.sleuthkit.datamodel.TskDataException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for populating the Other Occurrences tab
|
* Marker interface for Other Occurrences nodes.
|
||||||
*/
|
*/
|
||||||
class OtherOccurrenceNodeData {
|
interface OtherOccurrenceNodeData {
|
||||||
|
|
||||||
// For now hard code the string for the central repo files type, since
|
|
||||||
// getting it dynamically can fail.
|
|
||||||
private static final String FILE_TYPE_STR = "Files";
|
|
||||||
|
|
||||||
private final String caseName;
|
|
||||||
private String deviceID;
|
|
||||||
private String dataSourceName;
|
|
||||||
private final String filePath;
|
|
||||||
private final String typeStr;
|
|
||||||
private final CorrelationAttribute.Type type;
|
|
||||||
private final String value;
|
|
||||||
private TskData.FileKnown known;
|
|
||||||
private String comment;
|
|
||||||
|
|
||||||
private AbstractFile originalAbstractFile = null;
|
|
||||||
private CorrelationAttributeInstance originalCorrelationInstance = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a node from a central repo instance.
|
|
||||||
* @param instance The central repo instance
|
|
||||||
* @param type The type of the instance
|
|
||||||
* @param value The value of the instance
|
|
||||||
*/
|
|
||||||
OtherOccurrenceNodeData(CorrelationAttributeInstance instance, CorrelationAttribute.Type type, String value) {
|
|
||||||
caseName = instance.getCorrelationCase().getDisplayName();
|
|
||||||
deviceID = instance.getCorrelationDataSource().getDeviceID();
|
|
||||||
dataSourceName = instance.getCorrelationDataSource().getName();
|
|
||||||
filePath = instance.getFilePath();
|
|
||||||
this.typeStr = type.getDisplayName();
|
|
||||||
this.type = type;
|
|
||||||
this.value = value;
|
|
||||||
known = instance.getKnownStatus();
|
|
||||||
comment = instance.getComment();
|
|
||||||
|
|
||||||
originalCorrelationInstance = instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a node from an abstract file.
|
|
||||||
* @param newFile The abstract file
|
|
||||||
* @param autopsyCase The current case
|
|
||||||
* @throws EamDbException
|
|
||||||
*/
|
|
||||||
OtherOccurrenceNodeData(AbstractFile newFile, Case autopsyCase) throws EamDbException {
|
|
||||||
caseName = autopsyCase.getDisplayName();
|
|
||||||
try {
|
|
||||||
DataSource dataSource = autopsyCase.getSleuthkitCase().getDataSource(newFile.getDataSource().getId());
|
|
||||||
deviceID = dataSource.getDeviceId();
|
|
||||||
dataSourceName = dataSource.getName();
|
|
||||||
} catch (TskDataException | TskCoreException ex) {
|
|
||||||
throw new EamDbException("Error loading data source for abstract file ID " + newFile.getId(), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
filePath = newFile.getParentPath() + newFile.getName();
|
|
||||||
typeStr = FILE_TYPE_STR;
|
|
||||||
this.type = null;
|
|
||||||
value = newFile.getMd5Hash();
|
|
||||||
known = newFile.getKnown();
|
|
||||||
comment = "";
|
|
||||||
|
|
||||||
originalAbstractFile = newFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if this node is a "file" type
|
|
||||||
* @return true if it is a file type
|
|
||||||
*/
|
|
||||||
boolean isFileType() {
|
|
||||||
return FILE_TYPE_STR.equals(typeStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the known status for this node
|
|
||||||
* @param newKnownStatus The new known status
|
|
||||||
*/
|
|
||||||
void updateKnown(TskData.FileKnown newKnownStatus) {
|
|
||||||
known = newKnownStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the comment for this node
|
|
||||||
* @param newComment The new comment
|
|
||||||
*/
|
|
||||||
void updateComment(String newComment) {
|
|
||||||
comment = newComment;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if this is a central repo node.
|
|
||||||
* @return true if this node was created from a central repo instance, false otherwise
|
|
||||||
*/
|
|
||||||
boolean isCentralRepoNode() {
|
|
||||||
return (originalCorrelationInstance != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uses the saved instance plus type and value to make a new CorrelationAttribute.
|
|
||||||
* Should only be called if isCentralRepoNode() is true.
|
|
||||||
* @return the newly created CorrelationAttribute
|
|
||||||
*/
|
|
||||||
CorrelationAttribute createCorrelationAttribute() throws EamDbException {
|
|
||||||
if (! isCentralRepoNode() ) {
|
|
||||||
throw new EamDbException("Can not create CorrelationAttribute for non central repo node");
|
|
||||||
}
|
|
||||||
CorrelationAttribute attr = new CorrelationAttribute(type, value);
|
|
||||||
attr.addInstance(originalCorrelationInstance);
|
|
||||||
return attr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the case name
|
|
||||||
* @return the case name
|
|
||||||
*/
|
|
||||||
String getCaseName() {
|
|
||||||
return caseName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the device ID
|
|
||||||
* @return the device ID
|
|
||||||
*/
|
|
||||||
String getDeviceID() {
|
|
||||||
return deviceID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the data source name
|
|
||||||
* @return the data source name
|
|
||||||
*/
|
|
||||||
String getDataSourceName() {
|
|
||||||
return dataSourceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the file path
|
|
||||||
* @return the file path
|
|
||||||
*/
|
|
||||||
String getFilePath() {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type (as a string)
|
|
||||||
* @return the type
|
|
||||||
*/
|
|
||||||
String getType() {
|
|
||||||
return typeStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the value (MD5 hash for files)
|
|
||||||
* @return the value
|
|
||||||
*/
|
|
||||||
String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the known status
|
|
||||||
* @return the known status
|
|
||||||
*/
|
|
||||||
TskData.FileKnown getKnown() {
|
|
||||||
return known;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the comment
|
|
||||||
* @return the comment
|
|
||||||
*/
|
|
||||||
String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the backing abstract file.
|
|
||||||
* Should only be called if isCentralRepoNode() is false
|
|
||||||
* @return the original abstract file
|
|
||||||
*/
|
|
||||||
AbstractFile getAbstractFile() throws EamDbException {
|
|
||||||
if (originalCorrelationInstance == null) {
|
|
||||||
throw new EamDbException("AbstractFile is null");
|
|
||||||
}
|
|
||||||
return originalAbstractFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the backing CorrelationAttributeInstance.
|
|
||||||
* Should only be called if isCentralRepoNode() is true
|
|
||||||
* @return the original CorrelationAttributeInstance
|
|
||||||
* @throws EamDbException
|
|
||||||
*/
|
|
||||||
CorrelationAttributeInstance getCorrelationAttributeInstance() throws EamDbException {
|
|
||||||
if (originalCorrelationInstance == null) {
|
|
||||||
throw new EamDbException("CorrelationAttributeInstance is null");
|
|
||||||
}
|
|
||||||
return originalCorrelationInstance;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,233 @@
|
|||||||
|
/*
|
||||||
|
* Central Repository
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.centralrepository.contentviewer;
|
||||||
|
|
||||||
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
|
||||||
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
|
||||||
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||||
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
|
import org.sleuthkit.datamodel.DataSource;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
import org.sleuthkit.datamodel.TskData;
|
||||||
|
import org.sleuthkit.datamodel.TskDataException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for populating the Other Occurrences tab
|
||||||
|
*/
|
||||||
|
class OtherOccurrenceNodeInstanceData implements OtherOccurrenceNodeData {
|
||||||
|
|
||||||
|
// For now hard code the string for the central repo files type, since
|
||||||
|
// getting it dynamically can fail.
|
||||||
|
private static final String FILE_TYPE_STR = "Files";
|
||||||
|
|
||||||
|
private final String caseName;
|
||||||
|
private String deviceID;
|
||||||
|
private String dataSourceName;
|
||||||
|
private final String filePath;
|
||||||
|
private final String typeStr;
|
||||||
|
private final CorrelationAttribute.Type type;
|
||||||
|
private final String value;
|
||||||
|
private TskData.FileKnown known;
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
private AbstractFile originalAbstractFile = null;
|
||||||
|
private CorrelationAttributeInstance originalCorrelationInstance = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a node from a central repo instance.
|
||||||
|
* @param instance The central repo instance
|
||||||
|
* @param type The type of the instance
|
||||||
|
* @param value The value of the instance
|
||||||
|
*/
|
||||||
|
OtherOccurrenceNodeInstanceData(CorrelationAttributeInstance instance, CorrelationAttribute.Type type, String value) {
|
||||||
|
caseName = instance.getCorrelationCase().getDisplayName();
|
||||||
|
deviceID = instance.getCorrelationDataSource().getDeviceID();
|
||||||
|
dataSourceName = instance.getCorrelationDataSource().getName();
|
||||||
|
filePath = instance.getFilePath();
|
||||||
|
this.typeStr = type.getDisplayName();
|
||||||
|
this.type = type;
|
||||||
|
this.value = value;
|
||||||
|
known = instance.getKnownStatus();
|
||||||
|
comment = instance.getComment();
|
||||||
|
|
||||||
|
originalCorrelationInstance = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a node from an abstract file.
|
||||||
|
* @param newFile The abstract file
|
||||||
|
* @param autopsyCase The current case
|
||||||
|
* @throws EamDbException
|
||||||
|
*/
|
||||||
|
OtherOccurrenceNodeInstanceData(AbstractFile newFile, Case autopsyCase) throws EamDbException {
|
||||||
|
caseName = autopsyCase.getDisplayName();
|
||||||
|
try {
|
||||||
|
DataSource dataSource = autopsyCase.getSleuthkitCase().getDataSource(newFile.getDataSource().getId());
|
||||||
|
deviceID = dataSource.getDeviceId();
|
||||||
|
dataSourceName = dataSource.getName();
|
||||||
|
} catch (TskDataException | TskCoreException ex) {
|
||||||
|
throw new EamDbException("Error loading data source for abstract file ID " + newFile.getId(), ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
filePath = newFile.getParentPath() + newFile.getName();
|
||||||
|
typeStr = FILE_TYPE_STR;
|
||||||
|
this.type = null;
|
||||||
|
value = newFile.getMd5Hash();
|
||||||
|
known = newFile.getKnown();
|
||||||
|
comment = "";
|
||||||
|
|
||||||
|
originalAbstractFile = newFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this node is a "file" type
|
||||||
|
* @return true if it is a file type
|
||||||
|
*/
|
||||||
|
boolean isFileType() {
|
||||||
|
return FILE_TYPE_STR.equals(typeStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the known status for this node
|
||||||
|
* @param newKnownStatus The new known status
|
||||||
|
*/
|
||||||
|
void updateKnown(TskData.FileKnown newKnownStatus) {
|
||||||
|
known = newKnownStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the comment for this node
|
||||||
|
* @param newComment The new comment
|
||||||
|
*/
|
||||||
|
void updateComment(String newComment) {
|
||||||
|
comment = newComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if this is a central repo node.
|
||||||
|
* @return true if this node was created from a central repo instance, false otherwise
|
||||||
|
*/
|
||||||
|
boolean isCentralRepoNode() {
|
||||||
|
return (originalCorrelationInstance != null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses the saved instance plus type and value to make a new CorrelationAttribute.
|
||||||
|
* Should only be called if isCentralRepoNode() is true.
|
||||||
|
* @return the newly created CorrelationAttribute
|
||||||
|
*/
|
||||||
|
CorrelationAttribute createCorrelationAttribute() throws EamDbException {
|
||||||
|
if (! isCentralRepoNode() ) {
|
||||||
|
throw new EamDbException("Can not create CorrelationAttribute for non central repo node");
|
||||||
|
}
|
||||||
|
CorrelationAttribute attr = new CorrelationAttribute(type, value);
|
||||||
|
attr.addInstance(originalCorrelationInstance);
|
||||||
|
return attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the case name
|
||||||
|
* @return the case name
|
||||||
|
*/
|
||||||
|
String getCaseName() {
|
||||||
|
return caseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the device ID
|
||||||
|
* @return the device ID
|
||||||
|
*/
|
||||||
|
String getDeviceID() {
|
||||||
|
return deviceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data source name
|
||||||
|
* @return the data source name
|
||||||
|
*/
|
||||||
|
String getDataSourceName() {
|
||||||
|
return dataSourceName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the file path
|
||||||
|
* @return the file path
|
||||||
|
*/
|
||||||
|
String getFilePath() {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type (as a string)
|
||||||
|
* @return the type
|
||||||
|
*/
|
||||||
|
String getType() {
|
||||||
|
return typeStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value (MD5 hash for files)
|
||||||
|
* @return the value
|
||||||
|
*/
|
||||||
|
String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the known status
|
||||||
|
* @return the known status
|
||||||
|
*/
|
||||||
|
TskData.FileKnown getKnown() {
|
||||||
|
return known;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the comment
|
||||||
|
* @return the comment
|
||||||
|
*/
|
||||||
|
String getComment() {
|
||||||
|
return comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the backing abstract file.
|
||||||
|
* Should only be called if isCentralRepoNode() is false
|
||||||
|
* @return the original abstract file
|
||||||
|
*/
|
||||||
|
AbstractFile getAbstractFile() throws EamDbException {
|
||||||
|
if (originalCorrelationInstance == null) {
|
||||||
|
throw new EamDbException("AbstractFile is null");
|
||||||
|
}
|
||||||
|
return originalAbstractFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the backing CorrelationAttributeInstance.
|
||||||
|
* Should only be called if isCentralRepoNode() is true
|
||||||
|
* @return the original CorrelationAttributeInstance
|
||||||
|
* @throws EamDbException
|
||||||
|
*/
|
||||||
|
CorrelationAttributeInstance getCorrelationAttributeInstance() throws EamDbException {
|
||||||
|
if (originalCorrelationInstance == null) {
|
||||||
|
throw new EamDbException("CorrelationAttributeInstance is null");
|
||||||
|
}
|
||||||
|
return originalCorrelationInstance;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.sleuthkit.autopsy.centralrepository.contentviewer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for populating the Other Occurrences tab with a single message.
|
||||||
|
*/
|
||||||
|
final class OtherOccurrenceNodeMessageData implements OtherOccurrenceNodeData {
|
||||||
|
private final String displayMessage;
|
||||||
|
|
||||||
|
OtherOccurrenceNodeMessageData(String displayMessage) {
|
||||||
|
this.displayMessage = displayMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getDisplayMessage() {
|
||||||
|
return displayMessage;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user