|
|
@ -1,15 +1,16 @@ |
|
|
|
package com.fr.design.mainframe.cell.settingpane.desensitization.model; |
|
|
|
package com.fr.design.mainframe.cell.settingpane.desensitization.model; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.operator.org.OrganizationOperator; |
|
|
|
import com.fr.data.desensitize.rule.DesensitizationRuleManager; |
|
|
|
import com.fr.data.desensitize.rule.DesensitizationRuleManager; |
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRule; |
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRule; |
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; |
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; |
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRuleStatus; |
|
|
|
import com.fr.data.desensitize.rule.base.DesensitizationRuleStatus; |
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
import com.fr.design.beans.BasicBeanPane; |
|
|
|
import com.fr.design.data.datapane.preview.desensitization.TableDataPreviewDesensitizeManager; |
|
|
|
|
|
|
|
import com.fr.design.data.datapane.preview.desensitization.view.rule.DesensitizationRulePane; |
|
|
|
import com.fr.design.data.datapane.preview.desensitization.view.rule.DesensitizationRulePane; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
import com.fr.design.dialog.BasicDialog; |
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
|
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.icombocheckbox.UIComboCheckBox; |
|
|
|
import com.fr.design.gui.icombocheckbox.UIComboCheckBox; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
@ -19,9 +20,12 @@ import com.fr.design.layout.FRGUIPaneFactory; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayout; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.TableLayoutHelper; |
|
|
|
import com.fr.design.layout.VerticalFlowLayout; |
|
|
|
import com.fr.design.layout.VerticalFlowLayout; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
|
|
|
|
import com.fr.design.mainframe.JTemplateActionListener; |
|
|
|
import com.fr.report.cell.desensitization.CellDesensitizationBean; |
|
|
|
import com.fr.report.cell.desensitization.CellDesensitizationBean; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.third.org.apache.commons.collections4.map.HashedMap; |
|
|
|
import com.fr.third.org.apache.commons.collections4.map.HashedMap; |
|
|
|
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
@ -39,6 +43,7 @@ import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 单元格脱敏规则设置面板 |
|
|
|
* 单元格脱敏规则设置面板 |
|
|
@ -56,10 +61,11 @@ public class DesensitizationCellPane extends BasicBeanPane { |
|
|
|
private UITextField ruleTextField; |
|
|
|
private UITextField ruleTextField; |
|
|
|
private UIComboCheckBox rolesComboBox; |
|
|
|
private UIComboCheckBox rolesComboBox; |
|
|
|
private static final String APOSTROPHE = "..."; |
|
|
|
private static final String APOSTROPHE = "..."; |
|
|
|
private Map<String, String> roleMap; |
|
|
|
|
|
|
|
private DesensitizationRule rule; |
|
|
|
private DesensitizationRule rule; |
|
|
|
|
|
|
|
private static Map<String, String> roleMap; |
|
|
|
private static Map<DesensitizationRuleSource, Map<String, DesensitizationRule>> latestRules; |
|
|
|
private static Map<DesensitizationRuleSource, Map<String, DesensitizationRule>> latestRules; |
|
|
|
private CellDesensitizationTableModel model; |
|
|
|
private CellDesensitizationTableModel model; |
|
|
|
|
|
|
|
private static final CellDesensitizationBean EMPTY_BEAN = CellDesensitizationBean.createEmptyBean(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DesensitizationCellPane(Component parent, CellDesensitizationTableModel model) { |
|
|
|
DesensitizationCellPane(Component parent, CellDesensitizationTableModel model) { |
|
|
@ -141,7 +147,6 @@ public class DesensitizationCellPane extends BasicBeanPane { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
|
|
|
|
|
|
CellDesensitizationBean selectBean = model.getSelectedValue(); |
|
|
|
CellDesensitizationBean selectBean = model.getSelectedValue(); |
|
|
|
latestRules = DesensitizationRuleManager.getInstance().getAllRules(); |
|
|
|
|
|
|
|
DesensitizationRulePane rulePane = new DesensitizationRulePane(latestRules); |
|
|
|
DesensitizationRulePane rulePane = new DesensitizationRulePane(latestRules); |
|
|
|
BasicDialog ruleDialog = rulePane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(parent), new DialogActionAdapter() { |
|
|
|
BasicDialog ruleDialog = rulePane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(parent), new DialogActionAdapter() { |
|
|
|
|
|
|
|
|
|
|
@ -150,10 +155,6 @@ public class DesensitizationCellPane extends BasicBeanPane { |
|
|
|
rule = rulePane.updateBean(); |
|
|
|
rule = rulePane.updateBean(); |
|
|
|
if (Objects.nonNull(selectBean) && Objects.nonNull(rule) && !selectBean.getDesensitizationRule().equals(rule)) { |
|
|
|
if (Objects.nonNull(selectBean) && Objects.nonNull(rule) && !selectBean.getDesensitizationRule().equals(rule)) { |
|
|
|
selectBean.setDesensitizationRule(rule); |
|
|
|
selectBean.setDesensitizationRule(rule); |
|
|
|
ruleTextField.setText(rule.getRuleName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 非正常状态需要颜色修改为红色
|
|
|
|
|
|
|
|
refreshRuleState(selectBean); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.fireTableDataChanged(); |
|
|
|
model.fireTableDataChanged(); |
|
|
|
} |
|
|
|
} |
|
|
@ -205,32 +206,41 @@ public class DesensitizationCellPane extends BasicBeanPane { |
|
|
|
|
|
|
|
|
|
|
|
refreshRoles(); |
|
|
|
refreshRoles(); |
|
|
|
|
|
|
|
|
|
|
|
String ruleName = value.getDesensitizationRule().getRuleName(); |
|
|
|
refreshRuleText(value); |
|
|
|
ruleTextField.setText(ruleName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 非正常状态需要颜色修改为红色
|
|
|
|
// 非正常状态需要颜色修改为红色
|
|
|
|
refreshRuleState(value); |
|
|
|
refreshRuleState(value); |
|
|
|
|
|
|
|
|
|
|
|
Map<Object, Boolean> map = generateRolesCheckBoxSelectedValues(value); |
|
|
|
Map<Object, Boolean> map = generateRolesCheckBoxSelectedValues(value); |
|
|
|
rolesComboBox.setSelectedValues(map); |
|
|
|
rolesComboBox.setSelectedValues(map); |
|
|
|
|
|
|
|
|
|
|
|
label.setText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Setting") + row); |
|
|
|
label.setText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Setting") + (row + 1)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 刷新用户组信息 |
|
|
|
* 刷新规则文本 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param value |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void refreshRoles() { |
|
|
|
private void refreshRuleText(CellDesensitizationBean value) { |
|
|
|
Map<String, String> roles = TableDataPreviewDesensitizeManager.getInstance().getAllRoles(); |
|
|
|
ruleTextField.setText(StringUtils.EMPTY); |
|
|
|
if (!roleMap.equals(roles)) { |
|
|
|
DesensitizationRule desensitizationRule = value.getDesensitizationRule(); |
|
|
|
roleMap = roles; |
|
|
|
if (desensitizationRule != null) { |
|
|
|
rolesComboBox.refreshCombo(roles.values().toArray()); |
|
|
|
String ruleName = desensitizationRule.getRuleName(); |
|
|
|
|
|
|
|
ruleTextField.setText(ruleName); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* combobox组件刷新用户组信息 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void refreshRoles() { |
|
|
|
|
|
|
|
rolesComboBox.clearText(); |
|
|
|
|
|
|
|
rolesComboBox.refreshCombo(roleMap.values().toArray()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void refreshRuleState(CellDesensitizationBean value) { |
|
|
|
private void refreshRuleState(CellDesensitizationBean value) { |
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(value.getDesensitizationRule(), latestRules); |
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(value.getDesensitizationRule(), latestRules); |
|
|
|
if (value.equals(CellDesensitizationBean.createEmptyBean())) { |
|
|
|
if (EMPTY_BEAN.equals(value)) { |
|
|
|
ruleTextField.setForeground(Color.GRAY); |
|
|
|
ruleTextField.setForeground(Color.GRAY); |
|
|
|
} else if (ruleStatus != DesensitizationRuleStatus.NORMAL) { |
|
|
|
} else if (ruleStatus != DesensitizationRuleStatus.NORMAL) { |
|
|
|
ruleTextField.setForeground(Color.RED); |
|
|
|
ruleTextField.setForeground(Color.RED); |
|
|
@ -310,4 +320,13 @@ public class DesensitizationCellPane extends BasicBeanPane { |
|
|
|
return omitText.equals(StringUtils.EMPTY) ? text : omitText; |
|
|
|
return omitText.equals(StringUtils.EMPTY) ? text : omitText; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 更新用户组和平台规则 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static void updateData(Map<String, String> roleMap, Map<DesensitizationRuleSource, Map<String, DesensitizationRule>> latestRules) { |
|
|
|
|
|
|
|
DesensitizationCellPane.roleMap = roleMap; |
|
|
|
|
|
|
|
DesensitizationCellPane.latestRules = latestRules; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|