20 package org.sleuthkit.autopsy.commonfilesearch;
 
   23 import java.util.ArrayList;
 
   24 import java.util.List;
 
   25 import java.util.Optional;
 
   26 import java.util.logging.Level;
 
   52         this.crFileId = attrInstId;
 
   63         this.currentAttribute = attribute;
 
   67     AbstractFile getAbstractFile() {
 
   70         if (this.currentAttribute != null) {
 
   72             final CorrelationAttributeInstance currentAttributeInstance = this.
currentAttribute;
 
   75                 String currentFullPath = currentAttributeInstance.
getFilePath();
 
   76                 currentCase = Case.getCurrentCaseThrows();
 
   79                 if (currentCase.getName().equals(currentAttributeInstance.getCorrelationCase().getCaseUUID())) {
 
   80                     SleuthkitCase tskDb = currentCase.getSleuthkitCase();
 
   83                     Optional<DataSource> 
dataSource = tskDb.getDataSources().stream()
 
   86                     if (!dataSource.isPresent()) {
 
   91                     File fileFromPath = 
new File(currentFullPath);
 
   92                     String fileName = fileFromPath.getName();
 
   95                     String parentPath = fileFromPath.getParent();
 
   96                     if (!parentPath.endsWith(File.separator)) {
 
   97                         parentPath += File.separator;
 
   99                     parentPath = parentPath.replace(
"\\", 
"/");
 
  100                     final String whereClause = String.format(
"lower(name) = '%s' AND lower(parent_path) = '%s' AND data_source_obj_id = %s", fileName, parentPath, dataSource.get().getId());
 
  101                     List<AbstractFile> potentialAbstractFiles = tskDb.findAllFilesWhere(whereClause);
 
  103                     if (potentialAbstractFiles.isEmpty()) {
 
  105                     } 
else if (potentialAbstractFiles.size() > 1) {
 
  106                         LOGGER.log(Level.WARNING, String.format(
"Unable to find an exact match for AbstractFile for record with filePath: %s.  May have returned the wrong file.", 
new Object[]{currentFullPath}));
 
  107                         return potentialAbstractFiles.get(0);
 
  109                         return potentialAbstractFiles.get(0);
 
  114             } 
catch (TskCoreException | NoCurrentCaseException ex) {
 
  115                 LOGGER.log(Level.SEVERE, String.format(
"Unable to find AbstractFile for record with filePath: %s.  Node not created.", 
new Object[]{currentAttributeInstance.getFilePath()}), ex);
 
  126         List<DisplayableItemNode> attrInstNodeList = 
new ArrayList<>(0);
 
  129             AbstractFile abstractFileForAttributeInstance = this.getAbstractFile();
 
  131             attrInstNodeList.add(generatedInstNode);
 
  132         } 
catch (TskCoreException ex) {
 
  133             LOGGER.log(Level.SEVERE, String.format(
"Unable to get DataSource for record with md5: %s.  Node not created.", 
new Object[]{currentAttribute.getCorrelationValue()}), ex);
 
CorrelationAttributeInstance currentAttribute
 
DisplayableItemNode[] generateNodes()
 
final CorrelationAttributeInstance.Type correlationType
 
CorrelationAttributeInstance.Type getCorrelationAttributeInstanceType()
 
static final Logger LOGGER
 
CorrelationDataSource getCorrelationDataSource()
 
Long getDataSourceObjectID()
 
static Case getCurrentCase()
 
synchronized static Logger getLogger(String name)