|
|
|
@ -2,11 +2,14 @@ package com.fr.design.data.datapane.preview.desensitization.view.setting;
|
|
|
|
|
|
|
|
|
|
import com.fr.data.desensitize.base.DesensitizationTableData; |
|
|
|
|
import com.fr.data.desensitize.base.TableDataDesensitizationItem; |
|
|
|
|
import com.fr.data.desensitize.rule.DesensitizationRuleManager; |
|
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRule; |
|
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRuleStatus; |
|
|
|
|
import com.fr.design.data.datapane.preview.desensitization.TableDataPreviewDesensitizeManager; |
|
|
|
|
import com.fr.design.data.datapane.preview.desensitization.view.rule.DesensitizationRulePane; |
|
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
|
import com.fr.design.gui.icombobox.UIComboBox; |
|
|
|
|
import com.fr.design.gui.icombocheckbox.UIComboCheckBox; |
|
|
|
@ -15,12 +18,14 @@ import com.fr.design.gui.itableeditorpane.UITableEditAction;
|
|
|
|
|
import com.fr.design.gui.itableeditorpane.UITableModelAdapter; |
|
|
|
|
import com.fr.design.gui.itextfield.UITextField; |
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
|
import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
|
|
|
|
|
|
import javax.swing.AbstractCellEditor; |
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.JTable; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
@ -28,10 +33,11 @@ import javax.swing.event.CellEditorListener;
|
|
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
|
import javax.swing.table.TableCellEditor; |
|
|
|
|
import javax.swing.table.TableCellRenderer; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Component; |
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.LinkedHashSet; |
|
|
|
@ -52,6 +58,8 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
|
|
|
|
|
private static final String APOSTROPHE = "..."; |
|
|
|
|
|
|
|
|
|
private static final String COMMA = ","; |
|
|
|
|
|
|
|
|
|
private DesensitizationTableData tableData; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -66,17 +74,14 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
|
|
|
|
|
private Component parent; |
|
|
|
|
|
|
|
|
|
private DesensitizationRuleChooser ruleChooser; |
|
|
|
|
|
|
|
|
|
private DesensitizationRuleDescriptionPane descriptionPane; |
|
|
|
|
|
|
|
|
|
public TableDataDesensitizationTableModel(DesensitizationTableData tableData, Component parent) { |
|
|
|
|
// table相关
|
|
|
|
|
super(new String[]{ |
|
|
|
|
Toolkit.i18nText("Fine-Design_Report_Desensitization_Column"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule"), |
|
|
|
|
StringUtils.EMPTY, |
|
|
|
|
Toolkit.i18nText("Fine-Design_Report_Desensitization_Effected_Roles") |
|
|
|
|
Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Description"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Report_Desensitization_Effected_Roles"), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Status"), |
|
|
|
|
}); |
|
|
|
|
// 一些数据相关
|
|
|
|
|
this.tableData = tableData; |
|
|
|
@ -93,57 +98,69 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
// 规则详情展示
|
|
|
|
|
DesensitizationRuleDescriptionPane.class, |
|
|
|
|
// 生效用户组选择
|
|
|
|
|
EffectedRolesChooser.class |
|
|
|
|
EffectedRolesChooser.class, |
|
|
|
|
// 规则状态
|
|
|
|
|
DesensitizationRuleStatusPane.class |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.setDefaultEditor(ColumnNamesComboBox.class, new ColumnNamesComboBox()); |
|
|
|
|
this.ruleChooser = new DesensitizationRuleChooser(); |
|
|
|
|
this.setDefaultEditor(DesensitizationRuleChooser.class, ruleChooser); |
|
|
|
|
this.setDefaultRenderer(DesensitizationRuleChooser.class, ruleChooser); |
|
|
|
|
this.descriptionPane = new DesensitizationRuleDescriptionPane(); |
|
|
|
|
this.setDefaultEditor(DesensitizationRuleChooser.class, new DesensitizationRuleChooser()); |
|
|
|
|
this.setDefaultEditor(DesensitizationRuleDescriptionPane.class, new DesensitizationRuleDescriptionPane()); |
|
|
|
|
this.setDefaultEditor(EffectedRolesChooser.class, new EffectedRolesChooser()); |
|
|
|
|
this.setDefaultEditor(DesensitizationRuleStatusPane.class, new DesensitizationRuleStatusPane()); |
|
|
|
|
this.setDefaultRenderer(DesensitizationRuleStatusPane.class, new DesensitizationRuleStatusPane()); |
|
|
|
|
|
|
|
|
|
this.createTable().getColumnModel().getColumn(TableSequences.DesensitizationRuleStatus.getNum()).setMaxWidth(60); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object getValueAt(int rowIndex, int columnIndex) { |
|
|
|
|
TableDataDesensitizationItem desensitizationItem = this.getList().get(rowIndex); |
|
|
|
|
switch (columnIndex) { |
|
|
|
|
case 0: |
|
|
|
|
TableSequences match = TableSequences.match(columnIndex); |
|
|
|
|
switch (match) { |
|
|
|
|
case ColumnName: |
|
|
|
|
// 选中的数据集字段名称
|
|
|
|
|
return desensitizationItem.getColumnName(); |
|
|
|
|
case 1: |
|
|
|
|
case DesensitizationRule: |
|
|
|
|
// 脱敏规则名称
|
|
|
|
|
return desensitizationItem.getRule().getRuleName(); |
|
|
|
|
case 2: |
|
|
|
|
case DesensitizationRuleDescription: |
|
|
|
|
// 脱敏规则详情
|
|
|
|
|
return DesensitizationRule.getDescription(desensitizationItem.getRule()); |
|
|
|
|
case 3: |
|
|
|
|
case EffectedRoles: |
|
|
|
|
// 生效用户组
|
|
|
|
|
return matchRoleNamesByIds(desensitizationItem.getRoleIds()); |
|
|
|
|
case DesensitizationRuleStatus: |
|
|
|
|
// 规则状态
|
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(desensitizationItem.getRule()); |
|
|
|
|
// 非正常状态需要标记为异常
|
|
|
|
|
return ruleStatus == DesensitizationRuleStatus.NORMAL ? StringUtils.EMPTY : Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Status_Abnormal"); |
|
|
|
|
default: |
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过id匹配此用户组对应的部门职位名称(或者说自定义角色名称) |
|
|
|
|
* 通过id匹配此用户组对应的部门职位名称(或者说自定义角色名称),并拼接成字符串返回 |
|
|
|
|
* |
|
|
|
|
* @param roleIds |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<String> matchRoleNamesByIds(Collection<String> roleIds) { |
|
|
|
|
List<String> result = new ArrayList<>(); |
|
|
|
|
private String matchRoleNamesByIds(Collection<String> roleIds) { |
|
|
|
|
StringBuilder builder = new StringBuilder(); |
|
|
|
|
for (String roleId : roleIds) { |
|
|
|
|
if (roleMap != null && roleMap.containsKey(roleId)) { |
|
|
|
|
result.add(roleMap.get(roleId)); |
|
|
|
|
builder.append(roleMap.get(roleId)); |
|
|
|
|
builder.append(COMMA); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
return builder.length() <= 1 ? StringUtils.EMPTY : builder.substring(0, builder.length() - 1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean isCellEditable(int row, int col) { |
|
|
|
|
return true; |
|
|
|
|
TableSequences match = TableSequences.match(col); |
|
|
|
|
return match != TableSequences.DesensitizationRuleStatus; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -166,7 +183,7 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
/** |
|
|
|
|
* 列名选择下拉框 |
|
|
|
|
*/ |
|
|
|
|
private class ColumnNamesComboBox extends AbstractCellEditor implements TableCellEditor, TableCellRenderer { |
|
|
|
|
private class ColumnNamesComboBox extends AbstractCellEditor implements TableCellEditor { |
|
|
|
|
|
|
|
|
|
private UIComboBox columnNameComboBox; |
|
|
|
|
|
|
|
|
@ -202,15 +219,9 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
Object selectedItem = columnNameComboBox.getSelectedItem(); |
|
|
|
|
return Objects.isNull(selectedItem) ? StringUtils.EMPTY : selectedItem.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
|
|
|
|
columnNameComboBox.setSelectedItem(getList().get(row).getColumnName()); |
|
|
|
|
return columnNameComboBox; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private class DesensitizationRuleChooser extends AbstractCellEditor implements TableCellEditor, TableCellRenderer { |
|
|
|
|
private class DesensitizationRuleChooser extends AbstractCellEditor implements TableCellEditor { |
|
|
|
|
/** |
|
|
|
|
* 规则选择页面 |
|
|
|
|
*/ |
|
|
|
@ -223,26 +234,25 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
* 规则选择按钮 |
|
|
|
|
*/ |
|
|
|
|
private UIButton chooseButton; |
|
|
|
|
/** |
|
|
|
|
* 规则 |
|
|
|
|
*/ |
|
|
|
|
private DesensitizationRule rule; |
|
|
|
|
|
|
|
|
|
private ActionListener chooseRuleListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
DesensitizationRulePane rulePane = new DesensitizationRulePane(); |
|
|
|
|
TableDataDesensitizationItem desensitizationItem = getCurrentSelectBean(); |
|
|
|
|
int selectedRow = table.getSelectedRow(); |
|
|
|
|
BasicDialog ruleDialog = rulePane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(parent), new DialogActionAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void doOk() { |
|
|
|
|
rule = rulePane.updateBean(); |
|
|
|
|
TableDataDesensitizationItem desensitizationItem = getCurrentSelectBean(); |
|
|
|
|
DesensitizationRule rule = rulePane.updateBean(); |
|
|
|
|
if (Objects.nonNull(desensitizationItem) && Objects.nonNull(rule)) { |
|
|
|
|
desensitizationItem.setRule(rule); |
|
|
|
|
desensitizationItem.setRuleName(rule.getRuleName()); |
|
|
|
|
// 刷新规则名称、描述、状态
|
|
|
|
|
ruleNameTextField.setText(rule.getRuleName()); |
|
|
|
|
fireTableDataChanged(); |
|
|
|
|
table.getSelectionModel().setSelectionInterval(selectedRow, selectedRow); |
|
|
|
|
} |
|
|
|
|
rule = null; |
|
|
|
|
} |
|
|
|
|
}, BasicDialog.DEFAULT); |
|
|
|
|
ruleDialog.setVisible(true); |
|
|
|
@ -255,29 +265,13 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
ruleNameTextField.setEnabled(false); |
|
|
|
|
// 规则选择按钮
|
|
|
|
|
chooseButton = new UIButton(APOSTROPHE); |
|
|
|
|
chooseButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Click_To_Choose_Rule")); |
|
|
|
|
chooseButton.addActionListener(chooseRuleListener); |
|
|
|
|
// 规则选择页面
|
|
|
|
|
Component[][] templateChooserComponent = {{ruleNameTextField, chooseButton}}; |
|
|
|
|
double[] rowSize = {TableLayout.PREFERRED}; |
|
|
|
|
double[] columnSize = {TableLayout.FILL, 22}; |
|
|
|
|
choosePane = TableLayoutHelper.createCommonTableLayoutPane(templateChooserComponent, rowSize, columnSize, 0); |
|
|
|
|
this.addCellEditorListener(new CellEditorListener() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void editingCanceled(ChangeEvent e) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void editingStopped(ChangeEvent e) { |
|
|
|
|
TableDataDesensitizationItem desensitizationItem = getCurrentSelectBean(); |
|
|
|
|
if (Objects.nonNull(desensitizationItem) && Objects.nonNull(rule)) { |
|
|
|
|
desensitizationItem.setRule(rule); |
|
|
|
|
desensitizationItem.setRuleName(rule.getRuleName()); |
|
|
|
|
fireTableDataChanged(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -290,12 +284,6 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
public Object getCellEditorValue() { |
|
|
|
|
return ruleNameTextField.getText(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
|
|
|
|
ruleNameTextField.setText((String) value); |
|
|
|
|
return choosePane; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private class DesensitizationRuleDescriptionPane extends AbstractCellEditor implements TableCellEditor { |
|
|
|
@ -314,6 +302,7 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
*/ |
|
|
|
|
public void refreshDescription(DesensitizationRule desensitizationRule) { |
|
|
|
|
this.descriptionLabel.setText(DesensitizationRule.getDescription(desensitizationRule)); |
|
|
|
|
this.descriptionLabel.setToolTipText(this.descriptionLabel.getText()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -328,12 +317,31 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private class EffectedRolesChooser extends AbstractCellEditor implements TableCellEditor, TableCellRenderer { |
|
|
|
|
/** |
|
|
|
|
* 生效用户组复选框 |
|
|
|
|
*/ |
|
|
|
|
private class EffectedRolesChooser extends AbstractCellEditor implements TableCellEditor { |
|
|
|
|
|
|
|
|
|
private UIComboCheckBox rolesCheckBox; |
|
|
|
|
|
|
|
|
|
EffectedRolesChooser() { |
|
|
|
|
this.rolesCheckBox = new UIComboCheckBox(roleMap.values().toArray(), true); |
|
|
|
|
this.rolesCheckBox = new UIComboCheckBox(roleMap.values().toArray(), true) { |
|
|
|
|
@Override |
|
|
|
|
protected void setLayoutAndAddComponents() { |
|
|
|
|
// 使用BorderLayout,否则默认使用的FlowLayout会让整个下拉选框使用最小Size,然后TableCell这边会出现空白
|
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
this.add(getEditor(), BorderLayout.CENTER); |
|
|
|
|
this.add(getArrowButton(), BorderLayout.EAST); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void setEditorToolTipText(JComponent editor, String text) { |
|
|
|
|
// 选项过多时,已选中的值会做省略显示处理,此处添加一个Tooltips,显示完整值
|
|
|
|
|
if (text != null) { |
|
|
|
|
editor.setToolTipText(text); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
this.addCellEditorListener(new CellEditorListener() { |
|
|
|
|
@Override |
|
|
|
|
public void editingStopped(ChangeEvent e) { |
|
|
|
@ -399,15 +407,86 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
public Object getCellEditorValue() { |
|
|
|
|
return rolesCheckBox.getSelectedValues(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 规则状态展示页面 |
|
|
|
|
*/ |
|
|
|
|
private class DesensitizationRuleStatusPane extends AbstractCellEditor implements TableCellEditor, TableCellRenderer { |
|
|
|
|
|
|
|
|
|
private UILabel ruleStatusLabel; |
|
|
|
|
|
|
|
|
|
DesensitizationRuleStatusPane() { |
|
|
|
|
// 规则状态
|
|
|
|
|
this.ruleStatusLabel = new UILabel(); |
|
|
|
|
this.ruleStatusLabel.setForeground(Color.RED); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据脱敏规则信息,刷新规则状态,主要用于与规则选择器的联动 |
|
|
|
|
* |
|
|
|
|
* @param currentItem |
|
|
|
|
*/ |
|
|
|
|
public void refreshRuleStatus(TableDataDesensitizationItem currentItem) { |
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(currentItem.getRule()); |
|
|
|
|
if (ruleStatus == DesensitizationRuleStatus.NORMAL) { |
|
|
|
|
// 正常规则时,重置提示Label
|
|
|
|
|
this.ruleStatusLabel.setText(StringUtils.EMPTY); |
|
|
|
|
this.ruleStatusLabel.setToolTipText(null); |
|
|
|
|
} else { |
|
|
|
|
this.ruleStatusLabel.setText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Status_Abnormal")); |
|
|
|
|
this.ruleStatusLabel.setToolTipText(ruleStatus.getDescription()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 标签点击后,处理原规则 |
|
|
|
|
*/ |
|
|
|
|
private void ruleStatusLabelClick(TableDataDesensitizationItem currentItem) { |
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(currentItem.getRule()); |
|
|
|
|
if (ruleStatus == DesensitizationRuleStatus.NORMAL) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 点击Label后,弹窗提示
|
|
|
|
|
int option = FineJOptionPane.showConfirmDialog( |
|
|
|
|
parent, |
|
|
|
|
ruleStatus.getDescription(), |
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), |
|
|
|
|
FineJOptionPane.OK_CANCEL_OPTION, |
|
|
|
|
FineJOptionPane.INFORMATION_MESSAGE); |
|
|
|
|
if (option == FineJOptionPane.OK_OPTION && table.getSelectedRow() != -1) { |
|
|
|
|
int selectedRow = table.getSelectedRow(); |
|
|
|
|
// 点击确定后,根据规则状态对规则做处理
|
|
|
|
|
if (ruleStatus == DesensitizationRuleStatus.REMOVED || ruleStatus == DesensitizationRuleStatus.WRONG) { |
|
|
|
|
// 规则被删除或读取错误时,直接删掉
|
|
|
|
|
removeRow(selectedRow); |
|
|
|
|
} else if (ruleStatus == DesensitizationRuleStatus.MODIFIED) { |
|
|
|
|
// 规则被修改时,用新规则替换
|
|
|
|
|
DesensitizationRule lastedRule = DesensitizationRuleManager.getInstance().getLastedDesentizationRule(currentItem.getRule()); |
|
|
|
|
currentItem.setRule(lastedRule); |
|
|
|
|
setRowAt(currentItem, selectedRow); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
|
|
|
refreshRuleStatus(getList().get(row)); |
|
|
|
|
return ruleStatusLabel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Object getCellEditorValue() { |
|
|
|
|
return ruleStatusLabel; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { |
|
|
|
|
rolesCheckBox.setSelectedValues(generateRolesCheckBoxSelectedValues(getList().get(row))); |
|
|
|
|
return rolesCheckBox; |
|
|
|
|
refreshRuleStatus(getList().get(row)); |
|
|
|
|
return ruleStatusLabel; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class AddDesensitizationAction extends AddTableRowAction { |
|
|
|
|
|
|
|
|
|
public AddDesensitizationAction() { |
|
|
|
@ -439,4 +518,66 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 规则表-列字段编号 |
|
|
|
|
*/ |
|
|
|
|
private enum TableSequences { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 数据集列名选择 |
|
|
|
|
*/ |
|
|
|
|
ColumnName(0), |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 规则选择 |
|
|
|
|
*/ |
|
|
|
|
DesensitizationRule(1), |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 规则描述 |
|
|
|
|
*/ |
|
|
|
|
DesensitizationRuleDescription(2), |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 规则生效用户组 |
|
|
|
|
*/ |
|
|
|
|
EffectedRoles(3), |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 规则状态 |
|
|
|
|
*/ |
|
|
|
|
DesensitizationRuleStatus(4), |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 未知,用于无法匹配时的返回 |
|
|
|
|
*/ |
|
|
|
|
Unknown(100); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int num; |
|
|
|
|
|
|
|
|
|
TableSequences(int num) { |
|
|
|
|
this.num = num; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public int getNum() { |
|
|
|
|
return num; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据列序号匹配列字段 |
|
|
|
|
* |
|
|
|
|
* @param num |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
public static TableSequences match(int num) { |
|
|
|
|
for (TableSequences value : TableSequences.values()) { |
|
|
|
|
if (value.getNum() == num) { |
|
|
|
|
return value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Unknown; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|