mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
more granular synchronization in DrawableTagsManager
This commit is contained in:
parent
e126aee4cb
commit
bc33284c68
@ -45,7 +45,7 @@ public class DrawableTagsManager {
|
|||||||
|
|
||||||
private static final String FOLLOW_UP = "Follow Up";
|
private static final String FOLLOW_UP = "Follow Up";
|
||||||
|
|
||||||
private Object autopsyTagsManagerLock = new Object();
|
final private Object autopsyTagsManagerLock = new Object();
|
||||||
private TagsManager autopsyTagsManager;
|
private TagsManager autopsyTagsManager;
|
||||||
|
|
||||||
/** Used to distribute {@link TagsChangeEvent}s */
|
/** Used to distribute {@link TagsChangeEvent}s */
|
||||||
@ -66,7 +66,7 @@ public class DrawableTagsManager {
|
|||||||
* @param autopsyTagsManager
|
* @param autopsyTagsManager
|
||||||
*/
|
*/
|
||||||
public void setAutopsyTagsManager(TagsManager autopsyTagsManager) {
|
public void setAutopsyTagsManager(TagsManager autopsyTagsManager) {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
this.autopsyTagsManager = autopsyTagsManager;
|
this.autopsyTagsManager = autopsyTagsManager;
|
||||||
clearFollowUpTagName();
|
clearFollowUpTagName();
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ public class DrawableTagsManager {
|
|||||||
* next case.
|
* next case.
|
||||||
*/
|
*/
|
||||||
public void clearFollowUpTagName() {
|
public void clearFollowUpTagName() {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
followUpTagName = null;
|
followUpTagName = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ public class DrawableTagsManager {
|
|||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
public TagName getFollowUpTagName() throws TskCoreException {
|
public TagName getFollowUpTagName() throws TskCoreException {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
if (Objects.isNull(followUpTagName)) {
|
if (Objects.isNull(followUpTagName)) {
|
||||||
followUpTagName = getTagName(FOLLOW_UP);
|
followUpTagName = getTagName(FOLLOW_UP);
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ public class DrawableTagsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Collection<TagName> getNonCategoryTagNames() {
|
public Collection<TagName> getNonCategoryTagNames() {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
try {
|
try {
|
||||||
return autopsyTagsManager.getAllTagNames().stream()
|
return autopsyTagsManager.getAllTagNames().stream()
|
||||||
.filter(Category::isCategoryTagName)
|
.filter(Category::isCategoryTagName)
|
||||||
@ -140,13 +140,13 @@ public class DrawableTagsManager {
|
|||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
public List<ContentTag> getContentTagsByContent(Content content) throws TskCoreException {
|
public List<ContentTag> getContentTagsByContent(Content content) throws TskCoreException {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
return autopsyTagsManager.getContentTagsByContent(content);
|
return autopsyTagsManager.getContentTagsByContent(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TagName getTagName(String displayName) throws TskCoreException {
|
public TagName getTagName(String displayName) throws TskCoreException {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
try {
|
try {
|
||||||
for (TagName tn : autopsyTagsManager.getAllTagNames()) {
|
for (TagName tn : autopsyTagsManager.getAllTagNames()) {
|
||||||
if (displayName.equals(tn.getDisplayName())) {
|
if (displayName.equals(tn.getDisplayName())) {
|
||||||
@ -175,14 +175,14 @@ public class DrawableTagsManager {
|
|||||||
|
|
||||||
public void addContentTag(DrawableFile<?> file, TagName tagName, String comment) throws TskCoreException {
|
public void addContentTag(DrawableFile<?> file, TagName tagName, String comment) throws TskCoreException {
|
||||||
ContentTag addContentTag;
|
ContentTag addContentTag;
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
addContentTag = autopsyTagsManager.addContentTag(file, tagName, comment);
|
addContentTag = autopsyTagsManager.addContentTag(file, tagName, comment);
|
||||||
}
|
}
|
||||||
fireTagAdded(addContentTag);
|
fireTagAdded(addContentTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ContentTag> getContentTagsByTagName(TagName t) throws TskCoreException {
|
public List<ContentTag> getContentTagsByTagName(TagName t) throws TskCoreException {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
return autopsyTagsManager.getContentTagsByTagName(t);
|
return autopsyTagsManager.getContentTagsByTagName(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,13 +203,13 @@ public class DrawableTagsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<TagName> getAllTagNames() throws TskCoreException {
|
public List<TagName> getAllTagNames() throws TskCoreException {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
return autopsyTagsManager.getAllTagNames();
|
return autopsyTagsManager.getAllTagNames();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TagName> getTagNamesInUse() throws TskCoreException {
|
public List<TagName> getTagNamesInUse() throws TskCoreException {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
return autopsyTagsManager.getTagNamesInUse();
|
return autopsyTagsManager.getTagNamesInUse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,21 +221,11 @@ public class DrawableTagsManager {
|
|||||||
public void fireTagDeleted(ContentTag oldTag) {
|
public void fireTagDeleted(ContentTag oldTag) {
|
||||||
tagsEventBus.post(new TagsChangeEvent(Collections.singleton(oldTag.getContent().getId())));
|
tagsEventBus.post(new TagsChangeEvent(Collections.singleton(oldTag.getContent().getId())));
|
||||||
}
|
}
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * fire a TagsChangeEvent with the given fileIDs
|
|
||||||
// *
|
|
||||||
// * @param fileIDs
|
|
||||||
// */
|
|
||||||
// public final void fireChange(Collection<Long> fileIDs) {
|
|
||||||
// tagsEventBus.post(new TagsChangeEvent(fileIDs));
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void deleteContentTag(ContentTag ct) throws TskCoreException {
|
public void deleteContentTag(ContentTag ct) throws TskCoreException {
|
||||||
synchronized (autopsyTagsManager) {
|
synchronized (autopsyTagsManagerLock) {
|
||||||
autopsyTagsManager.deleteContentTag(ct);
|
autopsyTagsManager.deleteContentTag(ct);
|
||||||
}
|
}
|
||||||
fireTagDeleted(ct);
|
fireTagDeleted(ct);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user