19 package org.sleuthkit.autopsy.centralrepository;
21 import java.awt.event.ActionEvent;
22 import java.util.List;
23 import java.util.logging.Level;
24 import javax.swing.AbstractAction;
25 import javax.swing.Action;
26 import org.apache.commons.lang.StringUtils;
27 import org.openide.DialogDisplayer;
28 import org.openide.NotifyDescriptor;
29 import org.openide.util.NbBundle.Messages;
43 @Messages({
"AddEditCentralRepoCommentAction.menuItemText.addEditCentralRepoCommentEmptyFile=Add/Edit Central Repository Comment (Empty File)",
44 "AddEditCentralRepoCommentAction.menuItemText.addEditCentralRepoCommentNoMD5=Add/Edit Central Repository Comment (No MD5 Hash)",
45 "AddEditCentralRepoCommentAction.menuItemText.addEditCentralRepoComment=Add/Edit Central Repository Comment"})
49 private static final long serialVersionUID = 1L;
64 fileId = file.getId();
66 if (correlationAttributeInstance == null) {
69 if (!md5CorrelationAttr.isEmpty()) {
71 correlationAttributeInstance = md5CorrelationAttr.get(0);
73 correlationAttributeInstance = null;
76 if (file.getSize() == 0) {
77 putValue(Action.NAME, Bundle.AddEditCentralRepoCommentAction_menuItemText_addEditCentralRepoCommentEmptyFile());
78 }
else if (StringUtils.isBlank(file.getMd5Hash())) {
79 putValue(Action.NAME, Bundle.AddEditCentralRepoCommentAction_menuItemText_addEditCentralRepoCommentNoMD5());
81 putValue(Action.NAME, Bundle.AddEditCentralRepoCommentAction_menuItemText_addEditCentralRepoComment());
98 CentralRepoCommentDialog centralRepoCommentDialog =
new CentralRepoCommentDialog(correlationAttributeInstance);
99 centralRepoCommentDialog.display();
103 if (centralRepoCommentDialog.isCommentUpdated()) {
115 comment = centralRepoCommentDialog.getComment();
119 logger.log(Level.WARNING,
"Case not open after changing central repository comment", ex);
122 logger.log(Level.SEVERE,
"Error adding comment", ex);
123 NotifyDescriptor notifyDescriptor =
new NotifyDescriptor.Message(
124 "An error occurred while trying to save the comment to the central repository.",
125 NotifyDescriptor.ERROR_MESSAGE);
126 DialogDisplayer.getDefault().notify(notifyDescriptor);
148 return correlationAttributeInstance;
void notifyCentralRepoCommentChanged(long contentId, String newComment)
void updateAttributeInstanceComment(CorrelationAttributeInstance eamArtifact)
void addArtifactInstance(CorrelationAttributeInstance eamArtifact)
static List< CorrelationAttributeInstance > makeCorrAttrsForSearch(AnalysisResult analysisResult)
static CorrelationAttributeInstance getCorrAttrForFile(AbstractFile file)
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
static CentralRepository getInstance()