mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Merge pull request #3220 from wschaeferB/3199-ConsolidateDefaultTags
3199 consolidate default tags
This commit is contained in:
commit
ec2e1a8df0
@ -304,7 +304,6 @@
|
|||||||
<package>org.sleuthkit.autopsy.corecomponents</package>
|
<package>org.sleuthkit.autopsy.corecomponents</package>
|
||||||
<package>org.sleuthkit.autopsy.coreutils</package>
|
<package>org.sleuthkit.autopsy.coreutils</package>
|
||||||
<package>org.sleuthkit.autopsy.datamodel</package>
|
<package>org.sleuthkit.autopsy.datamodel</package>
|
||||||
<package>org.sleuthkit.autopsy.datamodel.tags</package>
|
|
||||||
<package>org.sleuthkit.autopsy.datasourceprocessors</package>
|
<package>org.sleuthkit.autopsy.datasourceprocessors</package>
|
||||||
<package>org.sleuthkit.autopsy.directorytree</package>
|
<package>org.sleuthkit.autopsy.directorytree</package>
|
||||||
<package>org.sleuthkit.autopsy.events</package>
|
<package>org.sleuthkit.autopsy.events</package>
|
||||||
|
@ -24,13 +24,14 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.logging.Level;
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
import org.openide.util.Exceptions;
|
|
||||||
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.Logger;
|
||||||
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
|
||||||
import org.sleuthkit.datamodel.TagName;
|
import org.sleuthkit.datamodel.TagName;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.sleuthkit.datamodel.TskData;
|
import org.sleuthkit.datamodel.TskData;
|
||||||
@ -41,17 +42,18 @@ import org.sleuthkit.datamodel.TskData;
|
|||||||
@Immutable
|
@Immutable
|
||||||
final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
|
final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(TagNameDefiniton.class.getName());
|
||||||
@NbBundle.Messages({"TagNameDefiniton.predefTagNames.bookmark.text=Bookmark",
|
@NbBundle.Messages({"TagNameDefiniton.predefTagNames.bookmark.text=Bookmark",
|
||||||
"TagNameDefiniton.predefTagNames.followUp.text=Follow Up",
|
"TagNameDefiniton.predefTagNames.followUp.text=Follow Up",
|
||||||
"TagNameDefiniton.predefTagNames.notableItem.text=Notable Item"})
|
"TagNameDefiniton.predefTagNames.notableItem.text=Notable Item"})
|
||||||
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
|
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
|
||||||
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
|
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
|
||||||
|
|
||||||
private static final List<String> STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
|
private static final List<String> STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), DhsImageCategory.ONE.getDisplayName(), DhsImageCategory.TWO.getDisplayName(), DhsImageCategory.THREE.getDisplayName()); // NON-NLS
|
||||||
private static final List<String> STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_bookmark_text(), Bundle.TagNameDefiniton_predefTagNames_followUp_text(),
|
private static final List<String> STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_bookmark_text(), Bundle.TagNameDefiniton_predefTagNames_followUp_text(),
|
||||||
Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(),
|
Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), DhsImageCategory.ONE.getDisplayName(),
|
||||||
Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
|
DhsImageCategory.TWO.getDisplayName(), DhsImageCategory.THREE.getDisplayName(),
|
||||||
Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
|
DhsImageCategory.FOUR.getDisplayName(), DhsImageCategory.FIVE.getDisplayName());
|
||||||
private final String displayName;
|
private final String displayName;
|
||||||
private final String description;
|
private final String description;
|
||||||
private final TagName.HTML_COLOR color;
|
private final TagName.HTML_COLOR color;
|
||||||
@ -182,7 +184,7 @@ final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
|
|||||||
try {
|
try {
|
||||||
tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted);
|
tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
Exceptions.printStackTrace(ex);
|
LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex);
|
||||||
}
|
}
|
||||||
return tagName;
|
return tagName;
|
||||||
}
|
}
|
||||||
@ -195,33 +197,26 @@ final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
|
|||||||
*/
|
*/
|
||||||
static synchronized Set<TagNameDefiniton> getTagNameDefinitions() {
|
static synchronized Set<TagNameDefiniton> getTagNameDefinitions() {
|
||||||
Set<TagNameDefiniton> tagNames = new HashSet<>();
|
Set<TagNameDefiniton> tagNames = new HashSet<>();
|
||||||
List<String> standardTags = new ArrayList<>(STANDARD_TAG_DISPLAY_NAMES); //modifiable copy of default tags list for us to keep track of which ones already exist
|
//modifiable copy of default tags list for us to keep track of which default tags have already been created
|
||||||
|
Set<String> standardTags = new HashSet<>(STANDARD_TAG_DISPLAY_NAMES);
|
||||||
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
|
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
|
||||||
if (null != setting && !setting.isEmpty()) {
|
if (null != setting && !setting.isEmpty()) {
|
||||||
List<String> tagNameTuples = Arrays.asList(setting.split(";"));
|
List<String> tagNameTuples = Arrays.asList(setting.split(";"));
|
||||||
List<String> notableTags = new ArrayList<>();
|
int numberOfAttributes = 0;
|
||||||
String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
|
if (tagNameTuples.size() > 0) {
|
||||||
if (badTagsStr == null || badTagsStr.isEmpty()) { //if there were no bad tags in the central repo properties file use the default list
|
// Determine if Tags.properties file needs to be upgraded
|
||||||
notableTags.addAll(STANDARD_NOTABLE_TAG_DISPLAY_NAMES);
|
numberOfAttributes = tagNameTuples.get(0).split(",").length;
|
||||||
} else { //otherwise use the list that was in the central repository properties file
|
|
||||||
notableTags.addAll(Arrays.asList(badTagsStr.split(",")));
|
|
||||||
}
|
}
|
||||||
for (String tagNameTuple : tagNameTuples) { //for each tag listed in the tags properties file
|
if (numberOfAttributes == 3) {
|
||||||
String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes
|
// Upgrade Tags.Properties with the settings in Central Repository Settings if necessary
|
||||||
if (tagNameAttributes.length == 3) { //if there are only 3 attributes so Tags.properties does not contain any tag definitions with knownStatus
|
tagNames.addAll(upgradeTagPropertiesFile(tagNameTuples, standardTags));
|
||||||
standardTags.remove(tagNameAttributes[0]); //remove tag from default tags we need to create still
|
} else if (numberOfAttributes == 4) {
|
||||||
if (notableTags.contains(tagNameAttributes[0])) { //if tag should be notable mark create it as such
|
// if the Tags.Properties file is up to date parse it
|
||||||
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.BAD));
|
tagNames.addAll(readCurrentTagPropertiesFile(tagNameTuples, standardTags));
|
||||||
} else { //otherwise create it as unknown
|
|
||||||
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.UNKNOWN)); //add the default value for that tag
|
|
||||||
}
|
|
||||||
} else if (tagNameAttributes.length == 4) { //if there are 4 attributes its a current list we can use the values present
|
|
||||||
standardTags.remove(tagNameAttributes[0]); //remove tag from default tags we need to create still
|
|
||||||
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.valueOf(tagNameAttributes[3])));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String standardTagName : standardTags) { //create standard tags which should always exist which were not already created for whatever reason, such as upgrade
|
//create standard tags which should always exist which were not already created for whatever reason, such as upgrade
|
||||||
|
for (String standardTagName : standardTags) {
|
||||||
if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) {
|
if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) {
|
||||||
tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.BAD));
|
tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.BAD));
|
||||||
} else {
|
} else {
|
||||||
@ -229,6 +224,63 @@ final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tagNames;
|
return tagNames;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the central repository properties file to get any knownStatus
|
||||||
|
* related tag settings that may exist in it.
|
||||||
|
*
|
||||||
|
* @param tagProperties the list of comma seperated tags in the
|
||||||
|
* Tags.properties file
|
||||||
|
* @param standardTagsToBeCreated the list of standard tags which have yet
|
||||||
|
* to be created
|
||||||
|
*
|
||||||
|
* @return tagNames a list of TagNameDefinitions
|
||||||
|
*/
|
||||||
|
private static Set<TagNameDefiniton> upgradeTagPropertiesFile(List<String> tagProperties, Set<String> standardTagsToBeCreated) {
|
||||||
|
Set<TagNameDefiniton> tagNames = new HashSet<>();
|
||||||
|
List<String> legacyNotableTags = new ArrayList<>();
|
||||||
|
String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
|
||||||
|
if (badTagsStr == null || badTagsStr.isEmpty()) { //if there were no bad tags in the central repo properties file use the default list
|
||||||
|
legacyNotableTags.addAll(STANDARD_NOTABLE_TAG_DISPLAY_NAMES);
|
||||||
|
} else { //otherwise use the list that was in the central repository properties file
|
||||||
|
legacyNotableTags.addAll(Arrays.asList(badTagsStr.split(",")));
|
||||||
|
}
|
||||||
|
for (String tagNameTuple : tagProperties) {
|
||||||
|
String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes
|
||||||
|
standardTagsToBeCreated.remove(tagNameAttributes[0]); //remove the tag from the list of standard tags which have not been created
|
||||||
|
if (legacyNotableTags.contains(tagNameAttributes[0])) { //if tag should be notable mark create it as such
|
||||||
|
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1],
|
||||||
|
TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.BAD));
|
||||||
|
} else { //otherwise create it as unknown
|
||||||
|
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1],
|
||||||
|
TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.UNKNOWN)); //add the default value for that tag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tagNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the Tags.properties file to get the TagNameDefinitions that are
|
||||||
|
* preserved accross cases.
|
||||||
|
*
|
||||||
|
* @param tagProperties the list of comma seperated tags in the
|
||||||
|
* Tags.properties file
|
||||||
|
* @param standardTagsToBeCreated the list of standard tags which have yet
|
||||||
|
* to be created
|
||||||
|
*
|
||||||
|
* @return tagNames a list of TagNameDefinitions
|
||||||
|
*/
|
||||||
|
private static Set<TagNameDefiniton> readCurrentTagPropertiesFile(List<String> tagProperties, Set<String> standardTagsToBeCreated) {
|
||||||
|
Set<TagNameDefiniton> tagNames = new HashSet<>();
|
||||||
|
for (String tagNameTuple : tagProperties) {
|
||||||
|
String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes
|
||||||
|
standardTagsToBeCreated.remove(tagNameAttributes[0]); //remove the tag from the list of standard tags which have not been created
|
||||||
|
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1],
|
||||||
|
TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.valueOf(tagNameAttributes[3])));
|
||||||
|
}
|
||||||
|
return tagNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.datamodel.tags;
|
package org.sleuthkit.autopsy.datamodel;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -38,6 +38,7 @@ import javafx.scene.layout.CornerRadii;
|
|||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
|
import org.sleuthkit.autopsy.datamodel.Bundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum to represent the six categories in the DHS image categorization scheme.
|
* Enum to represent the six categories in the DHS image categorization scheme.
|
||||||
@ -48,7 +49,7 @@ import org.openide.util.NbBundle;
|
|||||||
"Category.four=CAT-4: Exemplar/Comparison (Internal Use Only)",
|
"Category.four=CAT-4: Exemplar/Comparison (Internal Use Only)",
|
||||||
"Category.five=CAT-5: Non-pertinent",
|
"Category.five=CAT-5: Non-pertinent",
|
||||||
"Category.zero=CAT-0: Uncategorized"})
|
"Category.zero=CAT-0: Uncategorized"})
|
||||||
public enum Category {
|
public enum DhsImageCategory {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This order of declaration is required so that Enum's compareTo method
|
* This order of declaration is required so that Enum's compareTo method
|
||||||
@ -65,22 +66,21 @@ public enum Category {
|
|||||||
private static final BorderWidths BORDER_WIDTHS_2 = new BorderWidths(2);
|
private static final BorderWidths BORDER_WIDTHS_2 = new BorderWidths(2);
|
||||||
private static final CornerRadii CORNER_RADII_4 = new CornerRadii(4);
|
private static final CornerRadii CORNER_RADII_4 = new CornerRadii(4);
|
||||||
|
|
||||||
public static ImmutableList<Category> getNonZeroCategories() {
|
public static ImmutableList<DhsImageCategory> getNonZeroCategories() {
|
||||||
return nonZeroCategories;
|
return nonZeroCategories;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ImmutableList<Category> nonZeroCategories =
|
private static final ImmutableList<DhsImageCategory> nonZeroCategories =
|
||||||
ImmutableList.of(Category.FIVE, Category.FOUR, Category.THREE, Category.TWO, Category.ONE);
|
ImmutableList.of(DhsImageCategory.FIVE, DhsImageCategory.FOUR, DhsImageCategory.THREE, DhsImageCategory.TWO, DhsImageCategory.ONE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* map from displayName to enum value
|
* map from displayName to enum value
|
||||||
*/
|
*/
|
||||||
private static final Map<String, Category> nameMap =
|
private static final Map<String, DhsImageCategory> nameMap =
|
||||||
Stream.of(values()).collect(Collectors.toMap(
|
Stream.of(values()).collect(Collectors.toMap(DhsImageCategory::getDisplayName,
|
||||||
Category::getDisplayName,
|
|
||||||
Function.identity()));
|
Function.identity()));
|
||||||
|
|
||||||
public static Category fromDisplayName(String displayName) {
|
public static DhsImageCategory fromDisplayName(String displayName) {
|
||||||
return nameMap.get(displayName);
|
return nameMap.get(displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public enum Category {
|
|||||||
private final int id;
|
private final int id;
|
||||||
private Image snapshot;
|
private Image snapshot;
|
||||||
|
|
||||||
private Category(Color color, int id, String name) {
|
private DhsImageCategory(Color color, int id, String name) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.displayName = name;
|
this.displayName = name;
|
||||||
this.id = id;
|
this.id = id;
|
@ -40,7 +40,7 @@ import org.controlsfx.control.action.ActionUtils;
|
|||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
||||||
@ -60,15 +60,15 @@ public class CategorizeAction extends Action {
|
|||||||
|
|
||||||
private final ImageGalleryController controller;
|
private final ImageGalleryController controller;
|
||||||
private final UndoRedoManager undoManager;
|
private final UndoRedoManager undoManager;
|
||||||
private final Category cat;
|
private final DhsImageCategory cat;
|
||||||
private final Set<Long> selectedFileIDs;
|
private final Set<Long> selectedFileIDs;
|
||||||
private final Boolean createUndo;
|
private final Boolean createUndo;
|
||||||
|
|
||||||
public CategorizeAction(ImageGalleryController controller, Category cat, Set<Long> selectedFileIDs) {
|
public CategorizeAction(ImageGalleryController controller, DhsImageCategory cat, Set<Long> selectedFileIDs) {
|
||||||
this(controller, cat, selectedFileIDs, true);
|
this(controller, cat, selectedFileIDs, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CategorizeAction(ImageGalleryController controller, Category cat, Set<Long> selectedFileIDs, Boolean createUndo) {
|
private CategorizeAction(ImageGalleryController controller, DhsImageCategory cat, Set<Long> selectedFileIDs, Boolean createUndo) {
|
||||||
super(cat.getDisplayName());
|
super(cat.getDisplayName());
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
this.undoManager = controller.getUndoManager();
|
this.undoManager = controller.getUndoManager();
|
||||||
@ -103,7 +103,7 @@ public class CategorizeAction extends Action {
|
|||||||
|
|
||||||
// Each category get an item in the sub-menu. Selecting one of these menu items adds
|
// Each category get an item in the sub-menu. Selecting one of these menu items adds
|
||||||
// a tag with the associated category.
|
// a tag with the associated category.
|
||||||
for (final Category cat : Category.values()) {
|
for (final DhsImageCategory cat : DhsImageCategory.values()) {
|
||||||
MenuItem categoryItem = ActionUtils.createMenuItem(new CategorizeAction(controller, cat, selected));
|
MenuItem categoryItem = ActionUtils.createMenuItem(new CategorizeAction(controller, cat, selected));
|
||||||
getItems().add(categoryItem);
|
getItems().add(categoryItem);
|
||||||
}
|
}
|
||||||
@ -118,9 +118,9 @@ public class CategorizeAction extends Action {
|
|||||||
private final Set<Long> fileIDs;
|
private final Set<Long> fileIDs;
|
||||||
|
|
||||||
private final boolean createUndo;
|
private final boolean createUndo;
|
||||||
private final Category cat;
|
private final DhsImageCategory cat;
|
||||||
|
|
||||||
CategorizeTask(Set<Long> fileIDs, @Nonnull Category cat, boolean createUndo) {
|
CategorizeTask(Set<Long> fileIDs, @Nonnull DhsImageCategory cat, boolean createUndo) {
|
||||||
super();
|
super();
|
||||||
this.fileIDs = fileIDs;
|
this.fileIDs = fileIDs;
|
||||||
java.util.Objects.requireNonNull(cat);
|
java.util.Objects.requireNonNull(cat);
|
||||||
@ -132,14 +132,14 @@ public class CategorizeAction extends Action {
|
|||||||
public void run() {
|
public void run() {
|
||||||
final DrawableTagsManager tagsManager = controller.getTagsManager();
|
final DrawableTagsManager tagsManager = controller.getTagsManager();
|
||||||
final CategoryManager categoryManager = controller.getCategoryManager();
|
final CategoryManager categoryManager = controller.getCategoryManager();
|
||||||
Map<Long, Category> oldCats = new HashMap<>();
|
Map<Long, DhsImageCategory> oldCats = new HashMap<>();
|
||||||
TagName tagName = categoryManager.getTagName(cat);
|
TagName tagName = categoryManager.getTagName(cat);
|
||||||
TagName catZeroTagName = categoryManager.getTagName(Category.ZERO);
|
TagName catZeroTagName = categoryManager.getTagName(DhsImageCategory.ZERO);
|
||||||
for (long fileID : fileIDs) {
|
for (long fileID : fileIDs) {
|
||||||
try {
|
try {
|
||||||
DrawableFile file = controller.getFileFromId(fileID); //drawable db access
|
DrawableFile file = controller.getFileFromId(fileID); //drawable db access
|
||||||
if (createUndo) {
|
if (createUndo) {
|
||||||
Category oldCat = file.getCategory(); //drawable db access
|
DhsImageCategory oldCat = file.getCategory(); //drawable db access
|
||||||
TagName oldCatTagName = categoryManager.getTagName(oldCat);
|
TagName oldCatTagName = categoryManager.getTagName(oldCat);
|
||||||
if (false == tagName.equals(oldCatTagName)) {
|
if (false == tagName.equals(oldCatTagName)) {
|
||||||
oldCats.put(fileID, oldCat);
|
oldCats.put(fileID, oldCat);
|
||||||
@ -147,7 +147,7 @@ public class CategorizeAction extends Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final List<ContentTag> fileTags = tagsManager.getContentTags(file);
|
final List<ContentTag> fileTags = tagsManager.getContentTags(file);
|
||||||
if (tagName == categoryManager.getTagName(Category.ZERO)) {
|
if (tagName == categoryManager.getTagName(DhsImageCategory.ZERO)) {
|
||||||
// delete all cat tags for cat-0
|
// delete all cat tags for cat-0
|
||||||
fileTags.stream()
|
fileTags.stream()
|
||||||
.filter(tag -> CategoryManager.isCategoryTagName(tag.getName()))
|
.filter(tag -> CategoryManager.isCategoryTagName(tag.getName()))
|
||||||
@ -189,11 +189,11 @@ public class CategorizeAction extends Action {
|
|||||||
@Immutable
|
@Immutable
|
||||||
private final class CategorizationChange implements UndoRedoManager.UndoableCommand {
|
private final class CategorizationChange implements UndoRedoManager.UndoableCommand {
|
||||||
|
|
||||||
private final Category newCategory;
|
private final DhsImageCategory newCategory;
|
||||||
private final ImmutableMap<Long, Category> oldCategories;
|
private final ImmutableMap<Long, DhsImageCategory> oldCategories;
|
||||||
private final ImageGalleryController controller;
|
private final ImageGalleryController controller;
|
||||||
|
|
||||||
CategorizationChange(ImageGalleryController controller, Category newCategory, Map<Long, Category> oldCategories) {
|
CategorizationChange(ImageGalleryController controller, DhsImageCategory newCategory, Map<Long, DhsImageCategory> oldCategories) {
|
||||||
this.controller = controller;
|
this.controller = controller;
|
||||||
this.newCategory = newCategory;
|
this.newCategory = newCategory;
|
||||||
this.oldCategories = ImmutableMap.copyOf(oldCategories);
|
this.oldCategories = ImmutableMap.copyOf(oldCategories);
|
||||||
@ -216,7 +216,7 @@ public class CategorizeAction extends Action {
|
|||||||
@Override
|
@Override
|
||||||
public void undo() {
|
public void undo() {
|
||||||
|
|
||||||
for (Map.Entry<Long, Category> entry : oldCategories.entrySet()) {
|
for (Map.Entry<Long, DhsImageCategory> entry : oldCategories.entrySet()) {
|
||||||
new CategorizeAction(controller, entry.getValue(), Collections.singleton(entry.getKey()), false)
|
new CategorizeAction(controller, entry.getValue(), Collections.singleton(entry.getKey()), false)
|
||||||
.handle(null);
|
.handle(null);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ import org.openide.util.NbBundle;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryPreferences;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryPreferences;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,7 +49,7 @@ public class CategorizeGroupAction extends CategorizeAction {
|
|||||||
|
|
||||||
private final static Logger LOGGER = Logger.getLogger(CategorizeGroupAction.class.getName());
|
private final static Logger LOGGER = Logger.getLogger(CategorizeGroupAction.class.getName());
|
||||||
|
|
||||||
public CategorizeGroupAction(Category newCat, ImageGalleryController controller) {
|
public CategorizeGroupAction(DhsImageCategory newCat, ImageGalleryController controller) {
|
||||||
super(controller, newCat, null);
|
super(controller, newCat, null);
|
||||||
setEventHandler(actionEvent -> {
|
setEventHandler(actionEvent -> {
|
||||||
ObservableList<Long> fileIDs = controller.viewState().get().getGroup().getFileIDs();
|
ObservableList<Long> fileIDs = controller.viewState().get().getGroup().getFileIDs();
|
||||||
@ -58,12 +58,12 @@ public class CategorizeGroupAction extends CategorizeAction {
|
|||||||
//if they have preveiously disabled the warning, just go ahead and apply categories.
|
//if they have preveiously disabled the warning, just go ahead and apply categories.
|
||||||
addCatToFiles(ImmutableSet.copyOf(fileIDs));
|
addCatToFiles(ImmutableSet.copyOf(fileIDs));
|
||||||
} else {
|
} else {
|
||||||
final Map<Category, Long> catCountMap = new HashMap<>();
|
final Map<DhsImageCategory, Long> catCountMap = new HashMap<>();
|
||||||
|
|
||||||
for (Long fileID : fileIDs) {
|
for (Long fileID : fileIDs) {
|
||||||
try {
|
try {
|
||||||
Category category = controller.getFileFromId(fileID).getCategory();
|
DhsImageCategory category = controller.getFileFromId(fileID).getCategory();
|
||||||
if (false == Category.ZERO.equals(category) && newCat.equals(category) == false) {
|
if (false == DhsImageCategory.ZERO.equals(category) && newCat.equals(category) == false) {
|
||||||
catCountMap.merge(category, 1L, Long::sum);
|
catCountMap.merge(category, 1L, Long::sum);
|
||||||
}
|
}
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
@ -86,14 +86,14 @@ public class CategorizeGroupAction extends CategorizeAction {
|
|||||||
"CategorizeGroupAction.fileCountMessage={0} with {1}",
|
"CategorizeGroupAction.fileCountMessage={0} with {1}",
|
||||||
"CategorizeGroupAction.dontShowAgain=Don't show this message again",
|
"CategorizeGroupAction.dontShowAgain=Don't show this message again",
|
||||||
"CategorizeGroupAction.fileCountHeader=Files in the following categories will have their categories overwritten: "})
|
"CategorizeGroupAction.fileCountHeader=Files in the following categories will have their categories overwritten: "})
|
||||||
private void showConfirmationDialog(final Map<Category, Long> catCountMap, Category newCat, ObservableList<Long> fileIDs) {
|
private void showConfirmationDialog(final Map<DhsImageCategory, Long> catCountMap, DhsImageCategory newCat, ObservableList<Long> fileIDs) {
|
||||||
|
|
||||||
ButtonType categorizeButtonType =
|
ButtonType categorizeButtonType =
|
||||||
new ButtonType(Bundle.CategorizeGroupAction_OverwriteButton_text(), ButtonBar.ButtonData.APPLY);
|
new ButtonType(Bundle.CategorizeGroupAction_OverwriteButton_text(), ButtonBar.ButtonData.APPLY);
|
||||||
|
|
||||||
VBox textFlow = new VBox();
|
VBox textFlow = new VBox();
|
||||||
|
|
||||||
for (Map.Entry<Category, Long> entry : catCountMap.entrySet()) {
|
for (Map.Entry<DhsImageCategory, Long> entry : catCountMap.entrySet()) {
|
||||||
if (entry.getKey().equals(newCat) == false) {
|
if (entry.getKey().equals(newCat) == false) {
|
||||||
if (entry.getValue() > 0) {
|
if (entry.getValue() > 0) {
|
||||||
Label label = new Label(Bundle.CategorizeGroupAction_fileCountMessage(entry.getValue(), entry.getKey().getDisplayName()),
|
Label label = new Label(Bundle.CategorizeGroupAction_fileCountMessage(entry.getValue(), entry.getKey().getDisplayName()),
|
||||||
|
@ -19,14 +19,14 @@
|
|||||||
package org.sleuthkit.autopsy.imagegallery.actions;
|
package org.sleuthkit.autopsy.imagegallery.actions;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CategorizeSelectedFilesAction extends CategorizeAction {
|
public class CategorizeSelectedFilesAction extends CategorizeAction {
|
||||||
|
|
||||||
public CategorizeSelectedFilesAction(Category cat, ImageGalleryController controller) {
|
public CategorizeSelectedFilesAction(DhsImageCategory cat, ImageGalleryController controller) {
|
||||||
super(controller, cat, null);
|
super(controller, cat, null);
|
||||||
setEventHandler(actionEvent ->
|
setEventHandler(actionEvent ->
|
||||||
addCatToFiles(controller.getSelectionModel().getSelected())
|
addCatToFiles(controller.getSelectionModel().getSelected())
|
||||||
|
@ -35,7 +35,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
|||||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.datamodel.ContentTag;
|
import org.sleuthkit.datamodel.ContentTag;
|
||||||
import org.sleuthkit.datamodel.TagName;
|
import org.sleuthkit.datamodel.TagName;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
@ -80,13 +80,13 @@ public class CategoryManager {
|
|||||||
* the count related methods go through this cache, which loads initial
|
* the count related methods go through this cache, which loads initial
|
||||||
* values from the database if needed.
|
* values from the database if needed.
|
||||||
*/
|
*/
|
||||||
private final LoadingCache<Category, LongAdder> categoryCounts =
|
private final LoadingCache<DhsImageCategory, LongAdder> categoryCounts =
|
||||||
CacheBuilder.newBuilder().build(CacheLoader.from(this::getCategoryCountHelper));
|
CacheBuilder.newBuilder().build(CacheLoader.from(this::getCategoryCountHelper));
|
||||||
/**
|
/**
|
||||||
* cached TagNames corresponding to Categories, looked up from
|
* cached TagNames corresponding to Categories, looked up from
|
||||||
* autopsyTagManager at initial request or if invalidated by case change.
|
* autopsyTagManager at initial request or if invalidated by case change.
|
||||||
*/
|
*/
|
||||||
private final LoadingCache<Category, TagName> catTagNameMap =
|
private final LoadingCache<DhsImageCategory, TagName> catTagNameMap =
|
||||||
CacheBuilder.newBuilder().build(CacheLoader.from(
|
CacheBuilder.newBuilder().build(CacheLoader.from(
|
||||||
cat -> getController().getTagsManager().getTagName(cat)
|
cat -> getController().getTagsManager().getTagName(cat)
|
||||||
));
|
));
|
||||||
@ -119,18 +119,18 @@ public class CategoryManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the number of file with the given {@link Category}
|
* get the number of file with the given {@link DhsImageCategory}
|
||||||
*
|
*
|
||||||
* @param cat get the number of files with Category = cat
|
* @param cat get the number of files with Category = cat
|
||||||
*
|
*
|
||||||
* @return the number of files with the given Category
|
* @return the number of files with the given Category
|
||||||
*/
|
*/
|
||||||
synchronized public long getCategoryCount(Category cat) {
|
synchronized public long getCategoryCount(DhsImageCategory cat) {
|
||||||
if (cat == Category.ZERO) {
|
if (cat == DhsImageCategory.ZERO) {
|
||||||
// Keeping track of the uncategorized files is a bit tricky while ingest
|
// Keeping track of the uncategorized files is a bit tricky while ingest
|
||||||
// is going on, so always use the list of file IDs we already have along with the
|
// is going on, so always use the list of file IDs we already have along with the
|
||||||
// other category counts instead of trying to track it separately.
|
// other category counts instead of trying to track it separately.
|
||||||
long allOtherCatCount = getCategoryCount(Category.ONE) + getCategoryCount(Category.TWO) + getCategoryCount(Category.THREE) + getCategoryCount(Category.FOUR) + getCategoryCount(Category.FIVE);
|
long allOtherCatCount = getCategoryCount(DhsImageCategory.ONE) + getCategoryCount(DhsImageCategory.TWO) + getCategoryCount(DhsImageCategory.THREE) + getCategoryCount(DhsImageCategory.FOUR) + getCategoryCount(DhsImageCategory.FIVE);
|
||||||
return db.getNumberOfImageFilesInList() - allOtherCatCount;
|
return db.getNumberOfImageFilesInList() - allOtherCatCount;
|
||||||
} else {
|
} else {
|
||||||
return categoryCounts.getUnchecked(cat).sum();
|
return categoryCounts.getUnchecked(cat).sum();
|
||||||
@ -139,24 +139,24 @@ public class CategoryManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* increment the cached value for the number of files with the given
|
* increment the cached value for the number of files with the given
|
||||||
* {@link Category}
|
* {@link DhsImageCategory}
|
||||||
*
|
*
|
||||||
* @param cat the Category to increment
|
* @param cat the Category to increment
|
||||||
*/
|
*/
|
||||||
synchronized public void incrementCategoryCount(Category cat) {
|
synchronized public void incrementCategoryCount(DhsImageCategory cat) {
|
||||||
if (cat != Category.ZERO) {
|
if (cat != DhsImageCategory.ZERO) {
|
||||||
categoryCounts.getUnchecked(cat).increment();
|
categoryCounts.getUnchecked(cat).increment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* decrement the cached value for the number of files with the given
|
* decrement the cached value for the number of files with the given
|
||||||
* {@link Category}
|
* {@link DhsImageCategory}
|
||||||
*
|
*
|
||||||
* @param cat the Category to decrement
|
* @param cat the Category to decrement
|
||||||
*/
|
*/
|
||||||
synchronized public void decrementCategoryCount(Category cat) {
|
synchronized public void decrementCategoryCount(DhsImageCategory cat) {
|
||||||
if (cat != Category.ZERO) {
|
if (cat != DhsImageCategory.ZERO) {
|
||||||
categoryCounts.getUnchecked(cat).decrement();
|
categoryCounts.getUnchecked(cat).decrement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ public class CategoryManager {
|
|||||||
* @return a LongAdder whose value is set to the number of file with the
|
* @return a LongAdder whose value is set to the number of file with the
|
||||||
* given Category
|
* given Category
|
||||||
*/
|
*/
|
||||||
synchronized private LongAdder getCategoryCountHelper(Category cat) {
|
synchronized private LongAdder getCategoryCountHelper(DhsImageCategory cat) {
|
||||||
LongAdder longAdder = new LongAdder();
|
LongAdder longAdder = new LongAdder();
|
||||||
longAdder.decrement();
|
longAdder.decrement();
|
||||||
try {
|
try {
|
||||||
@ -188,7 +188,7 @@ public class CategoryManager {
|
|||||||
*
|
*
|
||||||
* @param fileIDs
|
* @param fileIDs
|
||||||
*/
|
*/
|
||||||
public void fireChange(Collection<Long> fileIDs, Category newCategory) {
|
public void fireChange(Collection<Long> fileIDs, DhsImageCategory newCategory) {
|
||||||
categoryEventBus.post(new CategoryChangeEvent(fileIDs, newCategory));
|
categoryEventBus.post(new CategoryChangeEvent(fileIDs, newCategory));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,21 +231,21 @@ public class CategoryManager {
|
|||||||
*
|
*
|
||||||
* @return the TagName used for this Category
|
* @return the TagName used for this Category
|
||||||
*/
|
*/
|
||||||
synchronized public TagName getTagName(Category cat) {
|
synchronized public TagName getTagName(DhsImageCategory cat) {
|
||||||
return catTagNameMap.getUnchecked(cat);
|
return catTagNameMap.getUnchecked(cat);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Category categoryFromTagName(TagName tagName) {
|
public static DhsImageCategory categoryFromTagName(TagName tagName) {
|
||||||
return Category.fromDisplayName(tagName.getDisplayName());
|
return DhsImageCategory.fromDisplayName(tagName.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCategoryTagName(TagName tName) {
|
public static boolean isCategoryTagName(TagName tName) {
|
||||||
return Category.isCategoryName(tName.getDisplayName());
|
return DhsImageCategory.isCategoryName(tName.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNotCategoryTagName(TagName tName) {
|
public static boolean isNotCategoryTagName(TagName tName) {
|
||||||
return Category.isNotCategoryName(tName.getDisplayName());
|
return DhsImageCategory.isNotCategoryName(tName.getDisplayName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,8 +270,8 @@ public class CategoryManager {
|
|||||||
} catch (TskCoreException tskException) {
|
} catch (TskCoreException tskException) {
|
||||||
LOGGER.log(Level.SEVERE, "Failed to get content tags for content. Unable to maintain category in a consistent state.", tskException); //NON-NLS
|
LOGGER.log(Level.SEVERE, "Failed to get content tags for content. Unable to maintain category in a consistent state.", tskException); //NON-NLS
|
||||||
}
|
}
|
||||||
Category newCat = CategoryManager.categoryFromTagName(addedTag.getName());
|
DhsImageCategory newCat = CategoryManager.categoryFromTagName(addedTag.getName());
|
||||||
if (newCat != Category.ZERO) {
|
if (newCat != DhsImageCategory.ZERO) {
|
||||||
incrementCategoryCount(newCat);
|
incrementCategoryCount(newCat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,8 +285,8 @@ public class CategoryManager {
|
|||||||
TagName tagName = deletedTagInfo.getName();
|
TagName tagName = deletedTagInfo.getName();
|
||||||
if (isCategoryTagName(tagName)) {
|
if (isCategoryTagName(tagName)) {
|
||||||
|
|
||||||
Category deletedCat = CategoryManager.categoryFromTagName(tagName);
|
DhsImageCategory deletedCat = CategoryManager.categoryFromTagName(tagName);
|
||||||
if (deletedCat != Category.ZERO) {
|
if (deletedCat != DhsImageCategory.ZERO) {
|
||||||
decrementCategoryCount(deletedCat);
|
decrementCategoryCount(deletedCat);
|
||||||
}
|
}
|
||||||
fireChange(Collections.singleton(deletedTagInfo.getContentID()), null);
|
fireChange(Collections.singleton(deletedTagInfo.getContentID()), null);
|
||||||
@ -301,15 +301,15 @@ public class CategoryManager {
|
|||||||
public static class CategoryChangeEvent {
|
public static class CategoryChangeEvent {
|
||||||
|
|
||||||
private final ImmutableSet<Long> fileIDs;
|
private final ImmutableSet<Long> fileIDs;
|
||||||
private final Category newCategory;
|
private final DhsImageCategory newCategory;
|
||||||
|
|
||||||
public CategoryChangeEvent(Collection<Long> fileIDs, Category newCategory) {
|
public CategoryChangeEvent(Collection<Long> fileIDs, DhsImageCategory newCategory) {
|
||||||
super();
|
super();
|
||||||
this.fileIDs = ImmutableSet.copyOf(fileIDs);
|
this.fileIDs = ImmutableSet.copyOf(fileIDs);
|
||||||
this.newCategory = newCategory;
|
this.newCategory = newCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Category getNewCategory() {
|
public DhsImageCategory getNewCategory() {
|
||||||
return newCategory;
|
return newCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -84,14 +84,14 @@ public class DrawableAttribute<T extends Comparable<T>> {
|
|||||||
* //TODO: this has lead to awkward hard to maintain code, and little
|
* //TODO: this has lead to awkward hard to maintain code, and little
|
||||||
* advantage. move categories into DrawableDB?
|
* advantage. move categories into DrawableDB?
|
||||||
*/
|
*/
|
||||||
public final static DrawableAttribute<Category> CATEGORY =
|
public final static DrawableAttribute<DhsImageCategory> CATEGORY =
|
||||||
new DrawableAttribute<Category>(AttributeName.CATEGORY, Bundle.DrawableAttribute_category(),
|
new DrawableAttribute<DhsImageCategory>(AttributeName.CATEGORY, Bundle.DrawableAttribute_category(),
|
||||||
false,
|
false,
|
||||||
"category-icon.png", //NON-NLS
|
"category-icon.png", //NON-NLS
|
||||||
f -> Collections.singleton(f.getCategory())) {
|
f -> Collections.singleton(f.getCategory())) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Node getGraphicForValue(Category val) {
|
public Node getGraphicForValue(DhsImageCategory val) {
|
||||||
return val.getGraphic();
|
return val.getGraphic();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@ -231,7 +231,7 @@ public final class DrawableDB {
|
|||||||
|
|
||||||
insertHashHitStmt = prepareStatement("INSERT OR IGNORE INTO hash_set_hits (hash_set_id, obj_id) VALUES (?,?)"); //NON-NLS
|
insertHashHitStmt = prepareStatement("INSERT OR IGNORE INTO hash_set_hits (hash_set_id, obj_id) VALUES (?,?)"); //NON-NLS
|
||||||
|
|
||||||
for (Category cat : Category.values()) {
|
for (DhsImageCategory cat : DhsImageCategory.values()) {
|
||||||
insertGroup(cat.getDisplayName(), DrawableAttribute.CATEGORY);
|
insertGroup(cat.getDisplayName(), DrawableAttribute.CATEGORY);
|
||||||
}
|
}
|
||||||
initializeImageList();
|
initializeImageList();
|
||||||
@ -1016,7 +1016,7 @@ public final class DrawableDB {
|
|||||||
case MIME_TYPE:
|
case MIME_TYPE:
|
||||||
return groupManager.getFileIDsWithMimeType((String) groupKey.getValue());
|
return groupManager.getFileIDsWithMimeType((String) groupKey.getValue());
|
||||||
case CATEGORY:
|
case CATEGORY:
|
||||||
return groupManager.getFileIDsWithCategory((Category) groupKey.getValue());
|
return groupManager.getFileIDsWithCategory((DhsImageCategory) groupKey.getValue());
|
||||||
case TAGS:
|
case TAGS:
|
||||||
return groupManager.getFileIDsWithTag((TagName) groupKey.getValue());
|
return groupManager.getFileIDsWithTag((TagName) groupKey.getValue());
|
||||||
}
|
}
|
||||||
@ -1195,7 +1195,7 @@ public final class DrawableDB {
|
|||||||
*
|
*
|
||||||
* @return the number of the with the given category
|
* @return the number of the with the given category
|
||||||
*/
|
*/
|
||||||
public long getCategoryCount(Category cat) {
|
public long getCategoryCount(DhsImageCategory cat) {
|
||||||
try {
|
try {
|
||||||
TagName tagName = controller.getTagsManager().getTagName(cat);
|
TagName tagName = controller.getTagsManager().getTagName(cat);
|
||||||
if (nonNull(tagName)) {
|
if (nonNull(tagName)) {
|
||||||
@ -1233,7 +1233,7 @@ public final class DrawableDB {
|
|||||||
DrawableTagsManager tagsManager = controller.getTagsManager();
|
DrawableTagsManager tagsManager = controller.getTagsManager();
|
||||||
|
|
||||||
// get a comma seperated list of TagName ids for non zero categories
|
// get a comma seperated list of TagName ids for non zero categories
|
||||||
String catTagNameIDs = Category.getNonZeroCategories().stream()
|
String catTagNameIDs = DhsImageCategory.getNonZeroCategories().stream()
|
||||||
.map(tagsManager::getTagName)
|
.map(tagsManager::getTagName)
|
||||||
.map(TagName::getId)
|
.map(TagName::getId)
|
||||||
.map(Object::toString)
|
.map(Object::toString)
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -85,7 +85,7 @@ public abstract class DrawableFile {
|
|||||||
|
|
||||||
private final SimpleBooleanProperty analyzed;
|
private final SimpleBooleanProperty analyzed;
|
||||||
|
|
||||||
private final SimpleObjectProperty<Category> category = new SimpleObjectProperty<>(null);
|
private final SimpleObjectProperty<DhsImageCategory> category = new SimpleObjectProperty<>(null);
|
||||||
|
|
||||||
private String make;
|
private String make;
|
||||||
|
|
||||||
@ -216,17 +216,17 @@ public abstract class DrawableFile {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCategory(Category category) {
|
public void setCategory(DhsImageCategory category) {
|
||||||
categoryProperty().set(category);
|
categoryProperty().set(category);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Category getCategory() {
|
public DhsImageCategory getCategory() {
|
||||||
updateCategory();
|
updateCategory();
|
||||||
return category.get();
|
return category.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleObjectProperty<Category> categoryProperty() {
|
public SimpleObjectProperty<DhsImageCategory> categoryProperty() {
|
||||||
return category;
|
return category;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,9 +238,9 @@ public abstract class DrawableFile {
|
|||||||
category.set(getContentTags().stream()
|
category.set(getContentTags().stream()
|
||||||
.map(Tag::getName).filter(CategoryManager::isCategoryTagName)
|
.map(Tag::getName).filter(CategoryManager::isCategoryTagName)
|
||||||
.map(TagName::getDisplayName)
|
.map(TagName::getDisplayName)
|
||||||
.map(Category::fromDisplayName)
|
.map(DhsImageCategory::fromDisplayName)
|
||||||
.sorted().findFirst() //sort by severity and take the first
|
.sorted().findFirst() //sort by severity and take the first
|
||||||
.orElse(Category.ZERO)
|
.orElse(DhsImageCategory.ZERO)
|
||||||
);
|
);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
LOGGER.log(Level.WARNING, "problem looking up category for " + this.getContentPathSafe(), ex); //NON-NLS
|
LOGGER.log(Level.WARNING, "problem looking up category for " + this.getContentPathSafe(), ex); //NON-NLS
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
package org.sleuthkit.autopsy.imagegallery.datamodel;
|
||||||
|
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import com.google.common.eventbus.AsyncEventBus;
|
import com.google.common.eventbus.AsyncEventBus;
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -229,7 +229,7 @@ public class DrawableTagsManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagName getTagName(Category cat) {
|
public TagName getTagName(DhsImageCategory cat) {
|
||||||
try {
|
try {
|
||||||
return getTagName(cat.getDisplayName());
|
return getTagName(cat.getDisplayName());
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
|
@ -71,7 +71,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
|||||||
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
||||||
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
|
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
|
||||||
@ -332,7 +332,7 @@ public class GroupManager {
|
|||||||
switch (groupBy.attrName) {
|
switch (groupBy.attrName) {
|
||||||
//these cases get special treatment
|
//these cases get special treatment
|
||||||
case CATEGORY:
|
case CATEGORY:
|
||||||
values = (List<A>) Arrays.asList(Category.values());
|
values = (List<A>) Arrays.asList(DhsImageCategory.values());
|
||||||
break;
|
break;
|
||||||
case TAGS:
|
case TAGS:
|
||||||
values = (List<A>) controller.getTagsManager().getTagNamesInUse().stream()
|
values = (List<A>) controller.getTagsManager().getTagNamesInUse().stream()
|
||||||
@ -388,7 +388,7 @@ public class GroupManager {
|
|||||||
switch (groupKey.getAttribute().attrName) {
|
switch (groupKey.getAttribute().attrName) {
|
||||||
//these cases get special treatment
|
//these cases get special treatment
|
||||||
case CATEGORY:
|
case CATEGORY:
|
||||||
fileIDsToReturn = getFileIDsWithCategory((Category) groupKey.getValue());
|
fileIDsToReturn = getFileIDsWithCategory((DhsImageCategory) groupKey.getValue());
|
||||||
break;
|
break;
|
||||||
case TAGS:
|
case TAGS:
|
||||||
fileIDsToReturn = getFileIDsWithTag((TagName) groupKey.getValue());
|
fileIDsToReturn = getFileIDsWithTag((TagName) groupKey.getValue());
|
||||||
@ -409,13 +409,13 @@ public class GroupManager {
|
|||||||
|
|
||||||
// @@@ This was kind of slow in the profiler. Maybe we should cache it.
|
// @@@ This was kind of slow in the profiler. Maybe we should cache it.
|
||||||
// Unless the list of file IDs is necessary, use countFilesWithCategory() to get the counts.
|
// Unless the list of file IDs is necessary, use countFilesWithCategory() to get the counts.
|
||||||
public Set<Long> getFileIDsWithCategory(Category category) throws TskCoreException {
|
public Set<Long> getFileIDsWithCategory(DhsImageCategory category) throws TskCoreException {
|
||||||
Set<Long> fileIDsToReturn = Collections.emptySet();
|
Set<Long> fileIDsToReturn = Collections.emptySet();
|
||||||
if (nonNull(db)) {
|
if (nonNull(db)) {
|
||||||
try {
|
try {
|
||||||
final DrawableTagsManager tagsManager = controller.getTagsManager();
|
final DrawableTagsManager tagsManager = controller.getTagsManager();
|
||||||
if (category == Category.ZERO) {
|
if (category == DhsImageCategory.ZERO) {
|
||||||
List< TagName> tns = Stream.of(Category.ONE, Category.TWO, Category.THREE, Category.FOUR, Category.FIVE)
|
List< TagName> tns = Stream.of(DhsImageCategory.ONE, DhsImageCategory.TWO, DhsImageCategory.THREE, DhsImageCategory.FOUR, DhsImageCategory.FIVE)
|
||||||
.map(tagsManager::getTagName)
|
.map(tagsManager::getTagName)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import org.openide.util.NbBundle;
|
|||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays summary statistics (counts) for each group
|
* Displays summary statistics (counts) for each group
|
||||||
@ -44,13 +44,13 @@ import org.sleuthkit.autopsy.datamodel.tags.Category;
|
|||||||
public class SummaryTablePane extends AnchorPane {
|
public class SummaryTablePane extends AnchorPane {
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<Pair<Category, Long>, String> catColumn;
|
private TableColumn<Pair<DhsImageCategory, Long>, String> catColumn;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableColumn<Pair<Category, Long>, Long> countColumn;
|
private TableColumn<Pair<DhsImageCategory, Long>, Long> countColumn;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private TableView<Pair<Category, Long>> tableView;
|
private TableView<Pair<DhsImageCategory, Long>> tableView;
|
||||||
private final ImageGalleryController controller;
|
private final ImageGalleryController controller;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -67,11 +67,11 @@ public class SummaryTablePane extends AnchorPane {
|
|||||||
tableView.prefHeightProperty().set(7 * 25);
|
tableView.prefHeightProperty().set(7 * 25);
|
||||||
|
|
||||||
//set up columns
|
//set up columns
|
||||||
catColumn.setCellValueFactory((TableColumn.CellDataFeatures<Pair<Category, Long>, String> p) -> new SimpleObjectProperty<>(p.getValue().getKey().getDisplayName()));
|
catColumn.setCellValueFactory((TableColumn.CellDataFeatures<Pair<DhsImageCategory, Long>, String> p) -> new SimpleObjectProperty<>(p.getValue().getKey().getDisplayName()));
|
||||||
catColumn.setPrefWidth(USE_COMPUTED_SIZE);
|
catColumn.setPrefWidth(USE_COMPUTED_SIZE);
|
||||||
catColumn.setText(Bundle.SummaryTablePane_catColumn());
|
catColumn.setText(Bundle.SummaryTablePane_catColumn());
|
||||||
|
|
||||||
countColumn.setCellValueFactory((TableColumn.CellDataFeatures<Pair<Category, Long>, Long> p) -> new SimpleObjectProperty<>(p.getValue().getValue()));
|
countColumn.setCellValueFactory((TableColumn.CellDataFeatures<Pair<DhsImageCategory, Long>, Long> p) -> new SimpleObjectProperty<>(p.getValue().getValue()));
|
||||||
countColumn.setPrefWidth(USE_COMPUTED_SIZE);
|
countColumn.setPrefWidth(USE_COMPUTED_SIZE);
|
||||||
countColumn.setText(Bundle.SummaryTablePane_countColumn());
|
countColumn.setText(Bundle.SummaryTablePane_countColumn());
|
||||||
|
|
||||||
@ -93,9 +93,9 @@ public class SummaryTablePane extends AnchorPane {
|
|||||||
*/
|
*/
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void handleCategoryChanged(org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager.CategoryChangeEvent evt) {
|
public void handleCategoryChanged(org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager.CategoryChangeEvent evt) {
|
||||||
final ObservableList<Pair<Category, Long>> data = FXCollections.observableArrayList();
|
final ObservableList<Pair<DhsImageCategory, Long>> data = FXCollections.observableArrayList();
|
||||||
if (Case.isCaseOpen()) {
|
if (Case.isCaseOpen()) {
|
||||||
for (Category cat : Category.values()) {
|
for (DhsImageCategory cat : DhsImageCategory.values()) {
|
||||||
data.add(new Pair<>(cat, controller.getCategoryManager().getCategoryCount(cat)));
|
data.add(new Pair<>(cat, controller.getCategoryManager().getCategoryCount(cat)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
|||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.imagegallery.actions.CategorizeGroupAction;
|
import org.sleuthkit.autopsy.imagegallery.actions.CategorizeGroupAction;
|
||||||
import org.sleuthkit.autopsy.imagegallery.actions.TagGroupAction;
|
import org.sleuthkit.autopsy.imagegallery.actions.TagGroupAction;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy;
|
||||||
@ -154,13 +154,13 @@ public class Toolbar extends ToolBar {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
CategorizeGroupAction cat5GroupAction = new CategorizeGroupAction(Category.FIVE, controller);
|
CategorizeGroupAction cat5GroupAction = new CategorizeGroupAction(DhsImageCategory.FIVE, controller);
|
||||||
catGroupMenuButton.setOnAction(cat5GroupAction);
|
catGroupMenuButton.setOnAction(cat5GroupAction);
|
||||||
catGroupMenuButton.setText(cat5GroupAction.getText());
|
catGroupMenuButton.setText(cat5GroupAction.getText());
|
||||||
catGroupMenuButton.setGraphic(cat5GroupAction.getGraphic());
|
catGroupMenuButton.setGraphic(cat5GroupAction.getGraphic());
|
||||||
catGroupMenuButton.showingProperty().addListener(showing -> {
|
catGroupMenuButton.showingProperty().addListener(showing -> {
|
||||||
if (catGroupMenuButton.isShowing()) {
|
if (catGroupMenuButton.isShowing()) {
|
||||||
List<MenuItem> categoryMenues = Lists.transform(Arrays.asList(Category.values()),
|
List<MenuItem> categoryMenues = Lists.transform(Arrays.asList(DhsImageCategory.values()),
|
||||||
cat -> GuiUtils.createAutoAssigningMenuItem(catGroupMenuButton, new CategorizeGroupAction(cat, controller)));
|
cat -> GuiUtils.createAutoAssigningMenuItem(catGroupMenuButton, new CategorizeGroupAction(cat, controller)));
|
||||||
catGroupMenuButton.getItems().setAll(categoryMenues);
|
catGroupMenuButton.getItems().setAll(categoryMenues);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
||||||
|
|
||||||
@ -38,17 +38,17 @@ public interface DrawableView {
|
|||||||
|
|
||||||
static final Border HASH_BORDER = new Border(new BorderStroke(Color.PURPLE, BorderStrokeStyle.DASHED, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
static final Border HASH_BORDER = new Border(new BorderStroke(Color.PURPLE, BorderStrokeStyle.DASHED, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
||||||
|
|
||||||
static final Border CAT1_BORDER = new Border(new BorderStroke(Category.ONE.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
static final Border CAT1_BORDER = new Border(new BorderStroke(DhsImageCategory.ONE.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
||||||
|
|
||||||
static final Border CAT2_BORDER = new Border(new BorderStroke(Category.TWO.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
static final Border CAT2_BORDER = new Border(new BorderStroke(DhsImageCategory.TWO.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
||||||
|
|
||||||
static final Border CAT3_BORDER = new Border(new BorderStroke(Category.THREE.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
static final Border CAT3_BORDER = new Border(new BorderStroke(DhsImageCategory.THREE.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
||||||
|
|
||||||
static final Border CAT4_BORDER = new Border(new BorderStroke(Category.FOUR.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
static final Border CAT4_BORDER = new Border(new BorderStroke(DhsImageCategory.FOUR.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
||||||
|
|
||||||
static final Border CAT5_BORDER = new Border(new BorderStroke(Category.FIVE.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
static final Border CAT5_BORDER = new Border(new BorderStroke(DhsImageCategory.FIVE.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
||||||
|
|
||||||
static final Border CAT0_BORDER = new Border(new BorderStroke(Category.ZERO.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
static final Border CAT0_BORDER = new Border(new BorderStroke(DhsImageCategory.ZERO.getColor(), BorderStrokeStyle.SOLID, CAT_CORNER_RADII, CAT_BORDER_WIDTHS));
|
||||||
|
|
||||||
Region getCategoryBorderRegion();
|
Region getCategoryBorderRegion();
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ public interface DrawableView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Border getCategoryBorder(Category category) {
|
static Border getCategoryBorder(DhsImageCategory category) {
|
||||||
if (category != null) {
|
if (category != null) {
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case ONE:
|
case ONE:
|
||||||
@ -121,14 +121,14 @@ public interface DrawableView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ThreadConfined(type = ThreadConfined.ThreadType.ANY)
|
@ThreadConfined(type = ThreadConfined.ThreadType.ANY)
|
||||||
default Category updateCategory() {
|
default DhsImageCategory updateCategory() {
|
||||||
if (getFile().isPresent()) {
|
if (getFile().isPresent()) {
|
||||||
final Category category = getFile().map(DrawableFile::getCategory).orElse(Category.ZERO);
|
final DhsImageCategory category = getFile().map(DrawableFile::getCategory).orElse(DhsImageCategory.ZERO);
|
||||||
final Border border = hasHashHit() && (category == Category.ZERO) ? HASH_BORDER : getCategoryBorder(category);
|
final Border border = hasHashHit() && (category == DhsImageCategory.ZERO) ? HASH_BORDER : getCategoryBorder(category);
|
||||||
Platform.runLater(() -> getCategoryBorderRegion().setBorder(border));
|
Platform.runLater(() -> getCategoryBorderRegion().setBorder(border));
|
||||||
return category;
|
return category;
|
||||||
} else {
|
} else {
|
||||||
return Category.ZERO;
|
return DhsImageCategory.ZERO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ import org.sleuthkit.autopsy.imagegallery.actions.RedoAction;
|
|||||||
import org.sleuthkit.autopsy.imagegallery.actions.SwingMenuItemAdapter;
|
import org.sleuthkit.autopsy.imagegallery.actions.SwingMenuItemAdapter;
|
||||||
import org.sleuthkit.autopsy.imagegallery.actions.TagSelectedFilesAction;
|
import org.sleuthkit.autopsy.imagegallery.actions.TagSelectedFilesAction;
|
||||||
import org.sleuthkit.autopsy.imagegallery.actions.UndoAction;
|
import org.sleuthkit.autopsy.imagegallery.actions.UndoAction;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewMode;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewMode;
|
||||||
@ -352,7 +352,7 @@ public class GroupPane extends BorderPane {
|
|||||||
return grouping.getReadOnlyProperty();
|
return grouping.getReadOnlyProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ToggleButton getToggleForCategory(Category category) {
|
private ToggleButton getToggleForCategory(DhsImageCategory category) {
|
||||||
switch (category) {
|
switch (category) {
|
||||||
case ZERO:
|
case ZERO:
|
||||||
return cat0Toggle;
|
return cat0Toggle;
|
||||||
@ -397,7 +397,7 @@ public class GroupPane extends BorderPane {
|
|||||||
assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'.";
|
assert slideShowToggle != null : "fx:id=\"segButton\" was not injected: check your FXML file 'GroupHeader.fxml'.";
|
||||||
assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'.";
|
assert tileToggle != null : "fx:id=\"tileToggle\" was not injected: check your FXML file 'GroupHeader.fxml'.";
|
||||||
|
|
||||||
for (Category cat : Category.values()) {
|
for (DhsImageCategory cat : DhsImageCategory.values()) {
|
||||||
ToggleButton toggleForCategory = getToggleForCategory(cat);
|
ToggleButton toggleForCategory = getToggleForCategory(cat);
|
||||||
toggleForCategory.setBorder(new Border(new BorderStroke(cat.getColor(), BorderStrokeStyle.SOLID, CORNER_RADII_2, BORDER_WIDTHS_2)));
|
toggleForCategory.setBorder(new Border(new BorderStroke(cat.getColor(), BorderStrokeStyle.SOLID, CORNER_RADII_2, BORDER_WIDTHS_2)));
|
||||||
toggleForCategory.getStyleClass().remove("radio-button");
|
toggleForCategory.getStyleClass().remove("radio-button");
|
||||||
@ -445,13 +445,13 @@ public class GroupPane extends BorderPane {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
CategorizeSelectedFilesAction cat5SelectedAction = new CategorizeSelectedFilesAction(Category.FIVE, controller);
|
CategorizeSelectedFilesAction cat5SelectedAction = new CategorizeSelectedFilesAction(DhsImageCategory.FIVE, controller);
|
||||||
catSelectedSplitMenu.setOnAction(cat5SelectedAction);
|
catSelectedSplitMenu.setOnAction(cat5SelectedAction);
|
||||||
catSelectedSplitMenu.setText(cat5SelectedAction.getText());
|
catSelectedSplitMenu.setText(cat5SelectedAction.getText());
|
||||||
catSelectedSplitMenu.setGraphic(cat5SelectedAction.getGraphic());
|
catSelectedSplitMenu.setGraphic(cat5SelectedAction.getGraphic());
|
||||||
catSelectedSplitMenu.showingProperty().addListener(showing -> {
|
catSelectedSplitMenu.showingProperty().addListener(showing -> {
|
||||||
if (catSelectedSplitMenu.isShowing()) {
|
if (catSelectedSplitMenu.isShowing()) {
|
||||||
List<MenuItem> categoryMenues = Lists.transform(Arrays.asList(Category.values()),
|
List<MenuItem> categoryMenues = Lists.transform(Arrays.asList(DhsImageCategory.values()),
|
||||||
cat -> GuiUtils.createAutoAssigningMenuItem(catSelectedSplitMenu, new CategorizeSelectedFilesAction(cat, controller)));
|
cat -> GuiUtils.createAutoAssigningMenuItem(catSelectedSplitMenu, new CategorizeSelectedFilesAction(cat, controller)));
|
||||||
catSelectedSplitMenu.getItems().setAll(categoryMenues);
|
catSelectedSplitMenu.getItems().setAll(categoryMenues);
|
||||||
}
|
}
|
||||||
@ -765,7 +765,7 @@ public class GroupPane extends BorderPane {
|
|||||||
}
|
}
|
||||||
ObservableSet<Long> selected = selectionModel.getSelected();
|
ObservableSet<Long> selected = selectionModel.getSelected();
|
||||||
if (selected.isEmpty() == false) {
|
if (selected.isEmpty() == false) {
|
||||||
Category cat = keyCodeToCat(t.getCode());
|
DhsImageCategory cat = keyCodeToCat(t.getCode());
|
||||||
if (cat != null) {
|
if (cat != null) {
|
||||||
new CategorizeAction(controller, cat, selected).handle(null);
|
new CategorizeAction(controller, cat, selected).handle(null);
|
||||||
}
|
}
|
||||||
@ -773,27 +773,27 @@ public class GroupPane extends BorderPane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Category keyCodeToCat(KeyCode t) {
|
private DhsImageCategory keyCodeToCat(KeyCode t) {
|
||||||
if (t != null) {
|
if (t != null) {
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case NUMPAD0:
|
case NUMPAD0:
|
||||||
case DIGIT0:
|
case DIGIT0:
|
||||||
return Category.ZERO;
|
return DhsImageCategory.ZERO;
|
||||||
case NUMPAD1:
|
case NUMPAD1:
|
||||||
case DIGIT1:
|
case DIGIT1:
|
||||||
return Category.ONE;
|
return DhsImageCategory.ONE;
|
||||||
case NUMPAD2:
|
case NUMPAD2:
|
||||||
case DIGIT2:
|
case DIGIT2:
|
||||||
return Category.TWO;
|
return DhsImageCategory.TWO;
|
||||||
case NUMPAD3:
|
case NUMPAD3:
|
||||||
case DIGIT3:
|
case DIGIT3:
|
||||||
return Category.THREE;
|
return DhsImageCategory.THREE;
|
||||||
case NUMPAD4:
|
case NUMPAD4:
|
||||||
case DIGIT4:
|
case DIGIT4:
|
||||||
return Category.FOUR;
|
return DhsImageCategory.FOUR;
|
||||||
case NUMPAD5:
|
case NUMPAD5:
|
||||||
case DIGIT5:
|
case DIGIT5:
|
||||||
return Category.FIVE;
|
return DhsImageCategory.FIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -57,7 +57,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
|||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
||||||
@ -171,7 +171,7 @@ public class MetaDataPane extends DrawableUIBase {
|
|||||||
if (p.getKey() == DrawableAttribute.TAGS) {
|
if (p.getKey() == DrawableAttribute.TAGS) {
|
||||||
return ((Collection<TagName>) p.getValue()).stream()
|
return ((Collection<TagName>) p.getValue()).stream()
|
||||||
.map(TagName::getDisplayName)
|
.map(TagName::getDisplayName)
|
||||||
.filter(Category::isNotCategoryName)
|
.filter(DhsImageCategory::isNotCategoryName)
|
||||||
.collect(Collectors.joining(" ; "));
|
.collect(Collectors.joining(" ; "));
|
||||||
} else {
|
} else {
|
||||||
return p.getValue().stream()
|
return p.getValue().stream()
|
||||||
|
@ -50,7 +50,7 @@ import org.sleuthkit.autopsy.coreutils.ThreadConfined;
|
|||||||
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
|
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
|
||||||
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
|
||||||
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
|
||||||
import org.sleuthkit.autopsy.datamodel.tags.Category;
|
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
|
||||||
import org.sleuthkit.autopsy.imagegallery.datamodel.VideoFile;
|
import org.sleuthkit.autopsy.imagegallery.datamodel.VideoFile;
|
||||||
import org.sleuthkit.autopsy.imagegallery.gui.VideoPlayer;
|
import org.sleuthkit.autopsy.imagegallery.gui.VideoPlayer;
|
||||||
@ -306,14 +306,14 @@ public class SlideShowView extends DrawableTileBase {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ThreadConfined(type = ThreadType.ANY)
|
@ThreadConfined(type = ThreadType.ANY)
|
||||||
public Category updateCategory() {
|
public DhsImageCategory updateCategory() {
|
||||||
Optional<DrawableFile> file = getFile();
|
Optional<DrawableFile> file = getFile();
|
||||||
if (file.isPresent()) {
|
if (file.isPresent()) {
|
||||||
Category updateCategory = super.updateCategory();
|
DhsImageCategory updateCategory = super.updateCategory();
|
||||||
Platform.runLater(() -> getGroupPane().syncCatToggle(file.get()));
|
Platform.runLater(() -> getGroupPane().syncCatToggle(file.get()));
|
||||||
return updateCategory;
|
return updateCategory;
|
||||||
} else {
|
} else {
|
||||||
return Category.ZERO;
|
return DhsImageCategory.ZERO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user