19 package org.sleuthkit.autopsy.modules.hashdatabase;
22 import java.io.IOException;
23 import java.nio.file.Paths;
24 import java.util.List;
25 import java.util.logging.Level;
26 import javax.swing.JFileChooser;
27 import javax.swing.JFrame;
28 import javax.swing.JOptionPane;
29 import org.apache.commons.io.FilenameUtils;
30 import org.openide.util.NbBundle;
31 import org.openide.windows.WindowManager;
55 @SuppressWarnings(
"PMD.SingularField")
56 final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
58 private static final String DEFAULT_FILE_NAME = NbBundle
59 .getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.defaultFileName");
60 private static final long serialVersionUID = 1L;
61 private JFileChooser fileChooser = null;
62 private HashDb newHashDb = null;
63 private final static String LAST_FILE_PATH_KEY =
"HashDbCreate_Path";
64 private CentralRepoOrganization selectedOrg = null;
65 private List<CentralRepoOrganization> orgs = null;
66 static final String HASH_DATABASE_DIR_NAME =
"HashDatabases";
67 private final JFileChooserFactory chooserFactory;
74 HashDbCreateDatabaseDialog() {
75 super((JFrame) WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.createHashDbMsg"),
true);
77 chooserFactory =
new JFileChooserFactory(CustomFileChooser.class);
88 HashDb getHashDatabase() {
92 private void display() {
93 setLocationRelativeTo(getOwner());
97 private void enableComponents() {
99 if (!CentralRepository.isEnabled() || !FeatureAccessUtils.canAddHashSetsToCentralRepo()) {
100 centralRepoRadioButton.setEnabled(
false);
101 fileTypeRadioButton.setSelected(
true);
106 boolean isFileType = fileTypeRadioButton.isSelected();
109 databasePathLabel.setEnabled(isFileType);
110 databasePathTextField.setEnabled(isFileType);
111 saveAsButton.setEnabled(isFileType);
114 lbOrg.setEnabled(!isFileType);
115 orgButton.setEnabled(!isFileType);
116 orgComboBox.setEnabled(!isFileType);
119 @NbBundle.Messages({
"HashDbCreateDatabaseDialog.populateOrgsError.message=Failure loading organizations."})
120 private void populateCombobox() {
121 orgComboBox.removeAllItems();
123 CentralRepository dbManager = CentralRepository.getInstance();
124 orgs = dbManager.getOrganizations();
125 orgs.forEach((
org) -> {
126 orgComboBox.addItem(
org.getName());
127 if (CentralRepoDbUtil.isDefaultOrg(
org)) {
128 orgComboBox.setSelectedItem(
org.getName());
132 if ((selectedOrg == null) && (!orgs.isEmpty())) {
133 selectedOrg = orgs.get(0);
135 }
catch (CentralRepoException ex) {
136 JOptionPane.showMessageDialog(
this, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message());
137 Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE,
"Failure loading organizations", ex);
146 private static final long serialVersionUID = 1L;
150 File selectedFile = getSelectedFile();
151 if (!FilenameUtils.getExtension(selectedFile.getName()).equalsIgnoreCase(
HashDbManager.getHashDatabaseFileExtension())) {
152 if (JOptionPane.showConfirmDialog(
this,
153 NbBundle.getMessage(
this.getClass(),
154 "HashDbCreateDatabaseDialog.hashDbMustHaveFileExtensionMsg",
156 NbBundle.getMessage(
this.getClass(),
157 "HashDbCreateDatabaseDialog.fileNameErr"),
158 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
163 if (selectedFile.exists()) {
164 if (JOptionPane.showConfirmDialog(
this,
165 NbBundle.getMessage(
this.getClass(),
166 "HashDbCreateDatabaseDialog.fileNameAlreadyExistsMsg"),
167 NbBundle.getMessage(
this.getClass(),
168 "HashDbCreateDatabaseDialog.fileExistsErr"),
169 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
174 super.approveSelection();
183 @SuppressWarnings(
"unchecked")
185 private
void initComponents() {
187 buttonGroup1 =
new javax.swing.ButtonGroup();
188 storageTypeButtonGroup =
new javax.swing.ButtonGroup();
189 saveAsButton =
new javax.swing.JButton();
190 cancelButton =
new javax.swing.JButton();
191 knownRadioButton =
new javax.swing.JRadioButton();
192 knownBadRadioButton =
new javax.swing.JRadioButton();
193 databasePathLabel =
new javax.swing.JLabel();
194 hashSetNameTextField =
new javax.swing.JTextField();
195 jLabel2 =
new javax.swing.JLabel();
196 sendIngestMessagesCheckbox =
new javax.swing.JCheckBox();
197 jLabel3 =
new javax.swing.JLabel();
198 databasePathTextField =
new javax.swing.JTextField();
199 okButton =
new javax.swing.JButton();
200 jLabel4 =
new javax.swing.JLabel();
201 fileTypeRadioButton =
new javax.swing.JRadioButton();
202 centralRepoRadioButton =
new javax.swing.JRadioButton();
203 lbOrg =
new javax.swing.JLabel();
204 orgComboBox =
new javax.swing.JComboBox<>();
205 orgButton =
new javax.swing.JButton();
206 noChangeRadioButton =
new javax.swing.JRadioButton();
208 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
210 org.openide.awt.Mnemonics.setLocalizedText(saveAsButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.saveAsButton.text"));
211 saveAsButton.addActionListener(
new java.awt.event.ActionListener() {
212 public void actionPerformed(java.awt.event.ActionEvent evt) {
213 saveAsButtonActionPerformed(evt);
217 org.openide.awt.Mnemonics.setLocalizedText(cancelButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.cancelButton.text"));
218 cancelButton.addActionListener(
new java.awt.event.ActionListener() {
219 public void actionPerformed(java.awt.event.ActionEvent evt) {
220 cancelButtonActionPerformed(evt);
224 buttonGroup1.add(knownRadioButton);
225 org.openide.awt.Mnemonics.setLocalizedText(knownRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.knownRadioButton.text"));
226 knownRadioButton.addActionListener(
new java.awt.event.ActionListener() {
227 public void actionPerformed(java.awt.event.ActionEvent evt) {
228 knownRadioButtonActionPerformed(evt);
232 buttonGroup1.add(knownBadRadioButton);
233 knownBadRadioButton.setSelected(
true);
234 org.openide.awt.Mnemonics.setLocalizedText(knownBadRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.knownBadRadioButton.text"));
235 knownBadRadioButton.addActionListener(
new java.awt.event.ActionListener() {
236 public void actionPerformed(java.awt.event.ActionEvent evt) {
237 knownBadRadioButtonActionPerformed(evt);
241 org.openide.awt.Mnemonics.setLocalizedText(databasePathLabel,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.databasePathLabel.text"));
243 hashSetNameTextField.setText(
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.hashSetNameTextField.text"));
245 org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel2.text"));
247 sendIngestMessagesCheckbox.setSelected(
true);
248 org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckbox,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.sendIngestMessagesCheckbox.text"));
249 sendIngestMessagesCheckbox.addActionListener(
new java.awt.event.ActionListener() {
250 public void actionPerformed(java.awt.event.ActionEvent evt) {
251 sendIngestMessagesCheckboxActionPerformed(evt);
255 org.openide.awt.Mnemonics.setLocalizedText(jLabel3,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel3.text"));
257 databasePathTextField.setEditable(
false);
258 databasePathTextField.setText(
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.databasePathTextField.text"));
260 org.openide.awt.Mnemonics.setLocalizedText(okButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.okButton.text"));
261 okButton.addActionListener(
new java.awt.event.ActionListener() {
262 public void actionPerformed(java.awt.event.ActionEvent evt) {
263 okButtonActionPerformed(evt);
267 org.openide.awt.Mnemonics.setLocalizedText(jLabel4,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel4.text"));
269 storageTypeButtonGroup.add(fileTypeRadioButton);
270 fileTypeRadioButton.setSelected(
true);
271 org.openide.awt.Mnemonics.setLocalizedText(fileTypeRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.fileTypeRadioButton.text"));
272 fileTypeRadioButton.addActionListener(
new java.awt.event.ActionListener() {
273 public void actionPerformed(java.awt.event.ActionEvent evt) {
274 fileTypeRadioButtonActionPerformed(evt);
278 storageTypeButtonGroup.add(centralRepoRadioButton);
279 org.openide.awt.Mnemonics.setLocalizedText(centralRepoRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.centralRepoRadioButton.text"));
280 centralRepoRadioButton.addActionListener(
new java.awt.event.ActionListener() {
281 public void actionPerformed(java.awt.event.ActionEvent evt) {
282 centralRepoRadioButtonActionPerformed(evt);
286 org.openide.awt.Mnemonics.setLocalizedText(lbOrg,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.lbOrg.text"));
288 orgComboBox.addActionListener(
new java.awt.event.ActionListener() {
289 public void actionPerformed(java.awt.event.ActionEvent evt) {
290 orgComboBoxActionPerformed(evt);
294 org.openide.awt.Mnemonics.setLocalizedText(orgButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.orgButton.text"));
295 orgButton.addActionListener(
new java.awt.event.ActionListener() {
296 public void actionPerformed(java.awt.event.ActionEvent evt) {
297 orgButtonActionPerformed(evt);
301 buttonGroup1.add(noChangeRadioButton);
302 org.openide.awt.Mnemonics.setLocalizedText(noChangeRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.noChangeRadioButton.text"));
303 noChangeRadioButton.addActionListener(
new java.awt.event.ActionListener() {
304 public void actionPerformed(java.awt.event.ActionEvent evt) {
305 noChangeRadioButtonActionPerformed(evt);
309 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
310 getContentPane().setLayout(layout);
311 layout.setHorizontalGroup(
312 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
313 .addGroup(layout.createSequentialGroup()
315 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
316 .addGroup(layout.createSequentialGroup()
317 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
318 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
320 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
321 .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
322 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
323 .addComponent(orgButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
324 .addGroup(layout.createSequentialGroup()
325 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
326 .addComponent(jLabel3)
327 .addComponent(jLabel4)
328 .addComponent(databasePathLabel))
329 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
330 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
331 .addGroup(layout.createSequentialGroup()
332 .addComponent(fileTypeRadioButton)
334 .addComponent(centralRepoRadioButton))
335 .addComponent(hashSetNameTextField)
336 .addComponent(databasePathTextField))))
337 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
338 .addComponent(saveAsButton))
339 .addGroup(layout.createSequentialGroup()
340 .addGap(0, 0, Short.MAX_VALUE)
341 .addComponent(okButton)
342 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
343 .addComponent(cancelButton)))
345 .addGroup(layout.createSequentialGroup()
346 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
347 .addGroup(layout.createSequentialGroup()
349 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
350 .addComponent(knownRadioButton)
351 .addComponent(knownBadRadioButton)
352 .addComponent(noChangeRadioButton)))
353 .addGroup(layout.createSequentialGroup()
355 .addComponent(jLabel2))
356 .addGroup(layout.createSequentialGroup()
358 .addComponent(sendIngestMessagesCheckbox)))
359 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
362 layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {cancelButton, okButton});
364 layout.setVerticalGroup(
365 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
366 .addGroup(layout.createSequentialGroup()
368 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
369 .addComponent(jLabel4)
370 .addComponent(fileTypeRadioButton)
371 .addComponent(centralRepoRadioButton))
372 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
373 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
374 .addComponent(jLabel3)
375 .addComponent(hashSetNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
376 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
377 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
378 .addComponent(databasePathLabel)
379 .addComponent(databasePathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
380 .addComponent(saveAsButton))
381 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
382 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
384 .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
385 .addComponent(orgButton))
386 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
387 .addComponent(jLabel2)
388 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
389 .addComponent(knownRadioButton)
390 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
391 .addComponent(knownBadRadioButton)
392 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
393 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
394 .addGroup(layout.createSequentialGroup()
395 .addGap(0, 0, Short.MAX_VALUE)
396 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
397 .addComponent(cancelButton)
398 .addComponent(okButton)))
399 .addGroup(layout.createSequentialGroup()
400 .addComponent(noChangeRadioButton)
402 .addComponent(sendIngestMessagesCheckbox)
403 .addGap(0, 0, Short.MAX_VALUE)))
410 private void knownRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
411 sendIngestMessagesCheckbox.setSelected(KnownFilesType.KNOWN.isDefaultInboxMessages());
412 sendIngestMessagesCheckbox.setEnabled(KnownFilesType.KNOWN.isInboxMessagesAllowed());
415 private void knownBadRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
416 sendIngestMessagesCheckbox.setSelected(KnownFilesType.KNOWN_BAD.isDefaultInboxMessages());
417 sendIngestMessagesCheckbox.setEnabled(KnownFilesType.KNOWN_BAD.isInboxMessagesAllowed());
420 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
424 private void saveAsButtonActionPerformed(java.awt.event.ActionEvent evt) {
426 String lastBaseDirectory = Paths.get(PlatformUtil.getUserConfigDirectory(), HASH_DATABASE_DIR_NAME).toString();
427 if (ModuleSettings.settingExists(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY)) {
428 lastBaseDirectory = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY);
430 StringBuilder path =
new StringBuilder();
431 path.append(lastBaseDirectory);
432 File hashDbFolder =
new File(path.toString());
434 if (!hashDbFolder.exists()) {
435 hashDbFolder.mkdir();
437 if (!hashSetNameTextField.getText().isEmpty()) {
438 path.append(File.separator).append(hashSetNameTextField.getText());
440 path.append(File.separator).append(DEFAULT_FILE_NAME);
442 path.append(
".").append(HashDbManager.getHashDatabaseFileExtension());
444 if(fileChooser == null) {
445 fileChooser = chooserFactory.getChooser();
447 fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
448 fileChooser.setDragEnabled(
false);
449 fileChooser.setMultiSelectionEnabled(
false);
453 fileChooser.setSelectedFile(
new File(path.toString()));
454 if (fileChooser.showSaveDialog(
this) == JFileChooser.APPROVE_OPTION) {
455 File databaseFile = fileChooser.getSelectedFile();
456 databasePathTextField.setText(databaseFile.getCanonicalPath());
457 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY, databaseFile.getParent());
459 }
catch (IOException ex) {
460 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING,
"Couldn't get selected file path.", ex);
464 @NbBundle.Messages({
"HashDbCreateDatabaseDialog.missingOrg=An organization must be selected",
465 "HashDbCreateDatabaseDialog.duplicateName=A hashset with this name already exists",
466 "HashDbCreateDatabaseDialog.databaseLookupError=Error accessing central repository",
467 "HashDbCreateDatabaseDialog.databaseCreationError=Error creating new hash set"
469 private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {
473 if (hashSetNameTextField.getText().isEmpty()) {
474 JOptionPane.showMessageDialog(
this,
475 NbBundle.getMessage(
this.getClass(),
476 "HashDbCreateDatabaseDialog.mustEnterHashSetNameMsg"),
477 NbBundle.getMessage(
this.getClass(),
478 "HashDbCreateDatabaseDialog.createHashDbErr"),
479 JOptionPane.ERROR_MESSAGE);
483 if (fileTypeRadioButton.isSelected()) {
484 if (databasePathTextField.getText().isEmpty()) {
485 JOptionPane.showMessageDialog(
this,
486 NbBundle.getMessage(
this.getClass(),
487 "HashDbCreateDatabaseDialog.mustEnterHashDbPathMsg"),
488 NbBundle.getMessage(
this.getClass(),
489 "HashDbCreateDatabaseDialog.createHashDbErr"),
490 JOptionPane.ERROR_MESSAGE);
494 if (selectedOrg == null) {
495 JOptionPane.showMessageDialog(
this,
496 NbBundle.getMessage(
this.getClass(),
497 "HashDbCreateDatabaseDialog.missingOrg"),
498 NbBundle.getMessage(
this.getClass(),
499 "HashDbCreateDatabaseDialog.createHashDbErr"),
500 JOptionPane.ERROR_MESSAGE);
507 if (knownRadioButton.isSelected()) {
508 type = KnownFilesType.KNOWN;
509 }
else if (noChangeRadioButton.isSelected()) {
510 type = KnownFilesType.NO_CHANGE;
512 type = KnownFilesType.KNOWN_BAD;
515 TskData.FileKnown fileKnown = type.getFileKnown();
517 String errorMessage = NbBundle
518 .getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.errMsg.hashDbCreationErr");
520 if (fileTypeRadioButton.isSelected()) {
522 newHashDb = HashDbManager.getInstance().addNewHashDatabaseNoSave(hashSetNameTextField.getText(), fileChooser.getSelectedFile().getCanonicalPath(),
true, sendIngestMessagesCheckbox.isSelected(), type);
523 }
catch (IOException ex) {
524 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
525 JOptionPane.showMessageDialog(
this,
526 NbBundle.getMessage(
this.getClass(),
527 "HashDbCreateDatabaseDialog.cannotCreateFileAtLocMsg"),
528 NbBundle.getMessage(
this.getClass(),
529 "HashDbCreateDatabaseDialog.createHashDbErr"),
530 JOptionPane.ERROR_MESSAGE);
532 }
catch (HashDbManagerException ex) {
533 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
534 JOptionPane.showMessageDialog(
this,
536 NbBundle.getMessage(this.getClass(),
537 "HashDbCreateDatabaseDialog.createHashDbErr"),
538 JOptionPane.ERROR_MESSAGE);
544 if (CentralRepository.getInstance().referenceSetExists(hashSetNameTextField.getText(),
"")) {
545 JOptionPane.showMessageDialog(
this,
546 NbBundle.getMessage(
this.getClass(),
547 "HashDbCreateDatabaseDialog.duplicateName"),
548 NbBundle.getMessage(
this.getClass(),
549 "HashDbCreateDatabaseDialog.createHashDbErr"),
550 JOptionPane.ERROR_MESSAGE);
553 }
catch (CentralRepoException ex) {
554 Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE,
"Error looking up reference set", ex);
555 JOptionPane.showMessageDialog(
this,
556 NbBundle.getMessage(
this.getClass(),
557 "HashDbCreateDatabaseDialog.databaseLookupError"),
558 NbBundle.getMessage(
this.getClass(),
559 "HashDbCreateDatabaseDialog.createHashDbErr"),
560 JOptionPane.ERROR_MESSAGE);
565 int referenceSetID = CentralRepository.getInstance().newReferenceSet(
new CentralRepoFileSet(selectedOrg.getOrgID(), hashSetNameTextField.getText(),
566 "", fileKnown,
false, CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID)));
567 newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetNameTextField.getText(),
569 true, sendIngestMessagesCheckbox.isSelected(), type,
false);
570 }
catch (CentralRepoException | TskCoreException ex) {
571 Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE,
"Error creating new reference set", ex);
572 JOptionPane.showMessageDialog(
this,
573 NbBundle.getMessage(
this.getClass(),
574 "HashDbCreateDatabaseDialog.databaseCreationError"),
575 NbBundle.getMessage(
this.getClass(),
576 "HashDbCreateDatabaseDialog.createHashDbErr"),
577 JOptionPane.ERROR_MESSAGE);
585 private void sendIngestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {
589 private void orgButtonActionPerformed(java.awt.event.ActionEvent evt) {
590 ManageOrganizationsDialog dialog =
new ManageOrganizationsDialog();
592 if (dialog.isChanged()) {
597 private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
598 if (null == orgComboBox.getSelectedItem()) {
601 String orgName = this.orgComboBox.getSelectedItem().toString();
602 for (CentralRepoOrganization
org : orgs) {
603 if (
org.getName().equals(orgName)) {
610 private void fileTypeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
614 private void centralRepoRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
618 private void noChangeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
619 sendIngestMessagesCheckbox.setSelected(KnownFilesType.NO_CHANGE.isDefaultInboxMessages());
620 sendIngestMessagesCheckbox.setEnabled(KnownFilesType.NO_CHANGE.isInboxMessagesAllowed());
624 private javax.swing.ButtonGroup buttonGroup1;
625 private javax.swing.JButton cancelButton;
626 private javax.swing.JRadioButton centralRepoRadioButton;
627 private javax.swing.JLabel databasePathLabel;
628 private javax.swing.JTextField databasePathTextField;
629 private javax.swing.JRadioButton fileTypeRadioButton;
630 private javax.swing.JTextField hashSetNameTextField;
631 private javax.swing.JLabel jLabel2;
632 private javax.swing.JLabel jLabel3;
633 private javax.swing.JLabel jLabel4;
634 private javax.swing.JRadioButton knownBadRadioButton;
635 private javax.swing.JRadioButton knownRadioButton;
636 private javax.swing.JLabel lbOrg;
637 private javax.swing.JRadioButton noChangeRadioButton;
638 private javax.swing.JButton okButton;
639 private javax.swing.JButton orgButton;
640 private javax.swing.JComboBox<String> orgComboBox;
641 private javax.swing.JButton saveAsButton;
642 private javax.swing.JCheckBox sendIngestMessagesCheckbox;
643 private javax.swing.ButtonGroup storageTypeButtonGroup;