file association works now

This commit is contained in:
Samuel H. Kenyon 2014-04-29 14:01:51 -04:00
parent a1b25bd900
commit 4bfc6ad8af
2 changed files with 11 additions and 6 deletions

View File

@ -78,7 +78,7 @@ public class ExternalResultsIngestModule extends IngestModuleAdapter implements
}
///@todo use a standard name or search for an XML file
importFilePath = importPath + File.separator + "ext-test5.xml";
importFilePath = importPath + File.separator + "ext-test6.xml";
}
}

View File

@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.ingest.IngestServices;
@ -99,13 +98,19 @@ public class ExternalResultsUtility {
}
}
// get associated file (if any) to use as the content
// Get associated file (if any) to use as the content obj to attach the artifact to
Content currContent = null;
//for (String filePath : art.files) {
if (art.files.size() > 0) {
String filePath = art.files.get(0).path;
List<AbstractFile> files = Case.getCurrentCase().getSleuthkitCase().findFiles(defaultDataSource, filePath);
String fileName = filePath;
String parentPath = "";
int charPos = filePath.lastIndexOf("/");
if (charPos > 0) {
fileName = filePath.substring(charPos + 1);
parentPath = filePath.substring(0, charPos + 1);
}
String whereQuery = "name='" + fileName + "' AND parent_path='" + parentPath + "'"; //NON-NLS
List<AbstractFile> files = Case.getCurrentCase().getSleuthkitCase().findAllFilesWhere(whereQuery);
if (files.size() > 0) {
currContent = files.get(0);
if (files.size() > 1) {