From f948fa32f07a0dc8f280fac102cf4967ecc39fff Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Wed, 22 Aug 2018 11:01:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=8D=87alphafine=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alphafine/AlphaFineConfigManager.java | 36 +++++++++---------- .../cell/render/ContentCellRender.java | 2 +- .../manager/impl/ActionSearchManager.java | 2 +- .../manager/impl/ComplementAdviceManager.java | 2 +- .../manager/impl/DocumentSearchManager.java | 2 +- .../manager/impl/FileSearchManager.java | 2 +- .../search/manager/impl/HotIssuesManager.java | 6 +--- .../manager/impl/PluginSearchManager.java | 2 +- .../manager/impl/RecentSearchManager.java | 3 ++ .../manager/impl/RecommendSearchManager.java | 2 +- .../manager/impl/SimilarSearchManeger.java | 4 +-- 11 files changed, 31 insertions(+), 32 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java index ba9c67bf5d..c853db1698 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java @@ -94,18 +94,18 @@ public class AlphaFineConfigManager implements XMLable { @Override public void readXML(XMLableReader reader) { if (reader.isAttr()) { - this.setEnabled(reader.getAttrAsBoolean("enabled", true)); - this.setSearchOnLine(reader.getAttrAsBoolean("searchOnline", true)); - this.setContainPlugin(reader.getAttrAsBoolean("containDocument", true)); - this.setContainDocument(reader.getAttrAsBoolean("containDocument", true)); - this.setContainRecommend(reader.getAttrAsBoolean("containRecommend", true)); - this.setContainAction(reader.getAttrAsBoolean("containAction", true)); - this.setContainTemplate(reader.getAttrAsBoolean("containTemplate", true)); - this.setContainFileContent(reader.getAttrAsBoolean("containFileContent", false)); + this.setEnabled(reader.getAttrAsBoolean("isEnabled", true)); + this.setSearchOnLine(reader.getAttrAsBoolean("isSearchOnline", true)); + this.setContainPlugin(reader.getAttrAsBoolean("isContainDocument", true)); + this.setContainDocument(reader.getAttrAsBoolean("isContainDocument", true)); + this.setContainRecommend(reader.getAttrAsBoolean("isContainRecommend", true)); + this.setContainAction(reader.getAttrAsBoolean("isContainAction", true)); + this.setContainTemplate(reader.getAttrAsBoolean("isContainTemplate", true)); + this.setContainFileContent(reader.getAttrAsBoolean("isContainFileContent", false)); this.setNeedSegmentationCheckbox(reader.getAttrAsBoolean("needSegmentationCheckbox", true)); this.setNeedIntelligentCustomerService(reader.getAttrAsBoolean("needIntelligentCustomerService", true)); this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts())); - this.setNeedRemind(reader.getAttrAsBoolean("needRemind", true)); + this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true)); this.setOperateCount(reader.getAttrAsInt("operateCount", 0)); } @@ -115,16 +115,16 @@ public class AlphaFineConfigManager implements XMLable { @Override public void writeXML(XMLPrintWriter writer) { writer.startTAG("AlphaFineConfigManager"); - writer.attr("enabled", this.isEnabled()) - .attr("searchOnline", this.isSearchOnLine()) + writer.attr("isEnabled", this.isEnabled()) + .attr("isSearchOnline", this.isSearchOnLine()) .attr("shortcuts", this.getShortcuts()) - .attr("containRecommend", this.isContainRecommend()) - .attr("containAction", this.isContainAction()) - .attr("containDocument", this.isContainDocument()) - .attr("containTemplate", this.isContainTemplate()) - .attr("containPlugin", this.isContainPlugin()) - .attr("containFileContent", this.isContainFileContent()) - .attr("needRemind", this.isNeedRemind()) + .attr("isContainRecommend", this.isContainRecommend()) + .attr("isContainAction", this.isContainAction()) + .attr("isContainDocument", this.isContainDocument()) + .attr("isContainTemplate", this.isContainTemplate()) + .attr("isContainPlugin", this.isContainPlugin()) + .attr("isContainFileContent", this.isContainFileContent()) + .attr("isNeedRemind", this.isNeedRemind()) .attr("operateCount", this.getOperateCount()) .attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox()) .attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java index cd9affb30c..3444fecdf0 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/cell/render/ContentCellRender.java @@ -122,7 +122,7 @@ public class ContentCellRender implements ListCellRenderer { private String getReplacedString(String modelName, String string) { int index = modelName.toLowerCase().indexOf(string.toLowerCase()); if (index == -1) { - return ""; + return StringUtils.EMPTY; } return modelName.substring(index, index + string.length()); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java index b85022d8c1..7ded4fd9c5 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ActionSearchManager.java @@ -58,7 +58,7 @@ public class ActionSearchManager implements AlphaFineSearchProvider { } @Override - public synchronized SearchResult getLessSearchResult(String[] searchText) { + public SearchResult getLessSearchResult(String[] searchText) { filterModelList = new SearchResult(); lessModelList = new SearchResult(); moreModelList = new SearchResult(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java index e1bd1917bb..20eeee6590 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/ComplementAdviceManager.java @@ -22,7 +22,7 @@ import com.fr.third.org.apache.commons.codec.digest.DigestUtils; public class ComplementAdviceManager { private static volatile ComplementAdviceManager instance; - private volatile SearchResult allModelList; + private SearchResult allModelList; public static ComplementAdviceManager getInstance() { if (instance == null) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java index c44c78705f..7bbbc49a4a 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/DocumentSearchManager.java @@ -51,7 +51,7 @@ public class DocumentSearchManager implements AlphaFineSearchProvider { } @Override - public synchronized SearchResult getLessSearchResult(String[] searchText) { + public SearchResult getLessSearchResult(String[] searchText) { lessModelList = new SearchResult(); moreModelList = new SearchResult(); if (ArrayUtils.isEmpty(searchText)) { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java index 0a2d29f113..626445d9cf 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/FileSearchManager.java @@ -62,7 +62,7 @@ public class FileSearchManager implements AlphaFineSearchProvider { return new FileModel(name, filePath, searchCount); } - public synchronized SearchResult getLessSearchResult(String[] searchText) { + public SearchResult getLessSearchResult(String[] searchText) { this.filterModelList = new SearchResult(); this.lessModelList = new SearchResult(); this.moreModelList = new SearchResult(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java index a10c07df2a..181d794174 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/HotIssuesManager.java @@ -139,11 +139,7 @@ public class HotIssuesManager { private String[] getSubTitleFromCloud(JSONObject data) { ArrayList list = new ArrayList<>(); for (int i = 0; i < HOT_SUB_ITEM_NUM; i++) { - String temp = null; - try { - temp = data.getString(HOT_ITEM + (i + 1)); - } catch (JSONException e) { - } + String temp = data.optString(HOT_ITEM + (i + 1)); if (!StringUtils.isEmpty(temp)) { list.add(temp); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java index 5bc972f2a3..c1b0c44a51 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java @@ -96,7 +96,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider { } @Override - public synchronized SearchResult getLessSearchResult(String[] searchText) { + public SearchResult getLessSearchResult(String[] searchText) { if (ArrayUtils.isEmpty(searchText)) { return new SearchResult(); } diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java index c4c4ca8e2e..404798a07c 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecentSearchManager.java @@ -134,6 +134,9 @@ public class RecentSearchManager implements AlphaFineSearchProvider { * @param cellModel */ public void addModel(String searchKey, AlphaCellModel cellModel) { + if(cellModel == null){ + return; + } try { initWriter(); Document doc = new Document(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java index 3bb4effb66..db05930d8b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/RecommendSearchManager.java @@ -47,7 +47,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { } @Override - public synchronized SearchResult getLessSearchResult(String[] searchText) { + public SearchResult getLessSearchResult(String[] searchText) { if (ArrayUtils.isEmpty(searchText)) { return new SearchResult(); diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java index b2c63ed316..7f742d4e57 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/SimilarSearchManeger.java @@ -22,8 +22,8 @@ import com.fr.third.org.apache.commons.codec.digest.DigestUtils; */ public class SimilarSearchManeger implements AlphaFineSearchProvider { private static volatile SimilarSearchManeger instance; - private volatile SearchResult lessModelList; - private volatile SearchResult moreModelList = new SearchResult(); + private SearchResult lessModelList; + private SearchResult moreModelList = new SearchResult(); public static SimilarSearchManeger getInstance() { if (instance == null) {