Browse Source

Pull request #10308: REPORT-75091 - 数据脱敏(报表)

Merge in DESIGN/design from ~YVAN/design:feature/x to feature/x

* commit '260b35ca5f484511f2b1be54979ca56f15e1a475':
  REPORT-75091 - 数据脱敏(报表) 【问题原因】之前用AbstractDesensitizationTabledata抽象类作为所有数据集的顶层抽象实现,在读写的时候有点膈应,主要是可能导致标签冗余,或者破坏原有读写委托的层级 【改动思路】现在调整为DesensitizationTableData接口,AbstractTableData实现此接口,并在内部提供读写的工具方法,子类统一通过调用工具方法的方式来读取脱敏规则信息 【review建议】
feature/x
Yvan-欧阳帆 2 years ago
parent
commit
5a32ebbfd4
  1. 10
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  2. 10
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/TableDataPreviewDesensitizeManager.java
  3. 14
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationSettingPane.java
  4. 6
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTableModel.java
  5. 8
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/setting/TableDataDesensitizationTablePane.java

10
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -6,7 +6,7 @@ package com.fr.design.data.datapane.preview;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.data.TableDataSource;
import com.fr.data.desensitize.base.AbstractDesensitizationTableData;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameDataModel;
@ -236,8 +236,8 @@ public class PreviewTablePane extends BasicPane {
desensitizationLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
TableDataDesensitizationSettingPane settingPane = new TableDataDesensitizationSettingPane((AbstractDesensitizationTableData) tableData);
settingPane.populateBean((AbstractDesensitizationTableData) tableData);
TableDataDesensitizationSettingPane settingPane = new TableDataDesensitizationSettingPane((DesensitizationTableData) tableData);
settingPane.populateBean((DesensitizationTableData) tableData);
BasicDialog dialog = settingPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(PreviewTablePane.this), new DialogActionAdapter() {
@Override
public void doOk() {
@ -775,7 +775,7 @@ public class PreviewTablePane extends BasicPane {
* @return
*/
private boolean isDesensitizeOpened() {
return tableData instanceof AbstractDesensitizationTableData &&
((AbstractDesensitizationTableData) tableData).getDesensitizeOpen();
return tableData instanceof DesensitizationTableData &&
((DesensitizationTableData) tableData).isDesensitizeOpen();
}
}

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

@ -2,7 +2,7 @@ package com.fr.design.data.datapane.preview.desensitization;
import com.fr.base.TableData;
import com.fr.data.desensitize.base.AbstractDesensitizationTableData;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.desensitize.base.TableDataDesensitizationBean;
import com.fr.data.desensitize.manage.DesensitizationManager;
import com.fr.data.desensitize.util.DesentizationUtils;
@ -62,9 +62,9 @@ public class TableDataPreviewDesensitizeManager implements DesensitizationManage
* @return
*/
public boolean needDesensitize(TableData tableData) {
return tableData instanceof AbstractDesensitizationTableData &&
DesentizationUtils.isCollectionNotEmpty(((AbstractDesensitizationTableData) tableData).getDesensitizationBeans()) &&
((AbstractDesensitizationTableData) tableData).getDesensitizationBeans().stream().noneMatch(TableDataDesensitizationBean::invalid);
return tableData instanceof DesensitizationTableData &&
DesentizationUtils.isCollectionNotEmpty(((DesensitizationTableData) tableData).getDesensitizationBeans()) &&
((DesensitizationTableData) tableData).getDesensitizationBeans().stream().noneMatch(TableDataDesensitizationBean::invalid);
}
/**
@ -77,7 +77,7 @@ public class TableDataPreviewDesensitizeManager implements DesensitizationManage
Map<Integer, TableDataDesensitizationBean> desensitizationBeanMap = new LinkedHashMap<>();
// 获取此数据集的所有脱敏信息
Collection<TableDataDesensitizationBean> desensitizationBeans = ((AbstractDesensitizationTableData) tableData).getDesensitizationBeans();
Collection<TableDataDesensitizationBean> desensitizationBeans = ((DesensitizationTableData) tableData).getDesensitizationBeans();
// 去除被禁用的规则 + 排序
List<TableDataDesensitizationBean> sortedBeans = desensitizationBeans
.stream()

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

@ -1,6 +1,6 @@
package com.fr.design.data.datapane.preview.desensitization.view.setting;
import com.fr.data.desensitize.base.AbstractDesensitizationTableData;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.desensitize.base.TableDataDesensitizationBean;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.datapane.preview.desensitization.view.common.DesensitizationOpenPane;
@ -18,19 +18,19 @@ import java.util.List;
* @version 11.0
* Created by Yvan on 2022/9/8
*/
public class TableDataDesensitizationSettingPane extends BasicBeanPane<AbstractDesensitizationTableData> {
public class TableDataDesensitizationSettingPane extends BasicBeanPane<DesensitizationTableData> {
/**
* 设置针对的数据集
*/
private AbstractDesensitizationTableData tableData;
private DesensitizationTableData tableData;
private DesensitizationOpenPane desensitizationOpenPane;
private TableDataDesensitizationTablePane tableDataDesensitizationTablePane;
public TableDataDesensitizationSettingPane(AbstractDesensitizationTableData tableData) {
public TableDataDesensitizationSettingPane(DesensitizationTableData tableData) {
this.tableData = tableData;
initComponents();
}
@ -67,14 +67,14 @@ public class TableDataDesensitizationSettingPane extends BasicBeanPane<AbstractD
}
@Override
public void populateBean(AbstractDesensitizationTableData tableData) {
public void populateBean(DesensitizationTableData tableData) {
this.tableData = tableData;
this.desensitizationOpenPane.setDesensitizationOpened(tableData.getDesensitizeOpen());
this.desensitizationOpenPane.setDesensitizationOpened(tableData.isDesensitizeOpen());
tableDataDesensitizationTablePane.populateDesensitizationSetting(tableData);
}
@Override
public AbstractDesensitizationTableData updateBean() {
public DesensitizationTableData updateBean() {
saveDesensitizeOpened();
saveDesensitizationBeans(tableDataDesensitizationTablePane.updateDesensitizationSetting());
return tableData;

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

@ -1,6 +1,6 @@
package com.fr.design.data.datapane.preview.desensitization.view.setting;
import com.fr.data.desensitize.base.AbstractDesensitizationTableData;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.desensitize.base.TableDataDesensitizationBean;
import com.fr.data.desensitize.rule.base.DesensitizationRule;
import com.fr.design.data.datapane.preview.desensitization.TableDataPreviewDesensitizeManager;
@ -52,7 +52,7 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
private static final String APOSTROPHE = "...";
private AbstractDesensitizationTableData tableData;
private DesensitizationTableData tableData;
/**
* 当前数据集的所有列名
@ -70,7 +70,7 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
private DesensitizationRuleDescriptionPane descriptionPane;
public TableDataDesensitizationTableModel(AbstractDesensitizationTableData tableData, Component parent) {
public TableDataDesensitizationTableModel(DesensitizationTableData tableData, Component parent) {
// table相关
super(new String[]{
Toolkit.i18nText("Fine-Design_Report_Desensitization_Column"),

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

@ -1,6 +1,6 @@
package com.fr.design.data.datapane.preview.desensitization.view.setting;
import com.fr.data.desensitize.base.AbstractDesensitizationTableData;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.desensitize.base.TableDataDesensitizationBean;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.layout.FRGUIPaneFactory;
@ -22,7 +22,7 @@ public class TableDataDesensitizationTablePane extends JPanel {
/**
* 脱敏数据集
*/
private AbstractDesensitizationTableData tableData;
private DesensitizationTableData tableData;
/**
* 父页面
@ -34,7 +34,7 @@ public class TableDataDesensitizationTablePane extends JPanel {
*/
private UITableEditorPane<TableDataDesensitizationBean> editorPane;
public TableDataDesensitizationTablePane(AbstractDesensitizationTableData tableData, Component parent) {
public TableDataDesensitizationTablePane(DesensitizationTableData tableData, Component parent) {
this.tableData = tableData;
this.parent = parent;
initComponent();
@ -52,7 +52,7 @@ public class TableDataDesensitizationTablePane extends JPanel {
*
* @param tableData
*/
public void populateDesensitizationSetting(AbstractDesensitizationTableData tableData) {
public void populateDesensitizationSetting(DesensitizationTableData tableData) {
this.tableData = tableData;
editorPane.populate(tableData.getDesensitizationBeans().toArray(new TableDataDesensitizationBean[0]));
}

Loading…
Cancel
Save