code cleanup

This commit is contained in:
Brian Sweeney 2018-05-25 08:40:07 -06:00
parent 16a2b2770d
commit db341a9cb0

View File

@ -37,23 +37,25 @@ import static org.sleuthkit.autopsy.timeline.datamodel.eventtype.ArtifactEventTy
import org.sleuthkit.datamodel.HashUtility;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Provides logic for selecting common files from all data sources and all cases in the Central Repo.
* Provides logic for selecting common files from all data sources and all cases
* in the Central Repo.
*/
public abstract class EamDbCommonFilesAlgorithm extends CommonFilesMetadataBuilder {
public abstract class EamDbCommonFilesAlgorithm extends CommonFilesMetadataBuilder {
private static final String WHERE_CLAUSE = "%s md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL)%s GROUP BY md5) order by md5"; //NON-NLS
private final EamDb dbManager;
/**
* Implements the algorithm for getting common files across all data
* sources and all cases. Can filter on mime types conjoined by logical AND.
* Implements the algorithm for getting common files across all data sources
* and all cases. Can filter on mime types conjoined by logical AND.
*
* @param dataSourceIdMap a map of obj_id to datasource name
* @param filterByMediaMimeType match only on files whose mime types can be broadly categorized as media types
* @param filterByDocMimeType match only on files whose mime types can be broadly categorized as document types
* @param filterByMediaMimeType match only on files whose mime types can be
* broadly categorized as media types
* @param filterByDocMimeType match only on files whose mime types can be
* broadly categorized as document types
*
* @throws EamDbException
*/
@ -69,7 +71,7 @@ public abstract class EamDbCommonFilesAlgorithm extends CommonFilesMetadataBuil
}
protected CommonFilesMetadata findFiles(CorrelationCase correlationCase) throws TskCoreException, NoCurrentCaseException, SQLException, EamDbException, Exception {
Map<String, Md5Metadata> currentCaseMetadata = getMetadataForCurrentCase();
Map<String, Md5Metadata> currentCaseMetadata = getMetadataForCurrentCase();
Collection<String> values = currentCaseMetadata.keySet();
Map<String, Md5Metadata> interCaseCommonFiles = new HashMap<>();
@ -88,8 +90,8 @@ public abstract class EamDbCommonFilesAlgorithm extends CommonFilesMetadataBuil
private Map<String, Md5Metadata> getMetadataForCurrentCase() throws NoCurrentCaseException, TskCoreException, SQLException, Exception {
//we need the list of files in the present case so we can compare against the central repo
CommonFilesMetadata metaData = super.findFiles();
Map<String, Md5Metadata> commonFiles = metaData.getMetadata();
CommonFilesMetadata metaData = super.findFiles();
Map<String, Md5Metadata> commonFiles = metaData.getMetadata();
return commonFiles;
}
@ -142,8 +144,8 @@ public abstract class EamDbCommonFilesAlgorithm extends CommonFilesMetadataBuil
}
protected CorrelationCase getCorrelationCaseFromId(int correlationCaseId) throws EamDbException, Exception {
for(CorrelationCase cCase : this.dbManager.getCases()){
if(cCase.getID() == correlationCaseId){
for (CorrelationCase cCase : this.dbManager.getCases()) {
if (cCase.getID() == correlationCaseId) {
return cCase;
}
}