mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
more tag/category autopsy integeration
update CategoryCounts, FollowUp and Category border on general Tag Event use most severe category if multiple categories are present for a file enforce category ordering via enum declaration order
This commit is contained in:
parent
961e08501f
commit
48d455bf29
@ -28,14 +28,17 @@ import org.sleuthkit.datamodel.TagName;
|
||||
/**
|
||||
* Enum to represent the six categories in the DHs image categorization scheme.
|
||||
*/
|
||||
public enum Category implements Comparable<Category> {
|
||||
public enum Category {
|
||||
|
||||
ZERO(Color.LIGHTGREY, 0, "CAT-0: Uncategorized"),
|
||||
/* This order of declaration is required so that Enum's compareTo method
|
||||
* preserves the fact that lower category numbers are first/most sever,
|
||||
* except 0 which is last */
|
||||
ONE(Color.RED, 1, "CAT-1: Child Exploitation (Illegal)"),
|
||||
TWO(Color.ORANGE, 2, "CAT-2: Child Exploitation (Non-Illegal/Age Difficult)"),
|
||||
THREE(Color.YELLOW, 3, "CAT-3: CGI/Animation (Child Exploitive)"),
|
||||
FOUR(Color.BISQUE, 4, "CAT-4: Exemplar/Comparison (Internal Use Only)"),
|
||||
FIVE(Color.GREEN, 5, "CAT-5: Non-pertinent");
|
||||
FIVE(Color.GREEN, 5, "CAT-5: Non-pertinent"),
|
||||
ZERO(Color.LIGHTGREY, 0, "CAT-0: Uncategorized");
|
||||
|
||||
/** map from displayName to enum value */
|
||||
private static final Map<String, Category> nameMap
|
||||
|
@ -268,22 +268,21 @@ public abstract class DrawableFile<T extends AbstractFile> extends AbstractFile
|
||||
return category;
|
||||
}
|
||||
|
||||
public void updateCategory() {
|
||||
/** set the category property to the most severe one found */
|
||||
private void updateCategory() {
|
||||
try {
|
||||
category.set(getSleuthkitCase().getContentTagsByContent(this).stream()
|
||||
.map(Tag::getName).filter(Category::isCategoryTagName)
|
||||
.findFirst()
|
||||
.map(TagName::getDisplayName)
|
||||
.map(Category::fromDisplayName)
|
||||
.sorted().findFirst() //sort by severity and take the first
|
||||
.orElse(Category.ZERO)
|
||||
);
|
||||
|
||||
} catch (TskCoreException ex) {
|
||||
Logger.getLogger(DrawableFile.class.getName()).log(Level.WARNING, "problem looking up category for file " + this.getName(), ex);
|
||||
} catch (IllegalStateException ex) {
|
||||
// We get here many times if the case is closed during ingest, so don't print out a ton of warnings.
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public abstract Image getThumbnail();
|
||||
|
@ -108,15 +108,19 @@ public interface DrawableView {
|
||||
|
||||
@ThreadConfined(type = ThreadConfined.ThreadType.ANY)
|
||||
default Category updateCategoryBorder() {
|
||||
final Category category = getFile().getCategory();
|
||||
final Border border = hasHashHit() && (category == Category.ZERO)
|
||||
? HASH_BORDER
|
||||
: getCategoryBorder(category);
|
||||
if (getFile() != null) {
|
||||
final Category category = getFile().getCategory();
|
||||
final Border border = hasHashHit() && (category == Category.ZERO)
|
||||
? HASH_BORDER
|
||||
: getCategoryBorder(category);
|
||||
|
||||
Platform.runLater(() -> {
|
||||
getCategoryBorderRegion().setBorder(border);
|
||||
getCategoryBorderRegion().requestLayout();
|
||||
});
|
||||
return category;
|
||||
Platform.runLater(() -> {
|
||||
getCategoryBorderRegion().setBorder(border);
|
||||
getCategoryBorderRegion().requestLayout();
|
||||
});
|
||||
return category;
|
||||
} else {
|
||||
return Category.ZERO;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2013-14 Basis Technology Corp.
|
||||
* Copyright 2013-15 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -302,7 +302,7 @@ public abstract class DrawableViewBase extends AnchorPane implements DrawableVie
|
||||
|
||||
@Override
|
||||
synchronized public void handleTagsChanged(TagsChangeEvent evnt) {
|
||||
if (fileID != null && evnt.getFileIDs().contains(fileID)) {
|
||||
if (fileID != null && (evnt.getFileIDs().contains(fileID) || evnt.getFileIDs().contains(-1L))) {
|
||||
updateFollowUpIcon();
|
||||
}
|
||||
}
|
||||
@ -386,7 +386,7 @@ public abstract class DrawableViewBase extends AnchorPane implements DrawableVie
|
||||
@Subscribe
|
||||
@Override
|
||||
synchronized public void handleCategoryChanged(CategoryChangeEvent evt) {
|
||||
if (evt.getFileIDs().contains(getFileID())) {
|
||||
if (evt.getFileIDs().contains(getFileID()) || evt.getFileIDs().contains(-1L)) {
|
||||
updateCategoryBorder();
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public class MetaDataPane extends AnchorPane implements DrawableView {
|
||||
@Subscribe
|
||||
@Override
|
||||
public void handleCategoryChanged(CategoryChangeEvent evt) {
|
||||
if (getFile() != null && evt.getFileIDs().contains(getFileID())) {
|
||||
if (getFile() != null && (evt.getFileIDs().contains(-1L) || evt.getFileIDs().contains(getFileID()))) {
|
||||
updateUI();
|
||||
}
|
||||
}
|
||||
@ -233,7 +233,7 @@ public class MetaDataPane extends AnchorPane implements DrawableView {
|
||||
@Override
|
||||
@Subscribe
|
||||
public void handleTagsChanged(TagsChangeEvent evt) {
|
||||
if (getFile() != null && evt.getFileIDs().contains(getFileID())) {
|
||||
if (getFile() != null && (evt.getFileIDs().contains(-1L) || evt.getFileIDs().contains(getFileID()))) {
|
||||
updateUI();
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ public class SummaryTablePane extends AnchorPane {
|
||||
|
||||
//register for category events
|
||||
controller.getCategoryManager().registerListener(this);
|
||||
handleCategoryChanged(null);
|
||||
}
|
||||
|
||||
public SummaryTablePane(ImageGalleryController controller) {
|
||||
@ -88,10 +89,6 @@ public class SummaryTablePane extends AnchorPane {
|
||||
*/
|
||||
@Subscribe
|
||||
public void handleCategoryChanged(CategoryChangeEvent evt) {
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
final ObservableList<Pair<Category, Long>> data = FXCollections.observableArrayList();
|
||||
if (Case.isCaseOpen()) {
|
||||
for (Category cat : Category.values()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user