mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-06 02:24:30 +00:00
3202 make TagNameDefinition non public again
This commit is contained in:
@@ -76,7 +76,6 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.events.DataSourceAddedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.events.ReportAddedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.services.Services;
|
||||
import org.sleuthkit.autopsy.casemodule.services.TagNameDefinition;
|
||||
import org.sleuthkit.autopsy.coordinationservice.CoordinationService;
|
||||
import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CategoryNode;
|
||||
import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CoordinationServiceException;
|
||||
@@ -1479,8 +1478,8 @@ public class Case {
|
||||
eventPublisher.publish(new ContentTagDeletedEvent(deletedTag));
|
||||
}
|
||||
|
||||
public void notifyTagStatusChanged(TagNameDefinition oldTag, TagNameDefinition newTag) {
|
||||
eventPublisher.publish(new AutopsyEvent(Events.TAG_STATUS_CHANGED.toString(), oldTag, newTag));
|
||||
public void notifyTagStatusChanged(String changedTagName) {
|
||||
eventPublisher.publish(new AutopsyEvent(Events.TAG_STATUS_CHANGED.toString(), changedTagName, changedTagName));
|
||||
}
|
||||
/**
|
||||
* Notifies case event subscribers that an artifact tag has been added.
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.sleuthkit.datamodel.TskData;
|
||||
* A tag name definition consisting of a display name, description and color.
|
||||
*/
|
||||
@Immutable
|
||||
public final class TagNameDefinition implements Comparable<TagNameDefinition> {
|
||||
final class TagNameDefinition implements Comparable<TagNameDefinition> {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(TagNameDefinition.class.getName());
|
||||
@NbBundle.Messages({"TagNameDefinition.predefTagNames.bookmark.text=Bookmark",
|
||||
@@ -68,7 +68,7 @@ public final class TagNameDefinition implements Comparable<TagNameDefinition> {
|
||||
* @param color The color for the tag name.
|
||||
* @param status The status denoted by the tag name.
|
||||
*/
|
||||
public TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) {
|
||||
TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) {
|
||||
this.displayName = displayName;
|
||||
this.description = description;
|
||||
this.color = color;
|
||||
@@ -84,7 +84,7 @@ public final class TagNameDefinition implements Comparable<TagNameDefinition> {
|
||||
*
|
||||
* @return The display name.
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public final class TagNameDefinition implements Comparable<TagNameDefinition> {
|
||||
*
|
||||
* @return a value of TskData.FileKnown which is associated with this tag
|
||||
*/
|
||||
public TskData.FileKnown getKnownStatus() {
|
||||
TskData.FileKnown getKnownStatus() {
|
||||
return knownStatus;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
|
||||
private final DefaultListModel<TagNameDefinition> tagTypesListModel;
|
||||
private Set<TagNameDefinition> tagTypes;
|
||||
private IngestJobEventPropertyChangeListener ingestJobEventsListener;
|
||||
private Set<TagPair> updatedStatusTags;
|
||||
private Set<String> updatedStatusTags;
|
||||
|
||||
/**
|
||||
* Creates new form TagOptionsPanel
|
||||
@@ -361,7 +361,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
|
||||
updatePanel();
|
||||
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
|
||||
if (originalTagName.getKnownStatus() != newTagType.getKnownStatus() && Case.isCaseOpen()) {
|
||||
updatedStatusTags.add(new TagPair(originalTagName, newTagType));
|
||||
updatedStatusTags.add(newTagType.getDisplayName());
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_editTagNameButtonActionPerformed
|
||||
@@ -422,8 +422,8 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
|
||||
}
|
||||
|
||||
private void sendStatusChangedEvents() {
|
||||
for (TagPair modifiedTag : updatedStatusTags) {
|
||||
Case.getCurrentCase().notifyTagStatusChanged(modifiedTag.getOldValue(), modifiedTag.getNewValue());
|
||||
for (String modifiedTagDisplayName : updatedStatusTags) {
|
||||
Case.getCurrentCase().notifyTagStatusChanged(modifiedTagDisplayName);
|
||||
}
|
||||
updatedStatusTags.clear();
|
||||
}
|
||||
@@ -445,7 +445,6 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
|
||||
boolean enableDelete = enableEdit && !TagNameDefinition.getStandardTagNames().contains(tagNamesList.getSelectedValue().getDisplayName());
|
||||
deleteTagNameButton.setEnabled(enableDelete);
|
||||
if (isSelected) {
|
||||
|
||||
descriptionTextArea.setText(tagNamesList.getSelectedValue().getDescription());
|
||||
if (tagNamesList.getSelectedValue().getKnownStatus() == TskData.FileKnown.BAD) {
|
||||
notableYesOrNoLabel.setText("Yes");
|
||||
@@ -468,42 +467,6 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
|
||||
super.finalize();
|
||||
}
|
||||
|
||||
private class TagPair implements Comparable<TagPair> {
|
||||
|
||||
private TagNameDefinition oldValue;
|
||||
private TagNameDefinition newValue;
|
||||
|
||||
private TagPair(TagNameDefinition oldV, TagNameDefinition newV) {
|
||||
oldValue = oldV;
|
||||
newValue = newV;
|
||||
}
|
||||
|
||||
private TagNameDefinition getOldValue() {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
private TagNameDefinition getNewValue() {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this tag name definition with the specified tag name
|
||||
* definition for order.
|
||||
*
|
||||
* @param other The tag name definition to which to compare this tag
|
||||
* name definition.
|
||||
*
|
||||
* @return Negative integer, zero, or a positive integer to indicate
|
||||
* that this tag name definition is less than, equal to, or
|
||||
* greater than the specified tag name definition.
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(TagPair other) {
|
||||
return this.getNewValue().compareTo(other.getNewValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A property change listener that listens to ingest job events.
|
||||
*/
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.sleuthkit.autopsy.casemodule.events.BlackBoardArtifactTagDeletedEvent
|
||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.events.DataSourceAddedEvent;
|
||||
import org.sleuthkit.autopsy.casemodule.services.TagNameDefinition;
|
||||
import org.sleuthkit.autopsy.casemodule.services.TagsManager;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
|
||||
@@ -314,17 +313,17 @@ final class CaseEventListener implements PropertyChangeListener {
|
||||
if (!EamDb.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
TskData.FileKnown status = ((TagNameDefinition) event.getNewValue()).getKnownStatus();
|
||||
String modifiedTagName = (String) event.getNewValue();
|
||||
List<String> notableTags = TagsManager.getNotableTagDisplayNames();
|
||||
TskData.FileKnown status = notableTags.contains(modifiedTagName) ? TskData.FileKnown.BAD : TskData.FileKnown.UNKNOWN;
|
||||
/**
|
||||
* Set knownBad status for all files/artifacts in the given case
|
||||
* that are tagged with the given tag name.
|
||||
*/
|
||||
System.out.println("TAG " + ((TagNameDefinition) event.getNewValue()).getDisplayName() + " event FROM " + ((TagNameDefinition) event.getOldValue()).getKnownStatus().toString() + " TO " + status.toString());
|
||||
try {
|
||||
TagName tagName = Case.getCurrentCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(((TagNameDefinition) event.getNewValue()).getDisplayName());
|
||||
TagName tagName = Case.getCurrentCase().getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(((TagName) event.getNewValue()).getDisplayName());
|
||||
// First find any matching artifacts
|
||||
List<BlackboardArtifactTag> artifactTags = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifactTagsByTagName(tagName);
|
||||
List<String> notableTags = TagsManager.getNotableTagDisplayNames();
|
||||
for (BlackboardArtifactTag bbTag : artifactTags) {
|
||||
List<CorrelationAttribute> convertedArtifacts = EamArtifactUtil.getCorrelationAttributeFromBlackboardArtifact(bbTag.getArtifact(), true, true);
|
||||
for (CorrelationAttribute eamArtifact : convertedArtifacts) {
|
||||
@@ -379,11 +378,10 @@ final class CaseEventListener implements PropertyChangeListener {
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
System.out.println("Cannot update ");
|
||||
LOGGER.log(Level.SEVERE, "Cannot update known status in central repository"); //NON-NLS
|
||||
} catch (EamDbException ex) {
|
||||
System.out.println("Cannot get CR");
|
||||
LOGGER.log(Level.SEVERE, "Cannot get central repository"); //NON-NLS
|
||||
}
|
||||
|
||||
} //TAG_STATUS_CHANGED
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user