diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml
index 394198f6c9..987b2ffe78 100755
--- a/Core/nbproject/project.xml
+++ b/Core/nbproject/project.xml
@@ -304,7 +304,6 @@
org.sleuthkit.autopsy.corecomponents
org.sleuthkit.autopsy.coreutils
org.sleuthkit.autopsy.datamodel
- org.sleuthkit.autopsy.datamodel.tags
org.sleuthkit.autopsy.datasourceprocessors
org.sleuthkit.autopsy.directorytree
org.sleuthkit.autopsy.events
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index 8c7d29baa3..7e7607bf92 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -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 {
+ 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 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 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 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 {
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 {
*/
static synchronized Set getTagNameDefinitions() {
Set tagNames = new HashSet<>();
- List 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 standardTags = new HashSet<>(STANDARD_TAG_DISPLAY_NAMES);
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
if (null != setting && !setting.isEmpty()) {
List tagNameTuples = Arrays.asList(setting.split(";"));
- List 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 {
}
}
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 upgradeTagPropertiesFile(List tagProperties, Set standardTagsToBeCreated) {
+ Set tagNames = new HashSet<>();
+ List 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 readCurrentTagPropertiesFile(List tagProperties, Set standardTagsToBeCreated) {
+ Set 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;
}
/**
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java b/Core/src/org/sleuthkit/autopsy/datamodel/DhsImageCategory.java
similarity index 85%
rename from Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java
rename to Core/src/org/sleuthkit/autopsy/datamodel/DhsImageCategory.java
index 39d624110f..2357c61599 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/DhsImageCategory.java
@@ -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 getNonZeroCategories() {
+ public static ImmutableList getNonZeroCategories() {
return nonZeroCategories;
}
- private static final ImmutableList nonZeroCategories =
- ImmutableList.of(Category.FIVE, Category.FOUR, Category.THREE, Category.TWO, Category.ONE);
+ private static final ImmutableList nonZeroCategories =
+ ImmutableList.of(DhsImageCategory.FIVE, DhsImageCategory.FOUR, DhsImageCategory.THREE, DhsImageCategory.TWO, DhsImageCategory.ONE);
/**
* map from displayName to enum value
*/
- private static final Map nameMap =
- Stream.of(values()).collect(Collectors.toMap(
- Category::getDisplayName,
+ private static final Map 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;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
index e55078018e..3f8b3aecd0 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
@@ -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 selectedFileIDs;
private final Boolean createUndo;
- public CategorizeAction(ImageGalleryController controller, Category cat, Set selectedFileIDs) {
+ public CategorizeAction(ImageGalleryController controller, DhsImageCategory cat, Set selectedFileIDs) {
this(controller, cat, selectedFileIDs, true);
}
- private CategorizeAction(ImageGalleryController controller, Category cat, Set selectedFileIDs, Boolean createUndo) {
+ private CategorizeAction(ImageGalleryController controller, DhsImageCategory cat, Set 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 fileIDs;
private final boolean createUndo;
- private final Category cat;
+ private final DhsImageCategory cat;
- CategorizeTask(Set fileIDs, @Nonnull Category cat, boolean createUndo) {
+ CategorizeTask(Set 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 oldCats = new HashMap<>();
+ Map 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 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 oldCategories;
+ private final DhsImageCategory newCategory;
+ private final ImmutableMap oldCategories;
private final ImageGalleryController controller;
- CategorizationChange(ImageGalleryController controller, Category newCategory, Map oldCategories) {
+ CategorizationChange(ImageGalleryController controller, DhsImageCategory newCategory, Map 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 entry : oldCategories.entrySet()) {
+ for (Map.Entry entry : oldCategories.entrySet()) {
new CategorizeAction(controller, entry.getValue(), Collections.singleton(entry.getKey()), false)
.handle(null);
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
index 439bb59512..f568fbd105 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
@@ -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 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 catCountMap = new HashMap<>();
+ final Map 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 catCountMap, Category newCat, ObservableList fileIDs) {
+ private void showConfirmationDialog(final Map catCountMap, DhsImageCategory newCat, ObservableList fileIDs) {
ButtonType categorizeButtonType =
new ButtonType(Bundle.CategorizeGroupAction_OverwriteButton_text(), ButtonBar.ButtonData.APPLY);
VBox textFlow = new VBox();
- for (Map.Entry entry : catCountMap.entrySet()) {
+ for (Map.Entry 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()),
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
index be8c3644bb..bb8cd9de96 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
@@ -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())
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
index 33bc9a58d4..66aa6c578d 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
@@ -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 categoryCounts =
+ private final LoadingCache 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 catTagNameMap =
+ private final LoadingCache 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 fileIDs, Category newCategory) {
+ public void fireChange(Collection 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 fileIDs;
- private final Category newCategory;
+ private final DhsImageCategory newCategory;
- public CategoryChangeEvent(Collection fileIDs, Category newCategory) {
+ public CategoryChangeEvent(Collection fileIDs, DhsImageCategory newCategory) {
super();
this.fileIDs = ImmutableSet.copyOf(fileIDs);
this.newCategory = newCategory;
}
- public Category getNewCategory() {
+ public DhsImageCategory getNewCategory() {
return newCategory;
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
index 0ac5142f3c..c3b8771b6d 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
@@ -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> {
* //TODO: this has lead to awkward hard to maintain code, and little
* advantage. move categories into DrawableDB?
*/
- public final static DrawableAttribute CATEGORY =
- new DrawableAttribute(AttributeName.CATEGORY, Bundle.DrawableAttribute_category(),
+ public final static DrawableAttribute CATEGORY =
+ new DrawableAttribute(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();
}
};
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
index 5426ac205a..fa008fe3e9 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
@@ -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)
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
index 5b40c9240c..af26dd2e97 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
@@ -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 = new SimpleObjectProperty<>(null);
+ private final SimpleObjectProperty 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 categoryProperty() {
+ public SimpleObjectProperty 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
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
index 0497068924..cb30c37bab 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
@@ -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) {
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
index e62c2b6541..7dddfa5ca8 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
@@ -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) Arrays.asList(Category.values());
+ values = (List) Arrays.asList(DhsImageCategory.values());
break;
case TAGS:
values = (List) 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 getFileIDsWithCategory(Category category) throws TskCoreException {
+ public Set getFileIDsWithCategory(DhsImageCategory category) throws TskCoreException {
Set 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());
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
index 2841eb5325..44814e2c9a 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
@@ -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, String> catColumn;
+ private TableColumn, String> catColumn;
@FXML
- private TableColumn, Long> countColumn;
+ private TableColumn, Long> countColumn;
@FXML
- private TableView> tableView;
+ private TableView> 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, String> p) -> new SimpleObjectProperty<>(p.getValue().getKey().getDisplayName()));
+ catColumn.setCellValueFactory((TableColumn.CellDataFeatures, String> p) -> new SimpleObjectProperty<>(p.getValue().getKey().getDisplayName()));
catColumn.setPrefWidth(USE_COMPUTED_SIZE);
catColumn.setText(Bundle.SummaryTablePane_catColumn());
- countColumn.setCellValueFactory((TableColumn.CellDataFeatures, Long> p) -> new SimpleObjectProperty<>(p.getValue().getValue()));
+ countColumn.setCellValueFactory((TableColumn.CellDataFeatures, 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> data = FXCollections.observableArrayList();
+ final ObservableList> 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)));
}
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
index 6cb29d46d1..40dad21cf2 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
@@ -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