Updated format in TagNameDefinition

This commit is contained in:
Kelly Kelly 2020-04-21 17:13:35 -04:00
parent 8409bee5b0
commit 98151b1de8

View File

@ -96,11 +96,11 @@ final class TagNameDefinition implements Comparable<TagNameDefinition> {
this.color = color; this.color = color;
this.knownStatus = status; this.knownStatus = status;
} }
static Collection<TagNameDefinition> getStandardTagNameDefinitions() { static Collection<TagNameDefinition> getStandardTagNameDefinitions() {
return STANDARD_TAGS_DEFINITIONS.values(); return STANDARD_TAGS_DEFINITIONS.values();
} }
static Collection<TagNameDefinition> getProjectVICDefaultDefinitions() { static Collection<TagNameDefinition> getProjectVICDefaultDefinitions() {
return PROJECT_VIC_TAG_DEFINITIONS.values(); return PROJECT_VIC_TAG_DEFINITIONS.values();
} }
@ -109,7 +109,7 @@ final class TagNameDefinition implements Comparable<TagNameDefinition> {
List<String> strList = new ArrayList<>(); List<String> strList = new ArrayList<>();
strList.addAll(STANDARD_TAGS_DEFINITIONS.keySet()); strList.addAll(STANDARD_TAGS_DEFINITIONS.keySet());
strList.addAll(PROJECT_VIC_TAG_DEFINITIONS.keySet()); strList.addAll(PROJECT_VIC_TAG_DEFINITIONS.keySet());
return strList; return strList;
} }
@ -226,14 +226,14 @@ final class TagNameDefinition implements Comparable<TagNameDefinition> {
/** /**
* Gets tag name definitions from the tag settings file as well as the * Gets tag name definitions from the tag settings file as well as the
* default tag name definitions. * default tag name definitions.
* *
* The currently custom tags properties are stored in one string property value * The currently custom tags properties are stored in one string property
* separated by ;. The properties of an individual tag are comma separated * value separated by ;. The properties of an individual tag are comma
* in the format of: * separated in the format of:
* tag_name,tag_description,tag_color,known_status * tag_name,tag_description,tag_color,known_status
* *
* In prior versions of autopsy the known_status was stored in the central repository, * In prior versions of autopsy the known_status was stored in the central
* therefore the properties file only had three values. * repository, therefore the properties file only had three values.
* *
* @return A set of tag name definition objects. * @return A set of tag name definition objects.
*/ */
@ -253,19 +253,19 @@ final class TagNameDefinition implements Comparable<TagNameDefinition> {
// Get the known status from the Central Repository // Get the known status from the Central Repository
String crTagKnownProp = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS String crTagKnownProp = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
List<String> knownTagNameList = new ArrayList<>(); List<String> knownTagNameList = new ArrayList<>();
if(crTagKnownProp != null && !crTagKnownProp.isEmpty()) { if (crTagKnownProp != null && !crTagKnownProp.isEmpty()) {
knownTagNameList.addAll(Arrays.asList(crTagKnownProp.split(","))); knownTagNameList.addAll(Arrays.asList(crTagKnownProp.split(",")));
} }
tagDefinitions = buildTagNameDefinitions(customTagDefinitions, knownTagNameList); tagDefinitions = buildTagNameDefinitions(customTagDefinitions, knownTagNameList);
} else if (numberOfAttributes == 4) { } else if (numberOfAttributes == 4) {
tagDefinitions = buildTagNameDefinitions(customTagDefinitions); tagDefinitions = buildTagNameDefinitions(customTagDefinitions);
} }
// Remove the standard and project vic tags. // Remove the standard and project vic tags.
List<String> standardTagNames = getStandardTagNames(); List<String> standardTagNames = getStandardTagNames();
for(TagNameDefinition def: tagDefinitions) { for (TagNameDefinition def : tagDefinitions) {
if(!standardTagNames.contains(def.getDisplayName())) { if (!standardTagNames.contains(def.getDisplayName())) {
tagNames.add(def); tagNames.add(def);
} }
} }
@ -274,32 +274,32 @@ final class TagNameDefinition implements Comparable<TagNameDefinition> {
} }
/** /**
* Returns a list of TagNameDefinitons created by merging the tag data * Returns a list of TagNameDefinitons created by merging the tag data from
* from the properties file and the known status information from the central * the properties file and the known status information from the central
* repository. * repository.
* *
* @param tagProperties List of description strings. * @param tagProperties List of description strings.
* @param centralRepoNotableTags List of known tag names. * @param centralRepoNotableTags List of known tag names.
* *
* @return A list of TagNameDefinitions. * @return A list of TagNameDefinitions.
*/ */
private static List<TagNameDefinition> buildTagNameDefinitions(List<String> tagProperties, List<String> centralRepoNotableTags) { private static List<TagNameDefinition> buildTagNameDefinitions(List<String> tagProperties, List<String> centralRepoNotableTags) {
List<TagNameDefinition> tagNameDefinitions = new ArrayList<>(); List<TagNameDefinition> tagNameDefinitions = new ArrayList<>();
for (String propertyString : tagProperties) { for (String propertyString : tagProperties) {
// Split the property into attributes // Split the property into attributes
String[] attributes = propertyString.split(","); //get the attributes String[] attributes = propertyString.split(","); //get the attributes
String tagName = attributes[0]; String tagName = attributes[0];
TskData.FileKnown knownStatus = TskData.FileKnown.UNKNOWN; TskData.FileKnown knownStatus = TskData.FileKnown.UNKNOWN;
if(centralRepoNotableTags.contains(tagName)) { if (centralRepoNotableTags.contains(tagName)) {
knownStatus = TskData.FileKnown.BAD; knownStatus = TskData.FileKnown.BAD;
} }
tagNameDefinitions.add(new TagNameDefinition(tagName, attributes[1], tagNameDefinitions.add(new TagNameDefinition(tagName, attributes[1],
TagName.HTML_COLOR.valueOf(attributes[2]), knownStatus)); TagName.HTML_COLOR.valueOf(attributes[2]), knownStatus));
} }
return tagNameDefinitions; return tagNameDefinitions;
} }
@ -308,14 +308,14 @@ final class TagNameDefinition implements Comparable<TagNameDefinition> {
* preserved across cases. * preserved across cases.
* *
* @param tagProperties List of description strings. * @param tagProperties List of description strings.
* *
* @param standardTagsToBeCreated the list of standard tags which have yet * @param standardTagsToBeCreated the list of standard tags which have yet
* to be created * to be created
* *
* @return tagNames a list of TagNameDefinitions * @return tagNames a list of TagNameDefinitions
*/ */
private static List<TagNameDefinition> buildTagNameDefinitions(List<String> tagProperties) { private static List<TagNameDefinition> buildTagNameDefinitions(List<String> tagProperties) {
List<TagNameDefinition> tagNameDefinitions = new ArrayList<>(); List<TagNameDefinition> tagNameDefinitions = new ArrayList<>();
for (String tagNameTuple : tagProperties) { for (String tagNameTuple : tagProperties) {
String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes
tagNameDefinitions.add(new TagNameDefinition(tagNameAttributes[0], tagNameAttributes[1], tagNameDefinitions.add(new TagNameDefinition(tagNameAttributes[0], tagNameAttributes[1],