Browse Source

Merge pull request #11399 in DESIGN/design from final/11.0 to release/11.0

* commit '18760905d1f73144897dd053acafbdff454c4edc':
  REPORT-90013 设计器新增不支持的数据连接类型可以保存 【问题原因】判断逻辑写反了 【改动思路】修改判读逻辑
  REPORT-89957 数据脱敏-本地规则无法保存 【问题原因】还是本地规则这边的问题,有好几个 1. 修改规则触发的updateRule方法,只传入了修改后的规则,修改前的规则未被移除 2. 规则无法保存,ResourceIOUtils.tryWrite接口在远程环境下有问题,会写到服务器上去 3. 所有规则展示的页面,因为之前改动性能,将规则缓存在了页面中,但是没有给刷新缓存的相关逻辑,实际上这个规则展示页面,是可以对本地规则做编辑等操作的,是需要刷新的 【改动思路】 1. updateRule做正确的更新逻辑,删除旧规则,添加新规则 2. ResourceIOUtils.tryWrite换成本地文件系统的IO方法 3. 每次打开所有规则展示的页面之前,刷新一下本地规则缓存 【review建议】
  REPORT-89926 数据脱敏三期增加埋点
release/11.0
superman 2 years ago
parent
commit
5f78362439
  1. 2
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java
  2. 13
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java
  3. 10
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java
  4. 12
      designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java

2
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionManagerPane.java

@ -80,7 +80,7 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio
// 仅校验jdbc连接,其他插件数据连接不进行校验
if (connection instanceof JDBCDatabaseConnection) {
DatabaseResultBean bean = WorkContext.getCurrent().get(DataBaseTypeOperator.class).validateDatabaseType(connection.getDriver(), connection.feature());
if (bean.equals(DatabaseResultBean.DefaultBean())) {
if (!bean.equals(DatabaseResultBean.DefaultBean())) {
throw new DataBaseNotSupportedException(bean.getMsg());
}
}

13
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java

@ -275,18 +275,25 @@ public class DesensitizationRuleChoosePane extends JPanel {
@Override
public void actionPerformed(ActionEvent e) {
// 获取当前选中规则
DesensitizationRule selectedValue = getSelectedValue();
// 获取当前选中规则的副本
DesensitizationRule selectedValue = null;
try {
selectedValue = (DesensitizationRule) getSelectedValue().clone();
} catch (CloneNotSupportedException ex) {
throw new RuntimeException(ex);
}
DesensitizationRuleEditPane editPane = new DesensitizationRuleEditPane(getCurrentExistRuleNames(selectedValue.getRuleName()));
editPane.populateBean(selectedValue);
final DesensitizationRule finalRule = selectedValue;
BasicDialog basicDialog = editPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(parent), new DialogActionAdapter() {
@Override
public void doOk() {
DesensitizationRule rule = editPane.updateBean();
// 修改同步到RuleManager中
if (DesensitizationRule.valid(rule)) {
DesensitizationRuleManager.getInstance().updateRule(rule);
DesensitizationRuleManager.getInstance().updateRule(finalRule, rule);
}
setSelectedValue(rule);
fireTableDataChanged();
}

10
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java

@ -250,6 +250,8 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
private ActionListener chooseRuleListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// 重新获取一下本地规则缓存
refreshCustomRuleCache();
DesensitizationRulePane rulePane = new DesensitizationRulePane(latestRules);
TableDataDesensitizationItem desensitizationItem = getCurrentSelectBean();
int selectedRow = table.getSelectedRow();
@ -606,4 +608,12 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
DesensitizationRuleManager.getInstance().getRuleStatus(rule, latestRules) != DesensitizationRuleStatus.NORMAL;
}
/**
* 刷新当前页面的本地规则缓存查询最新本地规则的逻辑也是使用了缓存因此无需考虑耗时
*/
private void refreshCustomRuleCache() {
Map<String, DesensitizationRule> customRules = DesensitizationRuleManager.getInstance().getRulesBySource(DesensitizationRuleSource.CUSTOM);
latestRules.put(DesensitizationRuleSource.CUSTOM, customRules);
}
}

12
designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/desensitization/CellDesensitizationGroupsPane.java

@ -121,7 +121,19 @@ public class CellDesensitizationGroupsPane extends JPanel {
*/
public void populate(List<CellDesensitizationBean> desensitizationBeans) {
if (Objects.nonNull(desensitizationBeans)) {
// 记录埋点数据
if (!desensitizationBeans.isEmpty()) {
recordDesensitization(desensitizationBeans);
}
editorPane.populate(desensitizationBeans.toArray(new CellDesensitizationBean[]{}));
}
}
/**
* 记录预览导出脱敏埋点
*/
private int recordDesensitization(List<CellDesensitizationBean> desensitizationBeans) {
return desensitizationBeans.size();
}
}

Loading…
Cancel
Save