mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
Fix codacy errors
This commit is contained in:
parent
8100e5e635
commit
75f8b44f8b
@ -40,7 +40,7 @@ import org.openide.util.NbBundle;
|
|||||||
/**
|
/**
|
||||||
* Configuration Visual Panel 1
|
* Configuration Visual Panel 1
|
||||||
*/
|
*/
|
||||||
public final class ConfigVisualPanel1 extends JPanel implements DocumentListener {
|
public final class ConfigVisualPanel1 extends JPanel {
|
||||||
|
|
||||||
private LogicalImagerConfig config;
|
private LogicalImagerConfig config;
|
||||||
private String configFilename;
|
private String configFilename;
|
||||||
@ -144,7 +144,7 @@ public final class ConfigVisualPanel1 extends JPanel implements DocumentListener
|
|||||||
configFilename = path;
|
configFilename = path;
|
||||||
configFileTextField.setText(path);
|
configFileTextField.setText(path);
|
||||||
newFile = false;
|
newFile = false;
|
||||||
} catch (Exception ex) {
|
} catch (JsonIOException | JsonSyntaxException | IOException ex) {
|
||||||
JOptionPane.showMessageDialog(this,
|
JOptionPane.showMessageDialog(this,
|
||||||
Bundle.ConfigVisualPanel1_invalidConfigJson() + ex.getMessage() ,
|
Bundle.ConfigVisualPanel1_invalidConfigJson() + ex.getMessage() ,
|
||||||
Bundle.ConfigVisualPanel1_configurationError(),
|
Bundle.ConfigVisualPanel1_configurationError(),
|
||||||
@ -203,22 +203,13 @@ public final class ConfigVisualPanel1 extends JPanel implements DocumentListener
|
|||||||
configFileTextField.setText(filename);
|
configFileTextField.setText(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void insertUpdate(DocumentEvent e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeUpdate(DocumentEvent e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void changedUpdate(DocumentEvent e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPanelValid() {
|
public boolean isPanelValid() {
|
||||||
return (newFile || !configFileTextField.getText().isEmpty());
|
return (newFile || !configFileTextField.getText().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Document Listener for textfield
|
||||||
|
*/
|
||||||
private static class MyDocumentListener implements DocumentListener {
|
private static class MyDocumentListener implements DocumentListener {
|
||||||
|
|
||||||
private final ConfigVisualPanel1 panel;
|
private final ConfigVisualPanel1 panel;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.configurelogicalimager;
|
package org.sleuthkit.autopsy.configurelogicalimager;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -555,7 +556,7 @@ public final class ConfigVisualPanel2 extends JPanel {
|
|||||||
ImmutablePair<String, LogicalImagerRule> ruleMap = panel.toRule();
|
ImmutablePair<String, LogicalImagerRule> ruleMap = panel.toRule();
|
||||||
appendRow(ruleMap);
|
appendRow(ruleMap);
|
||||||
break;
|
break;
|
||||||
} catch (Exception ex) {
|
} catch (IOException | NumberFormatException ex) {
|
||||||
JOptionPane.showMessageDialog(this,
|
JOptionPane.showMessageDialog(this,
|
||||||
ex.getMessage(),
|
ex.getMessage(),
|
||||||
"New rule error",
|
"New rule error",
|
||||||
@ -696,7 +697,7 @@ public final class ConfigVisualPanel2 extends JPanel {
|
|||||||
|
|
||||||
for (LogicalImagerRule rule : ruleSet.getRules()) {
|
for (LogicalImagerRule rule : ruleSet.getRules()) {
|
||||||
rulesTableModel.setValueAt(rule.getName(), row, 0);
|
rulesTableModel.setValueAt(rule.getName(), row, 0);
|
||||||
if (rowSelectionkey != null && rule.getName().equals(rowSelectionkey)) {
|
if (rowSelectionkey != null && rowSelectionkey.equals(rule.getName())) {
|
||||||
selectThisRow = row;
|
selectThisRow = row;
|
||||||
}
|
}
|
||||||
rulesTableModel.setValueAt(rule.getDescription(), row, 1);
|
rulesTableModel.setValueAt(rule.getDescription(), row, 1);
|
||||||
@ -839,6 +840,9 @@ public final class ConfigVisualPanel2 extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RulesTableModel for rules table
|
||||||
|
*/
|
||||||
private class RulesTableModel extends AbstractTableModel {
|
private class RulesTableModel extends AbstractTableModel {
|
||||||
|
|
||||||
private final List<String> ruleName = new ArrayList<>();
|
private final List<String> ruleName = new ArrayList<>();
|
||||||
@ -925,6 +929,9 @@ public final class ConfigVisualPanel2 extends JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table model for single column list table.
|
||||||
|
*/
|
||||||
private class SingleColumnTableModel extends AbstractTableModel {
|
private class SingleColumnTableModel extends AbstractTableModel {
|
||||||
|
|
||||||
private final List<String> list = new ArrayList<>();
|
private final List<String> list = new ArrayList<>();
|
||||||
@ -947,11 +954,9 @@ public final class ConfigVisualPanel2 extends JPanel {
|
|||||||
@Override
|
@Override
|
||||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||||
Object ret = null;
|
Object ret = null;
|
||||||
switch (columnIndex) {
|
if (columnIndex == 0) {
|
||||||
case 0:
|
|
||||||
ret = list.get(rowIndex);
|
ret = list.get(rowIndex);
|
||||||
break;
|
} else {
|
||||||
default:
|
|
||||||
throw new UnsupportedOperationException("Invalid table column index: " + columnIndex); //NON-NLS
|
throw new UnsupportedOperationException("Invalid table column index: " + columnIndex); //NON-NLS
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -964,11 +969,9 @@ public final class ConfigVisualPanel2 extends JPanel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
|
||||||
switch (columnIndex) {
|
if (columnIndex == 0) {
|
||||||
case 0:
|
|
||||||
list.add((String) aValue);
|
list.add((String) aValue);
|
||||||
break;
|
} else {
|
||||||
default:
|
|
||||||
throw new UnsupportedOperationException("Invalid table column index: " + columnIndex); //NON-NLS
|
throw new UnsupportedOperationException("Invalid table column index: " + columnIndex); //NON-NLS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,10 +39,7 @@ public class ConfigWizardPanel1 implements WizardDescriptor.ValidatingPanel<Wiza
|
|||||||
* component from this class, just use getComponent().
|
* component from this class, just use getComponent().
|
||||||
*/
|
*/
|
||||||
private ConfigVisualPanel1 component;
|
private ConfigVisualPanel1 component;
|
||||||
private String configFilename = null;
|
boolean valid = false;
|
||||||
private LogicalImagerConfig config = null;
|
|
||||||
boolean isValid = false;
|
|
||||||
private boolean newFile = true;
|
|
||||||
|
|
||||||
// Get the visual component for the panel. In this template, the component
|
// Get the visual component for the panel. In this template, the component
|
||||||
// is kept separate. This can be more efficient: if the wizard is created
|
// is kept separate. This can be more efficient: if the wizard is created
|
||||||
@ -56,7 +53,7 @@ public class ConfigWizardPanel1 implements WizardDescriptor.ValidatingPanel<Wiza
|
|||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if (evt.getPropertyName().equals("UPDATE_UI")) { // NON-NLS
|
if (evt.getPropertyName().equals("UPDATE_UI")) { // NON-NLS
|
||||||
isValid = component.isPanelValid();
|
valid = component.isPanelValid();
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +73,7 @@ public class ConfigWizardPanel1 implements WizardDescriptor.ValidatingPanel<Wiza
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return isValid;
|
return valid;
|
||||||
// If it depends on some condition (form filled out...) and
|
// If it depends on some condition (form filled out...) and
|
||||||
// this condition changes (last form field filled in...) then
|
// this condition changes (last form field filled in...) then
|
||||||
// use ChangeSupport to implement add/removeChangeListener below.
|
// use ChangeSupport to implement add/removeChangeListener below.
|
||||||
@ -133,17 +130,14 @@ public class ConfigWizardPanel1 implements WizardDescriptor.ValidatingPanel<Wiza
|
|||||||
@Override
|
@Override
|
||||||
public void storeSettings(WizardDescriptor wiz) {
|
public void storeSettings(WizardDescriptor wiz) {
|
||||||
// use wiz.putProperty to remember current panel state
|
// use wiz.putProperty to remember current panel state
|
||||||
configFilename = component.getConfigFilename();
|
wiz.putProperty("configFilename", component.getConfigFilename()); // NON-NLS
|
||||||
config = component.getConfig();
|
wiz.putProperty("config", component.getConfig()); // NON-NLS
|
||||||
newFile = component.isNewFile();
|
wiz.putProperty("newFile", component.isNewFile()); // NON-NLS
|
||||||
wiz.putProperty("configFilename", configFilename); // NON-NLS
|
|
||||||
wiz.putProperty("config", config); // NON-NLS
|
|
||||||
wiz.putProperty("newFile", newFile); // NON-NLS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws WizardValidationException {
|
public void validate() throws WizardValidationException {
|
||||||
isValid = component.isPanelValid();
|
valid = component.isPanelValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,8 +51,7 @@ public class ConfigWizardPanel2 implements WizardDescriptor.Panel<WizardDescript
|
|||||||
private ConfigVisualPanel2 component;
|
private ConfigVisualPanel2 component;
|
||||||
private String configFilename;
|
private String configFilename;
|
||||||
private LogicalImagerConfig config;
|
private LogicalImagerConfig config;
|
||||||
private boolean newFile;
|
boolean valid = false;
|
||||||
boolean isValid = false;
|
|
||||||
|
|
||||||
// Get the visual component for the panel. In this template, the component
|
// Get the visual component for the panel. In this template, the component
|
||||||
// is kept separate. This can be more efficient: if the wizard is created
|
// is kept separate. This can be more efficient: if the wizard is created
|
||||||
@ -89,8 +88,7 @@ public class ConfigWizardPanel2 implements WizardDescriptor.Panel<WizardDescript
|
|||||||
// use wiz.getProperty to retrieve previous panel state
|
// use wiz.getProperty to retrieve previous panel state
|
||||||
configFilename = (String) wiz.getProperty("configFilename"); // NON-NLS
|
configFilename = (String) wiz.getProperty("configFilename"); // NON-NLS
|
||||||
config = (LogicalImagerConfig) wiz.getProperty("config"); // NON-NLS
|
config = (LogicalImagerConfig) wiz.getProperty("config"); // NON-NLS
|
||||||
newFile = (boolean) wiz.getProperty("newFile"); // NON-NLS
|
component.setConfiguration(configFilename, config, (boolean) wiz.getProperty("newFile"));
|
||||||
component.setConfiguration(configFilename, config, newFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,14 +96,6 @@ public class ConfigWizardPanel2 implements WizardDescriptor.Panel<WizardDescript
|
|||||||
// use wiz.putProperty to remember current panel state
|
// use wiz.putProperty to remember current panel state
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addChangeListener(ChangeListener cl) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeChangeListener(ChangeListener cl) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getConfigFilename() {
|
public String getConfigFilename() {
|
||||||
return configFilename;
|
return configFilename;
|
||||||
}
|
}
|
||||||
@ -155,4 +145,14 @@ public class ConfigWizardPanel2 implements WizardDescriptor.Panel<WizardDescript
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChangeListener(ChangeListener cl) {
|
||||||
|
// Not used
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeChangeListener(ChangeListener cl) {
|
||||||
|
// Not used
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,12 +74,10 @@ public final class ConfigureLogicalImager implements ActionListener {
|
|||||||
// {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
|
// {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
|
||||||
wiz.setTitleFormat(new MessageFormat("{0}")); // NON-NLS
|
wiz.setTitleFormat(new MessageFormat("{0}")); // NON-NLS
|
||||||
wiz.setTitle(Bundle.ConfigureLogicalImager_title());
|
wiz.setTitle(Bundle.ConfigureLogicalImager_title());
|
||||||
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
|
if ((DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) &&
|
||||||
// do something
|
(panels.get(1) instanceof ConfigWizardPanel2)) {
|
||||||
if (panels.get(1) instanceof ConfigWizardPanel2) {
|
|
||||||
ConfigWizardPanel2 panel = (ConfigWizardPanel2) panels.get(1);
|
ConfigWizardPanel2 panel = (ConfigWizardPanel2) panels.get(1);
|
||||||
panel.saveConfigFile();
|
panel.saveConfigFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -41,8 +41,6 @@ public class EditFullPathsRulePanel extends javax.swing.JPanel {
|
|||||||
private JButton cancelButton;
|
private JButton cancelButton;
|
||||||
List<String> newFullPaths = new ArrayList<>();
|
List<String> newFullPaths = new ArrayList<>();
|
||||||
private final JTextArea fullPathsTextArea;
|
private final JTextArea fullPathsTextArea;
|
||||||
private boolean editing = false;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form EditFullPathsRulePanel
|
* Creates new form EditFullPathsRulePanel
|
||||||
@ -53,7 +51,6 @@ public class EditFullPathsRulePanel extends javax.swing.JPanel {
|
|||||||
public EditFullPathsRulePanel(JButton okButton, JButton cancelButton, String ruleName, LogicalImagerRule rule, boolean editing) {
|
public EditFullPathsRulePanel(JButton okButton, JButton cancelButton, String ruleName, LogicalImagerRule rule, boolean editing) {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
this.editing = editing;
|
|
||||||
if (editing) {
|
if (editing) {
|
||||||
ruleNameTextField.setEnabled(!editing);
|
ruleNameTextField.setEnabled(!editing);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ public class EditNonFullPathsRulePanel extends javax.swing.JPanel {
|
|||||||
private JButton cancelButton;
|
private JButton cancelButton;
|
||||||
private final javax.swing.JTextArea filenamesTextArea;
|
private final javax.swing.JTextArea filenamesTextArea;
|
||||||
private final javax.swing.JTextArea folderNamesTextArea;
|
private final javax.swing.JTextArea folderNamesTextArea;
|
||||||
private boolean editing = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form EditRulePanel
|
* Creates new form EditRulePanel
|
||||||
@ -58,7 +57,6 @@ public class EditNonFullPathsRulePanel extends javax.swing.JPanel {
|
|||||||
EditNonFullPathsRulePanel(JButton okButton, JButton cancelButton, String ruleName, LogicalImagerRule rule, boolean editing) {
|
EditNonFullPathsRulePanel(JButton okButton, JButton cancelButton, String ruleName, LogicalImagerRule rule, boolean editing) {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
this.editing = editing;
|
|
||||||
if (editing) {
|
if (editing) {
|
||||||
ruleNameTextField.setEnabled(!editing);
|
ruleNameTextField.setEnabled(!editing);
|
||||||
}
|
}
|
||||||
@ -472,7 +470,7 @@ public class EditNonFullPathsRulePanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
builder.minDays(minDays);
|
builder.minDays(minDays);
|
||||||
} catch (NumberFormatException | ParseException ex) {
|
} catch (NumberFormatException | ParseException ex) {
|
||||||
throw new IOException(Bundle.EditNonFullPathsRulePanel_modifiedDaysMustBeNumberException(ex.getMessage()));
|
throw new IOException(Bundle.EditNonFullPathsRulePanel_modifiedDaysMustBeNumberException(ex.getMessage()), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,7 +483,7 @@ public class EditNonFullPathsRulePanel extends javax.swing.JPanel {
|
|||||||
throw new IOException(Bundle.EditNonFullPathsRulePanel_minFileSizeNotPositiveException());
|
throw new IOException(Bundle.EditNonFullPathsRulePanel_minFileSizeNotPositiveException());
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException | ParseException ex) {
|
} catch (NumberFormatException | ParseException ex) {
|
||||||
throw new IOException(Bundle.EditNonFullPathsRulePanel_minFileSizeMustBeNumberException(ex.getMessage()));
|
throw new IOException(Bundle.EditNonFullPathsRulePanel_minFileSizeMustBeNumberException(ex.getMessage()), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +496,7 @@ public class EditNonFullPathsRulePanel extends javax.swing.JPanel {
|
|||||||
throw new IOException(Bundle.EditNonFullPathsRulePanel_maxFileSizeNotPositiveException());
|
throw new IOException(Bundle.EditNonFullPathsRulePanel_maxFileSizeNotPositiveException());
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException | ParseException ex) {
|
} catch (NumberFormatException | ParseException ex) {
|
||||||
throw new IOException(Bundle.EditNonFullPathsRulePanel_maxFileSizeMustBeNumberException(ex.getMessage()));
|
throw new IOException(Bundle.EditNonFullPathsRulePanel_maxFileSizeMustBeNumberException(ex.getMessage()), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,10 +518,10 @@ public class EditNonFullPathsRulePanel extends javax.swing.JPanel {
|
|||||||
"EditNonFullPathsRulePanel.emptyExtensionException=Extensions cannot have an empty entry",
|
"EditNonFullPathsRulePanel.emptyExtensionException=Extensions cannot have an empty entry",
|
||||||
})
|
})
|
||||||
private List<String> validateExtensions(JTextField textField) throws IOException {
|
private List<String> validateExtensions(JTextField textField) throws IOException {
|
||||||
List<String> extensions = new ArrayList<>();
|
|
||||||
if (isBlank(textField.getText())) {
|
if (isBlank(textField.getText())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
List<String> extensions = new ArrayList<>();
|
||||||
for (String extension : textField.getText().split(",")) {
|
for (String extension : textField.getText().split(",")) {
|
||||||
extension = strip(extension);
|
extension = strip(extension);
|
||||||
if (extension.isEmpty()) {
|
if (extension.isEmpty()) {
|
||||||
|
@ -103,10 +103,10 @@ public class EditRulePanel extends JPanel {
|
|||||||
"EditRulePanel.blankLineException={0} cannot have a blank line",
|
"EditRulePanel.blankLineException={0} cannot have a blank line",
|
||||||
})
|
})
|
||||||
static public List<String> validateTextList(JTextArea textArea, String fieldName) throws IOException {
|
static public List<String> validateTextList(JTextArea textArea, String fieldName) throws IOException {
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
if (isBlank(textArea.getText())) {
|
if (isBlank(textArea.getText())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
for (String line : textArea.getText().split("\\n")) { // NON-NLS
|
for (String line : textArea.getText().split("\\n")) { // NON-NLS
|
||||||
line = strip(line);
|
line = strip(line);
|
||||||
if (line.isEmpty()) {
|
if (line.isEmpty()) {
|
||||||
|
@ -35,6 +35,8 @@ public final class EncryptionProgramsRule {
|
|||||||
private static final String ENCRYPTION_PROGRAMS_RULE_DESCRIPTION = Bundle.EncryptionProgramsRule_encryptionProgramsRuleDescription();
|
private static final String ENCRYPTION_PROGRAMS_RULE_DESCRIPTION = Bundle.EncryptionProgramsRule_encryptionProgramsRuleDescription();
|
||||||
private static final List<String> FILENAMES = new ArrayList<>();
|
private static final List<String> FILENAMES = new ArrayList<>();
|
||||||
|
|
||||||
|
private EncryptionProgramsRule() {}
|
||||||
|
|
||||||
// TODO: Add more files here
|
// TODO: Add more files here
|
||||||
static {
|
static {
|
||||||
FILENAMES.add("truecrypt.exe"); //NON-NLS
|
FILENAMES.add("truecrypt.exe"); //NON-NLS
|
||||||
|
@ -45,7 +45,6 @@ public class LogicalImagerConfigDeserializer implements JsonDeserializer<Logical
|
|||||||
@Override
|
@Override
|
||||||
public LogicalImagerConfig deserialize(JsonElement je, Type type, JsonDeserializationContext jdc) throws JsonParseException {
|
public LogicalImagerConfig deserialize(JsonElement je, Type type, JsonDeserializationContext jdc) throws JsonParseException {
|
||||||
boolean finalizeImageWriter = false;
|
boolean finalizeImageWriter = false;
|
||||||
List<LogicalImagerRuleSet> ruleSets = new ArrayList<>();
|
|
||||||
|
|
||||||
final JsonObject jsonObject = je.getAsJsonObject();
|
final JsonObject jsonObject = je.getAsJsonObject();
|
||||||
final JsonElement jsonFinalizeImageWriter = jsonObject.get("finalize-image-writer"); // NON-NLS
|
final JsonElement jsonFinalizeImageWriter = jsonObject.get("finalize-image-writer"); // NON-NLS
|
||||||
@ -57,6 +56,8 @@ public class LogicalImagerConfigDeserializer implements JsonDeserializer<Logical
|
|||||||
if (asJsonArray == null) {
|
if (asJsonArray == null) {
|
||||||
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_missingRuleSetException());
|
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_missingRuleSetException());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<LogicalImagerRuleSet> ruleSets = new ArrayList<>();
|
||||||
for (JsonElement element: asJsonArray) {
|
for (JsonElement element: asJsonArray) {
|
||||||
String setName = null;
|
String setName = null;
|
||||||
List<LogicalImagerRule> rules = null;
|
List<LogicalImagerRule> rules = null;
|
||||||
@ -149,7 +150,7 @@ public class LogicalImagerConfigDeserializer implements JsonDeserializer<Logical
|
|||||||
default:
|
default:
|
||||||
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_unsupportedKeyException(sizeKey));
|
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_unsupportedKeyException(sizeKey));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
break;
|
break;
|
||||||
case "date-range": // NON-NLS
|
case "date-range": // NON-NLS
|
||||||
JsonObject dateRangeObject = entry1.getValue().getAsJsonObject();
|
JsonObject dateRangeObject = entry1.getValue().getAsJsonObject();
|
||||||
@ -169,7 +170,7 @@ public class LogicalImagerConfigDeserializer implements JsonDeserializer<Logical
|
|||||||
default:
|
default:
|
||||||
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_unsupportedKeyException(dateKey));
|
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_unsupportedKeyException(dateKey));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_unsupportedKeyException(key1));
|
throw new JsonParseException(Bundle.LogicalImagerConfigDeserializer_unsupportedKeyException(key1));
|
||||||
|
@ -52,10 +52,10 @@ public class LogicalImagerRule {
|
|||||||
private List<String> fullPaths = new ArrayList<>();
|
private List<String> fullPaths = new ArrayList<>();
|
||||||
@SerializedName("size-range")
|
@SerializedName("size-range")
|
||||||
@Expose(serialize = true)
|
@Expose(serialize = true)
|
||||||
private Map<String, Integer> sizeRange = new HashMap<>();
|
final private Map<String, Integer> sizeRange = new HashMap<>();
|
||||||
@SerializedName("date-range")
|
@SerializedName("date-range")
|
||||||
@Expose(serialize = true)
|
@Expose(serialize = true)
|
||||||
private Map<String, Integer> dateRange = new HashMap<>();
|
final private Map<String, Integer> dateRange = new HashMap<>();
|
||||||
|
|
||||||
// The following fields should not be serialized, internal use only
|
// The following fields should not be serialized, internal use only
|
||||||
@Expose(serialize = false)
|
@Expose(serialize = false)
|
||||||
@ -160,6 +160,9 @@ public class LogicalImagerRule {
|
|||||||
return maxDate;
|
return maxDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builder class
|
||||||
|
*/
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private Boolean shouldAlert = null;
|
private Boolean shouldAlert = null;
|
||||||
private Boolean shouldSave = null;
|
private Boolean shouldSave = null;
|
||||||
@ -175,8 +178,6 @@ public class LogicalImagerRule {
|
|||||||
private Integer minDate = null;
|
private Integer minDate = null;
|
||||||
private Integer maxDate = null;
|
private Integer maxDate = null;
|
||||||
|
|
||||||
public Builder() {}
|
|
||||||
|
|
||||||
public Builder shouldAlert(boolean shouldAlert) {
|
public Builder shouldAlert(boolean shouldAlert) {
|
||||||
this.shouldAlert = shouldAlert;
|
this.shouldAlert = shouldAlert;
|
||||||
return this;
|
return this;
|
||||||
|
@ -29,11 +29,11 @@ public class LogicalImagerRuleSet {
|
|||||||
|
|
||||||
@SerializedName("set-name")
|
@SerializedName("set-name")
|
||||||
@Expose(serialize = true)
|
@Expose(serialize = true)
|
||||||
private String setName;
|
final private String setName;
|
||||||
|
|
||||||
@SerializedName("rules")
|
@SerializedName("rules")
|
||||||
@Expose(serialize = true)
|
@Expose(serialize = true)
|
||||||
private List<LogicalImagerRule> rules;
|
private final List<LogicalImagerRule> rules;
|
||||||
|
|
||||||
public LogicalImagerRuleSet(String setName, List<LogicalImagerRule> rules) {
|
public LogicalImagerRuleSet(String setName, List<LogicalImagerRule> rules) {
|
||||||
this.setName = setName;
|
this.setName = setName;
|
||||||
|
@ -48,8 +48,8 @@ public class NewRuleSetPanel extends javax.swing.JPanel {
|
|||||||
editFullPathsRulePanel = new EditFullPathsRulePanel(okButton, cancelButton, "", new LogicalImagerRule(), false);
|
editFullPathsRulePanel = new EditFullPathsRulePanel(okButton, cancelButton, "", new LogicalImagerRule(), false);
|
||||||
fullPathsPanel.add(editFullPathsRulePanel, BorderLayout.NORTH);
|
fullPathsPanel.add(editFullPathsRulePanel, BorderLayout.NORTH);
|
||||||
|
|
||||||
sharedLayeredPane.add(nonFullPathsJPanel, new Integer(0));
|
sharedLayeredPane.add(nonFullPathsJPanel, Integer.valueOf(0));
|
||||||
sharedLayeredPane.add(fullPathsPanel, new Integer(1));
|
sharedLayeredPane.add(fullPathsPanel, Integer.valueOf(1));
|
||||||
nonFullPathsJPanel.setVisible(true);
|
nonFullPathsJPanel.setVisible(true);
|
||||||
fullPathsPanel.setVisible(false);
|
fullPathsPanel.setVisible(false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user