Browse Source
Merge in DESIGN/design from ~DESTINY.LIN/design:fbp/release to fbp/release * commit 'c1e283382b254f2c82084803515324eed0d21d0c': REPORT-137327 远程设计下切换目录卡顿优化 优化命名 REPORT-137327 远程设计下切换目录卡顿优化 配置部分优化fbp/release
Destiny.Lin-林锦龙
1 month ago
2 changed files with 55 additions and 0 deletions
@ -0,0 +1,51 @@
|
||||
package com.fanruan.config; |
||||
|
||||
import com.fanruan.repository.ConfigRepository; |
||||
import com.fr.config.utils.ConfData; |
||||
import com.fr.config.utils.ConfigReadUtils; |
||||
import com.fr.config.utils.PrefixHandler; |
||||
import com.fr.config.utils.SetupDataOperator; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* 设计器远程下获取Updata的操作类 |
||||
* |
||||
* @author Destiny.Lin |
||||
* @since 11.0 |
||||
* Created on 2024/10/14 |
||||
*/ |
||||
public class SetupDataDesignerRemoteOperator implements SetupDataOperator { |
||||
|
||||
private static final SetupDataDesignerRemoteOperator INSTANCE = new SetupDataDesignerRemoteOperator(); |
||||
|
||||
/** |
||||
* 单例 |
||||
*/ |
||||
public static SetupDataDesignerRemoteOperator getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
@Override |
||||
public ConfData getData(String prefix, String tenantId) { |
||||
return ConfigRepository.getInstance().getConfigByConfigsCache(getConfigNameSpace(prefix), () -> { |
||||
ConfData data = new ConfData(); |
||||
data.setDataMap(ConfigReadUtils.getData(prefix, tenantId)); |
||||
data.setMap(ConfigReadUtils.getClassInfo(prefix, tenantId)); |
||||
return data; |
||||
}); |
||||
} |
||||
|
||||
private String getConfigNameSpace(String id) { |
||||
|
||||
if (StringUtils.isEmpty(id)) { |
||||
throw new IllegalArgumentException("id cannot be null"); |
||||
} |
||||
int length = id.length(); |
||||
for (int i = 0; i < length; i++) { |
||||
if (PrefixHandler.SEPERATOR == id.charAt(i)) { |
||||
return id.substring(0, i); |
||||
} |
||||
} |
||||
throw new IllegalArgumentException("cannot resolve namespace of " + id); |
||||
} |
||||
} |
Loading…
Reference in new issue