From a7b256d5af0b5ddd856bd2e0d8d8911a81187638 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 2 Nov 2017 15:58:37 -0400 Subject: [PATCH 01/13] 3198 moved notable status for tag from CR --- .../casemodule/services/TagNameDefiniton.java | 42 ++++++++++++++-- .../casemodule/services/TagOptionsPanel.form | 2 +- .../casemodule/services/TagOptionsPanel.java | 2 +- .../casemodule/services/TagsManager.java | 49 ++++++++++++++++--- .../datamodel/AbstractSqlEamDb.java | 28 ----------- .../centralrepository/datamodel/EamDb.java | 14 ------ .../datamodel/PostgresEamDb.java | 11 ----- .../datamodel/PostgresEamDbSettings.java | 30 ------------ .../datamodel/SqliteEamDb.java | 11 +---- .../datamodel/SqliteEamDbSettings.java | 27 +--------- .../eventlisteners/CaseEventListener.java | 38 +++++++------- .../optionspanel/ManageTagsDialog.java | 9 +--- 12 files changed, 106 insertions(+), 157 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java index 101d68fa4c..e980d7b96c 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.casemodule.services; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; @@ -35,9 +36,13 @@ final class TagNameDefiniton implements Comparable { private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS + private static final String DEFAULT_BAD_TAGS = "Evidence,Notable Item," + + "CAT-1: Child Exploitation (Illegal),CAT-2: Child Exploitation (Non-Illegal/Age Difficult),CAT-3: Child Exploitive"; // NON-NLS + static final String NOTABLE = "(Notable)"; private final String displayName; private final String description; private final TagName.HTML_COLOR color; + private final String knownStatus; /** * Constructs a tag name definition consisting of a display name, @@ -47,10 +52,11 @@ final class TagNameDefiniton implements Comparable { * @param description The description for the tag name. * @param color The color for the tag name. */ - TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color) { + TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String notable) { this.displayName = displayName; this.description = description; this.color = color; + this.knownStatus = notable; } /** @@ -79,7 +85,13 @@ final class TagNameDefiniton implements Comparable { TagName.HTML_COLOR getColor() { return color; } - + + /** + * + */ + boolean isNotable(){ + return knownStatus.equals(NOTABLE); + } /** * Compares this tag name definition with the specified tag name definition * for order. @@ -140,7 +152,7 @@ final class TagNameDefiniton implements Comparable { * that is used by the tags settings file. */ private String toSettingsFormat() { - return displayName + "," + description + "," + color.name(); + return displayName + "," + description + "," + color.name() + "," + knownStatus; } /** @@ -152,15 +164,37 @@ 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 tagNameTuples = Arrays.asList(setting.split(";")); for (String tagNameTuple : tagNameTuples) { String[] tagNameAttributes = tagNameTuple.split(","); - tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]))); + if (tagNameAttributes.length == 3) { + if (badTags == null) { + String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS + if (badTagsStr == null) { + badTagsStr = DEFAULT_BAD_TAGS; + } + if (badTagsStr.isEmpty()) { + badTags = new ArrayList<>(); + } else { + badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(","))); + } + } + if (badTags.contains(tagNameAttributes[0])) { + tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), NOTABLE)); + } else { + tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), "")); //add the default value for that tag + } + } else if (tagNameAttributes.length == 4) { + tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), tagNameAttributes[3])); + } + } } return tagNames; } + /** * Sets the tag name definitions in the tag settings file. * diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form index 3f33f848c0..c58201621a 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form @@ -52,7 +52,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java index c1c9beb5b2..8fc6a5ff4d 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java @@ -190,7 +190,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { NewTagNameDialog.BUTTON_PRESSED result = dialog.getResult(); if (result == NewTagNameDialog.BUTTON_PRESSED.OK) { String newTagDisplayName = dialog.getTagName(); - TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR); + TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR, ""); /* * If tag name already exists, don't add the tag name. */ diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index c592e463cb..f66b195073 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.casemodule.services; import java.io.Closeable; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; @@ -87,7 +88,7 @@ public class TagsManager implements Closeable { Set customNames = TagNameDefiniton.getTagNameDefinitions(); customNames.forEach((tagType) -> { tagDisplayNames.add(tagType.getDisplayName()); - }); + }); try { TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager(); for (TagName tagName : tagsManager.getAllTagNames()) { @@ -97,7 +98,17 @@ public class TagsManager implements Closeable { /* * No current case, nothing more to add to the set. */ - } + } + return tagDisplayNames; + } + + public static List getNotableTagDisplayNames() { + List tagDisplayNames = new ArrayList<>(); + for (TagNameDefiniton tagDef : TagNameDefiniton.getTagNameDefinitions()) { + if (tagDef.isNotable()) { + tagDisplayNames.add(tagDef.getDisplayName()); + } + } return tagDisplayNames; } @@ -107,7 +118,8 @@ public class TagsManager implements Closeable { * * @param caseDb The case database. */ - TagsManager(SleuthkitCase caseDb) { + TagsManager(SleuthkitCase caseDb + ) { this.caseDb = caseDb; } @@ -186,7 +198,7 @@ public class TagsManager implements Closeable { * name to the case database. */ public synchronized TagName addTagName(String displayName) throws TagNameAlreadyExistsException, TskCoreException { - return addTagName(displayName, "", TagName.HTML_COLOR.NONE); + return addTagName(displayName, "", TagName.HTML_COLOR.NONE, ""); } /** @@ -205,7 +217,7 @@ public class TagsManager implements Closeable { * name to the case database. */ public synchronized TagName addTagName(String displayName, String description) throws TagNameAlreadyExistsException, TskCoreException { - return addTagName(displayName, description, TagName.HTML_COLOR.NONE); + return addTagName(displayName, description, TagName.HTML_COLOR.NONE, ""); } /** @@ -224,11 +236,36 @@ 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 { + String knownStatus = ""; + if (getNotableTagDisplayNames().contains(displayName)) { + knownStatus = TagNameDefiniton.NOTABLE; + } + return addTagName(displayName, description, color, knownStatus); + } + + /** + * Adds a tag name entry to the case database and adds a corresponding tag + * type to the current user's custom tag types. + * + * @param displayName The display name for the new tag type. + * @param description The description for the new tag type. + * @param color The color to associate with the new tag type. + * @param knownStatus The knownStatus to be used for the tag when + * correlating on the tagged item + * + * @return A TagName object that can be used to add instances of the tag + * type to the case database. + * + * @throws TagNameAlreadyExistsException If the tag name already exists. + * @throws TskCoreException If there is an error adding the tag + * name to the case database. + */ + public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) throws TagNameAlreadyExistsException, TskCoreException { try { TagName tagName = caseDb.addTagName(displayName, description, color); if (!STANDARD_TAG_DISPLAY_NAMES.contains(displayName)) { Set customTypes = TagNameDefiniton.getTagNameDefinitions(); - customTypes.add(new TagNameDefiniton(displayName, description, color)); + customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus)); TagNameDefiniton.setTagNameDefinitions(customTypes); } return tagName; diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java index b16589c3dd..0094dbb98e 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java @@ -34,7 +34,6 @@ import java.time.LocalDate; import java.util.HashMap; import java.util.Map; import java.util.Set; -import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; @@ -55,7 +54,6 @@ public abstract class AbstractSqlEamDb implements EamDb { private int bulkArtifactsCount; protected int bulkArtifactsThreshold; private final Map> bulkArtifacts; - private final List badTags; /** * Connect to the DB and initialize it. @@ -63,7 +61,6 @@ public abstract class AbstractSqlEamDb implements EamDb { * @throws UnknownHostException, EamDbException */ protected AbstractSqlEamDb() throws EamDbException { - badTags = new ArrayList<>(); bulkArtifactsCount = 0; bulkArtifacts = new HashMap<>(); @@ -78,31 +75,6 @@ public abstract class AbstractSqlEamDb implements EamDb { */ protected abstract Connection connect() throws EamDbException; - /** - * Get the list of tags recognized as "Bad" - * - * @return The list of bad tags - */ - @Override - public List getBadTags() { - synchronized (badTags) { - return new ArrayList<>(badTags); - } - } - - /** - * Set the tags recognized as "Bad" - * - * @param tags The tags to consider bad - */ - @Override - public void setBadTags(List tags) { - synchronized (badTags) { - badTags.clear(); - badTags.addAll(tags); - } - } - /** * Add a new name/value pair in the db_info table. * diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java index 70ab104fa4..173dd6cdad 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java @@ -95,20 +95,6 @@ public interface EamDb { && EamDbPlatformEnum.getSelectedPlatform() != EamDbPlatformEnum.DISABLED; } - /** - * Get the list of tags recognized as "Bad" - * - * @return The list of bad tags - */ - List getBadTags(); - - /** - * Set the tags recognized as "Bad" - * - * @param tags The tags to consider bad - */ - void setBadTags(List tags); - /** * Add a new name/value pair in the db_info table. * diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java index cecba78f4e..c139554c9c 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.centralrepository.datamodel; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; -import java.util.List; import java.util.logging.Level; import org.apache.commons.dbcp2.BasicDataSource; import org.sleuthkit.autopsy.coreutils.Logger; @@ -187,14 +186,4 @@ public class PostgresEamDb extends AbstractSqlEamDb { return CONFLICT_CLAUSE; } - @Override - public List getBadTags() { - return dbSettings.getBadTags(); - } - - @Override - public void setBadTags(List badTags) { - dbSettings.setBadTags(badTags); - } - } diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java index 461a499663..e2558ab0a0 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java @@ -24,8 +24,6 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Properties; import java.util.logging.Level; @@ -47,7 +45,6 @@ public final class PostgresEamDbSettings { private final int DEFAULT_BULK_THRESHHOLD = 1000; private final String DEFAULT_USERNAME = ""; private final String DEFAULT_PASSWORD = ""; - private final String DEFAULT_BAD_TAGS = "Evidence"; // NON-NLS private final String VALIDATION_QUERY = "SELECT version()"; // NON-NLS private final String JDBC_BASE_URI = "jdbc:postgresql://"; // NON-NLS private final String JDBC_DRIVER = "org.postgresql.Driver"; // NON-NLS @@ -59,7 +56,6 @@ public final class PostgresEamDbSettings { private int bulkThreshold; private String userName; private String password; - private List badTags; public PostgresEamDbSettings() { loadSettings(); @@ -120,16 +116,6 @@ public final class PostgresEamDbSettings { password = DEFAULT_PASSWORD; } } - - String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS - if (badTagsStr == null) { - badTagsStr = DEFAULT_BAD_TAGS; - } - if(badTagsStr.isEmpty()){ - badTags = new ArrayList<>(); - } else { - badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(","))); - } } public void saveSettings() { @@ -143,8 +129,6 @@ public final class PostgresEamDbSettings { } catch (TextConverterException ex) { LOGGER.log(Level.SEVERE, "Failed to convert password from text to hex text.", ex); } - - ModuleSettings.setConfigSetting("CentralRepository", "db.badTags", String.join(",", badTags)); // NON-NLS } /** @@ -631,20 +615,6 @@ public final class PostgresEamDbSettings { this.password = password; } - /** - * @return the badTags - */ - public List getBadTags() { - return badTags; - } - - /** - * @param badTags the badTags to set - */ - public void setBadTags(List badTags) { - this.badTags = badTags; - } - /** * @return the VALIDATION_QUERY */ diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java index 5890dd2a67..068093de46 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java @@ -200,16 +200,7 @@ public class SqliteEamDb extends AbstractSqlEamDb { return ""; } - @Override - public List getBadTags() { - return dbSettings.getBadTags(); - } - - @Override - public void setBadTags(List badTags) { - dbSettings.setBadTags(badTags); - } - + /** * Add a new name/value pair in the db_info table. * diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java index 6deb5145e8..56c1b7694e 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java @@ -26,8 +26,6 @@ import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.logging.Level; import java.util.regex.Pattern; @@ -44,7 +42,6 @@ public final class SqliteEamDbSettings { private final String DEFAULT_DBNAME = "central_repository.db"; // NON-NLS private final String DEFAULT_DBDIRECTORY = PlatformUtil.getUserDirectory() + File.separator + "central_repository"; // NON-NLS private final int DEFAULT_BULK_THRESHHOLD = 1000; - private final String DEFAULT_BAD_TAGS = "Evidence"; // NON-NLS private final String JDBC_DRIVER = "org.sqlite.JDBC"; // NON-NLS private final String JDBC_BASE_URI = "jdbc:sqlite:"; // NON-NLS private final String VALIDATION_QUERY = "SELECT count(*) from sqlite_master"; // NON-NLS @@ -59,7 +56,6 @@ public final class SqliteEamDbSettings { private String dbName; private String dbDirectory; private int bulkThreshold; - private List badTags; public SqliteEamDbSettings() { loadSettings(); @@ -90,15 +86,7 @@ public final class SqliteEamDbSettings { this.bulkThreshold = DEFAULT_BULK_THRESHHOLD; } - String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS - if (badTagsStr == null) { - badTagsStr = DEFAULT_BAD_TAGS; - } - if (badTagsStr.isEmpty()) { - badTags = new ArrayList<>(); - } else { - badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(","))); - } + } public void saveSettings() { @@ -107,7 +95,6 @@ public final class SqliteEamDbSettings { ModuleSettings.setConfigSetting("CentralRepository", "db.sqlite.dbName", getDbName()); // NON-NLS ModuleSettings.setConfigSetting("CentralRepository", "db.sqlite.dbDirectory", getDbDirectory()); // NON-NLS ModuleSettings.setConfigSetting("CentralRepository", "db.sqlite.bulkThreshold", Integer.toString(getBulkThreshold())); // NON-NLS - ModuleSettings.setConfigSetting("CentralRepository", "db.badTags", String.join(",", badTags)); // NON-NLS } /** @@ -500,19 +487,7 @@ public final class SqliteEamDbSettings { } } - /** - * @return the badTags - */ - public List getBadTags() { - return badTags; - } - /** - * @param badTags the badTags to set - */ - public void setBadTags(List badTags) { - this.badTags = badTags; - } /** * @return the dbDirectory diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java index a68b0cba8d..3f9dffc2fb 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java @@ -130,7 +130,7 @@ final class CaseEventListener implements PropertyChangeListener { final ContentTagAddedEvent tagAddedEvent = (ContentTagAddedEvent) event; final ContentTag tagAdded = tagAddedEvent.getAddedTag(); - if (dbManager.getBadTags().contains(tagAdded.getName().getDisplayName())) { + if (TagsManager.getNotableTagDisplayNames().contains(tagAdded.getName().getDisplayName())) { if (tagAdded.getContent() instanceof AbstractFile) { af = (AbstractFile) tagAdded.getContent(); knownStatus = TskData.FileKnown.BAD; @@ -151,7 +151,7 @@ final class CaseEventListener implements PropertyChangeListener { long contentID = tagDeletedEvent.getDeletedTagInfo().getContentID(); String tagName = tagDeletedEvent.getDeletedTagInfo().getName().getDisplayName(); - if (!dbManager.getBadTags().contains(tagName)) { + if (!TagsManager.getNotableTagDisplayNames().contains(tagName)) { // If the tag that got removed isn't on the list of central repo tags, do nothing return; } @@ -164,7 +164,7 @@ final class CaseEventListener implements PropertyChangeListener { if (tags.stream() .map(tag -> tag.getName().getDisplayName()) - .filter(dbManager.getBadTags()::contains) + .filter(TagsManager.getNotableTagDisplayNames()::contains) .collect(Collectors.toList()) .isEmpty()) { @@ -227,7 +227,7 @@ final class CaseEventListener implements PropertyChangeListener { final BlackBoardArtifactTagAddedEvent tagAddedEvent = (BlackBoardArtifactTagAddedEvent) event; final BlackboardArtifactTag tagAdded = tagAddedEvent.getAddedTag(); - if (dbManager.getBadTags().contains(tagAdded.getName().getDisplayName())) { + if (TagsManager.getNotableTagDisplayNames().contains(tagAdded.getName().getDisplayName())) { content = tagAdded.getContent(); bbArtifact = tagAdded.getArtifact(); knownStatus = TskData.FileKnown.BAD; @@ -245,7 +245,7 @@ final class CaseEventListener implements PropertyChangeListener { long artifactID = tagDeletedEvent.getDeletedTagInfo().getArtifactID(); String tagName = tagDeletedEvent.getDeletedTagInfo().getName().getDisplayName(); - if (!dbManager.getBadTags().contains(tagName)) { + if (!TagsManager.getNotableTagDisplayNames().contains(tagName)) { // If the tag that got removed isn't on the list of central repo tags, do nothing return; } @@ -259,7 +259,7 @@ final class CaseEventListener implements PropertyChangeListener { if (tags.stream() .map(tag -> tag.getName().getDisplayName()) - .filter(dbManager.getBadTags()::contains) + .filter(TagsManager.getNotableTagDisplayNames()::contains) .collect(Collectors.toList()) .isEmpty()) { @@ -367,20 +367,20 @@ final class CaseEventListener implements PropertyChangeListener { } CorrelationCase curCeCase = new CorrelationCase( - -1, - curCase.getName(), // unique case ID - EamOrganization.getDefault(), - curCase.getDisplayName(), - curCase.getCreatedDate(), - curCase.getNumber(), - curCase.getExaminer(), - curCase.getExaminerEmail(), - curCase.getExaminerPhone(), - curCase.getCaseNotes()); + -1, + curCase.getName(), // unique case ID + EamOrganization.getDefault(), + curCase.getDisplayName(), + curCase.getCreatedDate(), + curCase.getNumber(), + curCase.getExaminer(), + curCase.getExaminerEmail(), + curCase.getExaminerPhone(), + curCase.getCaseNotes()); - if (!EamDb.isEnabled()) { - return; - } + if (!EamDb.isEnabled()) { + return; + } try { // NOTE: Cannot determine if the opened case is a new case or a reopened case, diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java index 1960ee3df4..037c86edf8 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java @@ -91,15 +91,11 @@ final class ManageTagsDialog extends javax.swing.JDialog { lbWarnings.setText(Bundle.ManageTagsDialog_init_failedConnection_msg()); return; } - List badTags = dbManager.getBadTags(); + List badTags = TagsManager.getNotableTagDisplayNames(); List tagNames = new ArrayList<>(badTags); try { - tagNames.addAll( - TagsManager.getTagDisplayNames() - .stream() - .filter(tagName -> !badTags.contains(tagName)) - .collect(Collectors.toList())); + tagNames.addAll(TagsManager.getTagDisplayNames()); } catch (TskCoreException ex) { LOGGER.log(Level.WARNING, "Could not get list of tags in case", ex); lbWarnings.setText(Bundle.ManageTagsDialog_init_failedGettingTags_msg()); @@ -262,7 +258,6 @@ final class ManageTagsDialog extends javax.swing.JDialog { } try { EamDb dbManager = EamDb.getInstance(); - dbManager.setBadTags(badTags); dbManager.saveSettings(); } catch (EamDbException ex) { LOGGER.log(Level.SEVERE, "Failed to connect to central repository database."); // NON-NLS From 7278b5b97a0150fa39f2a168c67bd98392d6d3f5 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 3 Nov 2017 10:11:54 -0400 Subject: [PATCH 02/13] 3198 fix issue causing duplicate bad tags in list --- .../centralrepository/optionspanel/ManageTagsDialog.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java index 037c86edf8..ff179c3032 100755 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; -import java.util.stream.Collectors; import javax.swing.JFrame; import javax.swing.table.DefaultTableModel; import javax.swing.event.TableModelEvent; @@ -93,7 +92,7 @@ final class ManageTagsDialog extends javax.swing.JDialog { } List badTags = TagsManager.getNotableTagDisplayNames(); - List tagNames = new ArrayList<>(badTags); + List tagNames = new ArrayList<>(); try { tagNames.addAll(TagsManager.getTagDisplayNames()); } catch (TskCoreException ex) { From ad7d504d27c30d351cbf0f08580a31f22a4b3029 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 6 Nov 2017 15:00:05 -0500 Subject: [PATCH 03/13] 3199 Category class moved to Aut Core, tags created one place --- Core/nbproject/project.xml | 1 + .../casemodule/services/TagNameDefiniton.java | 57 +++++++++++-------- .../casemodule/services/TagsManager.java | 17 +++--- .../autopsy/datamodel/tags}/Category.java | 2 +- .../actions/CategorizeAction.java | 2 +- .../actions/CategorizeGroupAction.java | 2 +- .../CategorizeSelectedFilesAction.java | 2 +- .../datamodel/CategoryManager.java | 2 + .../datamodel/DrawableAttribute.java | 1 + .../imagegallery/datamodel/DrawableDB.java | 1 + .../imagegallery/datamodel/DrawableFile.java | 1 + .../datamodel/DrawableTagsManager.java | 4 +- .../datamodel/grouping/GroupManager.java | 2 +- .../imagegallery/gui/SummaryTablePane.java | 2 +- .../autopsy/imagegallery/gui/Toolbar.java | 2 +- .../gui/drawableviews/DrawableView.java | 2 +- .../gui/drawableviews/GroupPane.java | 2 +- .../gui/drawableviews/MetaDataPane.java | 2 +- .../gui/drawableviews/SlideShowView.java | 2 +- 19 files changed, 64 insertions(+), 42 deletions(-) rename {ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel => Core/src/org/sleuthkit/autopsy/datamodel/tags}/Category.java (98%) mode change 100755 => 100644 diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index 25e17dd3eb..553a2378d4 100755 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -264,6 +264,7 @@ 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 e980d7b96c..f1437f3c11 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.casemodule.services; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Objects; @@ -27,6 +28,7 @@ import java.util.Set; import javax.annotation.concurrent.Immutable; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.datamodel.TagName; +import org.sleuthkit.autopsy.datamodel.tags.Category; /** * A tag name definition consisting of a display name, description and color. @@ -36,8 +38,11 @@ final class TagNameDefiniton implements Comparable { private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS - private static final String DEFAULT_BAD_TAGS = "Evidence,Notable Item," - + "CAT-1: Child Exploitation (Illegal),CAT-2: Child Exploitation (Non-Illegal/Age Difficult),CAT-3: Child Exploitive"; // NON-NLS + private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList("Evidence", "Notable Item", Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS + private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text(), "Follow Up", + "Notable Item", Category.ONE.getDisplayName(), + Category.TWO.getDisplayName(), Category.THREE.getDisplayName(), + Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName()); static final String NOTABLE = "(Notable)"; private final String displayName; private final String description; @@ -46,17 +51,18 @@ final class TagNameDefiniton implements Comparable { /** * Constructs a tag name definition consisting of a display name, - * description and color. + * description, color and knownStatus. * * @param displayName The display name for the tag name. * @param description The description for the tag name. * @param color The color for the tag name. + * @param knownStatus The status denoted by the tag. */ - TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String notable) { + TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) { this.displayName = displayName; this.description = description; this.color = color; - this.knownStatus = notable; + this.knownStatus = knownStatus; } /** @@ -85,13 +91,14 @@ final class TagNameDefiniton implements Comparable { TagName.HTML_COLOR getColor() { return color; } - + /** - * + * */ - boolean isNotable(){ + boolean isNotable() { return knownStatus.equals(NOTABLE); } + /** * Compares this tag name definition with the specified tag name definition * for order. @@ -156,45 +163,49 @@ final class TagNameDefiniton implements Comparable { } /** - * Gets tag name definitions from the tag settings file. + * Gets tag name definitions from the tag settings file as well as the + * default tag name definitions. * * @return A set of tag name definition objects. */ static synchronized Set getTagNameDefinitions() { Set tagNames = new HashSet<>(); + List standardTags = new ArrayList<>(STANDARD_TAG_DISPLAY_NAMES); String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY); if (null != setting && !setting.isEmpty()) { - List badTags = null; List tagNameTuples = Arrays.asList(setting.split(";")); + List badTags = new ArrayList<>(); + String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS + if (badTagsStr == null || badTagsStr.isEmpty()) { + badTags.addAll(STANDARD_NOTABLE_TAG_DISPLAY_NAMES); + } else { + badTags.addAll(Arrays.asList(badTagsStr.split(","))); + } for (String tagNameTuple : tagNameTuples) { String[] tagNameAttributes = tagNameTuple.split(","); if (tagNameAttributes.length == 3) { - if (badTags == null) { - String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS - if (badTagsStr == null) { - badTagsStr = DEFAULT_BAD_TAGS; - } - if (badTagsStr.isEmpty()) { - badTags = new ArrayList<>(); - } else { - badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(","))); - } - } + standardTags.remove(tagNameAttributes[0]); //Use standard tag's saved settings instead of default settings if (badTags.contains(tagNameAttributes[0])) { tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), NOTABLE)); } else { tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), "")); //add the default value for that tag } } else if (tagNameAttributes.length == 4) { + standardTags.remove(tagNameAttributes[0]); //Use standard tag's saved settings instead of default settings tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), tagNameAttributes[3])); } - + } + } + for (String standardTagName : standardTags) { + if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) { + tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, NOTABLE)); + } else { + tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, "")); //add the default value for that tag } } 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 f66b195073..cf2bcf8ba2 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -31,6 +31,7 @@ import java.util.logging.Level; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifactTag; import org.sleuthkit.datamodel.Content; @@ -47,7 +48,11 @@ public class TagsManager implements Closeable { private static final Logger LOGGER = Logger.getLogger(TagsManager.class.getName()); @NbBundle.Messages("TagsManager.predefTagNames.bookmark.text=Bookmark") - private static final Set STANDARD_TAG_DISPLAY_NAMES = new HashSet<>(Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text())); + private static final Set STANDARD_TAG_DISPLAY_NAMES = new HashSet<>( + Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text(), "Follow Up", + "Notable Item", Category.ONE.getDisplayName(), + Category.TWO.getDisplayName(), Category.THREE.getDisplayName(), + Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName())); private final SleuthkitCase caseDb; /** @@ -84,7 +89,7 @@ public class TagsManager implements Closeable { * querying the case database for tag types. */ public static Set getTagDisplayNames() throws TskCoreException { - Set tagDisplayNames = new HashSet<>(STANDARD_TAG_DISPLAY_NAMES); + Set tagDisplayNames = new HashSet<>(); Set customNames = TagNameDefiniton.getTagNameDefinitions(); customNames.forEach((tagType) -> { tagDisplayNames.add(tagType.getDisplayName()); @@ -263,11 +268,9 @@ public class TagsManager implements Closeable { public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) throws TagNameAlreadyExistsException, TskCoreException { try { TagName tagName = caseDb.addTagName(displayName, description, color); - if (!STANDARD_TAG_DISPLAY_NAMES.contains(displayName)) { - Set customTypes = TagNameDefiniton.getTagNameDefinitions(); - customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus)); - TagNameDefiniton.setTagNameDefinitions(customTypes); - } + Set customTypes = TagNameDefiniton.getTagNameDefinitions(); + customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus)); + TagNameDefiniton.setTagNameDefinitions(customTypes); return tagName; } catch (TskCoreException ex) { List existingTagNames = caseDb.getAllTagNames(); diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java b/Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java old mode 100755 new mode 100644 similarity index 98% rename from ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java rename to Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java index 1b2bd604b0..39d624110f --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sleuthkit.autopsy.imagegallery.datamodel; +package org.sleuthkit.autopsy.datamodel.tags; import com.google.common.collect.ImmutableList; import java.util.Map; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java index 0cbef7e5d1..e55078018e 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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java index cc2ede2ce5..439bb59512 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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.datamodel.TskCoreException; /** diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java index ef70b0f1f6..be8c3644bb 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java @@ -19,7 +19,7 @@ package org.sleuthkit.autopsy.imagegallery.actions; import org.sleuthkit.autopsy.imagegallery.ImageGalleryController; -import org.sleuthkit.autopsy.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; /** * diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java index f18e96795b..33bc9a58d4 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java @@ -35,10 +35,12 @@ 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.datamodel.ContentTag; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; + /** * Provides a cached view of the number of files per category, and fires * {@link CategoryChangeEvent}s when files are categorized. diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java index 96e37d0a83..0ac5142f3c 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.imagegallery.datamodel; +import org.sleuthkit.autopsy.datamodel.tags.Category; import java.util.Arrays; import java.util.Collection; import java.util.Collections; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java index 9f8a6c924e..5426ac205a 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.imagegallery.datamodel; +import org.sleuthkit.autopsy.datamodel.tags.Category; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java index 2f86c47ad6..5b40c9240c 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.imagegallery.datamodel; +import org.sleuthkit.autopsy.datamodel.tags.Category; import java.lang.ref.SoftReference; import java.text.MessageFormat; import java.util.ArrayList; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java index 2172aacf51..491baa0d5d 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.imagegallery.datamodel; +import org.sleuthkit.autopsy.datamodel.tags.Category; import com.google.common.eventbus.AsyncEventBus; import com.google.common.eventbus.EventBus; import java.util.Collections; @@ -55,7 +56,7 @@ public class DrawableTagsManager { private static final String BOOKMARK = Bundle.DrawableTagsManager_bookMark(); private static Image FOLLOW_UP_IMAGE; private static Image BOOKMARK_IMAGE; - + public static String getFollowUpText() { return FOLLOW_UP; } @@ -162,6 +163,7 @@ public class DrawableTagsManager { } } + /** * get all the TagNames that are not categories * 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 5c02f5abd1..e62c2b6541 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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java index 708568fe41..2841eb5325 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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; /** * Displays summary statistics (counts) for each group diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java index bdc43c1c06..6cb29d46d1 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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute; import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup; import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableView.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableView.java index 6668657619..e6d7bf06f2 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableView.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableView.java @@ -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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java index 6fc8074248..bd84611b93 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java @@ -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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile; import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup; import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewMode; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java index bf6597ecb5..881925a098 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java @@ -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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile; diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/SlideShowView.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/SlideShowView.java index 94e56cf93c..b40e121102 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/SlideShowView.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/SlideShowView.java @@ -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.imagegallery.datamodel.Category; +import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile; import org.sleuthkit.autopsy.imagegallery.datamodel.VideoFile; import org.sleuthkit.autopsy.imagegallery.gui.VideoPlayer; From 21a74a4f6bc104b9fdc2f01e006a4bb4145ad9d4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 6 Nov 2017 16:03:03 -0500 Subject: [PATCH 04/13] 3199 remove remaining creation of Evidence Tag --- .../casemodule/services/TagNameDefiniton.java | 7 ++-- .../casemodule/services/TagsManager.java | 41 +++++++++++++++---- .../eventlisteners/CaseEventListener.java | 17 +------- .../datamodel/DrawableTagsManager.java | 14 +------ 4 files changed, 39 insertions(+), 40 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java index f1437f3c11..676590bd38 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.casemodule.services; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Objects; @@ -38,9 +37,9 @@ final class TagNameDefiniton implements Comparable { 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("Evidence", "Notable Item", Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS - private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text(), "Follow Up", - "Notable Item", Category.ONE.getDisplayName(), + private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getNotableItemText(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS + private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getBookmarkText(), TagsManager.getFollowUpText(), + TagsManager.getNotableItemText(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName(), Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName()); static final String NOTABLE = "(Notable)"; diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index cf2bcf8ba2..b9f63983fa 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.casemodule.services; import java.io.Closeable; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -31,7 +30,6 @@ import java.util.logging.Level; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.datamodel.tags.Category; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardArtifactTag; import org.sleuthkit.datamodel.Content; @@ -47,14 +45,41 @@ import org.sleuthkit.datamodel.TskCoreException; public class TagsManager implements Closeable { private static final Logger LOGGER = Logger.getLogger(TagsManager.class.getName()); - @NbBundle.Messages("TagsManager.predefTagNames.bookmark.text=Bookmark") - private static final Set STANDARD_TAG_DISPLAY_NAMES = new HashSet<>( - Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text(), "Follow Up", - "Notable Item", Category.ONE.getDisplayName(), - Category.TWO.getDisplayName(), Category.THREE.getDisplayName(), - Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName())); + @NbBundle.Messages({"TagsManager.predefTagNames.bookmark.text=Bookmark", + "TagsManager.predefTagNames.followUp.text=Follow Up", + "TagsManager.predefTagNames.notableItem.text=Notable Item"}) + private static final String FOLLOW_UP = Bundle.TagsManager_predefTagNames_followUp_text(); + private static final String BOOKMARK = Bundle.TagsManager_predefTagNames_bookmark_text(); + private static final String NOTABLE_ITEM = Bundle.TagsManager_predefTagNames_notableItem_text(); private final SleuthkitCase caseDb; + /** + * Get the text for the Follow Up tag. + * + * @return FOLLOW_UP + */ + public static String getFollowUpText() { + return FOLLOW_UP; + } + + /** + * Get the text for the Bookmark tag. + * + * @return BOOKMARK + */ + public static String getBookmarkText() { + return BOOKMARK; + } + + /** + * Get the text for the Notable Item tag. + * + * @return NOTABLE_ITEM + */ + static String getNotableItemText() { + return NOTABLE_ITEM; + } + /** * Tests whether or not a given tag display name contains an illegal * character. diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java index 3f9dffc2fb..dbe17d6e6d 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java @@ -350,22 +350,7 @@ final class CaseEventListener implements PropertyChangeListener { if ((null == event.getOldValue()) && (event.getNewValue() instanceof Case)) { Case curCase = (Case) event.getNewValue(); IngestEventsListener.resetCeModuleInstanceCount(); - try { - // only add default evidence tag if case is open and it doesn't already exist in the tags list. - if (Case.isCaseOpen() - && Case.getCurrentCase().getServices().getTagsManager().getAllTagNames().stream() - .map(tag -> tag.getDisplayName()) - .filter(tagName -> Bundle.caseeventlistener_evidencetag().equals(tagName)) - .collect(Collectors.toList()) - .isEmpty()) { - curCase.getServices().getTagsManager().addTagName(Bundle.caseeventlistener_evidencetag()); - } - } catch (TagsManager.TagNameAlreadyExistsException ex) { - LOGGER.info("Evidence tag already exists"); // NON-NLS - } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Error adding tag.", ex); // NON-NLS - } - + CorrelationCase curCeCase = new CorrelationCase( -1, curCase.getName(), // unique case ID diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java index 491baa0d5d..6859a12830 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java @@ -52,18 +52,8 @@ public class DrawableTagsManager { private static final Logger LOGGER = Logger.getLogger(DrawableTagsManager.class.getName()); - private static final String FOLLOW_UP = Bundle.DrawableTagsManager_followUp(); - private static final String BOOKMARK = Bundle.DrawableTagsManager_bookMark(); private static Image FOLLOW_UP_IMAGE; private static Image BOOKMARK_IMAGE; - - public static String getFollowUpText() { - return FOLLOW_UP; - } - - public static String getBookmarkText() { - return BOOKMARK; - } final private Object autopsyTagsManagerLock = new Object(); private TagsManager autopsyTagsManager; @@ -148,7 +138,7 @@ public class DrawableTagsManager { public TagName getFollowUpTagName() throws TskCoreException { synchronized (autopsyTagsManagerLock) { if (Objects.isNull(followUpTagName)) { - followUpTagName = getTagName(FOLLOW_UP); + followUpTagName = getTagName(TagsManager.getFollowUpText()); } return followUpTagName; } @@ -157,7 +147,7 @@ public class DrawableTagsManager { private Object getBookmarkTagName() throws TskCoreException { synchronized (autopsyTagsManagerLock) { if (Objects.isNull(bookmarkTagName)) { - bookmarkTagName = getTagName(BOOKMARK); + bookmarkTagName = getTagName(TagsManager.getBookmarkText()); } return bookmarkTagName; } From 0d66351f6c7e6dfdec99d5262bb4ab2b55d6c5af Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 6 Nov 2017 16:06:01 -0500 Subject: [PATCH 05/13] 3198 changed TagNameDefinition knownStatus to knownStatusDenoted --- .../autopsy/casemodule/services/TagNameDefiniton.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java index e980d7b96c..171d673cb6 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -42,7 +42,7 @@ final class TagNameDefiniton implements Comparable { private final String displayName; private final String description; private final TagName.HTML_COLOR color; - private final String knownStatus; + private final String knownStatusDenoted; /** * Constructs a tag name definition consisting of a display name, @@ -56,7 +56,7 @@ final class TagNameDefiniton implements Comparable { this.displayName = displayName; this.description = description; this.color = color; - this.knownStatus = notable; + this.knownStatusDenoted = notable; } /** @@ -90,7 +90,7 @@ final class TagNameDefiniton implements Comparable { * */ boolean isNotable(){ - return knownStatus.equals(NOTABLE); + return knownStatusDenoted.equals(NOTABLE); } /** * Compares this tag name definition with the specified tag name definition @@ -152,7 +152,7 @@ final class TagNameDefiniton implements Comparable { * that is used by the tags settings file. */ private String toSettingsFormat() { - return displayName + "," + description + "," + color.name() + "," + knownStatus; + return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted; } /** From e1770f5fdfefb9c8549230cef48010c3a7363bfb Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 9 Nov 2017 16:53:29 -0500 Subject: [PATCH 06/13] 3198 change storage of knownStatus for TagNameDefinition from String to enum --- .../casemodule/services/TagNameDefiniton.java | 22 +++++++++---------- .../casemodule/services/TagOptionsPanel.java | 3 ++- .../casemodule/services/TagsManager.java | 11 +++++----- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java index 171d673cb6..e4987fb207 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -27,6 +27,7 @@ import java.util.Set; import javax.annotation.concurrent.Immutable; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.datamodel.TagName; +import org.sleuthkit.datamodel.TskData; /** * A tag name definition consisting of a display name, description and color. @@ -36,13 +37,12 @@ final class TagNameDefiniton implements Comparable { private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS - private static final String DEFAULT_BAD_TAGS = "Evidence,Notable Item," + private static final String STANDARD_NOTABLE_TAG_DISPLAY_NAMES = "Evidence,Notable Item," + "CAT-1: Child Exploitation (Illegal),CAT-2: Child Exploitation (Non-Illegal/Age Difficult),CAT-3: Child Exploitive"; // NON-NLS - static final String NOTABLE = "(Notable)"; private final String displayName; private final String description; private final TagName.HTML_COLOR color; - private final String knownStatusDenoted; + private final TskData.FileKnown knownStatusDenoted; /** * Constructs a tag name definition consisting of a display name, @@ -52,11 +52,11 @@ final class TagNameDefiniton implements Comparable { * @param description The description for the tag name. * @param color The color for the tag name. */ - TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String notable) { + TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) { this.displayName = displayName; this.description = description; this.color = color; - this.knownStatusDenoted = notable; + this.knownStatusDenoted = status; } /** @@ -90,7 +90,7 @@ final class TagNameDefiniton implements Comparable { * */ boolean isNotable(){ - return knownStatusDenoted.equals(NOTABLE); + return knownStatusDenoted == TskData.FileKnown.BAD; } /** * Compares this tag name definition with the specified tag name definition @@ -152,7 +152,7 @@ final class TagNameDefiniton implements Comparable { * that is used by the tags settings file. */ private String toSettingsFormat() { - return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted; + return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted.toString(); } /** @@ -172,7 +172,7 @@ final class TagNameDefiniton implements Comparable { if (badTags == null) { String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS if (badTagsStr == null) { - badTagsStr = DEFAULT_BAD_TAGS; + badTagsStr = STANDARD_NOTABLE_TAG_DISPLAY_NAMES; } if (badTagsStr.isEmpty()) { badTags = new ArrayList<>(); @@ -181,12 +181,12 @@ final class TagNameDefiniton implements Comparable { } } if (badTags.contains(tagNameAttributes[0])) { - tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), NOTABLE)); + tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.BAD)); } else { - tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), "")); //add the default value for that 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) { - tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), tagNameAttributes[3])); + tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.valueOf(tagNameAttributes[3]))); } } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java index 8fc6a5ff4d..681cc95472 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java @@ -27,6 +27,7 @@ import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.corecomponents.OptionsPanel; import org.sleuthkit.datamodel.TagName; +import org.sleuthkit.datamodel.TskData; /** * A panel to allow the user to create and delete custom tag types. @@ -190,7 +191,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel { NewTagNameDialog.BUTTON_PRESSED result = dialog.getResult(); if (result == NewTagNameDialog.BUTTON_PRESSED.OK) { String newTagDisplayName = dialog.getTagName(); - TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR, ""); + TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR, TskData.FileKnown.UNKNOWN); /* * If tag name already exists, don't add the tag name. */ diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index f66b195073..8c87475785 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -38,6 +38,7 @@ import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.datamodel.TskData; /** * A per case Autopsy service that manages the addition of content and artifact @@ -198,7 +199,7 @@ public class TagsManager implements Closeable { * name to the case database. */ public synchronized TagName addTagName(String displayName) throws TagNameAlreadyExistsException, TskCoreException { - return addTagName(displayName, "", TagName.HTML_COLOR.NONE, ""); + return addTagName(displayName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN); } /** @@ -217,7 +218,7 @@ public class TagsManager implements Closeable { * name to the case database. */ public synchronized TagName addTagName(String displayName, String description) throws TagNameAlreadyExistsException, TskCoreException { - return addTagName(displayName, description, TagName.HTML_COLOR.NONE, ""); + return addTagName(displayName, description, TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN); } /** @@ -236,9 +237,9 @@ 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 { - String knownStatus = ""; + TskData.FileKnown knownStatus = TskData.FileKnown.UNKNOWN; if (getNotableTagDisplayNames().contains(displayName)) { - knownStatus = TagNameDefiniton.NOTABLE; + knownStatus = TskData.FileKnown.BAD; } return addTagName(displayName, description, color, knownStatus); } @@ -260,7 +261,7 @@ public class TagsManager implements Closeable { * @throws TskCoreException If there is an error adding the tag * name to the case database. */ - public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) throws TagNameAlreadyExistsException, TskCoreException { + public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException { try { TagName tagName = caseDb.addTagName(displayName, description, color); if (!STANDARD_TAG_DISPLAY_NAMES.contains(displayName)) { From c2d0bbb932a44167a84d4f1fa0560f1fa2f1827b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 15 Nov 2017 11:59:10 -0500 Subject: [PATCH 07/13] 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); } /** From 3fda67bb223f3ee3ae5d7635841e2698e79a3993 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 15 Nov 2017 12:25:18 -0500 Subject: [PATCH 08/13] 3199 fix merge error in TagsManager where both old and new arguments were in method call --- .../org/sleuthkit/autopsy/casemodule/services/TagsManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index e5e9315e6f..b7978ffd94 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -266,7 +266,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 { - return addTagName(displayName, description, color, knownStatus,TskData.FileKnown.UNKNOWN); + return addTagName(displayName, description, color, TskData.FileKnown.UNKNOWN); } /** From 5035aa41b4b429d1f6bf2ece3019ebce507b65a0 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 15 Nov 2017 15:57:28 -0500 Subject: [PATCH 09/13] 3199 include knownStatus in TagName class --- .../org/sleuthkit/autopsy/casemodule/services/TagsManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index b7978ffd94..4c71284bef 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -288,7 +288,7 @@ public class TagsManager implements Closeable { */ public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException { try { - TagName tagName = caseDb.addTagName(displayName, description, color); + TagName tagName = caseDb.addTagName(displayName, description, color, knownStatus); Set customTypes = TagNameDefiniton.getTagNameDefinitions(); customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus)); TagNameDefiniton.setTagNameDefinitions(customTypes); From 743df27125cf4a632288ec49102241533795d6cb Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 17 Nov 2017 14:56:16 -0500 Subject: [PATCH 10/13] 3199 add knownStatus to TagName class and tag_names table --- .../casemodule/services/NewTagNameDialog.java | 6 ++- .../casemodule/services/TagNameDefiniton.java | 37 ++++++++++++++++--- .../casemodule/services/TagsManager.java | 35 +----------------- .../datamodel/DrawableTagsManager.java | 4 +- 4 files changed, 39 insertions(+), 43 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java index ff21ac283b..b7b2e66ebc 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * -* Copyright 2011-2016 Basis Technology Corp. +* Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -117,7 +117,9 @@ final class NewTagNameDialog extends javax.swing.JDialog { JOptionPane.ERROR_MESSAGE); return; } - if (TagsManager.containsIllegalCharacters(newTagDisplayName)) { + + //if a tag name contains illegal characters and is not the name of one of the standard tags + if (TagsManager.containsIllegalCharacters(newTagDisplayName) && !TagNameDefiniton.getStandardTagNames().contains(newTagDisplayName)) { JOptionPane.showMessageDialog(null, NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"), NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"), diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java index cdae552e81..0c9b3ac41b 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2016 Basis Technology Corp. + * Copyright 2011-2017 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,9 +25,14 @@ import java.util.List; import java.util.Objects; import java.util.Set; 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.ModuleSettings; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.autopsy.datamodel.tags.Category; +import org.sleuthkit.datamodel.SleuthkitCase; +import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; /** @@ -36,11 +41,15 @@ import org.sleuthkit.datamodel.TskData; @Immutable final class TagNameDefiniton implements Comparable { + @NbBundle.Messages({"TagNameDefiniton.predefTagNames.bookmark.text=Bookmark", + "TagNameDefiniton.predefTagNames.followUp.text=Follow Up", + "TagNameDefiniion.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(TagsManager.getNotableItemText(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS - private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getBookmarkText(), TagsManager.getFollowUpText(), - TagsManager.getNotableItemText(), Category.ONE.getDisplayName(), + + private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniion_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.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.TagNameDefiniion_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName(), Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName()); private final String displayName; @@ -64,6 +73,10 @@ final class TagNameDefiniton implements Comparable { this.knownStatusDenoted = status; } + static List getStandardTagNames() { + return STANDARD_TAG_DISPLAY_NAMES; + } + /** * Gets the display name for the tag name. * @@ -164,6 +177,16 @@ final class TagNameDefiniton implements Comparable { return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted.toString(); } + private TagName saveToCase(SleuthkitCase caseDb) { + TagName tagName = null; + try { + tagName = caseDb.addTagName(displayName, description, color, knownStatusDenoted); + } catch (TskCoreException ex) { + Exceptions.printStackTrace(ex); + } + return tagName; + } + /** * Gets tag name definitions from the tag settings file as well as the * default tag name definitions. @@ -202,7 +225,7 @@ final class TagNameDefiniton implements Comparable { if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) { tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.BAD)); } else { - tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN)); + tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN)); } } return tagNames; @@ -220,6 +243,10 @@ final class TagNameDefiniton implements Comparable { setting.append(";"); } setting.append(tagName.toSettingsFormat()); + if (Case.isCaseOpen()) { + SleuthkitCase caseDb = Case.getCurrentCase().getSleuthkitCase(); + tagName.saveToCase(caseDb); + } } ModuleSettings.setConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY, setting.toString()); } diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index 4c71284bef..9830a5de56 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.logging.Level; -import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; @@ -46,41 +45,9 @@ import org.sleuthkit.datamodel.TskData; public class TagsManager implements Closeable { private static final Logger LOGGER = Logger.getLogger(TagsManager.class.getName()); - @NbBundle.Messages({"TagsManager.predefTagNames.bookmark.text=Bookmark", - "TagsManager.predefTagNames.followUp.text=Follow Up", - "TagsManager.predefTagNames.notableItem.text=Notable Item"}) - private static final String FOLLOW_UP = Bundle.TagsManager_predefTagNames_followUp_text(); - private static final String BOOKMARK = Bundle.TagsManager_predefTagNames_bookmark_text(); - private static final String NOTABLE_ITEM = Bundle.TagsManager_predefTagNames_notableItem_text(); + private final SleuthkitCase caseDb; - /** - * Get the text for the Follow Up tag. - * - * @return FOLLOW_UP - */ - public static String getFollowUpText() { - return FOLLOW_UP; - } - - /** - * Get the text for the Bookmark tag. - * - * @return BOOKMARK - */ - public static String getBookmarkText() { - return BOOKMARK; - } - - /** - * Get the text for the Notable Item tag. - * - * @return NOTABLE_ITEM - */ - static String getNotableItemText() { - return NOTABLE_ITEM; - } - /** * Tests whether or not a given tag display name contains an illegal * character. diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java index 6859a12830..0497068924 100755 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java @@ -138,7 +138,7 @@ public class DrawableTagsManager { public TagName getFollowUpTagName() throws TskCoreException { synchronized (autopsyTagsManagerLock) { if (Objects.isNull(followUpTagName)) { - followUpTagName = getTagName(TagsManager.getFollowUpText()); + followUpTagName = getTagName(NbBundle.getMessage(DrawableTagsManager.class, "DrawableTagsManager.followUp")); } return followUpTagName; } @@ -147,7 +147,7 @@ public class DrawableTagsManager { private Object getBookmarkTagName() throws TskCoreException { synchronized (autopsyTagsManagerLock) { if (Objects.isNull(bookmarkTagName)) { - bookmarkTagName = getTagName(TagsManager.getBookmarkText()); + bookmarkTagName = getTagName(NbBundle.getMessage(DrawableTagsManager.class, "DrawableTagsManager.bookMark")); } return bookmarkTagName; } From 5ab65ae0d54824165bce2a9c2755874957b07ff7 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 17 Nov 2017 15:02:28 -0500 Subject: [PATCH 11/13] 3199 fix typo in bundle message name --- .../autopsy/casemodule/services/TagNameDefiniton.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java index 0c9b3ac41b..abe071a0ec 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -43,13 +43,13 @@ final class TagNameDefiniton implements Comparable { @NbBundle.Messages({"TagNameDefiniton.predefTagNames.bookmark.text=Bookmark", "TagNameDefiniton.predefTagNames.followUp.text=Follow Up", - "TagNameDefiniion.predefTagNames.notableItem.text=Notable Item"}) + "TagNameDefiniton.predefTagNames.notableItem.text=Notable Item"}) private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS - private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniion_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(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.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.TagNameDefiniion_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), + Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName(), Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName()); private final String displayName; From bfaec69477a8007fabe0fd27ca87fb1187f3ecd8 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 17 Nov 2017 17:04:04 -0500 Subject: [PATCH 12/13] 3199 fix renamed sleuthkit method use in autopsy --- .../org/sleuthkit/autopsy/casemodule/services/TagsManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java index 9830a5de56..adfcbf0029 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java @@ -255,7 +255,7 @@ public class TagsManager implements Closeable { */ public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException { try { - TagName tagName = caseDb.addTagName(displayName, description, color, knownStatus); + TagName tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatus); Set customTypes = TagNameDefiniton.getTagNameDefinitions(); customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus)); TagNameDefiniton.setTagNameDefinitions(customTypes); From d8a75596a2f0b2031baa06cd313e21b3263c4511 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 17 Nov 2017 17:05:05 -0500 Subject: [PATCH 13/13] 3199 fix second usage of addOrUpdateTagName --- .../sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java index abe071a0ec..8c7d29baa3 100755 --- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java @@ -180,7 +180,7 @@ final class TagNameDefiniton implements Comparable { private TagName saveToCase(SleuthkitCase caseDb) { TagName tagName = null; try { - tagName = caseDb.addTagName(displayName, description, color, knownStatusDenoted); + tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted); } catch (TskCoreException ex) { Exceptions.printStackTrace(ex); }