Merge pull request #3220 from wschaeferB/3199-ConsolidateDefaultTags

3199 consolidate default tags
This commit is contained in:
Richard Cordovano 2017-11-20 17:39:01 -05:00 committed by GitHub
commit ec2e1a8df0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 207 additions and 156 deletions

View File

@ -304,7 +304,6 @@
<package>org.sleuthkit.autopsy.corecomponents</package>
<package>org.sleuthkit.autopsy.coreutils</package>
<package>org.sleuthkit.autopsy.datamodel</package>
<package>org.sleuthkit.autopsy.datamodel.tags</package>
<package>org.sleuthkit.autopsy.datasourceprocessors</package>
<package>org.sleuthkit.autopsy.directorytree</package>
<package>org.sleuthkit.autopsy.events</package>

View File

@ -24,13 +24,14 @@ import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.logging.Level;
import javax.annotation.concurrent.Immutable;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
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.TskCoreException;
import org.sleuthkit.datamodel.TskData;
@ -41,17 +42,18 @@ import org.sleuthkit.datamodel.TskData;
@Immutable
final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
private static final Logger LOGGER = Logger.getLogger(TagNameDefiniton.class.getName());
@NbBundle.Messages({"TagNameDefiniton.predefTagNames.bookmark.text=Bookmark",
"TagNameDefiniton.predefTagNames.followUp.text=Follow Up",
"TagNameDefiniton.predefTagNames.notableItem.text=Notable Item"})
private static final String TAGS_SETTINGS_NAME = "Tags"; //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(),
Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(),
Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), DhsImageCategory.ONE.getDisplayName(),
DhsImageCategory.TWO.getDisplayName(), DhsImageCategory.THREE.getDisplayName(),
DhsImageCategory.FOUR.getDisplayName(), DhsImageCategory.FIVE.getDisplayName());
private final String displayName;
private final String description;
private final TagName.HTML_COLOR color;
@ -182,7 +184,7 @@ final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
try {
tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex);
}
return tagName;
}
@ -195,33 +197,26 @@ final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
*/
static synchronized Set<TagNameDefiniton> getTagNameDefinitions() {
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);
if (null != setting && !setting.isEmpty()) {
List<String> tagNameTuples = Arrays.asList(setting.split(";"));
List<String> notableTags = 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
notableTags.addAll(STANDARD_NOTABLE_TAG_DISPLAY_NAMES);
} else { //otherwise use the list that was in the central repository properties file
notableTags.addAll(Arrays.asList(badTagsStr.split(",")));
int numberOfAttributes = 0;
if (tagNameTuples.size() > 0) {
// Determine if Tags.properties file needs to be upgraded
numberOfAttributes = tagNameTuples.get(0).split(",").length;
}
for (String tagNameTuple : tagNameTuples) { //for each tag listed in the tags properties file
String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes
if (tagNameAttributes.length == 3) { //if there are only 3 attributes so Tags.properties does not contain any tag definitions with knownStatus
standardTags.remove(tagNameAttributes[0]); //remove tag from default tags we need to create still
if (notableTags.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
}
} 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])));
}
if (numberOfAttributes == 3) {
// Upgrade Tags.Properties with the settings in Central Repository Settings if necessary
tagNames.addAll(upgradeTagPropertiesFile(tagNameTuples, standardTags));
} else if (numberOfAttributes == 4) {
// if the Tags.Properties file is up to date parse it
tagNames.addAll(readCurrentTagPropertiesFile(tagNameTuples, standardTags));
}
}
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)) {
tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.BAD));
} else {
@ -229,6 +224,63 @@ final class TagNameDefiniton implements Comparable<TagNameDefiniton> {
}
}
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;
}
/**

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.datamodel.tags;
package org.sleuthkit.autopsy.datamodel;
import com.google.common.collect.ImmutableList;
import java.util.Map;
@ -38,6 +38,7 @@ import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.datamodel.Bundle;
/**
* 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.five=CAT-5: Non-pertinent",
"Category.zero=CAT-0: Uncategorized"})
public enum Category {
public enum DhsImageCategory {
/*
* 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 CornerRadii CORNER_RADII_4 = new CornerRadii(4);
public static ImmutableList<Category> getNonZeroCategories() {
public static ImmutableList<DhsImageCategory> getNonZeroCategories() {
return nonZeroCategories;
}
private static final ImmutableList<Category> nonZeroCategories =
ImmutableList.of(Category.FIVE, Category.FOUR, Category.THREE, Category.TWO, Category.ONE);
private static final ImmutableList<DhsImageCategory> nonZeroCategories =
ImmutableList.of(DhsImageCategory.FIVE, DhsImageCategory.FOUR, DhsImageCategory.THREE, DhsImageCategory.TWO, DhsImageCategory.ONE);
/**
* map from displayName to enum value
*/
private static final Map<String, Category> nameMap =
Stream.of(values()).collect(Collectors.toMap(
Category::getDisplayName,
private static final Map<String, DhsImageCategory> nameMap =
Stream.of(values()).collect(Collectors.toMap(DhsImageCategory::getDisplayName,
Function.identity()));
public static Category fromDisplayName(String displayName) {
public static DhsImageCategory fromDisplayName(String displayName) {
return nameMap.get(displayName);
}
@ -99,7 +99,7 @@ public enum Category {
private final int id;
private Image snapshot;
private Category(Color color, int id, String name) {
private DhsImageCategory(Color color, int id, String name) {
this.color = color;
this.displayName = name;
this.id = id;

View File

@ -40,7 +40,7 @@ import org.controlsfx.control.action.ActionUtils;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
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.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
@ -60,15 +60,15 @@ public class CategorizeAction extends Action {
private final ImageGalleryController controller;
private final UndoRedoManager undoManager;
private final Category cat;
private final DhsImageCategory cat;
private final Set<Long> selectedFileIDs;
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);
}
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());
this.controller = controller;
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
// 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));
getItems().add(categoryItem);
}
@ -118,9 +118,9 @@ public class CategorizeAction extends Action {
private final Set<Long> fileIDs;
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();
this.fileIDs = fileIDs;
java.util.Objects.requireNonNull(cat);
@ -132,14 +132,14 @@ public class CategorizeAction extends Action {
public void run() {
final DrawableTagsManager tagsManager = controller.getTagsManager();
final CategoryManager categoryManager = controller.getCategoryManager();
Map<Long, Category> oldCats = new HashMap<>();
Map<Long, DhsImageCategory> oldCats = new HashMap<>();
TagName tagName = categoryManager.getTagName(cat);
TagName catZeroTagName = categoryManager.getTagName(Category.ZERO);
TagName catZeroTagName = categoryManager.getTagName(DhsImageCategory.ZERO);
for (long fileID : fileIDs) {
try {
DrawableFile file = controller.getFileFromId(fileID); //drawable db access
if (createUndo) {
Category oldCat = file.getCategory(); //drawable db access
DhsImageCategory oldCat = file.getCategory(); //drawable db access
TagName oldCatTagName = categoryManager.getTagName(oldCat);
if (false == tagName.equals(oldCatTagName)) {
oldCats.put(fileID, oldCat);
@ -147,7 +147,7 @@ public class CategorizeAction extends Action {
}
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
fileTags.stream()
.filter(tag -> CategoryManager.isCategoryTagName(tag.getName()))
@ -189,11 +189,11 @@ public class CategorizeAction extends Action {
@Immutable
private final class CategorizationChange implements UndoRedoManager.UndoableCommand {
private final Category newCategory;
private final ImmutableMap<Long, Category> oldCategories;
private final DhsImageCategory newCategory;
private final ImmutableMap<Long, DhsImageCategory> oldCategories;
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.newCategory = newCategory;
this.oldCategories = ImmutableMap.copyOf(oldCategories);
@ -216,7 +216,7 @@ public class CategorizeAction extends Action {
@Override
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)
.handle(null);
}

View File

@ -38,7 +38,7 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryPreferences;
import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import org.sleuthkit.datamodel.TskCoreException;
/**
@ -49,7 +49,7 @@ public class CategorizeGroupAction extends CategorizeAction {
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);
setEventHandler(actionEvent -> {
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.
addCatToFiles(ImmutableSet.copyOf(fileIDs));
} else {
final Map<Category, Long> catCountMap = new HashMap<>();
final Map<DhsImageCategory, Long> catCountMap = new HashMap<>();
for (Long fileID : fileIDs) {
try {
Category category = controller.getFileFromId(fileID).getCategory();
if (false == Category.ZERO.equals(category) && newCat.equals(category) == false) {
DhsImageCategory category = controller.getFileFromId(fileID).getCategory();
if (false == DhsImageCategory.ZERO.equals(category) && newCat.equals(category) == false) {
catCountMap.merge(category, 1L, Long::sum);
}
} catch (TskCoreException ex) {
@ -86,14 +86,14 @@ public class CategorizeGroupAction extends CategorizeAction {
"CategorizeGroupAction.fileCountMessage={0} with {1}",
"CategorizeGroupAction.dontShowAgain=Don't show this message again",
"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 =
new ButtonType(Bundle.CategorizeGroupAction_OverwriteButton_text(), ButtonBar.ButtonData.APPLY);
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.getValue() > 0) {
Label label = new Label(Bundle.CategorizeGroupAction_fileCountMessage(entry.getValue(), entry.getKey().getDisplayName()),

View File

@ -19,14 +19,14 @@
package org.sleuthkit.autopsy.imagegallery.actions;
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 CategorizeSelectedFilesAction(Category cat, ImageGalleryController controller) {
public CategorizeSelectedFilesAction(DhsImageCategory cat, ImageGalleryController controller) {
super(controller, cat, null);
setEventHandler(actionEvent ->
addCatToFiles(controller.getSelectionModel().getSelected())

View File

@ -35,7 +35,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.coreutils.Logger;
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.TagName;
import org.sleuthkit.datamodel.TskCoreException;
@ -80,13 +80,13 @@ public class CategoryManager {
* the count related methods go through this cache, which loads initial
* 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));
/**
* cached TagNames corresponding to Categories, looked up from
* 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(
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
*
* @return the number of files with the given Category
*/
synchronized public long getCategoryCount(Category cat) {
if (cat == Category.ZERO) {
synchronized public long getCategoryCount(DhsImageCategory cat) {
if (cat == DhsImageCategory.ZERO) {
// 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
// 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;
} else {
return categoryCounts.getUnchecked(cat).sum();
@ -139,24 +139,24 @@ public class CategoryManager {
/**
* increment the cached value for the number of files with the given
* {@link Category}
* {@link DhsImageCategory}
*
* @param cat the Category to increment
*/
synchronized public void incrementCategoryCount(Category cat) {
if (cat != Category.ZERO) {
synchronized public void incrementCategoryCount(DhsImageCategory cat) {
if (cat != DhsImageCategory.ZERO) {
categoryCounts.getUnchecked(cat).increment();
}
}
/**
* decrement the cached value for the number of files with the given
* {@link Category}
* {@link DhsImageCategory}
*
* @param cat the Category to decrement
*/
synchronized public void decrementCategoryCount(Category cat) {
if (cat != Category.ZERO) {
synchronized public void decrementCategoryCount(DhsImageCategory cat) {
if (cat != DhsImageCategory.ZERO) {
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
* given Category
*/
synchronized private LongAdder getCategoryCountHelper(Category cat) {
synchronized private LongAdder getCategoryCountHelper(DhsImageCategory cat) {
LongAdder longAdder = new LongAdder();
longAdder.decrement();
try {
@ -188,7 +188,7 @@ public class CategoryManager {
*
* @param fileIDs
*/
public void fireChange(Collection<Long> fileIDs, Category newCategory) {
public void fireChange(Collection<Long> fileIDs, DhsImageCategory newCategory) {
categoryEventBus.post(new CategoryChangeEvent(fileIDs, newCategory));
}
@ -231,21 +231,21 @@ public class CategoryManager {
*
* @return the TagName used for this Category
*/
synchronized public TagName getTagName(Category cat) {
synchronized public TagName getTagName(DhsImageCategory cat) {
return catTagNameMap.getUnchecked(cat);
}
public static Category categoryFromTagName(TagName tagName) {
return Category.fromDisplayName(tagName.getDisplayName());
public static DhsImageCategory categoryFromTagName(TagName tagName) {
return DhsImageCategory.fromDisplayName(tagName.getDisplayName());
}
public static boolean isCategoryTagName(TagName tName) {
return Category.isCategoryName(tName.getDisplayName());
return DhsImageCategory.isCategoryName(tName.getDisplayName());
}
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) {
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());
if (newCat != Category.ZERO) {
DhsImageCategory newCat = CategoryManager.categoryFromTagName(addedTag.getName());
if (newCat != DhsImageCategory.ZERO) {
incrementCategoryCount(newCat);
}
@ -285,8 +285,8 @@ public class CategoryManager {
TagName tagName = deletedTagInfo.getName();
if (isCategoryTagName(tagName)) {
Category deletedCat = CategoryManager.categoryFromTagName(tagName);
if (deletedCat != Category.ZERO) {
DhsImageCategory deletedCat = CategoryManager.categoryFromTagName(tagName);
if (deletedCat != DhsImageCategory.ZERO) {
decrementCategoryCount(deletedCat);
}
fireChange(Collections.singleton(deletedTagInfo.getContentID()), null);
@ -301,15 +301,15 @@ public class CategoryManager {
public static class CategoryChangeEvent {
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();
this.fileIDs = ImmutableSet.copyOf(fileIDs);
this.newCategory = newCategory;
}
public Category getNewCategory() {
public DhsImageCategory getNewCategory() {
return newCategory;
}

View File

@ -18,7 +18,7 @@
*/
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.Collection;
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
* advantage. move categories into DrawableDB?
*/
public final static DrawableAttribute<Category> CATEGORY =
new DrawableAttribute<Category>(AttributeName.CATEGORY, Bundle.DrawableAttribute_category(),
public final static DrawableAttribute<DhsImageCategory> CATEGORY =
new DrawableAttribute<DhsImageCategory>(AttributeName.CATEGORY, Bundle.DrawableAttribute_category(),
false,
"category-icon.png", //NON-NLS
f -> Collections.singleton(f.getCategory())) {
@Override
public Node getGraphicForValue(Category val) {
public Node getGraphicForValue(DhsImageCategory val) {
return val.getGraphic();
}
};

View File

@ -18,7 +18,7 @@
*/
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.nio.file.Files;
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
for (Category cat : Category.values()) {
for (DhsImageCategory cat : DhsImageCategory.values()) {
insertGroup(cat.getDisplayName(), DrawableAttribute.CATEGORY);
}
initializeImageList();
@ -1016,7 +1016,7 @@ public final class DrawableDB {
case MIME_TYPE:
return groupManager.getFileIDsWithMimeType((String) groupKey.getValue());
case CATEGORY:
return groupManager.getFileIDsWithCategory((Category) groupKey.getValue());
return groupManager.getFileIDsWithCategory((DhsImageCategory) groupKey.getValue());
case TAGS:
return groupManager.getFileIDsWithTag((TagName) groupKey.getValue());
}
@ -1195,7 +1195,7 @@ public final class DrawableDB {
*
* @return the number of the with the given category
*/
public long getCategoryCount(Category cat) {
public long getCategoryCount(DhsImageCategory cat) {
try {
TagName tagName = controller.getTagsManager().getTagName(cat);
if (nonNull(tagName)) {
@ -1233,7 +1233,7 @@ public final class DrawableDB {
DrawableTagsManager tagsManager = controller.getTagsManager();
// 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(TagName::getId)
.map(Object::toString)

View File

@ -18,7 +18,7 @@
*/
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.text.MessageFormat;
import java.util.ArrayList;
@ -85,7 +85,7 @@ public abstract class DrawableFile {
private final SimpleBooleanProperty analyzed;
private final SimpleObjectProperty<Category> category = new SimpleObjectProperty<>(null);
private final SimpleObjectProperty<DhsImageCategory> category = new SimpleObjectProperty<>(null);
private String make;
@ -216,17 +216,17 @@ public abstract class DrawableFile {
return "";
}
public void setCategory(Category category) {
public void setCategory(DhsImageCategory category) {
categoryProperty().set(category);
}
public Category getCategory() {
public DhsImageCategory getCategory() {
updateCategory();
return category.get();
}
public SimpleObjectProperty<Category> categoryProperty() {
public SimpleObjectProperty<DhsImageCategory> categoryProperty() {
return category;
}
@ -238,9 +238,9 @@ public abstract class DrawableFile {
category.set(getContentTags().stream()
.map(Tag::getName).filter(CategoryManager::isCategoryTagName)
.map(TagName::getDisplayName)
.map(Category::fromDisplayName)
.map(DhsImageCategory::fromDisplayName)
.sorted().findFirst() //sort by severity and take the first
.orElse(Category.ZERO)
.orElse(DhsImageCategory.ZERO)
);
} catch (TskCoreException ex) {
LOGGER.log(Level.WARNING, "problem looking up category for " + this.getContentPathSafe(), ex); //NON-NLS

View File

@ -18,7 +18,7 @@
*/
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.EventBus;
import java.util.Collections;
@ -229,7 +229,7 @@ public class DrawableTagsManager {
}
}
public TagName getTagName(Category cat) {
public TagName getTagName(DhsImageCategory cat) {
try {
return getTagName(cat.getDisplayName());
} catch (TskCoreException ex) {

View File

@ -71,7 +71,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
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.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
@ -332,7 +332,7 @@ public class GroupManager {
switch (groupBy.attrName) {
//these cases get special treatment
case CATEGORY:
values = (List<A>) Arrays.asList(Category.values());
values = (List<A>) Arrays.asList(DhsImageCategory.values());
break;
case TAGS:
values = (List<A>) controller.getTagsManager().getTagNamesInUse().stream()
@ -388,7 +388,7 @@ public class GroupManager {
switch (groupKey.getAttribute().attrName) {
//these cases get special treatment
case CATEGORY:
fileIDsToReturn = getFileIDsWithCategory((Category) groupKey.getValue());
fileIDsToReturn = getFileIDsWithCategory((DhsImageCategory) groupKey.getValue());
break;
case TAGS:
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.
// 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();
if (nonNull(db)) {
try {
final DrawableTagsManager tagsManager = controller.getTagsManager();
if (category == Category.ZERO) {
List< TagName> tns = Stream.of(Category.ONE, Category.TWO, Category.THREE, Category.FOUR, Category.FIVE)
if (category == DhsImageCategory.ZERO) {
List< TagName> tns = Stream.of(DhsImageCategory.ONE, DhsImageCategory.TWO, DhsImageCategory.THREE, DhsImageCategory.FOUR, DhsImageCategory.FIVE)
.map(tagsManager::getTagName)
.collect(Collectors.toList());

View File

@ -36,7 +36,7 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
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
@ -44,13 +44,13 @@ import org.sleuthkit.autopsy.datamodel.tags.Category;
public class SummaryTablePane extends AnchorPane {
@FXML
private TableColumn<Pair<Category, Long>, String> catColumn;
private TableColumn<Pair<DhsImageCategory, Long>, String> catColumn;
@FXML
private TableColumn<Pair<Category, Long>, Long> countColumn;
private TableColumn<Pair<DhsImageCategory, Long>, Long> countColumn;
@FXML
private TableView<Pair<Category, Long>> tableView;
private TableView<Pair<DhsImageCategory, Long>> tableView;
private final ImageGalleryController controller;
@FXML
@ -67,11 +67,11 @@ public class SummaryTablePane extends AnchorPane {
tableView.prefHeightProperty().set(7 * 25);
//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.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.setText(Bundle.SummaryTablePane_countColumn());
@ -93,9 +93,9 @@ public class SummaryTablePane extends AnchorPane {
*/
@Subscribe
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()) {
for (Category cat : Category.values()) {
for (DhsImageCategory cat : DhsImageCategory.values()) {
data.add(new Pair<>(cat, controller.getCategoryManager().getCategoryCount(cat)));
}
}

View File

@ -49,7 +49,7 @@ import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.actions.CategorizeGroupAction;
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.grouping.DrawableGroup;
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.setText(cat5GroupAction.getText());
catGroupMenuButton.setGraphic(cat5GroupAction.getGraphic());
catGroupMenuButton.showingProperty().addListener(showing -> {
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)));
catGroupMenuButton.getItems().setAll(categoryMenues);
}

View File

@ -17,7 +17,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
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.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 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();
@ -97,7 +97,7 @@ public interface DrawableView {
}
}
static Border getCategoryBorder(Category category) {
static Border getCategoryBorder(DhsImageCategory category) {
if (category != null) {
switch (category) {
case ONE:
@ -121,14 +121,14 @@ public interface DrawableView {
}
@ThreadConfined(type = ThreadConfined.ThreadType.ANY)
default Category updateCategory() {
default DhsImageCategory updateCategory() {
if (getFile().isPresent()) {
final Category category = getFile().map(DrawableFile::getCategory).orElse(Category.ZERO);
final Border border = hasHashHit() && (category == Category.ZERO) ? HASH_BORDER : getCategoryBorder(category);
final DhsImageCategory category = getFile().map(DrawableFile::getCategory).orElse(DhsImageCategory.ZERO);
final Border border = hasHashHit() && (category == DhsImageCategory.ZERO) ? HASH_BORDER : getCategoryBorder(category);
Platform.runLater(() -> getCategoryBorderRegion().setBorder(border));
return category;
} else {
return Category.ZERO;
return DhsImageCategory.ZERO;
}
}
}

View File

@ -122,7 +122,7 @@ import org.sleuthkit.autopsy.imagegallery.actions.RedoAction;
import org.sleuthkit.autopsy.imagegallery.actions.SwingMenuItemAdapter;
import org.sleuthkit.autopsy.imagegallery.actions.TagSelectedFilesAction;
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.grouping.DrawableGroup;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewMode;
@ -352,7 +352,7 @@ public class GroupPane extends BorderPane {
return grouping.getReadOnlyProperty();
}
private ToggleButton getToggleForCategory(Category category) {
private ToggleButton getToggleForCategory(DhsImageCategory category) {
switch (category) {
case ZERO:
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 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);
toggleForCategory.setBorder(new Border(new BorderStroke(cat.getColor(), BorderStrokeStyle.SOLID, CORNER_RADII_2, BORDER_WIDTHS_2)));
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.setText(cat5SelectedAction.getText());
catSelectedSplitMenu.setGraphic(cat5SelectedAction.getGraphic());
catSelectedSplitMenu.showingProperty().addListener(showing -> {
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)));
catSelectedSplitMenu.getItems().setAll(categoryMenues);
}
@ -765,7 +765,7 @@ public class GroupPane extends BorderPane {
}
ObservableSet<Long> selected = selectionModel.getSelected();
if (selected.isEmpty() == false) {
Category cat = keyCodeToCat(t.getCode());
DhsImageCategory cat = keyCodeToCat(t.getCode());
if (cat != 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) {
switch (t) {
case NUMPAD0:
case DIGIT0:
return Category.ZERO;
return DhsImageCategory.ZERO;
case NUMPAD1:
case DIGIT1:
return Category.ONE;
return DhsImageCategory.ONE;
case NUMPAD2:
case DIGIT2:
return Category.TWO;
return DhsImageCategory.TWO;
case NUMPAD3:
case DIGIT3:
return Category.THREE;
return DhsImageCategory.THREE;
case NUMPAD4:
case DIGIT4:
return Category.FOUR;
return DhsImageCategory.FOUR;
case NUMPAD5:
case DIGIT5:
return Category.FIVE;
return DhsImageCategory.FIVE;
}
}
return null;

View File

@ -57,7 +57,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
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.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
@ -171,7 +171,7 @@ public class MetaDataPane extends DrawableUIBase {
if (p.getKey() == DrawableAttribute.TAGS) {
return ((Collection<TagName>) p.getValue()).stream()
.map(TagName::getDisplayName)
.filter(Category::isNotCategoryName)
.filter(DhsImageCategory::isNotCategoryName)
.collect(Collectors.joining(" ; "));
} else {
return p.getValue().stream()

View File

@ -50,7 +50,7 @@ import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
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.VideoFile;
import org.sleuthkit.autopsy.imagegallery.gui.VideoPlayer;
@ -306,14 +306,14 @@ public class SlideShowView extends DrawableTileBase {
*/
@Override
@ThreadConfined(type = ThreadType.ANY)
public Category updateCategory() {
public DhsImageCategory updateCategory() {
Optional<DrawableFile> file = getFile();
if (file.isPresent()) {
Category updateCategory = super.updateCategory();
DhsImageCategory updateCategory = super.updateCategory();
Platform.runLater(() -> getGroupPane().syncCatToggle(file.get()));
return updateCategory;
} else {
return Category.ZERO;
return DhsImageCategory.ZERO;
}
}