mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
2774 enforce case naming rules when renaming a display name
This commit is contained in:
parent
20725202e5
commit
c1fad4beb8
@ -488,36 +488,6 @@ final class CasePropertiesPanel extends javax.swing.JPanel {
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
//WJS-TODO ensure case not saved with empty name
|
||||
// @NbBundle.Messages({
|
||||
// "CasePropertiesPanel.errorDialog.emptyCaseNameMessage=No case name entered.",
|
||||
// "CasePropertiesPanel.errorDialog.invalidCaseNameMessage=Case names cannot include the following symbols: \\, /, :, *, ?, \", <, >, |"
|
||||
// })
|
||||
// private void saveCaseName() {
|
||||
// String newCaseDisplayName = caseNameTextField.getText();
|
||||
//
|
||||
// if (newCaseDisplayName.equals(theCase.getDisplayName())) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (newCaseDisplayName.trim().isEmpty()) {
|
||||
// MessageNotifyUtil.Message.error(Bundle.CasePropertiesPanel_errorDialog_emptyCaseNameMessage());
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!Case.isValidName(newCaseDisplayName)) {
|
||||
// MessageNotifyUtil.Message.error(Bundle.CasePropertiesPanel_errorDialog_invalidCaseNameMessage());
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// theCase.updateDisplayName(newCaseDisplayName);
|
||||
// } catch (CaseActionException ex) {
|
||||
// MessageNotifyUtil.Message.error(ex.getLocalizedMessage());
|
||||
// LOGGER.log(Level.SEVERE, "Failed to update case display name", ex); //NON-NLS
|
||||
// }
|
||||
// }
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel caseDirField;
|
||||
private javax.swing.JLabel caseDirLabel;
|
||||
|
@ -29,6 +29,7 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
|
||||
import org.sleuthkit.autopsy.centralrepository.optionspanel.ManageOrganizationsDialog;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
|
||||
|
||||
/**
|
||||
* Panel which allows for editing and setting of the case details which are
|
||||
@ -500,6 +501,10 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@Messages({
|
||||
"OptionalCasePropertiesPanel.errorDialog.emptyCaseNameMessage=No case name entered.",
|
||||
"OptionalCasePropertiesPanel.errorDialog.invalidCaseNameMessage=Case names cannot include the following symbols: \\, /, :, *, ?, \", <, >, |"
|
||||
})
|
||||
/**
|
||||
* Save changed value from text fields and text areas into the EamCase
|
||||
* object.
|
||||
@ -508,6 +513,14 @@ final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
|
||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
if (EamDb.isEnabled()) {
|
||||
try {
|
||||
if (caseDisplayNameTextField.getText().trim().isEmpty()) {
|
||||
MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_emptyCaseNameMessage());
|
||||
return;
|
||||
}
|
||||
if (!Case.isValidName(caseDisplayNameTextField.getText())) {
|
||||
MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_invalidCaseNameMessage());
|
||||
return;
|
||||
}
|
||||
EamDb dbManager = EamDb.getInstance();
|
||||
CorrelationCase correlationCase = dbManager.getCaseByUUID(Case.getCurrentCase().getName());
|
||||
if (caseDisplayNameTextField.isVisible()) {
|
||||
|
@ -1436,12 +1436,9 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
||||
checkIfUsedStatement.setInt(1, organizationToDelete.getOrgID());
|
||||
checkIfUsedStatement.setInt(2, organizationToDelete.getOrgID());
|
||||
resultSet = checkIfUsedStatement.executeQuery();
|
||||
System.out.println(checkIfUsedStatement.toString());
|
||||
resultSet.next();
|
||||
long count = resultSet.getLong(1);
|
||||
System.out.println("COUNT OF RESULTS: "+ count);
|
||||
if (count > 0) {
|
||||
throw new EamDbException("Can not delete organization which is currently a case in the central repo");
|
||||
if (resultSet.getLong(1) > 0) {
|
||||
throw new EamDbException("Can not delete organization which is currently in use by a case or reference set in the central repo");
|
||||
}
|
||||
deleteOrgStatement = conn.prepareStatement(deleteOrgSql);
|
||||
deleteOrgStatement.setInt(1, organizationToDelete.getOrgID());
|
||||
|
Loading…
x
Reference in New Issue
Block a user