mirror of
https://github.com/elisspace/autopsy.git
synced 2026-10-04 00:09:53 +00:00
Polish for multi-user case classes
This commit is contained in:
@@ -1589,15 +1589,15 @@ public class Case {
|
||||
public void notifyDataSourceAdded(Content dataSource, UUID addingDataSourceEventId) {
|
||||
eventPublisher.publish(new DataSourceAddedEvent(dataSource, addingDataSourceEventId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notifies case event subscribers that a data source has been added to the
|
||||
* case database.
|
||||
*
|
||||
* This should not be called from the event dispatch thread (EDT)
|
||||
*
|
||||
* @param dataSource The data source.
|
||||
* @param newName The new name for the data source
|
||||
* @param dataSource The data source.
|
||||
* @param newName The new name for the data source
|
||||
*/
|
||||
public void notifyDataSourceNameChanged(Content dataSource, String newName) {
|
||||
eventPublisher.publish(new DataSourceNameChangedEvent(dataSource, newName));
|
||||
@@ -1776,16 +1776,14 @@ public class Case {
|
||||
} catch (CaseMetadataException ex) {
|
||||
throw new CaseActionException(Bundle.Case_exceptionMessage_metadataUpdateError(), ex);
|
||||
}
|
||||
if (getCaseType() == CaseType.MULTI_USER_CASE) {
|
||||
if (!oldCaseDetails.getCaseDisplayName().equals(caseDetails.getCaseDisplayName())) {
|
||||
try {
|
||||
CoordinationService coordinationService = CoordinationService.getInstance();
|
||||
CaseNodeData nodeData = new CaseNodeData(coordinationService.getNodeData(CategoryNode.CASES, metadata.getCaseDirectory()));
|
||||
nodeData.setDisplayName(caseDetails.getCaseDisplayName());
|
||||
coordinationService.setNodeData(CategoryNode.CASES, metadata.getCaseDirectory(), nodeData.toArray());
|
||||
} catch (CoordinationServiceException | InterruptedException | IOException ex) {
|
||||
throw new CaseActionException(Bundle.Case_exceptionMessage_couldNotUpdateCaseNodeData(ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
if (getCaseType() == CaseType.MULTI_USER_CASE && !oldCaseDetails.getCaseDisplayName().equals(caseDetails.getCaseDisplayName())) {
|
||||
try {
|
||||
CoordinationService coordinationService = CoordinationService.getInstance();
|
||||
CaseNodeData nodeData = new CaseNodeData(coordinationService.getNodeData(CategoryNode.CASES, metadata.getCaseDirectory()));
|
||||
nodeData.setDisplayName(caseDetails.getCaseDisplayName());
|
||||
coordinationService.setNodeData(CategoryNode.CASES, metadata.getCaseDirectory(), nodeData.toArray());
|
||||
} catch (CoordinationServiceException | InterruptedException | IOException ex) {
|
||||
throw new CaseActionException(Bundle.Case_exceptionMessage_couldNotUpdateCaseNodeData(ex.getLocalizedMessage()), ex);
|
||||
}
|
||||
}
|
||||
if (!oldCaseDetails.getCaseNumber().equals(caseDetails.getCaseNumber())) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2017 Basis Technology Corp.
|
||||
* Copyright 2011-2019 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -28,6 +28,7 @@ import java.nio.file.Paths;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
@@ -53,7 +54,7 @@ public final class CaseMetadata {
|
||||
|
||||
private static final String FILE_EXTENSION = ".aut";
|
||||
private static final String DATE_FORMAT_STRING = "yyyy/MM/dd HH:mm:ss (z)";
|
||||
private static final DateFormat DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_STRING);
|
||||
private static final DateFormat DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_STRING, Locale.US);
|
||||
|
||||
/*
|
||||
* Fields from schema version 1
|
||||
@@ -127,7 +128,7 @@ public final class CaseMetadata {
|
||||
* @return The date format.
|
||||
*/
|
||||
public static DateFormat getDateFormat() {
|
||||
return new SimpleDateFormat(DATE_FORMAT_STRING);
|
||||
return new SimpleDateFormat(DATE_FORMAT_STRING, Locale.US);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.sleuthkit.autopsy.casemodule.CaseMetadata;
|
||||
import org.sleuthkit.autopsy.coordinationservice.CoordinationService;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
*/
|
||||
final class MultiUserCasesRootNode extends AbstractNode {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MultiUserCasesRootNode.class.getName());
|
||||
|
||||
private static final Logger logger = Logger.getLogger(MultiUserCasesRootNode.class.getName());
|
||||
|
||||
/**
|
||||
* Constructs a root node for displaying MultiUserCaseNodes in a NetBeans
|
||||
* Explorer View.
|
||||
@@ -46,6 +46,11 @@ final class MultiUserCasesRootNode extends AbstractNode {
|
||||
super(Children.create(new MultiUserCasesRootNodeChildren(), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* A child factory for creating child nodes for a MultiUserCasesRootNode.
|
||||
* The child nodes are of type MultiUserCaseNode. The node keys are of type
|
||||
* CaseNodeData.
|
||||
*/
|
||||
private static class MultiUserCasesRootNodeChildren extends ChildFactory<CaseNodeData> {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,7 +61,7 @@ final class OpenCaseAutoIngestLogAction extends AbstractAction {
|
||||
"OpenCaseAutoIngestLogAction.logOpenFailedErrorMsg=Failed to open case auto ingest log. See application log for details."
|
||||
})
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
try {
|
||||
if (caseAutoIngestLogFilePath.toFile().exists()) {
|
||||
Desktop.getDesktop().edit(caseAutoIngestLogFilePath.toFile());
|
||||
@@ -75,7 +75,7 @@ final class OpenCaseAutoIngestLogAction extends AbstractAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
public OpenCaseAutoIngestLogAction clone() throws CloneNotSupportedException {
|
||||
super.clone();
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ final class OpenMultiUserCaseAction extends AbstractAction {
|
||||
"# {0} - caseErrorMessage", "OpenMultiUserCaseAction.caseOpeningErrorErrorMsg=Failed to open case: {0}"
|
||||
})
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
StartupWindowProvider.getInstance().close();
|
||||
OpenMultiUserCaseDialog.getInstance().setVisible(false);
|
||||
new Thread(() -> {
|
||||
@@ -91,7 +91,7 @@ final class OpenMultiUserCaseAction extends AbstractAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
public OpenMultiUserCaseAction clone() throws CloneNotSupportedException {
|
||||
super.clone();
|
||||
throw new CloneNotSupportedException();
|
||||
}
|
||||
|
||||
@@ -19,13 +19,9 @@
|
||||
package org.sleuthkit.autopsy.casemodule;
|
||||
|
||||
import java.awt.Dialog;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.windows.WindowManager;
|
||||
import org.sleuthkit.autopsy.casemodule.Bundle;
|
||||
|
||||
/**
|
||||
* A singleton JDialog that allows a user to open a multi-user case.
|
||||
@@ -65,12 +61,6 @@ final class OpenMultiUserCaseDialog extends JDialog {
|
||||
* pressed and adds a OpenMultiUserCasePanel child component.
|
||||
*/
|
||||
private void init() {
|
||||
getRootPane().registerKeyboardAction(
|
||||
action -> {
|
||||
setVisible(false);
|
||||
},
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
|
||||
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
multiUserCasesPanel = new OpenMultiUserCasePanel(this);
|
||||
add(multiUserCasesPanel);
|
||||
pack();
|
||||
|
||||
@@ -50,7 +50,7 @@ final class OpenMultiUserCasePanel extends JPanel {
|
||||
caseExplorerScrollPane.add(caseBrowserPanel);
|
||||
caseExplorerScrollPane.setViewportView(caseBrowserPanel);
|
||||
openSelectedCaseButton.setEnabled(false);
|
||||
caseBrowserPanel.addListSelectionListener((ListSelectionEvent e) -> {
|
||||
caseBrowserPanel.addListSelectionListener((ListSelectionEvent event) -> {
|
||||
openSelectedCaseButton.setEnabled(caseBrowserPanel.getExplorerManager().getSelectedNodes().length > 0);
|
||||
});
|
||||
}
|
||||
@@ -177,12 +177,10 @@ final class OpenMultiUserCasePanel extends JPanel {
|
||||
private void openSelectedCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openSelectedCaseButtonActionPerformed
|
||||
ExplorerManager explorerManager = caseBrowserPanel.getExplorerManager();
|
||||
Node[] selectedNodes = explorerManager.getSelectedNodes();
|
||||
if (selectedNodes.length > 0) {
|
||||
if (selectedNodes[0] instanceof MultiUserCaseNode) {
|
||||
MultiUserCaseNode caseNode = (MultiUserCaseNode) selectedNodes[0];
|
||||
CaseNodeData nodeData = caseNode.getCaseNodeData();
|
||||
new OpenMultiUserCaseAction(nodeData).actionPerformed(evt);
|
||||
}
|
||||
if (selectedNodes.length > 0 && selectedNodes[0] instanceof MultiUserCaseNode) {
|
||||
MultiUserCaseNode caseNode = (MultiUserCaseNode) selectedNodes[0];
|
||||
CaseNodeData nodeData = caseNode.getCaseNodeData();
|
||||
new OpenMultiUserCaseAction(nodeData).actionPerformed(evt);
|
||||
}
|
||||
}//GEN-LAST:event_openSelectedCaseButtonActionPerformed
|
||||
|
||||
|
||||
Reference in New Issue
Block a user