mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
4065 initial implementation without refresh - minimal public api changes
This commit is contained in:
parent
ab5280682c
commit
372ca76864
@ -30,6 +30,7 @@ import java.util.logging.Level;
|
|||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
|
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifactTag;
|
import org.sleuthkit.datamodel.BlackboardArtifactTag;
|
||||||
@ -71,13 +72,14 @@ public class TagsManager implements Closeable {
|
|||||||
|| tagDisplayName.contains(";"));
|
|| tagDisplayName.contains(";"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NbBundle.Messages({"TagsManager.notableTagEnding.text= (Notable)"})
|
@NbBundle.Messages({"TagsManager.notableTagEnding.text= (Notable)"})
|
||||||
/**
|
/**
|
||||||
* Get String of text which is used to label tags as notable to the user.
|
* Get String of text which is used to label tags as notable to the user.
|
||||||
*
|
*
|
||||||
* @return Bundle message TagsManager.notableTagEnding.text
|
* @return Bundle message TagsManager.notableTagEnding.text
|
||||||
*/
|
*/
|
||||||
public static String getNotableTagLabel(){
|
public static String getNotableTagLabel() {
|
||||||
return Bundle.TagsManager_notableTagEnding_text();
|
return Bundle.TagsManager_notableTagEnding_text();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,13 +125,13 @@ public class TagsManager implements Closeable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of names of standard/predefined tags
|
* Returns a list of names of standard/predefined tags
|
||||||
*
|
*
|
||||||
* @return list of predefined tag names
|
* @return list of predefined tag names
|
||||||
*/
|
*/
|
||||||
public static List<String> getStandardTagNames() {
|
public static List<String> getStandardTagNames() {
|
||||||
return TagNameDefinition.getStandardTagNames();
|
return TagNameDefinition.getStandardTagNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a per case Autopsy service that manages the addition of
|
* Constructs a per case Autopsy service that manages the addition of
|
||||||
* content and artifact tags to the case database.
|
* content and artifact tags to the case database.
|
||||||
@ -163,7 +165,26 @@ public class TagsManager implements Closeable {
|
|||||||
* @throws TskCoreException If there is an error querying the case database.
|
* @throws TskCoreException If there is an error querying the case database.
|
||||||
*/
|
*/
|
||||||
public List<TagName> getTagNamesInUse() throws TskCoreException {
|
public List<TagName> getTagNamesInUse() throws TskCoreException {
|
||||||
return caseDb.getTagNamesInUse();
|
if (UserPreferences.showOnlyCurrentUserTags()) {
|
||||||
|
// return caseDb.getTagNamesInUse(System.getProperty("user.name"));
|
||||||
|
Set<TagName> tagNameSet = new HashSet<>();
|
||||||
|
String userName = System.getProperty("user.name");
|
||||||
|
List<BlackboardArtifactTag> artifactTags = caseDb.getAllBlackboardArtifactTags();
|
||||||
|
for (BlackboardArtifactTag tag : artifactTags) {
|
||||||
|
if (tag.getUserName().equals(userName)) {
|
||||||
|
tagNameSet.add(tag.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<ContentTag> contentTags = caseDb.getAllContentTags();
|
||||||
|
for (ContentTag tag : contentTags) {
|
||||||
|
if (tag.getUserName().equals(userName)) {
|
||||||
|
tagNameSet.add(tag.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList(tagNameSet);
|
||||||
|
} else {
|
||||||
|
return caseDb.getTagNamesInUse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,15 +193,35 @@ public class TagsManager implements Closeable {
|
|||||||
* blackboard_artifact_tags tables, for the given data source object id.
|
* blackboard_artifact_tags tables, for the given data source object id.
|
||||||
*
|
*
|
||||||
* @param dsObjId data source object id
|
* @param dsObjId data source object id
|
||||||
*
|
*
|
||||||
* @return A list, possibly empty, of TagName data transfer objects (DTOs)
|
* @return A list, possibly empty, of TagName data transfer objects (DTOs)
|
||||||
* for the rows.
|
* for the rows.
|
||||||
*
|
*
|
||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
public List<TagName> getTagNamesInUse(long dsObjId) throws TskCoreException {
|
public List<TagName> getTagNamesInUse(long dsObjId) throws TskCoreException {
|
||||||
return caseDb.getTagNamesInUse(dsObjId);
|
if (UserPreferences.showOnlyCurrentUserTags()) {
|
||||||
|
// return caseDb.getTagNamesInUse(dsObjId, System.getProperty("user.name"));
|
||||||
|
Set<TagName> tagNameSet = new HashSet<>();
|
||||||
|
String userName = System.getProperty("user.name");
|
||||||
|
List<BlackboardArtifactTag> artifactTags = caseDb.getAllBlackboardArtifactTags();
|
||||||
|
for (BlackboardArtifactTag tag : artifactTags) {
|
||||||
|
if (tag.getUserName().equals(userName) && tag.getArtifact().getDataSource().getId() == dsObjId) {
|
||||||
|
tagNameSet.add(tag.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<ContentTag> contentTags = caseDb.getAllContentTags();
|
||||||
|
for (ContentTag tag : contentTags) {
|
||||||
|
if (tag.getUserName().equals(userName) && tag.getContent().getDataSource().getId() == dsObjId) {
|
||||||
|
tagNameSet.add(tag.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new ArrayList(tagNameSet);
|
||||||
|
} else {
|
||||||
|
return caseDb.getTagNamesInUse(dsObjId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a map of tag display names to tag name entries in the case database.
|
* Gets a map of tag display names to tag name entries in the case database.
|
||||||
* It has keys for the display names of the standard tag types, the current
|
* It has keys for the display names of the standard tag types, the current
|
||||||
@ -413,27 +454,52 @@ public class TagsManager implements Closeable {
|
|||||||
* the case database.
|
* the case database.
|
||||||
*/
|
*/
|
||||||
public long getContentTagsCountByTagName(TagName tagName) throws TskCoreException {
|
public long getContentTagsCountByTagName(TagName tagName) throws TskCoreException {
|
||||||
return caseDb.getContentTagsCountByTagName(tagName);
|
if (UserPreferences.showOnlyCurrentUserTags()) {
|
||||||
|
String userName = System.getProperty("user.name");
|
||||||
|
long count = 0;
|
||||||
|
List<ContentTag> contentTags = getContentTagsByTagName(tagName);
|
||||||
|
for (ContentTag tag : contentTags) {
|
||||||
|
if (userName.equals(tag.getUserName())) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
} else {
|
||||||
|
return caseDb.getContentTagsCountByTagName(tagName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets content tags count by tag name, for the given data source
|
* Gets content tags count by tag name, for the given data source
|
||||||
*
|
*
|
||||||
* @param tagName The representation of the desired tag type in the case
|
* @param tagName The representation of the desired tag type in the case
|
||||||
* database, which can be obtained by calling getTagNames and/or addTagName.
|
* database, which can be obtained by calling getTagNames
|
||||||
*
|
* and/or addTagName.
|
||||||
|
*
|
||||||
* @param dsObjId data source object id
|
* @param dsObjId data source object id
|
||||||
*
|
*
|
||||||
* @return A count of the content tags with the specified tag name, and for
|
* @return A count of the content tags with the specified tag name, and for
|
||||||
* the given data source
|
* the given data source
|
||||||
*
|
*
|
||||||
* @throws TskCoreException If there is an error getting the tags count from
|
* @throws TskCoreException If there is an error getting the tags count from
|
||||||
* the case database.
|
* the case database.
|
||||||
*/
|
*/
|
||||||
public long getContentTagsCountByTagName(TagName tagName, long dsObjId) throws TskCoreException {
|
public long getContentTagsCountByTagName(TagName tagName, long dsObjId) throws TskCoreException {
|
||||||
return caseDb.getContentTagsCountByTagName(tagName, dsObjId);
|
if (UserPreferences.showOnlyCurrentUserTags()) {
|
||||||
|
String userName = System.getProperty("user.name");
|
||||||
|
long count = 0;
|
||||||
|
List<ContentTag> contentTags = getContentTagsByTagName(tagName, dsObjId);
|
||||||
|
for (ContentTag tag : contentTags) {
|
||||||
|
if (userName.equals(tag.getUserName())) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
} else {
|
||||||
|
return caseDb.getContentTagsCountByTagName(tagName, dsObjId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a content tag by tag id.
|
* Gets a content tag by tag id.
|
||||||
*
|
*
|
||||||
@ -463,11 +529,11 @@ public class TagsManager implements Closeable {
|
|||||||
return caseDb.getContentTagsByTagName(tagName);
|
return caseDb.getContentTagsByTagName(tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets content tags by tag name, for the given data source.
|
* Gets content tags by tag name, for the given data source.
|
||||||
*
|
*
|
||||||
* @param tagName The tag name of interest.
|
* @param tagName The tag name of interest.
|
||||||
*
|
*
|
||||||
* @param dsObjId data source object id
|
* @param dsObjId data source object id
|
||||||
*
|
*
|
||||||
* @return A list, possibly empty, of the content tags with the specified
|
* @return A list, possibly empty, of the content tags with the specified
|
||||||
@ -479,7 +545,7 @@ public class TagsManager implements Closeable {
|
|||||||
public List<ContentTag> getContentTagsByTagName(TagName tagName, long dsObjId) throws TskCoreException {
|
public List<ContentTag> getContentTagsByTagName(TagName tagName, long dsObjId) throws TskCoreException {
|
||||||
return caseDb.getContentTagsByTagName(tagName, dsObjId);
|
return caseDb.getContentTagsByTagName(tagName, dsObjId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets content tags count by content.
|
* Gets content tags count by content.
|
||||||
*
|
*
|
||||||
@ -589,8 +655,8 @@ public class TagsManager implements Closeable {
|
|||||||
* and/or addTagName.
|
* and/or addTagName.
|
||||||
* @param dsObjId data source object id
|
* @param dsObjId data source object id
|
||||||
*
|
*
|
||||||
* @return A count of the artifact tags with the specified tag name,
|
* @return A count of the artifact tags with the specified tag name, for the
|
||||||
* for the given data source.
|
* given data source.
|
||||||
*
|
*
|
||||||
* @throws TskCoreException If there is an error getting the tags count from
|
* @throws TskCoreException If there is an error getting the tags count from
|
||||||
* the case database.
|
* the case database.
|
||||||
@ -598,7 +664,7 @@ public class TagsManager implements Closeable {
|
|||||||
public long getBlackboardArtifactTagsCountByTagName(TagName tagName, long dsObjId) throws TskCoreException {
|
public long getBlackboardArtifactTagsCountByTagName(TagName tagName, long dsObjId) throws TskCoreException {
|
||||||
return caseDb.getBlackboardArtifactTagsCountByTagName(tagName, dsObjId);
|
return caseDb.getBlackboardArtifactTagsCountByTagName(tagName, dsObjId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an artifact tag by tag id.
|
* Gets an artifact tag by tag id.
|
||||||
*
|
*
|
||||||
@ -647,7 +713,7 @@ public class TagsManager implements Closeable {
|
|||||||
public List<BlackboardArtifactTag> getBlackboardArtifactTagsByTagName(TagName tagName, long dsObjId) throws TskCoreException {
|
public List<BlackboardArtifactTag> getBlackboardArtifactTagsByTagName(TagName tagName, long dsObjId) throws TskCoreException {
|
||||||
return caseDb.getBlackboardArtifactTagsByTagName(tagName, dsObjId);
|
return caseDb.getBlackboardArtifactTagsByTagName(tagName, dsObjId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets artifact tags for a particular artifact.
|
* Gets artifact tags for a particular artifact.
|
||||||
*
|
*
|
||||||
|
@ -70,7 +70,8 @@ public final class UserPreferences {
|
|||||||
private static final String MAX_NUM_OF_LOG_FILE = "MaximumNumberOfLogFiles";
|
private static final String MAX_NUM_OF_LOG_FILE = "MaximumNumberOfLogFiles";
|
||||||
private static final int LOG_FILE_NUM_INT = 10;
|
private static final int LOG_FILE_NUM_INT = 10;
|
||||||
public static final String GROUP_ITEMS_IN_TREE_BY_DATASOURCE = "GroupItemsInTreeByDataSource"; //NON-NLS
|
public static final String GROUP_ITEMS_IN_TREE_BY_DATASOURCE = "GroupItemsInTreeByDataSource"; //NON-NLS
|
||||||
|
private static final String SHOW_ONLY_CURRENT_USER_TAGS = "ShowOnlyCurrentUserTags";
|
||||||
|
|
||||||
// Prevent instantiation.
|
// Prevent instantiation.
|
||||||
private UserPreferences() {
|
private UserPreferences() {
|
||||||
}
|
}
|
||||||
@ -196,6 +197,14 @@ public final class UserPreferences {
|
|||||||
preferences.putBoolean(GROUP_ITEMS_IN_TREE_BY_DATASOURCE, value);
|
preferences.putBoolean(GROUP_ITEMS_IN_TREE_BY_DATASOURCE, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean showOnlyCurrentUserTags() {
|
||||||
|
return preferences.getBoolean(SHOW_ONLY_CURRENT_USER_TAGS, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setShowOnlyCurrentUserTags(boolean value) {
|
||||||
|
preferences.putBoolean(SHOW_ONLY_CURRENT_USER_TAGS, value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads persisted case database connection info.
|
* Reads persisted case database connection info.
|
||||||
*
|
*
|
||||||
@ -379,21 +388,25 @@ public final class UserPreferences {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* get the maximum number of log files to save
|
* get the maximum number of log files to save
|
||||||
|
*
|
||||||
* @return Number of log files
|
* @return Number of log files
|
||||||
*/
|
*/
|
||||||
public static int getLogFileCount() {
|
public static int getLogFileCount() {
|
||||||
return preferences.getInt(MAX_NUM_OF_LOG_FILE, LOG_FILE_NUM_INT);
|
return preferences.getInt(MAX_NUM_OF_LOG_FILE, LOG_FILE_NUM_INT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the default number of log files to save
|
* get the default number of log files to save
|
||||||
|
*
|
||||||
* @return LOG_FILE_COUNT
|
* @return LOG_FILE_COUNT
|
||||||
*/
|
*/
|
||||||
public static int getDefaultLogFileCount() {
|
public static int getDefaultLogFileCount() {
|
||||||
return LOG_FILE_NUM_INT;
|
return LOG_FILE_NUM_INT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the maximum number of log files to save
|
* Set the maximum number of log files to save
|
||||||
|
*
|
||||||
* @param count number of log files
|
* @param count number of log files
|
||||||
*/
|
*/
|
||||||
public static void setLogFileCount(int count) {
|
public static void setLogFileCount(int count) {
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2018 Basis Technology Corp.
|
* Copyright 2011-2018 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -59,19 +59,19 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
private final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; //NON-NLS
|
private final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; //NON-NLS
|
||||||
|
|
||||||
private final long datasourceObjId;
|
private final long datasourceObjId;
|
||||||
|
|
||||||
Tags() {
|
Tags() {
|
||||||
this(0);
|
this(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tags(long dsObjId) {
|
Tags(long dsObjId) {
|
||||||
this.datasourceObjId = dsObjId;
|
this.datasourceObjId = dsObjId;
|
||||||
}
|
}
|
||||||
|
|
||||||
long filteringDataSourceObjId() {
|
long filteringDataSourceObjId() {
|
||||||
return this.datasourceObjId;
|
return this.datasourceObjId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T accept(AutopsyItemVisitor<T> visitor) {
|
public <T> T accept(AutopsyItemVisitor<T> visitor) {
|
||||||
return visitor.visit(this);
|
return visitor.visit(this);
|
||||||
@ -98,13 +98,12 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
*/
|
*/
|
||||||
public class RootNode extends DisplayableItemNode {
|
public class RootNode extends DisplayableItemNode {
|
||||||
|
|
||||||
|
|
||||||
public RootNode(long objId) {
|
public RootNode(long objId) {
|
||||||
super(Children.create(new TagNameNodeFactory(objId), true), Lookups.singleton(DISPLAY_NAME));
|
super(Children.create(new TagNameNodeFactory(objId), true), Lookups.singleton(DISPLAY_NAME));
|
||||||
super.setName(DISPLAY_NAME);
|
super.setName(DISPLAY_NAME);
|
||||||
super.setDisplayName(DISPLAY_NAME);
|
super.setDisplayName(DISPLAY_NAME);
|
||||||
this.setIconBaseWithExtension(ICON_PATH);
|
this.setIconBaseWithExtension(ICON_PATH);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -139,7 +138,7 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
private class TagNameNodeFactory extends ChildFactory.Detachable<TagName> implements Observer {
|
private class TagNameNodeFactory extends ChildFactory.Detachable<TagName> implements Observer {
|
||||||
|
|
||||||
private final long datasourceObjId;
|
private final long datasourceObjId;
|
||||||
|
|
||||||
private final Set<Case.Events> CASE_EVENTS_OF_INTEREST = EnumSet.of(Case.Events.BLACKBOARD_ARTIFACT_TAG_ADDED,
|
private final Set<Case.Events> CASE_EVENTS_OF_INTEREST = EnumSet.of(Case.Events.BLACKBOARD_ARTIFACT_TAG_ADDED,
|
||||||
Case.Events.BLACKBOARD_ARTIFACT_TAG_DELETED,
|
Case.Events.BLACKBOARD_ARTIFACT_TAG_DELETED,
|
||||||
Case.Events.CONTENT_TAG_ADDED,
|
Case.Events.CONTENT_TAG_ADDED,
|
||||||
@ -197,13 +196,14 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
*
|
||||||
* @param objId data source object id
|
* @param objId data source object id
|
||||||
*/
|
*/
|
||||||
TagNameNodeFactory(long objId) {
|
TagNameNodeFactory(long objId) {
|
||||||
this.datasourceObjId = objId;
|
this.datasourceObjId = objId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addNotify() {
|
protected void addNotify() {
|
||||||
IngestManager.getInstance().addIngestJobEventListener(pcl);
|
IngestManager.getInstance().addIngestJobEventListener(pcl);
|
||||||
@ -224,11 +224,10 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
@Override
|
@Override
|
||||||
protected boolean createKeys(List<TagName> keys) {
|
protected boolean createKeys(List<TagName> keys) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
List<TagName> tagNamesInUse = UserPreferences.groupItemsInTreeByDatasource() ?
|
List<TagName> tagNamesInUse = UserPreferences.groupItemsInTreeByDatasource()
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse(datasourceObjId) :
|
? Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse(datasourceObjId)
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse()
|
: Case.getCurrentCaseThrows().getServices().getTagsManager().getTagNamesInUse();
|
||||||
;
|
|
||||||
Collections.sort(tagNamesInUse);
|
Collections.sort(tagNamesInUse);
|
||||||
keys.addAll(tagNamesInUse);
|
keys.addAll(tagNamesInUse);
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||||
@ -277,14 +276,13 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
try {
|
try {
|
||||||
TagsManager tm = Case.getCurrentCaseThrows().getServices().getTagsManager();
|
TagsManager tm = Case.getCurrentCaseThrows().getServices().getTagsManager();
|
||||||
if (UserPreferences.groupItemsInTreeByDatasource()) {
|
if (UserPreferences.groupItemsInTreeByDatasource()) {
|
||||||
tagsCount = tm.getContentTagsCountByTagName(tagName, datasourceObjId);
|
tagsCount = tm.getContentTagsCountByTagName(tagName, datasourceObjId);
|
||||||
tagsCount += tm.getBlackboardArtifactTagsCountByTagName(tagName, datasourceObjId);
|
tagsCount += tm.getBlackboardArtifactTagsCountByTagName(tagName, datasourceObjId);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tagsCount = tm.getContentTagsCountByTagName(tagName);
|
tagsCount = tm.getContentTagsCountByTagName(tagName);
|
||||||
tagsCount += tm.getBlackboardArtifactTagsCountByTagName(tagName);
|
tagsCount += tm.getBlackboardArtifactTagsCountByTagName(tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||||
Logger.getLogger(TagNameNode.class.getName()).log(Level.SEVERE, "Failed to get tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS
|
Logger.getLogger(TagNameNode.class.getName()).log(Level.SEVERE, "Failed to get tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
@ -387,9 +385,9 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
private void updateDisplayName() {
|
private void updateDisplayName() {
|
||||||
long tagsCount = 0;
|
long tagsCount = 0;
|
||||||
try {
|
try {
|
||||||
tagsCount = UserPreferences.groupItemsInTreeByDatasource() ?
|
tagsCount = UserPreferences.groupItemsInTreeByDatasource()
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagName(tagName, datasourceObjId) :
|
? Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagName(tagName, datasourceObjId)
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
|
: Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsCountByTagName(tagName);
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||||
Logger.getLogger(ContentTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get content tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS
|
Logger.getLogger(ContentTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get content tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
@ -444,11 +442,20 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
protected boolean createKeys(List<ContentTag> keys) {
|
protected boolean createKeys(List<ContentTag> keys) {
|
||||||
// Use the content tags bearing the specified tag name as the keys.
|
// Use the content tags bearing the specified tag name as the keys.
|
||||||
try {
|
try {
|
||||||
List<ContentTag> contentTags = UserPreferences.groupItemsInTreeByDatasource() ?
|
List<ContentTag> contentTags = UserPreferences.groupItemsInTreeByDatasource()
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByTagName(tagName, datasourceObjId) :
|
? Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByTagName(tagName, datasourceObjId)
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByTagName(tagName);
|
: Case.getCurrentCaseThrows().getServices().getTagsManager().getContentTagsByTagName(tagName);
|
||||||
|
if (UserPreferences.showOnlyCurrentUserTags()) {
|
||||||
keys.addAll(contentTags);
|
String userName = System.getProperty("user.name");
|
||||||
|
for (ContentTag tag : contentTags){
|
||||||
|
if (userName.equals(tag.getUserName())){
|
||||||
|
keys.add(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
keys.addAll(contentTags);
|
||||||
|
}
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||||
Logger.getLogger(ContentTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
|
Logger.getLogger(ContentTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
@ -479,6 +486,7 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
|
|
||||||
private final TagName tagName;
|
private final TagName tagName;
|
||||||
private final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; //NON-NLS
|
private final String ICON_PATH = "org/sleuthkit/autopsy/images/tag-folder-blue-icon-16.png"; //NON-NLS
|
||||||
|
private int displayCount = 0;
|
||||||
|
|
||||||
public BlackboardArtifactTagTypeNode(TagName tagName) {
|
public BlackboardArtifactTagTypeNode(TagName tagName) {
|
||||||
super(Children.create(new BlackboardArtifactTagNodeFactory(tagName), true), Lookups.singleton(tagName.getDisplayName() + " " + ARTIFACT_DISPLAY_NAME));
|
super(Children.create(new BlackboardArtifactTagNodeFactory(tagName), true), Lookups.singleton(tagName.getDisplayName() + " " + ARTIFACT_DISPLAY_NAME));
|
||||||
@ -492,9 +500,9 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
private void updateDisplayName() {
|
private void updateDisplayName() {
|
||||||
long tagsCount = 0;
|
long tagsCount = 0;
|
||||||
try {
|
try {
|
||||||
tagsCount = UserPreferences.groupItemsInTreeByDatasource() ?
|
tagsCount = UserPreferences.groupItemsInTreeByDatasource()
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName, datasourceObjId) :
|
? Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName, datasourceObjId)
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
|
: Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsCountByTagName(tagName);
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||||
Logger.getLogger(BlackboardArtifactTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get blackboard artifact tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS
|
Logger.getLogger(BlackboardArtifactTagTypeNode.class.getName()).log(Level.SEVERE, "Failed to get blackboard artifact tags count for " + tagName.getDisplayName() + " tag name", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
@ -549,10 +557,20 @@ public class Tags implements AutopsyVisitableItem {
|
|||||||
protected boolean createKeys(List<BlackboardArtifactTag> keys) {
|
protected boolean createKeys(List<BlackboardArtifactTag> keys) {
|
||||||
try {
|
try {
|
||||||
// Use the blackboard artifact tags bearing the specified tag name as the keys.
|
// Use the blackboard artifact tags bearing the specified tag name as the keys.
|
||||||
List<BlackboardArtifactTag> artifactTags = UserPreferences.groupItemsInTreeByDatasource() ?
|
List<BlackboardArtifactTag> artifactTags = UserPreferences.groupItemsInTreeByDatasource()
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName, datasourceObjId) :
|
? Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName, datasourceObjId)
|
||||||
Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName);
|
: Case.getCurrentCaseThrows().getServices().getTagsManager().getBlackboardArtifactTagsByTagName(tagName);
|
||||||
keys.addAll(artifactTags);
|
if (UserPreferences.showOnlyCurrentUserTags()) {
|
||||||
|
String userName = System.getProperty("user.name");
|
||||||
|
for (BlackboardArtifactTag tag : artifactTags){
|
||||||
|
if (userName.equals(tag.getUserName())){
|
||||||
|
keys.add(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
keys.addAll(artifactTags);
|
||||||
|
}
|
||||||
} catch (TskCoreException | NoCurrentCaseException ex) {
|
} catch (TskCoreException | NoCurrentCaseException ex) {
|
||||||
Logger.getLogger(BlackboardArtifactTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
|
Logger.getLogger(BlackboardArtifactTagNodeFactory.class.getName()).log(Level.SEVERE, "Failed to get tag names", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
|
@ -124,4 +124,5 @@ GroupDataSourcesDialog.dataSourceCountLabel.text=jLabel1
|
|||||||
GroupDataSourcesDialog.queryLabel.text=Would you like to group by data source for faster loading?
|
GroupDataSourcesDialog.queryLabel.text=Would you like to group by data source for faster loading?
|
||||||
GroupDataSourcesDialog.yesButton.text=Yes
|
GroupDataSourcesDialog.yesButton.text=Yes
|
||||||
GroupDataSourcesDialog.noButton.text=No
|
GroupDataSourcesDialog.noButton.text=No
|
||||||
GroupDataSourcesDialog.title=Group by Data Source?
|
GroupDataSourcesDialog.title=Group by Data Source?
|
||||||
|
DirectoryTreeTopComponent.showOnlyCurrentUserTagsCheckbox.text=X
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
<Component id="backButton" min="-2" max="-2" attributes="0"/>
|
<Component id="backButton" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="forwardButton" min="-2" max="-2" attributes="0"/>
|
<Component id="forwardButton" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="51" max="32767" attributes="0"/>
|
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||||
|
<Component id="showOnlyCurrentUserTagsCheckbox" pref="33" max="32767" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="showRejectedCheckBox" min="-2" max="-2" attributes="0"/>
|
<Component id="showRejectedCheckBox" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="groupByDatasourceCheckBox" min="-2" max="-2" attributes="0"/>
|
<Component id="groupByDatasourceCheckBox" min="-2" max="-2" attributes="0"/>
|
||||||
@ -36,7 +38,10 @@
|
|||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" attributes="0">
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
|
||||||
<Component id="showRejectedCheckBox" min="-2" max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
<Component id="showRejectedCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="showOnlyCurrentUserTagsCheckbox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="groupByDatasourceCheckBox" min="-2" max="-2" attributes="0"/>
|
<Component id="groupByDatasourceCheckBox" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
@ -151,5 +156,15 @@
|
|||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="groupByDatasourceCheckBoxActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="groupByDatasourceCheckBoxActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
|
<Component class="javax.swing.JCheckBox" name="showOnlyCurrentUserTagsCheckbox">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
|
<ResourceString bundle="org/sleuthkit/autopsy/directorytree/Bundle.properties" key="DirectoryTreeTopComponent.showOnlyCurrentUserTagsCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="showOnlyCurrentUserTagsCheckboxActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -137,6 +137,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
forwardButton.setEnabled(false);
|
forwardButton.setEnabled(false);
|
||||||
|
|
||||||
groupByDatasourceCheckBox.setSelected(UserPreferences.groupItemsInTreeByDatasource());
|
groupByDatasourceCheckBox.setSelected(UserPreferences.groupItemsInTreeByDatasource());
|
||||||
|
showOnlyCurrentUserTagsCheckbox.setSelected(UserPreferences.showOnlyCurrentUserTags());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -191,6 +192,7 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
forwardButton = new javax.swing.JButton();
|
forwardButton = new javax.swing.JButton();
|
||||||
showRejectedCheckBox = new javax.swing.JCheckBox();
|
showRejectedCheckBox = new javax.swing.JCheckBox();
|
||||||
groupByDatasourceCheckBox = new javax.swing.JCheckBox();
|
groupByDatasourceCheckBox = new javax.swing.JCheckBox();
|
||||||
|
showOnlyCurrentUserTagsCheckbox = new javax.swing.JCheckBox();
|
||||||
|
|
||||||
treeView.setBorder(null);
|
treeView.setBorder(null);
|
||||||
|
|
||||||
@ -235,6 +237,13 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
org.openide.awt.Mnemonics.setLocalizedText(showOnlyCurrentUserTagsCheckbox, org.openide.util.NbBundle.getMessage(DirectoryTreeTopComponent.class, "DirectoryTreeTopComponent.showOnlyCurrentUserTagsCheckbox.text")); // NOI18N
|
||||||
|
showOnlyCurrentUserTagsCheckbox.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
showOnlyCurrentUserTagsCheckboxActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
@ -244,7 +253,9 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
.addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(backButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(forwardButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
|
.addGap(18, 18, 18)
|
||||||
|
.addComponent(showOnlyCurrentUserTagsCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(showRejectedCheckBox)
|
.addComponent(showRejectedCheckBox)
|
||||||
.addComponent(groupByDatasourceCheckBox))
|
.addComponent(groupByDatasourceCheckBox))
|
||||||
@ -256,7 +267,9 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(5, 5, 5)
|
.addGap(5, 5, 5)
|
||||||
.addComponent(showRejectedCheckBox)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(showRejectedCheckBox)
|
||||||
|
.addComponent(showOnlyCurrentUserTagsCheckbox))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(groupByDatasourceCheckBox))
|
.addComponent(groupByDatasourceCheckBox))
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@ -323,10 +336,15 @@ public final class DirectoryTreeTopComponent extends TopComponent implements Dat
|
|||||||
UserPreferences.setGroupItemsInTreeByDatasource(this.groupByDatasourceCheckBox.isSelected());
|
UserPreferences.setGroupItemsInTreeByDatasource(this.groupByDatasourceCheckBox.isSelected());
|
||||||
}//GEN-LAST:event_groupByDatasourceCheckBoxActionPerformed
|
}//GEN-LAST:event_groupByDatasourceCheckBoxActionPerformed
|
||||||
|
|
||||||
|
private void showOnlyCurrentUserTagsCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_showOnlyCurrentUserTagsCheckboxActionPerformed
|
||||||
|
UserPreferences.setShowOnlyCurrentUserTags(this.showOnlyCurrentUserTagsCheckbox.isSelected());
|
||||||
|
}//GEN-LAST:event_showOnlyCurrentUserTagsCheckboxActionPerformed
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton backButton;
|
private javax.swing.JButton backButton;
|
||||||
private javax.swing.JButton forwardButton;
|
private javax.swing.JButton forwardButton;
|
||||||
private javax.swing.JCheckBox groupByDatasourceCheckBox;
|
private javax.swing.JCheckBox groupByDatasourceCheckBox;
|
||||||
|
private javax.swing.JCheckBox showOnlyCurrentUserTagsCheckbox;
|
||||||
private javax.swing.JCheckBox showRejectedCheckBox;
|
private javax.swing.JCheckBox showRejectedCheckBox;
|
||||||
private javax.swing.JScrollPane treeView;
|
private javax.swing.JScrollPane treeView;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user