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;
53 @SuppressWarnings(
"PMD.SingularField")
54 final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
56 private static final String DEFAULT_FILE_NAME = NbBundle
57 .getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.defaultFileName");
58 private JFileChooser fileChooser = null;
59 private HashDb newHashDb = null;
60 private final static String LAST_FILE_PATH_KEY =
"HashDbCreate_Path";
61 private EamOrganization selectedOrg = null;
62 private List<EamOrganization> orgs = null;
63 static final String HASH_DATABASE_DIR_NAME =
"HashDatabases";
70 HashDbCreateDatabaseDialog() {
71 super((JFrame) WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.createHashDbMsg"),
true);
83 HashDb getHashDatabase() {
87 private void initFileChooser() {
88 fileChooser =
new JFileChooser() {
90 public void approveSelection() {
91 File selectedFile = getSelectedFile();
92 if (!FilenameUtils.getExtension(selectedFile.getName()).equalsIgnoreCase(HashDbManager.getHashDatabaseFileExtension())) {
93 if (JOptionPane.showConfirmDialog(
this,
94 NbBundle.getMessage(
this.getClass(),
95 "HashDbCreateDatabaseDialog.hashDbMustHaveFileExtensionMsg",
96 HashDbManager.getHashDatabaseFileExtension()),
97 NbBundle.getMessage(
this.getClass(),
98 "HashDbCreateDatabaseDialog.fileNameErr"),
99 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
104 if (selectedFile.exists()) {
105 if (JOptionPane.showConfirmDialog(
this,
106 NbBundle.getMessage(
this.getClass(),
107 "HashDbCreateDatabaseDialog.fileNameAlreadyExistsMsg"),
108 NbBundle.getMessage(
this.getClass(),
109 "HashDbCreateDatabaseDialog.fileExistsErr"),
110 JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) {
115 super.approveSelection();
118 fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
119 fileChooser.setDragEnabled(
false);
120 fileChooser.setMultiSelectionEnabled(
false);
123 private void display() {
124 setLocationRelativeTo(getOwner());
128 private void enableComponents(){
130 if(! EamDb.isEnabled()){
131 centralRepoRadioButton.setEnabled(
false);
132 fileTypeRadioButton.setSelected(
true);
137 boolean isFileType = fileTypeRadioButton.isSelected();
140 databasePathLabel.setEnabled(isFileType);
141 databasePathTextField.setEnabled(isFileType);
142 saveAsButton.setEnabled(isFileType);
145 lbOrg.setEnabled(! isFileType);
146 orgButton.setEnabled(! isFileType);
147 orgComboBox.setEnabled(! isFileType);
150 @NbBundle.Messages({
"HashDbCreateDatabaseDialog.populateOrgsError.message=Failure loading organizations."})
151 private void populateCombobox() {
152 orgComboBox.removeAllItems();
154 EamDb dbManager = EamDb.getInstance();
155 orgs = dbManager.getOrganizations();
156 orgs.forEach((
org) -> {
157 orgComboBox.addItem(
org.getName());
158 if(EamDbUtil.isDefaultOrg(
org)){
159 orgComboBox.setSelectedItem(
org.getName());
163 if ((selectedOrg == null) && (!orgs.isEmpty())) {
164 selectedOrg = orgs.get(0);
166 }
catch (EamDbException ex) {
167 JOptionPane.showMessageDialog(
this, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message());
168 Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE,
"Failure loading organizations", ex);
177 @SuppressWarnings(
"unchecked")
179 private
void initComponents() {
181 buttonGroup1 =
new javax.swing.ButtonGroup();
182 storageTypeButtonGroup =
new javax.swing.ButtonGroup();
183 saveAsButton =
new javax.swing.JButton();
184 cancelButton =
new javax.swing.JButton();
185 knownRadioButton =
new javax.swing.JRadioButton();
186 knownBadRadioButton =
new javax.swing.JRadioButton();
187 databasePathLabel =
new javax.swing.JLabel();
188 hashSetNameTextField =
new javax.swing.JTextField();
189 jLabel2 =
new javax.swing.JLabel();
190 sendIngestMessagesCheckbox =
new javax.swing.JCheckBox();
191 jLabel3 =
new javax.swing.JLabel();
192 databasePathTextField =
new javax.swing.JTextField();
193 okButton =
new javax.swing.JButton();
194 jLabel4 =
new javax.swing.JLabel();
195 fileTypeRadioButton =
new javax.swing.JRadioButton();
196 centralRepoRadioButton =
new javax.swing.JRadioButton();
197 lbOrg =
new javax.swing.JLabel();
198 orgComboBox =
new javax.swing.JComboBox<>();
199 orgButton =
new javax.swing.JButton();
201 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
203 org.openide.awt.Mnemonics.setLocalizedText(saveAsButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.saveAsButton.text"));
204 saveAsButton.addActionListener(
new java.awt.event.ActionListener() {
205 public void actionPerformed(java.awt.event.ActionEvent evt) {
206 saveAsButtonActionPerformed(evt);
210 org.openide.awt.Mnemonics.setLocalizedText(cancelButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.cancelButton.text"));
211 cancelButton.addActionListener(
new java.awt.event.ActionListener() {
212 public void actionPerformed(java.awt.event.ActionEvent evt) {
213 cancelButtonActionPerformed(evt);
217 buttonGroup1.add(knownRadioButton);
218 org.openide.awt.Mnemonics.setLocalizedText(knownRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.knownRadioButton.text"));
219 knownRadioButton.addActionListener(
new java.awt.event.ActionListener() {
220 public void actionPerformed(java.awt.event.ActionEvent evt) {
221 knownRadioButtonActionPerformed(evt);
225 buttonGroup1.add(knownBadRadioButton);
226 knownBadRadioButton.setSelected(
true);
227 org.openide.awt.Mnemonics.setLocalizedText(knownBadRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.knownBadRadioButton.text"));
228 knownBadRadioButton.addActionListener(
new java.awt.event.ActionListener() {
229 public void actionPerformed(java.awt.event.ActionEvent evt) {
230 knownBadRadioButtonActionPerformed(evt);
234 org.openide.awt.Mnemonics.setLocalizedText(databasePathLabel,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.databasePathLabel.text"));
236 hashSetNameTextField.setText(
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.hashSetNameTextField.text"));
238 org.openide.awt.Mnemonics.setLocalizedText(jLabel2,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel2.text"));
240 sendIngestMessagesCheckbox.setSelected(
true);
241 org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckbox,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.sendIngestMessagesCheckbox.text"));
242 sendIngestMessagesCheckbox.addActionListener(
new java.awt.event.ActionListener() {
243 public void actionPerformed(java.awt.event.ActionEvent evt) {
244 sendIngestMessagesCheckboxActionPerformed(evt);
248 org.openide.awt.Mnemonics.setLocalizedText(jLabel3,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel3.text"));
250 databasePathTextField.setEditable(
false);
251 databasePathTextField.setText(
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.databasePathTextField.text"));
253 org.openide.awt.Mnemonics.setLocalizedText(okButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.okButton.text"));
254 okButton.addActionListener(
new java.awt.event.ActionListener() {
255 public void actionPerformed(java.awt.event.ActionEvent evt) {
256 okButtonActionPerformed(evt);
260 org.openide.awt.Mnemonics.setLocalizedText(jLabel4,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.jLabel4.text"));
262 storageTypeButtonGroup.add(fileTypeRadioButton);
263 fileTypeRadioButton.setSelected(
true);
264 org.openide.awt.Mnemonics.setLocalizedText(fileTypeRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.fileTypeRadioButton.text"));
265 fileTypeRadioButton.addActionListener(
new java.awt.event.ActionListener() {
266 public void actionPerformed(java.awt.event.ActionEvent evt) {
267 fileTypeRadioButtonActionPerformed(evt);
271 storageTypeButtonGroup.add(centralRepoRadioButton);
272 org.openide.awt.Mnemonics.setLocalizedText(centralRepoRadioButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.centralRepoRadioButton.text"));
273 centralRepoRadioButton.addActionListener(
new java.awt.event.ActionListener() {
274 public void actionPerformed(java.awt.event.ActionEvent evt) {
275 centralRepoRadioButtonActionPerformed(evt);
279 org.openide.awt.Mnemonics.setLocalizedText(lbOrg,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.lbOrg.text"));
281 orgComboBox.addActionListener(
new java.awt.event.ActionListener() {
282 public void actionPerformed(java.awt.event.ActionEvent evt) {
283 orgComboBoxActionPerformed(evt);
287 org.openide.awt.Mnemonics.setLocalizedText(orgButton,
org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class,
"HashDbCreateDatabaseDialog.orgButton.text"));
288 orgButton.addActionListener(
new java.awt.event.ActionListener() {
289 public void actionPerformed(java.awt.event.ActionEvent evt) {
290 orgButtonActionPerformed(evt);
294 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
295 getContentPane().setLayout(layout);
296 layout.setHorizontalGroup(
297 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
298 .addGroup(layout.createSequentialGroup()
300 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
301 .addGroup(layout.createSequentialGroup()
302 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
303 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
305 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
306 .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
307 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
308 .addComponent(orgButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
309 .addGroup(layout.createSequentialGroup()
310 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
311 .addComponent(jLabel3)
312 .addComponent(jLabel4)
313 .addComponent(databasePathLabel))
314 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
315 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
316 .addGroup(layout.createSequentialGroup()
317 .addComponent(fileTypeRadioButton)
319 .addComponent(centralRepoRadioButton))
320 .addComponent(hashSetNameTextField)
321 .addComponent(databasePathTextField))))
322 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
323 .addComponent(saveAsButton))
324 .addGroup(layout.createSequentialGroup()
325 .addGap(0, 0, Short.MAX_VALUE)
326 .addComponent(okButton)
327 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
328 .addComponent(cancelButton)))
330 .addGroup(layout.createSequentialGroup()
331 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
332 .addGroup(layout.createSequentialGroup()
334 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
335 .addComponent(knownRadioButton)
336 .addComponent(knownBadRadioButton)))
337 .addGroup(layout.createSequentialGroup()
339 .addComponent(jLabel2))
340 .addGroup(layout.createSequentialGroup()
342 .addComponent(sendIngestMessagesCheckbox)))
343 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
346 layout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {cancelButton, okButton});
348 layout.setVerticalGroup(
349 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
350 .addGroup(layout.createSequentialGroup()
352 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
353 .addComponent(jLabel4)
354 .addComponent(fileTypeRadioButton)
355 .addComponent(centralRepoRadioButton))
356 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
357 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
358 .addComponent(jLabel3)
359 .addComponent(hashSetNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
360 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
361 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
362 .addComponent(databasePathLabel)
363 .addComponent(databasePathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
364 .addComponent(saveAsButton))
365 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
366 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
368 .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
369 .addComponent(orgButton))
370 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
371 .addComponent(jLabel2)
372 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
373 .addComponent(knownRadioButton)
374 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
375 .addComponent(knownBadRadioButton)
376 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
377 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
378 .addGroup(layout.createSequentialGroup()
379 .addComponent(sendIngestMessagesCheckbox)
380 .addGap(0, 0, Short.MAX_VALUE))
381 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
382 .addGap(0, 0, Short.MAX_VALUE)
383 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
384 .addComponent(cancelButton)
385 .addComponent(okButton))))
392 private void knownRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
393 sendIngestMessagesCheckbox.setSelected(
false);
394 sendIngestMessagesCheckbox.setEnabled(
false);
397 private void knownBadRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
398 sendIngestMessagesCheckbox.setSelected(
true);
399 sendIngestMessagesCheckbox.setEnabled(
true);
402 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
406 private void saveAsButtonActionPerformed(java.awt.event.ActionEvent evt) {
408 String lastBaseDirectory = Paths.get(PlatformUtil.getUserConfigDirectory(), HASH_DATABASE_DIR_NAME).toString();
409 if (ModuleSettings.settingExists(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY)) {
410 lastBaseDirectory = ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY);
412 StringBuilder path =
new StringBuilder();
413 path.append(lastBaseDirectory);
414 File hashDbFolder =
new File(path.toString());
416 if (!hashDbFolder.exists()){
417 hashDbFolder.mkdir();
419 if (!hashSetNameTextField.getText().isEmpty()) {
420 path.append(File.separator).append(hashSetNameTextField.getText());
422 path.append(File.separator).append(DEFAULT_FILE_NAME);
424 path.append(
".").append(HashDbManager.getHashDatabaseFileExtension());
425 fileChooser.setSelectedFile(
new File(path.toString()));
426 if (fileChooser.showSaveDialog(
this) == JFileChooser.APPROVE_OPTION) {
427 File databaseFile = fileChooser.getSelectedFile();
428 databasePathTextField.setText(databaseFile.getCanonicalPath());
429 ModuleSettings.setConfigSetting(ModuleSettings.MAIN_SETTINGS, LAST_FILE_PATH_KEY, databaseFile.getParent());
431 }
catch (IOException ex) {
432 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING,
"Couldn't get selected file path.", ex);
436 @NbBundle.Messages({
"HashDbCreateDatabaseDialog.missingOrg=An organization must be selected",
437 "HashDbCreateDatabaseDialog.duplicateName=A hashset with this name already exists",
438 "HashDbCreateDatabaseDialog.databaseLookupError=Error accessing central repository",
439 "HashDbCreateDatabaseDialog.databaseCreationError=Error creating new hash set"
441 private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {
445 if (hashSetNameTextField.getText().isEmpty()) {
446 JOptionPane.showMessageDialog(
this,
447 NbBundle.getMessage(
this.getClass(),
448 "HashDbCreateDatabaseDialog.mustEnterHashSetNameMsg"),
449 NbBundle.getMessage(
this.getClass(),
450 "HashDbCreateDatabaseDialog.createHashDbErr"),
451 JOptionPane.ERROR_MESSAGE);
455 if(fileTypeRadioButton.isSelected()){
456 if (databasePathTextField.getText().isEmpty()) {
457 JOptionPane.showMessageDialog(
this,
458 NbBundle.getMessage(
this.getClass(),
459 "HashDbCreateDatabaseDialog.mustEnterHashDbPathMsg"),
460 NbBundle.getMessage(
this.getClass(),
461 "HashDbCreateDatabaseDialog.createHashDbErr"),
462 JOptionPane.ERROR_MESSAGE);
466 if(selectedOrg == null){
467 JOptionPane.showMessageDialog(
this,
468 NbBundle.getMessage(
this.getClass(),
469 "HashDbCreateDatabaseDialog.missingOrg"),
470 NbBundle.getMessage(
this.getClass(),
471 "HashDbCreateDatabaseDialog.createHashDbErr"),
472 JOptionPane.ERROR_MESSAGE);
478 TskData.FileKnown fileKnown;
479 if (knownRadioButton.isSelected()) {
480 type = KnownFilesType.KNOWN;
481 fileKnown = TskData.FileKnown.KNOWN;
483 type = KnownFilesType.KNOWN_BAD;
484 fileKnown = TskData.FileKnown.BAD;
487 String errorMessage = NbBundle
488 .getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.errMsg.hashDbCreationErr");
490 if(fileTypeRadioButton.isSelected()){
492 newHashDb = HashDbManager.getInstance().addNewHashDatabaseNoSave(hashSetNameTextField.getText(), fileChooser.getSelectedFile().getCanonicalPath(),
true, sendIngestMessagesCheckbox.isSelected(), type);
493 }
catch (IOException ex) {
494 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
495 JOptionPane.showMessageDialog(
this,
496 NbBundle.getMessage(
this.getClass(),
497 "HashDbCreateDatabaseDialog.cannotCreateFileAtLocMsg"),
498 NbBundle.getMessage(
this.getClass(),
499 "HashDbCreateDatabaseDialog.createHashDbErr"),
500 JOptionPane.ERROR_MESSAGE);
502 }
catch (HashDbManagerException ex) {
503 Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
504 JOptionPane.showMessageDialog(
this,
506 NbBundle.getMessage(this.getClass(),
507 "HashDbCreateDatabaseDialog.createHashDbErr"),
508 JOptionPane.ERROR_MESSAGE);
514 if(EamDb.getInstance().referenceSetExists(hashSetNameTextField.getText(),
"")){
515 JOptionPane.showMessageDialog(
this,
516 NbBundle.getMessage(
this.getClass(),
517 "HashDbCreateDatabaseDialog.duplicateName"),
518 NbBundle.getMessage(
this.getClass(),
519 "HashDbCreateDatabaseDialog.createHashDbErr"),
520 JOptionPane.ERROR_MESSAGE);
523 }
catch (EamDbException ex){
524 Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE,
"Error looking up reference set", ex);
525 JOptionPane.showMessageDialog(
this,
526 NbBundle.getMessage(
this.getClass(),
527 "HashDbCreateDatabaseDialog.databaseLookupError"),
528 NbBundle.getMessage(
this.getClass(),
529 "HashDbCreateDatabaseDialog.createHashDbErr"),
530 JOptionPane.ERROR_MESSAGE);
535 int referenceSetID = EamDb.getInstance().newReferenceSet(
new EamGlobalSet(selectedOrg.getOrgID(), hashSetNameTextField.getText(),
536 "", fileKnown,
false, EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID)));
537 newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetNameTextField.getText(),
539 true, sendIngestMessagesCheckbox.isSelected(), type,
false);
540 }
catch (EamDbException | TskCoreException ex){
541 Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE,
"Error creating new reference set", ex);
542 JOptionPane.showMessageDialog(
this,
543 NbBundle.getMessage(
this.getClass(),
544 "HashDbCreateDatabaseDialog.databaseCreationError"),
545 NbBundle.getMessage(
this.getClass(),
546 "HashDbCreateDatabaseDialog.createHashDbErr"),
547 JOptionPane.ERROR_MESSAGE);
555 private void sendIngestMessagesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {
559 private void orgButtonActionPerformed(java.awt.event.ActionEvent evt) {
560 ManageOrganizationsDialog dialog =
new ManageOrganizationsDialog();
562 if (dialog.isChanged()) {
567 private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {
568 if (null == orgComboBox.getSelectedItem())
return;
569 String orgName = this.orgComboBox.getSelectedItem().toString();
570 for (EamOrganization
org : orgs) {
571 if (
org.getName().equals(orgName)) {
578 private void fileTypeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
582 private void centralRepoRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {
587 private javax.swing.ButtonGroup buttonGroup1;
588 private javax.swing.JButton cancelButton;
589 private javax.swing.JRadioButton centralRepoRadioButton;
590 private javax.swing.JLabel databasePathLabel;
591 private javax.swing.JTextField databasePathTextField;
592 private javax.swing.JRadioButton fileTypeRadioButton;
593 private javax.swing.JTextField hashSetNameTextField;
594 private javax.swing.JLabel jLabel2;
595 private javax.swing.JLabel jLabel3;
596 private javax.swing.JLabel jLabel4;
597 private javax.swing.JRadioButton knownBadRadioButton;
598 private javax.swing.JRadioButton knownRadioButton;
599 private javax.swing.JLabel lbOrg;
600 private javax.swing.JButton okButton;
601 private javax.swing.JButton orgButton;
602 private javax.swing.JComboBox<String> orgComboBox;
603 private javax.swing.JButton saveAsButton;
604 private javax.swing.JCheckBox sendIngestMessagesCheckbox;
605 private javax.swing.ButtonGroup storageTypeButtonGroup;