提交 fb02511b 编写于 作者: O o2sword

设计搜索内存优化,减少对象创建,减少数据输出

上级 c51727e4
......@@ -86,7 +86,6 @@ public class WrapDesigner extends GsonPropertyObject {
public void setPatternList(Map<String, String> map) {
if(map!=null && !map.isEmpty()){
List<DesignerPattern> patternList = new ArrayList<>();
for (String key : map.keySet()){
DesignerPattern pattern = new DesignerPattern();
pattern.setProperty(key);
......@@ -97,9 +96,10 @@ public class WrapDesigner extends GsonPropertyObject {
}
}
pattern.setPropertyValue(propertyValue);
patternList.add(pattern);
this.patternList.add(pattern);
}
this.patternList = patternList;
map.clear();
map = null;
}
}
......@@ -118,6 +118,8 @@ public class WrapDesigner extends GsonPropertyObject {
pattern.setPropertyValue(propertyValue);
this.patternList.add(pattern);
}
map.clear();
map = null;
}
}
......@@ -138,6 +140,8 @@ public class WrapDesigner extends GsonPropertyObject {
pattern.setPropertyValue(propertyValue);
this.patternList.add(pattern);
}
map.clear();
map = null;
}
}
......@@ -190,6 +194,7 @@ public class WrapDesigner extends GsonPropertyObject {
}
this.lines = lines;
map.clear();
map = null;
}
}
......
......@@ -88,7 +88,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
AppInfo appInfo = emc.find( woScript.getAppId(), AppInfo.class );
AppInfo appInfo = emc.fetch(woScript.getAppId(), AppInfo.class, ListTools.toList(AppInfo.id_FIELDNAME, AppInfo.appName_FIELDNAME));
if(appInfo != null){
wo.setAppId(appInfo.getId());
wo.setAppName(appInfo.getAppName());
......@@ -102,6 +102,7 @@ class ActionSearch extends BaseAction {
}
}
woScripts.clear();
woScripts = null;
}catch (Exception e){
logger.error(e);
}
......@@ -126,7 +127,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
AppInfo appInfo = emc.find( woForm.getAppId(), AppInfo.class );
AppInfo appInfo = emc.fetch(woForm.getAppId(), AppInfo.class, ListTools.toList(AppInfo.id_FIELDNAME, AppInfo.appName_FIELDNAME));
if(appInfo != null){
wo.setAppId(appInfo.getId());
wo.setAppName(appInfo.getAppName());
......@@ -140,6 +141,7 @@ class ActionSearch extends BaseAction {
}
}
woForms.clear();
woForms = null;
}
}catch (Exception e){
......
......@@ -91,7 +91,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
Portal portal = emc.find(woScript.getPortal(), Portal.class);
Portal portal = emc.fetch(woScript.getPortal(), Portal.class, ListTools.toList(Portal.id_FIELDNAME, Portal.name_FIELDNAME));
if(portal != null){
wo.setAppId(portal.getId());
wo.setAppName(portal.getName());
......@@ -105,6 +105,7 @@ class ActionSearch extends BaseAction {
}
}
woScripts.clear();
woScripts = null;
}catch (Exception e){
logger.error(e);
}
......@@ -129,7 +130,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
Portal portal = emc.find(wopage.getPortal(), Portal.class);
Portal portal = emc.fetch(wopage.getPortal(), Portal.class, ListTools.toList(Portal.id_FIELDNAME, Portal.name_FIELDNAME));
if(portal != null){
wo.setAppId(portal.getId());
wo.setAppName(portal.getName());
......@@ -143,6 +144,7 @@ class ActionSearch extends BaseAction {
}
}
wos.clear();
wos = null;
}
}catch (Exception e){
......@@ -169,7 +171,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
Portal portal = emc.find(woWidget.getPortal(), Portal.class);
Portal portal = emc.fetch(woWidget.getPortal(), Portal.class, ListTools.toList(Portal.id_FIELDNAME, Portal.name_FIELDNAME));
if(portal != null){
wo.setAppId(portal.getId());
wo.setAppName(portal.getName());
......@@ -183,6 +185,7 @@ class ActionSearch extends BaseAction {
}
}
wos.clear();
wos = null;
}
}catch (Exception e){
......
......@@ -93,6 +93,7 @@ class ActionSearch extends BaseAction {
}
}
woAgents.clear();
woAgents = null;
}catch (Exception e){
logger.error(e);
}
......@@ -127,6 +128,7 @@ class ActionSearch extends BaseAction {
}
}
woInvokes.clear();
woInvokes = null;
}catch (Exception e){
logger.error(e);
}
......
......@@ -96,7 +96,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
Query query = emc.find(woView.getQuery(), Query.class);
Query query = emc.fetch(woView.getQuery(), Query.class, ListTools.toList(Query.id_FIELDNAME, Query.name_FIELDNAME));
if (query != null) {
wo.setAppId(query.getId());
wo.setAppName(query.getName());
......@@ -135,7 +135,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
Query query = emc.find(woTable.getQuery(), Query.class);
Query query = emc.fetch(woTable.getQuery(), Query.class, ListTools.toList(Query.id_FIELDNAME, Query.name_FIELDNAME));
if (query != null) {
wo.setAppId(query.getId());
wo.setAppName(query.getName());
......@@ -149,6 +149,7 @@ class ActionSearch extends BaseAction {
}
}
woTables.clear();
woTables = null;
}catch (Exception e){
logger.error(e);
}
......@@ -174,7 +175,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
Query query = emc.find(woStat.getQuery(), Query.class);
Query query = emc.fetch(woStat.getQuery(), Query.class, ListTools.toList(Query.id_FIELDNAME, Query.name_FIELDNAME));
if (query != null) {
wo.setAppId(query.getId());
wo.setAppName(query.getName());
......@@ -188,6 +189,7 @@ class ActionSearch extends BaseAction {
}
}
woStats.clear();
woStats = null;
}catch (Exception e){
logger.error(e);
}
......@@ -213,7 +215,7 @@ class ActionSearch extends BaseAction {
wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
if (!map.isEmpty()) {
Wo wo = new Wo();
Query query = emc.find(woStatement.getQuery(), Query.class);
Query query = emc.fetch(woStatement.getQuery(), Query.class, ListTools.toList(Query.id_FIELDNAME, Query.name_FIELDNAME));
if (query != null) {
wo.setAppId(query.getId());
wo.setAppName(query.getName());
......@@ -227,6 +229,7 @@ class ActionSearch extends BaseAction {
}
}
woStatements.clear();
woStatements = null;
}catch (Exception e){
logger.error(e);
}
......
......@@ -33,8 +33,8 @@ class ActionSearch extends BaseAction {
if(StringUtils.isBlank(wi.getKeyword())){
throw new ExceptionFieldEmpty("keyword");
}
logger.info("{}搜索全局设计:{}", effectivePerson.getDistinguishedName(), wi);
if (ListTools.isEmpty(wi.getModuleList())) {
logger.info("{}搜索设计:{}的关键字:{}", effectivePerson.getDistinguishedName(), wi.getModuleList(), wi.getKeyword());
if (ListTools.isNotEmpty(wi.getModuleList())) {
result.setData(search(wi));
}else{
lock.lock();
......@@ -112,7 +112,7 @@ class ActionSearch extends BaseAction {
private CompletableFuture<List<WrapDesigner>> searchAsync(final Wi wi, final Map<String, List<WiDesigner.ModuleApp>> moduleMap, final String moduleType, final Class<?> applicationClass, Executor executor){
CompletableFuture<List<WrapDesigner>> cf = CompletableFuture.supplyAsync(() -> {
List<WrapDesigner> swList = new ArrayList<>();
List<WrapDesigner> swList = null;
if(moduleMap.containsKey(moduleType)) {
try {
WiDesigner wiDesigner = new WiDesigner();
......@@ -126,7 +126,7 @@ class ActionSearch extends BaseAction {
} catch (Exception e) {
logger.error(e);
}
if (swList.size() > 2) {
if (swList!=null && swList.size() > 2) {
try {
SortTools.desc(swList, "designerType","appId");
} catch (Exception e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册