From c2d0bbb932a44167a84d4f1fa0560f1fa2f1827b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 15 Nov 2017 11:59:10 -0500 Subject: [PATCH] 3198 comment getTagNameDefinitions --- .../casemodule/services/TagNameDefiniton.java | 28 +++++++++---------- .../casemodule/services/TagsManager.java | 9 ++---- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java index e4987fb207..d435f2a452 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -85,13 +85,14 @@ final class TagNameDefiniton implements Comparable { TagName.HTML_COLOR getColor() { return color; } - + /** - * + * */ - boolean isNotable(){ + boolean isNotable() { return knownStatusDenoted == TskData.FileKnown.BAD; } + /** * Compares this tag name definition with the specified tag name definition * for order. @@ -164,28 +165,28 @@ final class TagNameDefiniton implements Comparable { Set tagNames = new HashSet<>(); String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY); if (null != setting && !setting.isEmpty()) { - List badTags = null; + List notableTags = null; List tagNameTuples = Arrays.asList(setting.split(";")); for (String tagNameTuple : tagNameTuples) { String[] tagNameAttributes = tagNameTuple.split(","); - if (tagNameAttributes.length == 3) { - if (badTags == null) { + if (tagNameAttributes.length == 3) { //Upgrade case Tags.properties does not contain any tag definitions with knownStatus + if (notableTags == null) { String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS - if (badTagsStr == null) { + if (badTagsStr == null) { //if a badtags list could not be read from a central repository properties file use the defualt bad tags badTagsStr = STANDARD_NOTABLE_TAG_DISPLAY_NAMES; } - if (badTagsStr.isEmpty()) { - badTags = new ArrayList<>(); + if (badTagsStr.isEmpty()) { //if a badtags list is empty the user has saved all tags as non-notable so we will have all tags non-notable + notableTags = new ArrayList<>(); } else { - badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(","))); + notableTags = new ArrayList<>(Arrays.asList(badTagsStr.split(","))); //if the badtags list was present and had contents use the contents as the current notable tags list } } - if (badTags.contains(tagNameAttributes[0])) { + if (notableTags.contains(tagNameAttributes[0])) { //if the name attribute is in the notable tags list add the tag as a notable tag tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.BAD)); - } else { + } else { //otherwise add the tag as a default knownStatus tag 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) { + } else if (tagNameAttributes.length == 4) { //if there are 4 attributes its a current list we can use the values present tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.valueOf(tagNameAttributes[3]))); } @@ -194,7 +195,6 @@ final class TagNameDefiniton implements Comparable { return tagNames; } - /** * Sets the tag name definitions in the tag settings file. * diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index 8c87475785..58068b27b3 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -119,8 +119,7 @@ public class TagsManager implements Closeable { * * @param caseDb The case database. */ - TagsManager(SleuthkitCase caseDb - ) { + TagsManager(SleuthkitCase caseDb) { this.caseDb = caseDb; } @@ -237,11 +236,7 @@ public class TagsManager implements Closeable { * name to the case database. */ public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException { - TskData.FileKnown knownStatus = TskData.FileKnown.UNKNOWN; - if (getNotableTagDisplayNames().contains(displayName)) { - knownStatus = TskData.FileKnown.BAD; - } - return addTagName(displayName, description, color, knownStatus); + return addTagName(displayName, description, color, knownStatus,TskData.FileKnown.UNKNOWN); } /**