|
|
|
@ -2,6 +2,7 @@ package com.fr.design.mainframe.cell.settingpane.desensitization.model;
|
|
|
|
|
|
|
|
|
|
import com.fr.data.desensitize.rule.DesensitizationRuleManager; |
|
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRule; |
|
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; |
|
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRuleStatus; |
|
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
|
import com.fr.design.data.datapane.preview.desensitization.TableDataPreviewDesensitizeManager; |
|
|
|
@ -25,6 +26,7 @@ import com.fr.third.org.apache.commons.collections4.map.HashedMap;
|
|
|
|
|
import javax.swing.JComponent; |
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
import javax.swing.SwingWorker; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
import java.awt.Color; |
|
|
|
|
import java.awt.Component; |
|
|
|
@ -56,6 +58,7 @@ public class DesensitizationCellPane extends BasicBeanPane {
|
|
|
|
|
private static final String APOSTROPHE = "..."; |
|
|
|
|
private Map<String, String> roleMap; |
|
|
|
|
private DesensitizationRule rule; |
|
|
|
|
private static Map<DesensitizationRuleSource, Map<String, DesensitizationRule>> latestRules; |
|
|
|
|
private CellDesensitizationTableModel model; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -87,6 +90,7 @@ public class DesensitizationCellPane extends BasicBeanPane {
|
|
|
|
|
rolesComboBox = new RuleUIComboCheckBox(); |
|
|
|
|
rolesComboBox.setPlaceHolder(Toolkit.i18nText("Fine-Design_Report_Desensitization_Role_Place_Holder")); |
|
|
|
|
rolesComboBox.setEnabled(true); |
|
|
|
|
latestRules = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
emptyTextField = new UITextField(); |
|
|
|
|
emptyTextField.setEnabled(false); |
|
|
|
@ -127,7 +131,7 @@ public class DesensitizationCellPane extends BasicBeanPane {
|
|
|
|
|
Set<String> roleIds = generateRolesIdsBySelectedValues(); |
|
|
|
|
if (Objects.nonNull(selectBean) && !selectBean.getRoleIds().equals(roleIds)) { |
|
|
|
|
selectBean.setRoleIds(generateRolesIdsBySelectedValues()); |
|
|
|
|
model.fireAttrChanged(); |
|
|
|
|
model.fireTableDataChanged(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
@ -135,8 +139,10 @@ public class DesensitizationCellPane extends BasicBeanPane {
|
|
|
|
|
private final ActionListener chooseRuleListener = new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
|
|
CellDesensitizationBean selectBean = model.getSelectedValue(); |
|
|
|
|
DesensitizationRulePane rulePane = new DesensitizationRulePane(new HashMap<>()); |
|
|
|
|
latestRules = DesensitizationRuleManager.getInstance().getAllRules(); |
|
|
|
|
DesensitizationRulePane rulePane = new DesensitizationRulePane(latestRules); |
|
|
|
|
BasicDialog ruleDialog = rulePane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(parent), new DialogActionAdapter() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -149,7 +155,7 @@ public class DesensitizationCellPane extends BasicBeanPane {
|
|
|
|
|
// 非正常状态需要颜色修改为红色
|
|
|
|
|
refreshRuleState(selectBean); |
|
|
|
|
|
|
|
|
|
model.fireAttrChanged(); |
|
|
|
|
model.fireTableDataChanged(); |
|
|
|
|
} |
|
|
|
|
rule = null; |
|
|
|
|
} |
|
|
|
@ -211,6 +217,9 @@ public class DesensitizationCellPane extends BasicBeanPane {
|
|
|
|
|
label.setText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Setting") + row); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 刷新用户组信息 |
|
|
|
|
*/ |
|
|
|
|
private void refreshRoles() { |
|
|
|
|
Map<String, String> roles = TableDataPreviewDesensitizeManager.getInstance().getAllRoles(); |
|
|
|
|
if (!roleMap.equals(roles)) { |
|
|
|
@ -220,7 +229,7 @@ public class DesensitizationCellPane extends BasicBeanPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void refreshRuleState(CellDesensitizationBean value) { |
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(value.getDesensitizationRule()); |
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(value.getDesensitizationRule(), latestRules); |
|
|
|
|
if (value.equals(CellDesensitizationBean.createEmptyBean())) { |
|
|
|
|
ruleTextField.setForeground(Color.GRAY); |
|
|
|
|
} else if (ruleStatus != DesensitizationRuleStatus.NORMAL) { |
|
|
|
|