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, 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; CR_COMMENT_CHANGED;
}; };
@ -1536,7 +1540,7 @@ public class Case {
eventPublisher.publish(new AutopsyEvent(Events.TAG_DEFINITION_CHANGED.toString(), changedTagName, null)); 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)); eventPublisher.publish(new CommentChangedEvent(id));
} }

View File

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

View File

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