From bf8955ee7fc68cd3d18962ff6531af4d2501285a Mon Sep 17 00:00:00 2001 From: APriestman Date: Thu, 12 Mar 2015 13:27:51 -0400 Subject: [PATCH] Restored new versions of GroupManager.java and SummaryTablePane.java --- .../imageanalyzer/grouping/GroupManager.java | 15 +++++++++++---- .../imageanalyzer/gui/SummaryTablePane.java | 3 +-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ImageAnalyzer/src/org/sleuthkit/autopsy/imageanalyzer/grouping/GroupManager.java b/ImageAnalyzer/src/org/sleuthkit/autopsy/imageanalyzer/grouping/GroupManager.java index 75513483fd..31fc425b82 100644 --- a/ImageAnalyzer/src/org/sleuthkit/autopsy/imageanalyzer/grouping/GroupManager.java +++ b/ImageAnalyzer/src/org/sleuthkit/autopsy/imageanalyzer/grouping/GroupManager.java @@ -503,8 +503,6 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener { } } - //System.out.println("countAllFiles: " + db.countAllFiles()); - //System.out.println("countFiles: " + db.countFiles()); return db.findAllFileIdsWhere("obj_id NOT IN (" + StringUtils.join(files, ',') + ")"); } else { @@ -515,7 +513,6 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener { files.add(ct.getContent().getId()); } } - //System.out.println(" Found " + files.size() + " files in category " + category.getDisplayName()); return files; } @@ -525,11 +522,21 @@ public class GroupManager implements FileUpdateEvent.FileUpdateListener { } } + /** + * Count the number of files with the given category. + * This is faster than getFileIDsWithCategory and should be used if only the + * counts are needed and not the file IDs. + * @param category Category to match against + * @return Number of files with the given category + * @throws TskCoreException + */ public int countFilesWithCategory(Category category) throws TskCoreException { try { if (category == Category.ZERO) { - //List files = new ArrayList<>(); + // It is unlikely that Category Zero (Uncategorized) files will be tagged as such - + // this is really just the default setting. So we count the number of files + // tagged with the other categories and subtract from the total. int allOtherCatCount = 0; TagName[] tns = {Category.FOUR.getTagName(), Category.THREE.getTagName(), Category.TWO.getTagName(), Category.ONE.getTagName(), Category.FIVE.getTagName()}; for (TagName tn : tns) { diff --git a/ImageAnalyzer/src/org/sleuthkit/autopsy/imageanalyzer/gui/SummaryTablePane.java b/ImageAnalyzer/src/org/sleuthkit/autopsy/imageanalyzer/gui/SummaryTablePane.java index 39f50556fe..df31e5bd59 100644 --- a/ImageAnalyzer/src/org/sleuthkit/autopsy/imageanalyzer/gui/SummaryTablePane.java +++ b/ImageAnalyzer/src/org/sleuthkit/autopsy/imageanalyzer/gui/SummaryTablePane.java @@ -105,8 +105,7 @@ public class SummaryTablePane extends AnchorPane implements Category.CategoryLis for (Category cat : Category.values()) { try { - //data.add(new Pair<>(cat, ImageAnalyzerController.getDefault().getGroupManager().getFileIDsWithCategory(cat).size())); - data.add(new Pair<>(cat, ImageAnalyzerController.getDefault().getGroupManager().countFilesWithCategory(cat))); + data.add(new Pair<>(cat, ImageAnalyzerController.getDefault().getGroupManager().countFilesWithCategory(cat))); } catch (TskCoreException ex) { Exceptions.printStackTrace(ex); }