From 21b9a7304580a03ee4be6e0e1ad3c5dd5b2e209d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvan-=E6=AC=A7=E9=98=B3=E5=B8=86?= Date: Fri, 13 Jan 2023 15:44:37 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-83773=20&&=20REPORT-83838=20&&=20REPORT-?= =?UTF-8?q?83716=20&&=20REPORT-83738=20=E6=95=B0=E6=8D=AE=E8=84=B1?= =?UTF-8?q?=E6=95=8F=E4=BA=8C=E6=9C=9F=E8=BF=AD=E4=BB=A3bug=20=E3=80=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=8E=9F=E5=9B=A0=E3=80=91rt=20=E3=80=90?= =?UTF-8?q?=E6=94=B9=E5=8A=A8=E6=80=9D=E8=B7=AF=E3=80=91=E4=B8=BB=E8=A6=81?= =?UTF-8?q?=E6=98=AF=EF=BC=9A=201.=20=E6=B7=BB=E5=8A=A0=E5=9F=8B=E7=82=B9?= =?UTF-8?q?=202.=20=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=AB=AF=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE=E9=9B=86=E4=B8=AD?= =?UTF-8?q?=E8=84=B1=E6=95=8F=E9=85=8D=E7=BD=AE=E7=9A=84=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=203.=20=E4=B8=80=E4=BA=9B=E9=80=BB=E8=BE=91bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E3=80=90review=E5=BB=BA=E8=AE=AE=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/data/DesignTableDataManager.java | 12 ++++- .../datapane/preview/PreviewTablePane.java | 51 +++++++++++++++---- .../view/PreviewTableDesensitizationPane.java | 13 +++++ .../rule/DesensitizationRuleEditPane.java | 10 ++++ 4 files changed, 74 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 2ce2a7d828..e18b2a47d3 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -661,4 +661,14 @@ public abstract class DesignTableDataManager { public static void setThreadLocal(String value) { threadLocal.set(value); } -} \ No newline at end of file + + /** + * 根据数据集名称判断是否为服务器数据集或服务器存储过程 + * + * @param tableDataName 数据集名称 + * @return + */ + public static boolean isGlobalTableData(String tableDataName) { + return globalDsCache.containsKey(tableDataName); + } +} diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index 7b9a7a3d20..27285850ad 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -33,6 +33,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.JTemplate; import com.fr.design.ui.util.UIUtil; +import com.fr.esd.query.StrategicTableData; import com.fr.function.TIME; import com.fr.general.FRFont; import com.fr.general.data.DataModel; @@ -223,6 +224,18 @@ public class PreviewTablePane extends BasicPane { * 点击脱敏配置后的操作 */ public void clickDesensitizationLabel() { + // 埋点记录 + recordDesensitization(); + // 判断数据集类型 + if (isGlobalTableData()) { + // 服务器数据集不允许在设计器端修改脱敏配置 + FineJOptionPane.showMessageDialog( + this, + Toolkit.i18nText("Fine-Design_Report_Cannot_Modify_Desensitization_Config_Of_ServerTableData"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), + FineJOptionPane.WARNING_MESSAGE); + return; + } TableDataDesensitizationSettingPane settingPane = new TableDataDesensitizationSettingPane((DesensitizationTableData) tableData); settingPane.populateBean((DesensitizationTableData) tableData); BasicDialog dialog = settingPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(PreviewTablePane.this), new DialogActionAdapter() { @@ -248,25 +261,41 @@ public class PreviewTablePane extends BasicPane { } /** - * 设置脱敏设置的个数 + * 触发数据脱敏埋点记录 + * + * @return 数据脱敏字段数量 + */ + private int recordDesensitization() { + return getCurrentTableDataDesensitizaitionCount(); + } + + /** + * 当前tableData是否为服务器数据集或服务器存储过程 * - * @param model + * @return */ - private void setDesensitizationCount(TableModel model) { - desensitizationPane.setDesensitizationCount(isDesensitizeOpened(), - model instanceof DesensitizedPreviewTableModel ? - ((DesensitizedPreviewTableModel) model).getDesensitizeColumnsCount() : - 0); + public boolean isGlobalTableData() { + return this.tableData instanceof StrategicTableData && + DesignTableDataManager.isGlobalTableData(((StrategicTableData) this.tableData).getDsName()); } /** * 根据TableData设置脱敏设置的个数 */ private void setDesensitizationCountByTableData() { - desensitizationPane.setDesensitizationCount(isDesensitizeOpened(), - this.tableData instanceof DesensitizationTableData ? - ((DesensitizationTableData) this.tableData).getDesensitizationConfig().getDesensitizationItems().size() : - 0); + desensitizationPane.setDesensitizationCount(isDesensitizeOpened(), getCurrentTableDataDesensitizaitionCount()); + desensitizationPane.dealWithTableDataType(isGlobalTableData()); + } + + /** + * 获取当前数据集中设置脱敏规则的个数 + * + * @return + */ + private int getCurrentTableDataDesensitizaitionCount() { + return this.tableData instanceof DesensitizationTableData ? + ((DesensitizationTableData) this.tableData).getDesensitizationConfig().getDesensitizationItems().size() : + 0; } /** diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java index 1bf150dd51..01c92e333f 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java @@ -112,9 +112,22 @@ public class PreviewTableDesensitizationPane extends JPanel { return previewToggle; } + /** + * 设置Label的值,主要是需要动态修改配置的脱敏规则的数量 + * + * @param desensitizeOpen + * @param count + */ public void setDesensitizationCount(boolean desensitizeOpen, int count) { desensitizationLabel.setText(desensitizeOpen ? DATA_DESENSITIZATION_CONFIG + LEFT_BRACKET + count + RIGHT_BRACKET + COUNT : DATA_DESENSITIZATION_CONFIG); } + + /** + * 服务器数据集时,Label需要置灰 + */ + public void dealWithTableDataType(boolean globalTableData) { + desensitizationLabel.setForeground(globalTableData ? UIConstants.DISABLED_ICON_COLOR : UIConstants.NORMAL_BLUE); + } } diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleEditPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleEditPane.java index 7354dc0b11..b3c0d2615a 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleEditPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleEditPane.java @@ -2,6 +2,7 @@ package com.fr.design.data.datapane.preview.desensitization.view.rule; import com.fr.data.desensitize.rule.base.DesensitizationCondition; import com.fr.data.desensitize.rule.base.DesensitizationRule; +import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; import com.fr.data.desensitize.rule.base.DesensitizationRuleType; import com.fr.design.beans.BasicBeanPane; import com.fr.design.constants.UIConstants; @@ -271,6 +272,15 @@ public class DesensitizationRuleEditPane extends BasicBeanPane