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