mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
added new getArtifactBadInstances method to eamdb
This commit is contained in:
parent
e2a1f9fcdd
commit
ebceb7e90d
@ -1245,6 +1245,55 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
|
|
||||||
return artifactInstances;
|
return artifactInstances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CorrelationAttributeInstance> getArtifactInstancesKnownBad(CorrelationAttribute.Type aType) throws EamDbException {
|
||||||
|
if (aType == null) {
|
||||||
|
throw new EamDbException("Correlation type is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
Connection conn = connect();
|
||||||
|
|
||||||
|
List<CorrelationAttributeInstance> artifactInstances = new ArrayList<>();
|
||||||
|
|
||||||
|
CorrelationAttributeInstance artifactInstance;
|
||||||
|
PreparedStatement preparedStatement = null;
|
||||||
|
ResultSet resultSet = null;
|
||||||
|
|
||||||
|
String tableName = EamDbUtil.correlationTypeToInstanceTableName(aType);
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("SELECT cases.case_name, cases.case_uid, data_sources.name, device_id, file_path, known_status, comment, data_sources.case_id FROM ");
|
||||||
|
sql.append(tableName);
|
||||||
|
sql.append(" LEFT JOIN cases ON ");
|
||||||
|
sql.append(tableName);
|
||||||
|
sql.append(".case_id=cases.id");
|
||||||
|
sql.append(" LEFT JOIN data_sources ON ");
|
||||||
|
sql.append(tableName);
|
||||||
|
sql.append(".data_source_id=data_sources.id");
|
||||||
|
sql.append(" WHERE known_status=?");
|
||||||
|
sql.append(" GROUP BY ");
|
||||||
|
sql.append(tableName);
|
||||||
|
sql.append(".value");
|
||||||
|
|
||||||
|
try {
|
||||||
|
preparedStatement = conn.prepareStatement(sql.toString());
|
||||||
|
preparedStatement.setByte(1, TskData.FileKnown.BAD.getFileKnownValue());
|
||||||
|
resultSet = preparedStatement.executeQuery();
|
||||||
|
while (resultSet.next()) {
|
||||||
|
artifactInstance = getEamArtifactInstanceFromResultSet(resultSet);
|
||||||
|
artifactInstances.add(artifactInstance);
|
||||||
|
}
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
throw new EamDbException("Error getting notable artifact instances.", ex); // NON-NLS
|
||||||
|
} finally {
|
||||||
|
EamDbUtil.closePreparedStatement(preparedStatement);
|
||||||
|
EamDbUtil.closeResultSet(resultSet);
|
||||||
|
EamDbUtil.closeConnection(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return artifactInstances;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count matching eamArtifacts instances that have knownStatus = "Bad".
|
* Count matching eamArtifacts instances that have knownStatus = "Bad".
|
||||||
|
@ -329,6 +329,7 @@ public interface EamDb {
|
|||||||
*/
|
*/
|
||||||
List<CorrelationAttributeInstance> getArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException;
|
List<CorrelationAttributeInstance> getArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException;
|
||||||
|
|
||||||
|
List<CorrelationAttributeInstance> getArtifactInstancesKnownBad(CorrelationAttribute.Type aType) throws EamDbException;
|
||||||
/**
|
/**
|
||||||
* Count matching eamArtifacts instances that have knownStatus = "Bad".
|
* Count matching eamArtifacts instances that have knownStatus = "Bad".
|
||||||
*
|
*
|
||||||
|
@ -590,6 +590,16 @@ public class SqliteEamDb extends AbstractSqlEamDb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CorrelationAttributeInstance> getArtifactInstancesKnownBad(CorrelationAttribute.Type aType) throws EamDbException {
|
||||||
|
try{
|
||||||
|
acquireSharedLock();
|
||||||
|
return super.getArtifactInstancesKnownBad(aType);
|
||||||
|
} finally {
|
||||||
|
releaseSharedLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count matching eamArtifacts instances that have knownStatus = "Bad".
|
* Count matching eamArtifacts instances that have knownStatus = "Bad".
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user