clarify comments

This commit is contained in:
millmanorama 2016-09-28 13:43:52 +02:00
parent 905975e568
commit c78dab32a0
2 changed files with 26 additions and 16 deletions

View File

@ -266,10 +266,10 @@ class ReportHTML implements TableReportModule {
} }
} else if (dataType.startsWith(ARTIFACT_TYPE.TSK_ACCOUNT.getDisplayName())) { } else if (dataType.startsWith(ARTIFACT_TYPE.TSK_ACCOUNT.getDisplayName())) {
/* TSK_ACCOUNT artifacts get separated by their TSK_ACCOUNT_TYPE /* TSK_ACCOUNT artifacts get separated by their TSK_ACCOUNT_TYPE
* attribute, with a compound dataType name, so they are not caught * attribute, with a synthetic compound dataType name, so they are
* by the switch statement above. For now we just give them all the * not caught by the switch statement above. For now we just give
* general account icon, but we could do something else in the * them all the general account icon, but we could do something else
* future. * in the future.
*/ */
in = getClass().getResourceAsStream("/org/sleuthkit/autopsy/report/images/accounts.png"); //NON-NLS in = getClass().getResourceAsStream("/org/sleuthkit/autopsy/report/images/accounts.png"); //NON-NLS
iconFileName = "accounts.png"; //NON-NLS iconFileName = "accounts.png"; //NON-NLS

View File

@ -18,7 +18,9 @@
*/ */
package org.sleuthkit.autopsy.report; package org.sleuthkit.autopsy.report;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Multimaps;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
@ -35,7 +37,6 @@ import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Collectors;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.EscapeUtil; import org.sleuthkit.autopsy.coreutils.EscapeUtil;
@ -157,21 +158,30 @@ class TableReportGenerator {
} }
/* TSK_ACCOUNT artifacts get grouped by their TSK_ACCOUNT_TYPE /* TSK_ACCOUNT artifacts get grouped by their TSK_ACCOUNT_TYPE
* attribute, and then handed off the default method for writing * attribute, and then handed off to the standard method for writing
* tables. */ * tables. */
if (type.getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) { if (type.getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getTypeID()) {
Map<String, List<ArtifactData>> collect = artifactList.stream().collect(Collectors.groupingBy((ArtifactData artifactData) -> { //Group account artifacts by their account type
try { ListMultimap<String, ArtifactData> groupedArtifacts = Multimaps.index(artifactList,
return artifactData.getArtifact().getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE)).getValueString(); artifactData -> {
} catch (TskCoreException ex) { try {
logger.log(Level.SEVERE, "Unable to get value of TSK_ACCOUNT_TYPE attribute. Defaulting to \"unknown\"", ex); return artifactData.getArtifact().getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ACCOUNT_TYPE)).getValueString();
return "unknown"; } catch (TskCoreException ex) {
} logger.log(Level.SEVERE, "Unable to get value of TSK_ACCOUNT_TYPE attribute. Defaulting to \"unknown\"", ex);
})); return "unknown";
for (Map.Entry<String, List<ArtifactData>> x : collect.entrySet()) { }
writeTableForDataType(x.getValue(), type, BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getDisplayName() + ": " + x.getKey(), comment); });
for (String accountType : groupedArtifacts.keySet()) {
/* If the report is a ReportHTML, the data type name
* eventualy makes it to useDataTypeIcon which expects but
* does not require a artifact name, so we make a synthetic
* compund name by appending a ":" and the account type.
*/
final String compundDataTypeName = BlackboardArtifact.ARTIFACT_TYPE.TSK_ACCOUNT.getDisplayName() + ": " + accountType;
writeTableForDataType(groupedArtifacts.get(accountType), type, compundDataTypeName, comment);
} }
} else { } else {
//all other artifact types are sent to writeTableForDataType directly
writeTableForDataType(artifactList, type, type.getDisplayName(), comment); writeTableForDataType(artifactList, type, type.getDisplayName(), comment);
} }
} }