Pass Content object through to ResultsTableArtifact to eliminate unnecessary database queries and File object creation.

This commit is contained in:
esaunders 2017-07-24 16:39:14 -04:00
parent 0a34be3bd8
commit 1ea1d24d69

View File

@ -491,18 +491,19 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
private final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private final SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private String[][] rowData = null; private String[][] rowData = null;
private final String artifactDisplayName; private final String artifactDisplayName;
private final Content content;
ResultsTableArtifact(BlackboardArtifact artifact) { ResultsTableArtifact(BlackboardArtifact artifact, Content content) {
artifactDisplayName = artifact.getDisplayName(); artifactDisplayName = artifact.getDisplayName();
this.content = content;
addRows(artifact); addRows(artifact);
} }
ResultsTableArtifact(String errorMsg) { ResultsTableArtifact(String errorMsg) {
artifactDisplayName = errorMsg; artifactDisplayName = errorMsg;
rowData = new String[1][3]; rowData = new String[1][3];
rowData[0] = new String[]{"", errorMsg, ""}; rowData[0] = new String[]{"", errorMsg, ""};
content = null;
} }
private String[][] getRows() { private String[][] getRows() {
@ -512,7 +513,6 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
private void addRows(BlackboardArtifact artifact) { private void addRows(BlackboardArtifact artifact) {
List<String[]> rowsToAdd = new ArrayList<>(); List<String[]> rowsToAdd = new ArrayList<>();
try { try {
Content content = artifact.getSleuthkitCase().getContentById(artifact.getObjectID());
/* /*
* Add rows for each attribute. * Add rows for each attribute.
*/ */
@ -716,7 +716,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
// Build the new artifact contents cache. // Build the new artifact contents cache.
ArrayList<ResultsTableArtifact> artifactContents = new ArrayList<>(); ArrayList<ResultsTableArtifact> artifactContents = new ArrayList<>();
for (BlackboardArtifact artifact : artifacts) { for (BlackboardArtifact artifact : artifacts) {
artifactContents.add(new ResultsTableArtifact(artifact)); artifactContents.add(new ResultsTableArtifact(artifact, content));
} }
// If the node has an underlying blackboard artifact, show it. If not, // If the node has an underlying blackboard artifact, show it. If not,