4014-more clean up of comments and logging for has comment column code

This commit is contained in:
William Schaefer 2018-08-10 12:19:30 -04:00
parent d07326a342
commit 17e56c19ef
3 changed files with 13 additions and 10 deletions

View File

@ -375,6 +375,10 @@ public class Case {
*/
TAG_DEFINITION_CHANGED,
/**
* An item in the central repository has had its comment modified. The
* old value is null, the new value is string for current comment.
*/
CR_COMMENT_CHANGED;
};
@ -1103,7 +1107,7 @@ public class Case {
/*
* Open the top components (windows within the main application
* window).
*
*
* Note: If the core windows are not opened here, they will be
* opened via the DirectoryTreeTopComponent 'propertyChange()'
* method on a DATA_SOURCE_ADDED event.
@ -1536,10 +1540,10 @@ public class Case {
eventPublisher.publish(new AutopsyEvent(Events.TAG_DEFINITION_CHANGED.toString(), changedTagName, null));
}
public void notifyCentralRepoCommentChanged(long id){
public void notifyCentralRepoCommentChanged(long id) {
eventPublisher.publish(new CommentChangedEvent(id));
}
/**
* Notifies case event subscribers that an artifact tag has been added.
*

View File

@ -12,8 +12,8 @@ public class CommentChangedEvent extends AutopsyEvent implements Serializable {
private final long contentID;
public CommentChangedEvent(long id) {
super(Case.Events.CR_COMMENT_CHANGED.toString(), true, false);
public CommentChangedEvent(long id, String newComment) {
super(Case.Events.CR_COMMENT_CHANGED.toString(), null, newComment);
contentID = id;
}

View File

@ -23,8 +23,6 @@ import java.util.logging.Level;
import javax.swing.AbstractAction;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
@ -43,6 +41,7 @@ import org.sleuthkit.datamodel.AbstractFile;
public final class AddEditCentralRepoCommentAction extends AbstractAction {
private static final Logger logger = Logger.getLogger(AddEditCentralRepoCommentAction.class.getName());
private static final long serialVersionUID = 1L;
private boolean addToDatabase;
private CorrelationAttribute correlationAttribute;
@ -110,9 +109,9 @@ public final class AddEditCentralRepoCommentAction extends AbstractAction {
comment = centralRepoCommentDialog.getComment();
if (fileId != null) {
try {
Case.getCurrentCaseThrows().notifyCentralRepoCommentChanged(fileId);
} catch (NoCurrentCaseException ignored) {
//WJS should this be ignored or is it an issue in multi-user instances
Case.getCurrentCaseThrows().notifyCentralRepoCommentChanged(fileId, comment);
} catch (NoCurrentCaseException ex) {
logger.log(Level.WARNING, "Case not open after changing central repository comment", ex);
}
}
} catch (EamDbException ex) {