Browse Source

Merge pull request #11400 in DESIGN/design from release/11.0 to bugfix/11.0

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

17
build.gradle

@ -1,4 +1,5 @@
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
import org.gradle.internal.os.OperatingSystem
plugins { plugins {
id 'java' id 'java'
@ -65,11 +66,7 @@ allprojects {
implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion
implementation 'com.install4j:install4j-runtime:8.0.4' implementation 'com.install4j:install4j-runtime:8.0.4'
implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser:6.23'
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third:jxbrowser-v7:7.22' implementation 'com.fr.third:jxbrowser-v7:7.22'
implementation 'com.fr.third:jxbrowser-mac-v7:7.22'
implementation 'com.fr.third:jxbrowser-win64-v7:7.22'
implementation 'com.fr.third:jxbrowser-swing-v7:7.22' implementation 'com.fr.third:jxbrowser-swing-v7:7.22'
implementation 'com.fr.third.server:servlet-api:3.0' implementation 'com.fr.third.server:servlet-api:3.0'
implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swexpl:2.0.1'
@ -94,4 +91,16 @@ allprojects {
testImplementation 'org.powermock:powermock-api-easymock:1.7.1' testImplementation 'org.powermock:powermock-api-easymock:1.7.1'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }
if (OperatingSystem.current().isMacOsX()) {
dependencies {
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-mac-v7:7.22'
}
} else if (OperatingSystem.current().isWindows()) {
dependencies {
implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third:jxbrowser-win64-v7:7.22'
}
}
} }

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连接,其他插件数据连接不进行校验 // 仅校验jdbc连接,其他插件数据连接不进行校验
if (connection instanceof JDBCDatabaseConnection) { if (connection instanceof JDBCDatabaseConnection) {
DatabaseResultBean bean = WorkContext.getCurrent().get(DataBaseTypeOperator.class).validateDatabaseType(connection.getDriver(), connection.feature()); 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()); 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 @Override
public void actionPerformed(ActionEvent e) { 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())); DesensitizationRuleEditPane editPane = new DesensitizationRuleEditPane(getCurrentExistRuleNames(selectedValue.getRuleName()));
editPane.populateBean(selectedValue); editPane.populateBean(selectedValue);
final DesensitizationRule finalRule = selectedValue;
BasicDialog basicDialog = editPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(parent), new DialogActionAdapter() { BasicDialog basicDialog = editPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(parent), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
DesensitizationRule rule = editPane.updateBean(); DesensitizationRule rule = editPane.updateBean();
// 修改同步到RuleManager中 // 修改同步到RuleManager中
if (DesensitizationRule.valid(rule)) { if (DesensitizationRule.valid(rule)) {
DesensitizationRuleManager.getInstance().updateRule(rule); DesensitizationRuleManager.getInstance().updateRule(finalRule, rule);
} }
setSelectedValue(rule);
fireTableDataChanged(); 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() { private ActionListener chooseRuleListener = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
// 重新获取一下本地规则缓存
refreshCustomRuleCache();
DesensitizationRulePane rulePane = new DesensitizationRulePane(latestRules); DesensitizationRulePane rulePane = new DesensitizationRulePane(latestRules);
TableDataDesensitizationItem desensitizationItem = getCurrentSelectBean(); TableDataDesensitizationItem desensitizationItem = getCurrentSelectBean();
int selectedRow = table.getSelectedRow(); int selectedRow = table.getSelectedRow();
@ -606,4 +608,12 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
DesensitizationRuleManager.getInstance().getRuleStatus(rule, latestRules) != DesensitizationRuleStatus.NORMAL; 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) { public void populate(List<CellDesensitizationBean> desensitizationBeans) {
if (Objects.nonNull(desensitizationBeans)) { if (Objects.nonNull(desensitizationBeans)) {
// 记录埋点数据
if (!desensitizationBeans.isEmpty()) {
recordDesensitization(desensitizationBeans);
}
editorPane.populate(desensitizationBeans.toArray(new CellDesensitizationBean[]{})); editorPane.populate(desensitizationBeans.toArray(new CellDesensitizationBean[]{}));
} }
} }
/**
* 记录预览导出脱敏埋点
*/
private int recordDesensitization(List<CellDesensitizationBean> desensitizationBeans) {
return desensitizationBeans.size();
}
} }

Loading…
Cancel
Save