Leo.Qin
2 years ago
4 changed files with 79 additions and 24 deletions
@ -0,0 +1,47 @@
|
||||
package com.fr.design.mainframe.cell.settingpane.desensitization.model; |
||||
|
||||
import com.fr.base.operator.org.OrganizationOperator; |
||||
import com.fr.data.desensitize.rule.DesensitizationRuleManager; |
||||
import com.fr.data.desensitize.rule.base.DesensitizationRule; |
||||
import com.fr.data.desensitize.rule.base.DesensitizationRuleSource; |
||||
import com.fr.workspace.WorkContext; |
||||
|
||||
import javax.swing.SwingWorker; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
import java.util.concurrent.ExecutionException; |
||||
|
||||
/** |
||||
* 刷新脱敏设置全局 roles 和 rules SwingWorker |
||||
* |
||||
* @author Leo.Qin |
||||
* @version 11.0 |
||||
* Created by Leo.Qin on 2023/1/5 |
||||
*/ |
||||
public class UpdateDataWorker extends SwingWorker<Map<String, Object>, Void> { |
||||
|
||||
private final String ROLE_KEY = "Roles"; |
||||
private final String RULE_KEY = "Rules"; |
||||
|
||||
@Override |
||||
protected Map<String, Object> doInBackground() { |
||||
Map<String, Object> result = new HashMap<>(); |
||||
Map<String, String> allRoles = WorkContext.getCurrent().get(OrganizationOperator.class).getAllRoles4Desensitization(); |
||||
Map<DesensitizationRuleSource, Map<String, DesensitizationRule>> allRules = DesensitizationRuleManager.getInstance().getAllRules(); |
||||
|
||||
result.put(ROLE_KEY, allRoles); |
||||
result.put(RULE_KEY, allRules); |
||||
|
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
protected void done() { |
||||
try { |
||||
Map<String, Object> result = get(); |
||||
DesensitizationCellPane.updateData((Map<String, String>) result.get(ROLE_KEY), (Map<DesensitizationRuleSource, Map<String, DesensitizationRule>>) result.get(RULE_KEY)); |
||||
} catch (InterruptedException | ExecutionException e) { |
||||
throw new RuntimeException(e); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue