Fixed getNotableTagDisplayName

This commit is contained in:
Kelly Kelly 2020-05-08 14:28:41 -04:00
parent 885c91c2d5
commit 5251ea50ae

View File

@ -146,6 +146,12 @@ public class TagsManager implements Closeable {
return tagDisplayNames;
}
/**
* Gets the set of display names of notable (TskData.FileKnown.BAD) tag types.
* If a case is not open the list will only include only the user defined
* custom tags. Otherwise the list will include all notable tags.
* @return
*/
public static List<String> getNotableTagDisplayNames() {
List<String> tagDisplayNames = new ArrayList<>();
for (TagNameDefinition tagDef : TagNameDefinition.getTagNameDefinitions()) {
@ -153,6 +159,22 @@ public class TagsManager implements Closeable {
tagDisplayNames.add(tagDef.getDisplayName());
}
}
try {
TagsManager tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager();
for (TagName tagName : tagsManager.getAllTagNames()) {
if(tagName.getKnownStatus() == TskData.FileKnown.BAD &&
!tagDisplayNames.contains(tagName.getDisplayName())) {
tagDisplayNames.add(tagName.getDisplayName());
}
}
} catch (NoCurrentCaseException ignored) {
/*
* No current case, nothing more to add to the set.
*/
} catch(TskCoreException ex) {
LOGGER.log(Level.SEVERE, "Faile to get list of TagNams from tagsManager.");
}
return tagDisplayNames;
}