|
|
|
@ -40,6 +40,7 @@ import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Iterator; |
|
|
|
|
import java.util.LinkedHashSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
@ -132,9 +133,7 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
return matchRoleNamesByIds(desensitizationItem.getRoleIds()); |
|
|
|
|
case DesensitizationRuleStatus: |
|
|
|
|
// 规则状态
|
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(desensitizationItem.getRule()); |
|
|
|
|
// 非正常状态需要标记为异常
|
|
|
|
|
return ruleStatus == DesensitizationRuleStatus.NORMAL ? StringUtils.EMPTY : Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Status_Abnormal"); |
|
|
|
|
return needMarkRule(desensitizationItem.getRule()) ? StringUtils.EMPTY : Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Status_Abnormal"); |
|
|
|
|
default: |
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
} |
|
|
|
@ -165,7 +164,11 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public UITableEditAction[] createAction() { |
|
|
|
|
return new UITableEditAction[]{new AddDesensitizationAction(), new RemoveDesensitizationAction(parent)}; |
|
|
|
|
return new UITableEditAction[]{ |
|
|
|
|
new AddDesensitizationAction(), |
|
|
|
|
new RemoveDesensitizationAction(parent), |
|
|
|
|
new RefreshTableAction(), |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -428,14 +431,16 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
* @param currentItem |
|
|
|
|
*/ |
|
|
|
|
public void refreshRuleStatus(TableDataDesensitizationItem currentItem) { |
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(currentItem.getRule()); |
|
|
|
|
if (ruleStatus == DesensitizationRuleStatus.NORMAL) { |
|
|
|
|
// 正常规则时,重置提示Label
|
|
|
|
|
this.ruleStatusLabel.setText(StringUtils.EMPTY); |
|
|
|
|
this.ruleStatusLabel.setToolTipText(null); |
|
|
|
|
} else { |
|
|
|
|
DesensitizationRule rule = currentItem.getRule(); |
|
|
|
|
if (needMarkRule(rule)) { |
|
|
|
|
// 非正常规则,根据规则状态展示不同提示文字
|
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(rule); |
|
|
|
|
this.ruleStatusLabel.setText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Rule_Status_Abnormal")); |
|
|
|
|
this.ruleStatusLabel.setToolTipText(ruleStatus.getDescription()); |
|
|
|
|
} else { |
|
|
|
|
// 正常规则,重置提示Label
|
|
|
|
|
this.ruleStatusLabel.setText(StringUtils.EMPTY); |
|
|
|
|
this.ruleStatusLabel.setToolTipText(null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -518,6 +523,36 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private class RefreshTableAction extends UITableEditAction { |
|
|
|
|
|
|
|
|
|
public RefreshTableAction() { |
|
|
|
|
this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh")); |
|
|
|
|
this.setSmallIcon("/com/fr/design/standard/refresh/refresh", false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
// 刷新TableData的规则,主要是为了自动替换掉平台中被修改的规则
|
|
|
|
|
List<TableDataDesensitizationItem> items = getList(); |
|
|
|
|
Iterator<TableDataDesensitizationItem> iterator = items.iterator(); |
|
|
|
|
while (iterator.hasNext()) { |
|
|
|
|
TableDataDesensitizationItem item = iterator.next(); |
|
|
|
|
DesensitizationRuleStatus ruleStatus = DesensitizationRuleManager.getInstance().getRuleStatus(item.getRule()); |
|
|
|
|
if (ruleStatus == DesensitizationRuleStatus.REMOVED) { |
|
|
|
|
// 规则被移除,则删除整条脱敏Item
|
|
|
|
|
iterator.remove(); |
|
|
|
|
} else { |
|
|
|
|
// 规则被修改、禁用等,更新一下规则
|
|
|
|
|
item.setRule(DesensitizationRuleManager.getInstance().getLastedDesentizationRule(item.getRule())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
fireTableDataChanged(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void checkEnabled() {} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 规则表-列字段编号 |
|
|
|
|
*/ |
|
|
|
@ -580,4 +615,16 @@ public class TableDataDesensitizationTableModel extends UITableModelAdapter<Tabl
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 是否需要对异常规则做标记,需要满足 |
|
|
|
|
* 1. 规则非默认空规则 |
|
|
|
|
* 2. 规则本身异常 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private boolean needMarkRule(DesensitizationRule rule) { |
|
|
|
|
return !rule.equals(DesensitizationRule.createDefaultEmptyRule()) && |
|
|
|
|
DesensitizationRuleManager.getInstance().getRuleStatus(rule) != DesensitizationRuleStatus.NORMAL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|