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;
54 @SuppressWarnings(
"PMD.SingularField")
55 final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
57 private static final String DEFAULT_FILE_NAME = NbBundle
58 .getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.defaultFileName");
59 private JFileChooser fileChooser = null;
60 private HashDb newHashDb = null;
61 private final static String LAST_FILE_PATH_KEY =
"HashDbCreate_Path";
62 private CentralRepoOrganization selectedOrg = null;
63 private List<CentralRepoOrganization> orgs = null;
64 static final String HASH_DATABASE_DIR_NAME =
"HashDatabases";
71 HashDbCreateDatabaseDialog() {
72 super((JFrame) WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.createHashDbMsg"),
true);
84 HashDb getHashDatabase() {
88 private void initFileChooser() {
89 fileChooser =
new JFileChooser() {
91 public void approveSelection() {
92 File selectedFile = getSelectedFile();
93 if (!FilenameUtils.getExtension(selectedFile.getName()).equalsIgnoreCase(HashDbManager.getHashDatabaseFileExtension())) {
94 if (JOptionPane.showConfirmDialog(
this,
95 NbBundle.getMessage(
this.getClass(),
96 "HashDbCreateDatabaseDialog.hashDbMustHaveFileExtensionMsg",
97 HashDbManager.getHashDatabaseFileExtension()),
98 NbBundle.getMessage(
this.getClass(),
99 "HashDbCreateDatabaseDialog.fileNameErr"),
100 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
105 if (selectedFile.exists()) {
106 if (JOptionPane.showConfirmDialog(
this,
107 NbBundle.getMessage(
this.getClass(),
108 "HashDbCreateDatabaseDialog.fileNameAlreadyExistsMsg"),
109 NbBundle.getMessage(
this.getClass(),
110 "HashDbCreateDatabaseDialog.fileExistsErr"),
111 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
116 super.approveSelection();
119 fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
120 fileChooser.setDragEnabled(
false);
121 fileChooser.setMultiSelectionEnabled(
false);
124 private void display() {
125 setLocationRelativeTo(getOwner());
129 private void enableComponents() {
131 if (!CentralRepository.isEnabled() || !FeatureAccessUtils.canAddHashSetsToCentralRepo()) {
132 centralRepoRadioButton.setEnabled(
false);
133 fileTypeRadioButton.setSelected(
true);
138 boolean isFileType = fileTypeRadioButton.isSelected();
141 databasePathLabel.setEnabled(isFileType);
142 databasePathTextField.setEnabled(isFileType);
143 saveAsButton.setEnabled(isFileType);
146 lbOrg.setEnabled(!isFileType);
147 orgButton.setEnabled(!isFileType);
148 orgComboBox.setEnabled(!isFileType);
151 @NbBundle.Messages({
"HashDbCreateDatabaseDialog.populateOrgsError.message=Failure loading organizations."})
152 private void populateCombobox() {
153 orgComboBox.removeAllItems();
155 CentralRepository dbManager = CentralRepository.getInstance();
156 orgs = dbManager.getOrganizations();
157 orgs.forEach((
org) -> {
158 orgComboBox.addItem(
org.getName());
159 if (CentralRepoDbUtil.isDefaultOrg(
org)) {
160 orgComboBox.setSelectedItem(
org.getName());
164 if ((selectedOrg == null) && (!orgs.isEmpty())) {
165 selectedOrg = orgs.get(0);
167 }
catch (CentralRepoException ex) {
168 JOptionPane.showMessageDialog(
this, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message());
169 Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE,
"Failure loading organizations", ex);
178 @SuppressWarnings(
"unchecked")
180 private
void initComponents() {
182 buttonGroup1 =
new javax.swing.ButtonGroup();
183 storageTypeButtonGroup =
new javax.swing.ButtonGroup();
184 saveAsButton =
new javax.swing.JButton();
185 cancelButton =
new javax.swing.JButton();
186 knownRadioButton =
new javax.swing.JRadioButton();
187 knownBadRadioButton =
new javax.swing.JRadioButton();
188 databasePathLabel =
new javax.swing.JLabel();
189 hashSetNameTextField =
new javax.swing.JTextField();
190 jLabel2 =
new javax.swing.JLabel();
191 sendIngestMessagesCheckbox =
new javax.swing.JCheckBox();
192 jLabel3 =
new javax.swing.JLabel();
193 databasePathTextField =
new javax.swing.JTextField();
194 okButton =
new javax.swing.JButton();
195 jLabel4 =
new javax.swing.JLabel();
196 fileTypeRadioButton =
new javax.swing.JRadioButton();
197 centralRepoRadioButton =
new javax.swing.JRadioButton();
198 lbOrg =
new javax.swing.JLabel();
199 orgComboBox =
new javax.swing.JComboBox<>();
200 orgButton =
new javax.swing.JButton();
202 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
204 org.openide.awt.Mnemonics.setLocalizedText(saveAsButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.saveAsButton.text"));
205 saveAsButton.addActionListener(
new java.awt.event.ActionListener() {
206 public void actionPerformed(java.awt.event.ActionEvent evt) {
207 saveAsButtonActionPerformed(evt);
211 org.openide.awt.Mnemonics.setLocalizedText(cancelButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.cancelButton.text"));
212 cancelButton.addActionListener(
new java.awt.event.ActionListener() {
213 public void actionPerformed(java.awt.event.ActionEvent evt) {
214 cancelButtonActionPerformed(evt);
218 buttonGroup1.add(knownRadioButton);
219 org.openide.awt.Mnemonics.setLocalizedText(knownRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.knownRadioButton.text"));
220 knownRadioButton.addActionListener(
new java.awt.event.ActionListener() {
221 public void actionPerformed(java.awt.event.ActionEvent evt) {
222 knownRadioButtonActionPerformed(evt);
226 buttonGroup1.add(knownBadRadioButton);
227 knownBadRadioButton.setSelected(
true);
228 org.openide.awt.Mnemonics.setLocalizedText(knownBadRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.knownBadRadioButton.text"));
229 knownBadRadioButton.addActionListener(
new java.awt.event.ActionListener() {
230 public void actionPerformed(java.awt.event.ActionEvent evt) {
231 knownBadRadioButtonActionPerformed(evt);
235 org.openide.awt.Mnemonics.setLocalizedText(databasePathLabel,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.databasePathLabel.text"));
237 hashSetNameTextField.setText(
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.hashSetNameTextField.text"));
239 org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel2.text"));
241 sendIngestMessagesCheckbox.setSelected(
true);
242 org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckbox,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.sendIngestMessagesCheckbox.text"));
243 sendIngestMessagesCheckbox.addActionListener(
new java.awt.event.ActionListener() {
244 public void actionPerformed(java.awt.event.ActionEvent evt) {
245 sendIngestMessagesCheckboxActionPerformed(evt);
249 org.openide.awt.Mnemonics.setLocalizedText(jLabel3,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel3.text"));
251 databasePathTextField.setEditable(
false);
252 databasePathTextField.setText(
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.databasePathTextField.text"));
254 org.openide.awt.Mnemonics.setLocalizedText(okButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.okButton.text"));
255 okButton.addActionListener(
new java.awt.event.ActionListener() {
256 public void actionPerformed(java.awt.event.ActionEvent evt) {
257 okButtonActionPerformed(evt);
261 org.openide.awt.Mnemonics.setLocalizedText(jLabel4,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel4.text"));
263 storageTypeButtonGroup.add(fileTypeRadioButton);
264 fileTypeRadioButton.setSelected(
true);
265 org.openide.awt.Mnemonics.setLocalizedText(fileTypeRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.fileTypeRadioButton.text"));
266 fileTypeRadioButton.addActionListener(
new java.awt.event.ActionListener() {
267 public void actionPerformed(java.awt.event.ActionEvent evt) {
268 fileTypeRadioButtonActionPerformed(evt);
272 storageTypeButtonGroup.add(centralRepoRadioButton);
273 org.openide.awt.Mnemonics.setLocalizedText(centralRepoRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.centralRepoRadioButton.text"));
274 centralRepoRadioButton.addActionListener(
new java.awt.event.ActionListener() {
275 public void actionPerformed(java.awt.event.ActionEvent evt) {
276 centralRepoRadioButtonActionPerformed(evt);
280 org.openide.awt.Mnemonics.setLocalizedText(lbOrg,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.lbOrg.text"));
282 orgComboBox.addActionListener(
new java.awt.event.ActionListener() {
283 public void actionPerformed(java.awt.event.ActionEvent evt) {
284 orgComboBoxActionPerformed(evt);
288 org.openide.awt.Mnemonics.setLocalizedText(orgButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.orgButton.text"));
289 orgButton.addActionListener(
new java.awt.event.ActionListener() {
290 public void actionPerformed(java.awt.event.ActionEvent evt) {
291 orgButtonActionPerformed(evt);
295 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
296 getContentPane().setLayout(layout);
297 layout.setHorizontalGroup(
298 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
299 .addGroup(layout.createSequentialGroup()
301 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
302 .addGroup(layout.createSequentialGroup()
303 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
304 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
306 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
307 .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
308 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
309 .addComponent(orgButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
310 .addGroup(layout.createSequentialGroup()
311 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
312 .addComponent(jLabel3)
313 .addComponent(jLabel4)
314 .addComponent(databasePathLabel))
315 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
316 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
317 .addGroup(layout.createSequentialGroup()
318 .addComponent(fileTypeRadioButton)
320 .addComponent(centralRepoRadioButton))
321 .addComponent(hashSetNameTextField)
322 .addComponent(databasePathTextField))))
323 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
324 .addComponent(saveAsButton))
325 .addGroup(layout.createSequentialGroup()
326 .addGap(0, 0, Short.MAX_VALUE)
327 .addComponent(okButton)
328 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
329 .addComponent(cancelButton)))
331 .addGroup(layout.createSequentialGroup()
332 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
333 .addGroup(layout.createSequentialGroup()
335 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
336 .addComponent(knownRadioButton)
337 .addComponent(knownBadRadioButton)))
338 .addGroup(layout.createSequentialGroup()
340 .addComponent(jLabel2))
341 .addGroup(layout.createSequentialGroup()
343 .addComponent(sendIngestMessagesCheckbox)))
344 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
347 layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {cancelButton, okButton});
349 layout.setVerticalGroup(
350 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
351 .addGroup(layout.createSequentialGroup()
353 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
354 .addComponent(jLabel4)
355 .addComponent(fileTypeRadioButton)
356 .addComponent(centralRepoRadioButton))
357 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
358 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
359 .addComponent(jLabel3)
360 .addComponent(hashSetNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
361 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
362 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
363 .addComponent(databasePathLabel)
364 .addComponent(databasePathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
365 .addComponent(saveAsButton))
366 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
367 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
369 .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
370 .addComponent(orgButton))
371 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
372 .addComponent(jLabel2)
373 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
374 .addComponent(knownRadioButton)
375 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
376 .addComponent(knownBadRadioButton)
377 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
378 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
379 .addGroup(layout.createSequentialGroup()
380 .addComponent(sendIngestMessagesCheckbox)
381 .addGap(0, 0, Short.MAX_VALUE))
382 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
383 .addGap(0, 0, Short.MAX_VALUE)
384 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
385 .addComponent(cancelButton)
386 .addComponent(okButton))))
393 private void knownRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
394 sendIngestMessagesCheckbox.setSelected(
false);
395 sendIngestMessagesCheckbox.setEnabled(
false);
398 private void knownBadRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
399 sendIngestMessagesCheckbox.setSelected(
true);
400 sendIngestMessagesCheckbox.setEnabled(
true);
403 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
407 private void saveAsButtonActionPerformed(java.awt.event.ActionEvent evt) {
409 String lastBaseDirectory = Paths.get(PlatformUtil.getUserConfigDirectory(), HASH_DATABASE_DIR_NAME).toString();
410 if (ModuleSettings.settingExists(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY)) {
411 lastBaseDirectory = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY);
413 StringBuilder path =
new StringBuilder();
414 path.append(lastBaseDirectory);
415 File hashDbFolder =
new File(path.toString());
417 if (!hashDbFolder.exists()) {
418 hashDbFolder.mkdir();
420 if (!hashSetNameTextField.getText().isEmpty()) {
421 path.append(File.separator).append(hashSetNameTextField.getText());
423 path.append(File.separator).append(DEFAULT_FILE_NAME);
425 path.append(
".").append(HashDbManager.getHashDatabaseFileExtension());
426 fileChooser.setSelectedFile(
new File(path.toString()));
427 if (fileChooser.showSaveDialog(
this) == JFileChooser.APPROVE_OPTION) {
428 File databaseFile = fileChooser.getSelectedFile();
429 databasePathTextField.setText(databaseFile.getCanonicalPath());
430 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY, databaseFile.getParent());
432 }
catch (IOException ex) {
433 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING,
"Couldn't get selected file path.", ex);
437 @NbBundle.Messages({
"HashDbCreateDatabaseDialog.missingOrg=An organization must be selected",
438 "HashDbCreateDatabaseDialog.duplicateName=A hashset with this name already exists",
439 "HashDbCreateDatabaseDialog.databaseLookupError=Error accessing central repository",
440 "HashDbCreateDatabaseDialog.databaseCreationError=Error creating new hash set"
442 private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {
446 if (hashSetNameTextField.getText().isEmpty()) {
447 JOptionPane.showMessageDialog(
this,
448 NbBundle.getMessage(
this.getClass(),
449 "HashDbCreateDatabaseDialog.mustEnterHashSetNameMsg"),
450 NbBundle.getMessage(
this.getClass(),
451 "HashDbCreateDatabaseDialog.createHashDbErr"),
452 JOptionPane.ERROR_MESSAGE);
456 if (fileTypeRadioButton.isSelected()) {
457 if (databasePathTextField.getText().isEmpty()) {
458 JOptionPane.showMessageDialog(
this,
459 NbBundle.getMessage(
this.getClass(),
460 "HashDbCreateDatabaseDialog.mustEnterHashDbPathMsg"),
461 NbBundle.getMessage(
this.getClass(),
462 "HashDbCreateDatabaseDialog.createHashDbErr"),
463 JOptionPane.ERROR_MESSAGE);
467 if (selectedOrg == null) {
468 JOptionPane.showMessageDialog(
this,
469 NbBundle.getMessage(
this.getClass(),
470 "HashDbCreateDatabaseDialog.missingOrg"),
471 NbBundle.getMessage(
this.getClass(),
472 "HashDbCreateDatabaseDialog.createHashDbErr"),
473 JOptionPane.ERROR_MESSAGE);
479 TskData.FileKnown fileKnown;
480 if (knownRadioButton.isSelected()) {
481 type = KnownFilesType.KNOWN;
482 fileKnown = TskData.FileKnown.KNOWN;
484 type = KnownFilesType.KNOWN_BAD;
485 fileKnown = TskData.FileKnown.BAD;
488 String errorMessage = NbBundle
489 .getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.errMsg.hashDbCreationErr");
491 if (fileTypeRadioButton.isSelected()) {
493 newHashDb = HashDbManager.getInstance().addNewHashDatabaseNoSave(hashSetNameTextField.getText(), fileChooser.getSelectedFile().getCanonicalPath(),
true, sendIngestMessagesCheckbox.isSelected(), type);
494 }
catch (IOException ex) {
495 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
496 JOptionPane.showMessageDialog(
this,
497 NbBundle.getMessage(
this.getClass(),
498 "HashDbCreateDatabaseDialog.cannotCreateFileAtLocMsg"),
499 NbBundle.getMessage(
this.getClass(),
500 "HashDbCreateDatabaseDialog.createHashDbErr"),
501 JOptionPane.ERROR_MESSAGE);
503 }
catch (HashDbManagerException ex) {
504 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
505 JOptionPane.showMessageDialog(
this,
507 NbBundle.getMessage(this.getClass(),
508 "HashDbCreateDatabaseDialog.createHashDbErr"),
509 JOptionPane.ERROR_MESSAGE);
515 if (CentralRepository.getInstance().referenceSetExists(hashSetNameTextField.getText(),
"")) {
516 JOptionPane.showMessageDialog(
this,
517 NbBundle.getMessage(
this.getClass(),
518 "HashDbCreateDatabaseDialog.duplicateName"),
519 NbBundle.getMessage(
this.getClass(),
520 "HashDbCreateDatabaseDialog.createHashDbErr"),
521 JOptionPane.ERROR_MESSAGE);
524 }
catch (CentralRepoException ex) {
525 Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE,
"Error looking up reference set", ex);
526 JOptionPane.showMessageDialog(
this,
527 NbBundle.getMessage(
this.getClass(),
528 "HashDbCreateDatabaseDialog.databaseLookupError"),
529 NbBundle.getMessage(
this.getClass(),
530 "HashDbCreateDatabaseDialog.createHashDbErr"),
531 JOptionPane.ERROR_MESSAGE);
536 int referenceSetID = CentralRepository.getInstance().newReferenceSet(
new CentralRepoFileSet(selectedOrg.getOrgID(), hashSetNameTextField.getText(),
537 "", fileKnown,
false, CentralRepository.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID)));
538 newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetNameTextField.getText(),
540 true, sendIngestMessagesCheckbox.isSelected(), type,
false);
541 }
catch (CentralRepoException | TskCoreException ex) {
542 Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE,
"Error creating new reference set", ex);
543 JOptionPane.showMessageDialog(
this,
544 NbBundle.getMessage(
this.getClass(),
545 "HashDbCreateDatabaseDialog.databaseCreationError"),
546 NbBundle.getMessage(
this.getClass(),
547 "HashDbCreateDatabaseDialog.createHashDbErr"),
548 JOptionPane.ERROR_MESSAGE);
556 private void sendIngestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {
560 private void orgButtonActionPerformed(java.awt.event.ActionEvent evt) {
561 ManageOrganizationsDialog dialog =
new ManageOrganizationsDialog();
563 if (dialog.isChanged()) {
568 private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
569 if (null == orgComboBox.getSelectedItem()) {
572 String orgName = this.orgComboBox.getSelectedItem().toString();
573 for (CentralRepoOrganization
org : orgs) {
574 if (
org.getName().equals(orgName)) {
581 private void fileTypeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
585 private void centralRepoRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
590 private javax.swing.ButtonGroup buttonGroup1;
591 private javax.swing.JButton cancelButton;
592 private javax.swing.JRadioButton centralRepoRadioButton;
593 private javax.swing.JLabel databasePathLabel;
594 private javax.swing.JTextField databasePathTextField;
595 private javax.swing.JRadioButton fileTypeRadioButton;
596 private javax.swing.JTextField hashSetNameTextField;
597 private javax.swing.JLabel jLabel2;
598 private javax.swing.JLabel jLabel3;
599 private javax.swing.JLabel jLabel4;
600 private javax.swing.JRadioButton knownBadRadioButton;
601 private javax.swing.JRadioButton knownRadioButton;
602 private javax.swing.JLabel lbOrg;
603 private javax.swing.JButton okButton;
604 private javax.swing.JButton orgButton;
605 private javax.swing.JComboBox<String> orgComboBox;
606 private javax.swing.JButton saveAsButton;
607 private javax.swing.JCheckBox sendIngestMessagesCheckbox;
608 private javax.swing.ButtonGroup storageTypeButtonGroup;